does-not-reach

A program of Instructions.

This program is not meant to build. What the tool says is the lesson.

NGA6102 `bcc` reaches -128 to 127 and this is -149 bytes away; write `jcc`, which is five bytes where two do not reach /Users/waldek/Desktop/NGA/tutorial/12-instructions/does-not-reach/loop.asm:25

main.ngp

target { region $0080 .. $00FF ram   region $2000 .. $BFFF ram }
modules { "loop.asm" }
container raw

loop.asm

.section
counter
        .res 1
.ends

.macro unrolled n
.if n > 0
        lda counter
        clc
        adc #7
        sta counter
        unrolled n - 1
.endif
.endm

; tag branch
; The same loop with the processor's own branch, which has one form and
; reaches what that form reaches.
.proc entry
        ldx #0
@loop
        unrolled 16
        inx
        cpx #5
        bcc @loop
        rts
.endp
; end branch