z80 - How do I find value of register and flags in Assembler? -
programmcode | zero-flag | sign-flag | register | register hl | 0 | 0 | 00h | 00 00h --------------|-----------|-----------|------------|------------ mov hl, 00ffh | | | | dec hl | | | | add 81h | | | | cp | | | | sub 02h | | | |
i have part of program in mc8-assembler (the cpu of mc8 formed 8bit processor zilog z80 of training board) value going have flag after execution , whatvalue being found in register? values before execution given in first column.
can + write explanation?
what intel calls mov
, zilog calls ld
; otherwise can work out answer looking @ e.g. this instruction table.
mov hl, 00ffh
ld hl, 00ffh
in zilog terms, appropriate ld hl
. it's instruction 0x21 , tells loads value hl , doesn't affect flags. that's row 1 sorted. dec hl
on @ 0x2b doesn't affect flags (which catches me out, record) add a,*
that's sign , 0 might change, depending on think happens a.
just each instruction in turn, see does, thing, consider flags if that's instruction affects flags.
Comments
Post a Comment