Update sketch to suggest use of `*ADDR`

This commit is contained in:
n loewen 2023-08-15 21:31:35 +01:00
parent 4e01a0943c
commit 8f9f50e28c
1 changed files with 50 additions and 39 deletions

View File

@ -1,5 +1,10 @@
;; sketching around subroutines with return stack ;; sketching around subroutines with return stack
; I think the sketching below contains some useful ideas,
; but the new `*ADDR` assembly op should make this a whole lot simpler
; sketches follow ..........
; jump table ; jump table
; ---------- ; ----------
; each function has a label ; each function has a label
@ -10,18 +15,23 @@
; then when the subroutine ends, it jumps here ; then when the subroutine ends, it jumps here
; where that number gets mapped back onto the function's label ; where that number gets mapped back onto the function's label
lda $1 =*reentryPoint
=routine1 $1
lda =routine1
sto $19 ; contains ID # for the next fn to jump to sto $19 ; contains ID # for the next fn to jump to
@jump_table @jump_table
hop $1 hop $1
jmp @jt2 jmp @jt2
jmp @example_computation jmp @example_computation
@jt2 @jt2
hop $2 hop $2
; jmp @jt3 ; jmp @jt3
nop nop
; etc … ; etc …
jmp @end jmp @end
@example_computation @example_computation
@ -59,4 +69,5 @@ sto $1
jmp $jmp_table jmp $jmp_table
; ok this isnt quite it… we also need to chexk if we hit 0 by just deceementinf and if so retuen 0 ; ok this isnt quite it… we also need to chexk if we hit 0 by just deceementinf and if so retuen 0
jmp @jump_table @end
END