ThinkPositive equ 1
PrintChar equ &BB5A
org &8100
ld hl,Introduction
call PrintString
call NewLine
ld hl,Message
call PrintString
ret
PrintString:
ld a,(hl)
cp 255
ret z
inc hl
call PrintChar
jr PrintString
Introduction:
db 'Thought of the day...',255
ifdef ThinkPositive
Message: db 'Z80 is Awesome!',255
else
Message: db '6510 sucks!',255
endif
Newline:
ld a,13
call PrintChar
ld a,10
call PrintChar
ret
For your information, this piece of z80 asm prints 2 strings.
00
as string terminator would make more sense. Usingor a
to test for00
is only a 1 byte instruction (note thatld a,(hl)
when(hl)
is00
would not set the Z-flag). Furthermore it would make sense to add the0dh
and0ah
at the end of the string when a CR/LF needs to be printed instead of adding a subroutine call for it.