fizzbuzz.s: Increment `len' in place rather than via register.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 14 Nov 2021 15:46:11 +0000 (15:46 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 14 Nov 2021 15:46:11 +0000 (15:46 +0000)
The Z80 isn't a load/store architecture, even though my RISC-programming
habits lead me to treat it like one.

fizzbuzz.s

index 6a68e9d..76242ef 100644 (file)
@@ -111,10 +111,9 @@ incr:      ld      a, (hl)
        djnz    incr
 
        ;; Carry out.
-       ld      a, (len)
        ld      (hl), 1
-       inc     a
-       ld      (len), a
+       ld      hl, len
+       inc     (hl)
        jp      again
 
 squish: