218/317
7 - Debugger and PROM Programmer Tutorial for ST72251
ld X, {Ad4}
; MSB address Task
push X
; Written at top of stack
ld A, S
ld ImStack3, A
; Remember position of stack pointer
ld A, #org2
; Top of stack for task 2
ld S, A
ld X, {Ad3}
; LSB address Task
push X
ld X, {Ad2}
; MSB address Task
push X
; Written at top of stack
ld A, S
ld ImStack2, A
; Remember position of stack pointer
ld A, #org1
; Top of stack for task 1
ld S, A
ld X, {Ad1}
; LSB address Task
push X
ld X, AddrTasks
; MSB address Task
push X
; Written at top of stack
ld A, S
ld ImStack1, A
; Remember position of stack pointer
clr Permut
; Set task counter to first
ret
; Jump to first task
; Yield
; =====
Yield:
ld A, #watch
; Loading the watchdog
ld wdgr, A
ld X, Permut
; To select the element where to save
ld A, S
; The stack pointer of the current task
ld (ImStack1,X), A
ld A, X
inc A
; Increment number of task
and A, #3
; If last, go to first
ld Permut, A
ld X, A
ld A, (ImStack1,X)
; Get next stack pointer
ld S, A
ret
END