Given the following C code:
int a=8;
if (a==8)
...
will the equivalent in z80 assembly be the code below?
ld a, 8
cp 8
Given the following C code:
int a=8;
if (a==8)
...
will the equivalent in z80 assembly be the code below?
ld a, 8
cp 8
Just throwing some registers around:
ld hl,8 ; int is a 16 bit value
push hl
push bc
ld bc,8
or a : clear carry flag
sbc hl,bc ; zero flag set when equal
pop bc
pop hl
jr nz,endif
...
endif:
...
For an interesting take on using macros for structured assembly programming see https://dev.to/jhlagado/structured-programming-in-z80-assembly-554d