EasyManua.ls Logo

ST ST7 - Page 218

ST ST7
317 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
218/317
7 - Debugger and PROM Programmer Tutorial for ST72251
ld X, {AddrTasks+4} ; 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, {AddrTasks+3} ; LSB address Task
push X
ld X, {AddrTasks+2} ; 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, {AddrTasks+1} ; 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

Table of Contents

Related product manuals