Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,26 @@
ld b,&05 ;load the decrement value into b
ld hl,myFunc ;load the address of "myFunc" into HL
call repeatProcedure
forever:
jp forever ;trap the program counter here
repeatProcedure: ;input: b = times to repeat, hl = which procedure to repeat
call trampoline
; the "ret" in myFunc will bring you here
djnz repeatProcedure
ret ;exit "repeatProcedure" and proceed to "forever"
trampoline:
push hl
ret
;this is effectively a call to whatever is in HL, in this case "myFunc." The "ret" at the end of myFunc will return us to
;just after the line "call trampoline"
myFunc: ;this doesn't do anything useful but that's not the point
push hl ;not needed for this routine but if it altered HL we would need this so that we come back here next time we loop
or a
pop hl
ret

View file

@ -0,0 +1,2 @@
trampoline:
jp (hl) ;despite the parentheses this does NOT dereference HL, it merely acts as "LD PC,HL".

View file

@ -0,0 +1,10 @@
LD HL,myFunc
LD (repeatproc+1),HL
LD B,5 ;repeat count
CALL repeatProc
;somewhere far away from here:
repeatProc:
call &0000 ;gets overwritten with the address of MyFunc
djnz repeatProc
ret