X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=memory.asm;h=335a04d22779af2ac0ab4c5f9dd7661e8c6d5299;hb=1650b06e609ebb40a1fcd3df54a3147f41f42138;hp=8a7ec6e06de799d3b606d00babbe108cc74a548e;hpb=f3bc3b97f37dd7bc012c152374d4185c734b3a7e;p=rrq%2Frrqforth.git diff --git a/memory.asm b/memory.asm index 8a7ec6e..335a04d 100644 --- a/memory.asm +++ b/memory.asm @@ -1,5 +1,42 @@ ;;; This file defines "memory access words" + WORD p_cfa2flags_get,'CFA>FLAGS@',fasm + ;; ( cfa -- flags ) + pop rax + cfa2tfa rax + push qword[rax+16] + next + + WORD p_tfa2cfa,'TFA>CFA',fasm + ;; ( tfa -- cfa ) + ;; Advance a word tfa pointer to the cfa field + mov rax,qword[rsp] + tfa2cfa rax + mov qword [rsp],rax + next + + WORD p_tfa2dfa,'TFA>DFA',fasm + ;; ( tfa -- dfa ) + ;; Advance a word tfa pointer to the dfa field + mov rax,qword[rsp] + tfa2dfa rax + mov qword [rsp],rax + next + + WORD p_tfa2flags_get,'TFA>FLAGS@',fasm + ;; ( cfa -- flags ) + pop rax + push qword[rax+16] + next + + WORD p_dfa2tfa,'DFA>TFA',fasm + ;; ( dfa -- tfa ) + ;; Advance a word tfa pointer to the dfa field + mov rax,qword[rsp] + mov rax,qword [rax-24] ; tfa + mov qword [rsp],rax + next + WORD p_get, '@',fasm ;; ( addr -- v ) ;; Load value v from address addr @@ -33,21 +70,21 @@ next WORD p_2get, '2@',fasm - ;; ( addr -- v1 v2 ) - ;; Load the cell pair {x2,x1} from address addr. + ;; ( addr -- v2 v1 ) + ;; Load the cell pair {v1,v2} from address addr. pop rax - push qword [rax+8] - push qword [rax] + push qword [rax+8] ; v2 + push qword [rax] ; v1 next - WORD p_2put, '!',fasm - ;; ( v1 v2 addr -- ) - ;; Store value pair {v2,v1} at address addr. + WORD p_2put, '2!',fasm + ;; ( v2 v1 addr -- ) + ;; Store value pair {v1,v2} at address addr. pop rax pop rbx - mov qword [rax], rbx + mov qword [rax], rbx ; v1 pop rbx - mov qword [rax+8], rbx + mov qword [rax+8], rbx ; v2 next WORD p_erase, 'ERASE',fasm