I tried going through the documentation I have but it's really confusing, I need to understand this for an exam but I'm having lots of troubles.
aseg
org 100h
start: ld ix, vector
ld B, amount
ld A, 0
cycle: add A, (IX)
jp PE, fail
inc IX
djnz cycle
ld (resp), A
jp fin
fail: ld A, 1
ld (error), A
fin: rst 38h
vector: db 12,7,9,21
amount equ $ - vector
resp ds 1
error: db 0
end start
I understand what most of the 'functions' (ld, add, jp, inc) do separately, what I don't understand is:
1) What value is loaded into IX in the first line? (the variable?) vector has 4 values on it, I tried this in a z80 simulator and it says that IX gets the value 0019, but I don't see where this is coming from...
2) Am I understanding correctly that "vector: db 12,7,9,21" creates an array with the values 12,7,9,21?
3)What does the line "end start" do?
4)What value is "amount" holding?