Add stack manipulation subroutines

This commit is contained in:
Juhani Krekelä 2022-08-17 03:02:04 +03:00
parent 95c29fc2e0
commit 7a4c6295f3
1 changed files with 20 additions and 0 deletions

View File

@ -78,6 +78,26 @@ stEmit:
store ffff, r1
ret
; ------------------------------------------------------------------
; Stack manipulation
; ------------------------------------------------------------------
; a - a a
stDup:
cleq r0, r0, peekWord
breq r0, r0, pushWord
; a b -- a b a
stOver:
cleq r0, r0, popWord
cleq r0, r0, tmpStoreWord01
cleq r0, r0, peekWord
cleq r0, r0, tmp2StoreWord01
cleq r0, r0, tmpLoadWord01
cleq r0, r0, pushWord
cleq r0, r0, tmp2LoadWord01
breq r0, r0, pushWord
; ==================================================================
; Low-level functions
; ==================================================================