From 0bf6b60e8ecdc17c4eb93d4880267894380b386e Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sun, 14 Nov 2021 15:03:23 +0000 Subject: [PATCH] fizzbuzz.s: Add a dummy high length byte. The length is still only one byte, but the extra zero means we can load the BC in a single instruction rather than having to prat about with setting up the two halves separately -- and loading C via A because of instruction-set limitations. --- fizzbuzz.s | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fizzbuzz.s b/fizzbuzz.s index 8521554..00504d4 100644 --- a/fizzbuzz.s +++ b/fizzbuzz.s @@ -57,10 +57,8 @@ nobuzz: ld a, e jr nz, prnl ;; OK, so just print the value. - ld a, (len) - ld b, 0 - ld c, a ld hl, buf - 1 + ld bc, (len) add hl, bc ld b, c @@ -146,5 +144,5 @@ print: ;; Initial state. The buffer notionally continues for another 254 ;; bytes, but there's no point in including them in the image. -len: db 1 +len: db 1, 0 buf: db 1 -- 2.11.0