Use addr statement in calculator.asm

This commit is contained in:
Juhani Krekelä 2022-08-09 00:44:14 +03:00
parent 117a2e24c2
commit 34c3fa70e3
1 changed files with 11 additions and 26 deletions

View File

@ -1,8 +1,6 @@
org 0
start:
cleq r0, r0, initStack
load r0, lit01
load r1, litff
cleq r0, r0, pushWord
@ -143,17 +141,17 @@ popWord:
; trashes:
; r0, r1, r2, r3
pushByte:
load r2, SPHigh
load r2, SP+0
store storeByteHigh, r2
load r3, SPLow
load r3, SP+1
store storeByteLow, r3
cleq r0, r0, storeByte
load r0, SPHigh
load r1, SPLow
load r0, SP+0
load r1, SP+1
cleq r0, r0, incWord
store SPHigh, r0
store SPLow, r1
store SP+0, r0
store SP+1, r1
ret
@ -162,11 +160,11 @@ pushByte:
; trashes:
; r1, r2, r3
popByte:
load r0, SPHigh
load r1, SPLow
load r0, SP+0
load r1, SP+1
cleq r0, r0, decWord
store SPHigh, r0
store SPLow, r1
store SP+0, r0
store SP+1, r1
store loadByteHigh, r0
store loadByteLow, r1
@ -695,18 +693,5 @@ litff: data ff
; Stack
; ==================================================================
SPHigh: data 0
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
SP: addr stackBase
stackBase: