FIRST STEPS IN MACHINE CODE

ASSEMBLY LANGUAGE LISTINGS

hbar

DEMONSTRATION OF FLAGS

33, 244, 126   LD HL, 32500

Start of data store

126 LD A, (HL)

Load 'A' register

35 INC HL

Move to next byte

190 CP (HL)

compare its value to 'A'

245 PUSH AF

copy the F register

209 POP DE

into the E register

6, 8 LD B, 8

Load loop counter

35

LOOP

INC HL

Move to next byte

54, 0 LD (HL), 0

place 0 into it

203, 19 RL E

Move 1 bit of E into carry

48, 2 JR NC, NEXT

jump to NEXT if bit is 0

54, 1 LD (HL), 1

place 1 into byte

16, 245

NEXT

DJNZ, LOOP

Loop back to LOOP, unless

201 RET

all 8 done, then return.


hbar
Go To Referring Page