Skip to content

Commit

Permalink
adding create to the mix
Browse files Browse the repository at this point in the history
  • Loading branch information
cthulhuology committed Dec 11, 2013
1 parent d94dc24 commit f9cf9d5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
1 change: 1 addition & 0 deletions dict.asm
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ dict if,'?'
dict invoke,'->'
dict continue,'<-'
dict forever,'halt'
dict create,'create'
6 changes: 5 additions & 1 deletion image.asm
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,18 @@ def invoke
def continue
def forever

; dictionary
def create

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Constants, Variables, and Values


dictionary_free: dq dictionary_end


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; The dictionary

dictionary:
%include "dict.asm"
dictionary_end: dq 0
23 changes: 19 additions & 4 deletions vm.asm
Original file line number Diff line number Diff line change
Expand Up @@ -525,12 +525,27 @@ rstack equ 8*17 ;
%endmacro

; words
%macro create 0 ; create a dictionary entry

%macro create 0 ; create a dictionary entry ( c-addr u a-addr u -- )
lea r11, [dictionary_free + bp] ; load dictionary free pointer
swap
mov [r11], tos ; save definition address
lea r11, [r11 + 8]
drop
mov [r11], tos ; save definition length
lea r11, [r11 + 8]
drop
mov rcx, tos ; copy count
mov [r11], tos ; save string length
lea r11, [r11 + 8]
drop
mov rdi, r11
mov rsi, tos
rep movsb ; copy string
add r11,7
and r11, ~7 ; align r11
mov [dictionary_free +bp], r11 ; update dictionary free pointer
%endmacro

%macro

; variables

%macro variable 0
Expand Down

0 comments on commit f9cf9d5

Please sign in to comment.