Fully implement stack-based memory manipulation in calculator.asm
This commit is contained in:
parent
5cfae260fd
commit
3583fc8379
|
@ -247,7 +247,7 @@ stSwap:
|
||||||
; Memory
|
; Memory
|
||||||
; ------------------------------------------------------------------
|
; ------------------------------------------------------------------
|
||||||
|
|
||||||
; a p --
|
; b ptr --
|
||||||
stStoreByte:
|
stStoreByte:
|
||||||
cleq r0, r0, popWord
|
cleq r0, r0, popWord
|
||||||
store storeByteHigh, r0
|
store storeByteHigh, r0
|
||||||
|
@ -257,6 +257,53 @@ stStoreByte:
|
||||||
or r0, r1
|
or r0, r1
|
||||||
breq r0, r0, storeByte
|
breq r0, r0, storeByte
|
||||||
|
|
||||||
|
; ptr -- b
|
||||||
|
stLoadByte:
|
||||||
|
cleq r0, r0, popWord
|
||||||
|
store loadByteHigh, r0
|
||||||
|
store loadByteLow, r1
|
||||||
|
cleq r0, r0, loadByte
|
||||||
|
xor r1, r1
|
||||||
|
or r1, r0
|
||||||
|
xor r0, r0
|
||||||
|
breq r0, r0, pushWord
|
||||||
|
|
||||||
|
; n ptr --
|
||||||
|
stStoreWord:
|
||||||
|
cleq r0, r0, popWord
|
||||||
|
cleq r0, r0, tmpStoreWord01
|
||||||
|
store storeByteHigh, r0
|
||||||
|
store storeByteLow, r1
|
||||||
|
cleq r0, r0, peekWord
|
||||||
|
cleq r0, r0, storeByte
|
||||||
|
cleq r0, r0, tmpLoadWord01
|
||||||
|
cleq r0, r0, incWord
|
||||||
|
store storeByteHigh, r0
|
||||||
|
store storeByteLow, r1
|
||||||
|
cleq r0, r0, popWord
|
||||||
|
xor r0, r0
|
||||||
|
or r0, r1
|
||||||
|
breq r0, r0, storeByte
|
||||||
|
|
||||||
|
; ptr -- n
|
||||||
|
stLoadWord:
|
||||||
|
cleq r0, r0, peekWord
|
||||||
|
store loadByteHigh, r0
|
||||||
|
store loadByteLow, r1
|
||||||
|
cleq r0, r0, loadByte
|
||||||
|
cleq r0, r0, tmpStoreWord01
|
||||||
|
cleq r0, r0, popWord
|
||||||
|
cleq r0, r0, incWord
|
||||||
|
store loadByteHigh, r0
|
||||||
|
store loadByteLow, r1
|
||||||
|
cleq r0, r0, loadByte
|
||||||
|
xor r2, r2
|
||||||
|
or r2, r0
|
||||||
|
cleq r0, r0, tmpLoadWord01
|
||||||
|
xor r1, r1
|
||||||
|
or r1, r2
|
||||||
|
breq r0, r0, pushWord
|
||||||
|
|
||||||
; ==================================================================
|
; ==================================================================
|
||||||
; Low-level functions
|
; Low-level functions
|
||||||
; ==================================================================
|
; ==================================================================
|
||||||
|
|
Loading…
Reference in New Issue