Use addr statement in calculator.asm
This commit is contained in:
parent
117a2e24c2
commit
34c3fa70e3
|
@ -1,8 +1,6 @@
|
||||||
org 0
|
org 0
|
||||||
|
|
||||||
start:
|
start:
|
||||||
cleq r0, r0, initStack
|
|
||||||
|
|
||||||
load r0, lit01
|
load r0, lit01
|
||||||
load r1, litff
|
load r1, litff
|
||||||
cleq r0, r0, pushWord
|
cleq r0, r0, pushWord
|
||||||
|
@ -143,17 +141,17 @@ popWord:
|
||||||
; trashes:
|
; trashes:
|
||||||
; r0, r1, r2, r3
|
; r0, r1, r2, r3
|
||||||
pushByte:
|
pushByte:
|
||||||
load r2, SPHigh
|
load r2, SP+0
|
||||||
store storeByteHigh, r2
|
store storeByteHigh, r2
|
||||||
load r3, SPLow
|
load r3, SP+1
|
||||||
store storeByteLow, r3
|
store storeByteLow, r3
|
||||||
cleq r0, r0, storeByte
|
cleq r0, r0, storeByte
|
||||||
|
|
||||||
load r0, SPHigh
|
load r0, SP+0
|
||||||
load r1, SPLow
|
load r1, SP+1
|
||||||
cleq r0, r0, incWord
|
cleq r0, r0, incWord
|
||||||
store SPHigh, r0
|
store SP+0, r0
|
||||||
store SPLow, r1
|
store SP+1, r1
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@ -162,11 +160,11 @@ pushByte:
|
||||||
; trashes:
|
; trashes:
|
||||||
; r1, r2, r3
|
; r1, r2, r3
|
||||||
popByte:
|
popByte:
|
||||||
load r0, SPHigh
|
load r0, SP+0
|
||||||
load r1, SPLow
|
load r1, SP+1
|
||||||
cleq r0, r0, decWord
|
cleq r0, r0, decWord
|
||||||
store SPHigh, r0
|
store SP+0, r0
|
||||||
store SPLow, r1
|
store SP+1, r1
|
||||||
|
|
||||||
store loadByteHigh, r0
|
store loadByteHigh, r0
|
||||||
store loadByteLow, r1
|
store loadByteLow, r1
|
||||||
|
@ -695,18 +693,5 @@ litff: data ff
|
||||||
; Stack
|
; Stack
|
||||||
; ==================================================================
|
; ==================================================================
|
||||||
|
|
||||||
SPHigh: data 0
|
SP: addr stackBase
|
||||||
SPLow: data 0
|
|
||||||
|
|
||||||
; trashes:
|
|
||||||
; r3
|
|
||||||
initStack:
|
|
||||||
load r3, initStackDummyLoad+1
|
|
||||||
store SPHigh, r3
|
|
||||||
load r3, initStackDummyLoad+2
|
|
||||||
store SPLow, r3
|
|
||||||
ret
|
|
||||||
|
|
||||||
initStackDummyLoad: load r0, stackBase
|
|
||||||
|
|
||||||
stackBase:
|
stackBase:
|
||||||
|
|
Loading…
Reference in New Issue