Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
2
Task/Collections/Z80-Assembly/collections-1.z80
Normal file
2
Task/Collections/Z80-Assembly/collections-1.z80
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
List:
|
||||
byte 1,2,3,4,5
|
||||
25
Task/Collections/Z80-Assembly/collections-2.z80
Normal file
25
Task/Collections/Z80-Assembly/collections-2.z80
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
List:
|
||||
byte 5 ;size byte
|
||||
byte 1,2,3,4,5 ;the actual list
|
||||
byte 0,0,0,0,0 ;free space
|
||||
|
||||
;NOTE: separating the above list into different rows is just for visual clarity - it makes no difference to the CPU!
|
||||
|
||||
AppendList:
|
||||
;input: A = the value you wish to append.
|
||||
ld hl,List
|
||||
ld a,(HL) ;get the size byte
|
||||
ld b,a ;store in B to use as loop counter for DJNZ
|
||||
inc hl ;increment HL past the "size byte" to the actual data.
|
||||
push hl ;save this pointer for later
|
||||
push af ;save the value we want to append for later.
|
||||
|
||||
GotoEndOfList:
|
||||
inc hl
|
||||
djnz GotoEndOfList
|
||||
;now, HL points to the first "free" byte.
|
||||
pop af
|
||||
ld (HL),a ;store at the end of the list
|
||||
pop hl ;go back to beginning of the list.
|
||||
inc (hl) ;add 1 to the size byte.
|
||||
ret
|
||||
Loading…
Add table
Add a link
Reference in a new issue