BROKEN! trying to change alignment to 2:
This commit is contained in:
parent
a18f898140
commit
4cac45c0d2
|
@ -1,5 +1,5 @@
|
|||
MEMSIZE = $20000
|
||||
CFG_PRINT_SYMTAB = 1
|
||||
CFG_DEBUG = 0
|
||||
CFG_DEBUG = 10
|
||||
|
||||
|
||||
|
|
23
macros.asm
23
macros.asm
|
@ -52,18 +52,19 @@ MACRO NEXT {
|
|||
jmp dword[eax]
|
||||
|
||||
}
|
||||
|
||||
|
||||
ALIGNMENT equ 2
|
||||
ALIGN_NONCE equ 1
|
||||
ALIGN_MASK equ $FFFFFFFE
|
||||
;=============================================================================
|
||||
; Header format Size: 8 bytes Alignment: 4
|
||||
; Header format Size: 8 bytes Alignment: 2
|
||||
;-----------------------------------------------------------------------------
|
||||
; offset size description
|
||||
;-----------------------------------------------------------------------------
|
||||
; -8 4 Link/flags | AND $FFFFFFFC = pointer to prev head
|
||||
; -8 4 Link/flags | AND $FFFFFFFE = pointer to prev head
|
||||
; --------------------------------------
|
||||
; | AND 3 = flags.
|
||||
; | 00: normal
|
||||
; | 01: immediate
|
||||
; | AND 1 = flags.
|
||||
; | 0: normal
|
||||
; | 1: immediatiate
|
||||
;-----------------------------------------------------------------------------
|
||||
; -4 4 Hash 32-bit FNV1a of name
|
||||
;-----------------------------------------------------------------------------
|
||||
|
@ -74,7 +75,7 @@ MACRO NEXT {
|
|||
IMMEDIATE equ 1
|
||||
|
||||
MACRO HEAD name,type, immediate=0 {
|
||||
align 4
|
||||
align 2
|
||||
dd LASTHEAD or immediate
|
||||
HASH `name
|
||||
name: dd type
|
||||
|
@ -83,7 +84,7 @@ LASTHEAD = name
|
|||
|
||||
|
||||
MACRO HEADN name,hashname,type,immediate=0 {
|
||||
align 4
|
||||
align ALIGNMENT
|
||||
dd LASTHEAD or immediate
|
||||
HASH hashname
|
||||
name: dd type
|
||||
|
@ -91,7 +92,7 @@ LASTHEAD = name
|
|||
}
|
||||
|
||||
MACRO ANON name,type {
|
||||
align 4
|
||||
align ALIGNMENT
|
||||
name: dd type
|
||||
}
|
||||
|
||||
|
@ -100,7 +101,7 @@ LOCAL .end
|
|||
db .end-$-1
|
||||
db args
|
||||
.end:
|
||||
align 4
|
||||
align ALIGNMENT
|
||||
}
|
||||
; Set C flag if bytereg is whitespace
|
||||
;
|
||||
|
|
59
nforth.asm
59
nforth.asm
|
@ -238,12 +238,11 @@ _search: ;(hash--0/zr or --entry/nz)
|
|||
.loop:
|
||||
cmp [ebx-4],edx ;is entry's hash = needle?
|
||||
je .done ;found
|
||||
mov ebx,[ebx-8] ;link (16-bit amount to skip back);
|
||||
and ebx,$FFFFFFFC ;mask off control bits
|
||||
mov ebx,[ebx-8] ;link
|
||||
and ebx,ALIGN_MASK ;mask off control bits
|
||||
jnz .loop
|
||||
ret
|
||||
; xor ebx,ebx
|
||||
.done: test ebx,ebx ;0/zr = fail
|
||||
.done: test ebx,ebx ;0/zr = fail
|
||||
ret
|
||||
|
||||
|
||||
|
@ -963,42 +962,42 @@ HEAD _strlit,$+4
|
|||
push esi ;
|
||||
RSTACK
|
||||
movzx ebx,al ;TOS = cnt
|
||||
lea esi,[esi+ebx+3+1] ;bump IP, aligning. +1 for the 0-term
|
||||
and esi,$FFFFFFFC ;
|
||||
lea esi,[esi+ebx+1+1] ;bump IP, aligning. +1 for the 0-term
|
||||
and esi,ALIGN_MASK;
|
||||
NEXT
|
||||
;;; primitive to copy string from source into dictionary, preceded by its byte
|
||||
;;; size. Line boundary may not be crossed!
|
||||
ANON _getstr,$+4
|
||||
push esi
|
||||
mov esi,[PARSE.PTR+4]
|
||||
mov edi,[HERE+4]
|
||||
mov edx,edi ;edx points at count byte
|
||||
xor ecx,ecx
|
||||
lodsb ;skip past space following "
|
||||
.loop: inc ecx
|
||||
push esi
|
||||
mov esi,[PARSE.PTR+4]
|
||||
mov edi,[HERE+4]
|
||||
mov edx,edi ;edx points at count byte
|
||||
xor ecx,ecx
|
||||
lodsb ;skip past space following "
|
||||
.loop:
|
||||
inc ecx
|
||||
stosb
|
||||
lodsb
|
||||
test al,al
|
||||
je .err
|
||||
cmp al,'"' ;"
|
||||
jne .loop
|
||||
xor eax,eax
|
||||
stosb ;null-term
|
||||
dec ecx ;-1 for the byte count itself.
|
||||
mov [edx],cl ;byte count, update
|
||||
add edi,3
|
||||
and edi,$FFFFFFFC ;align
|
||||
mov [HERE+4],edi
|
||||
mov [PARSE.PTR+4],esi ;just past "
|
||||
pop esi
|
||||
|
||||
test al,al
|
||||
je .err
|
||||
cmp al,'"' ;"
|
||||
jne .loop
|
||||
xor eax,eax
|
||||
stosb ;null-term
|
||||
dec ecx ;-1 for the byte count itself.
|
||||
mov [edx],cl ;byte count, update
|
||||
add edi,ALIGN_NONCE
|
||||
and edi,ALIGN_MASK ;align
|
||||
mov [HERE+4],edi
|
||||
mov [PARSE.PTR+4],esi ;just past "
|
||||
pop esi
|
||||
NEXT
|
||||
.err:
|
||||
DSTACK
|
||||
push ebx
|
||||
push ebx
|
||||
RSTACK
|
||||
mov ebx,ERRNUM_RANGE
|
||||
jmp ERXIT+4
|
||||
mov ebx,ERRNUM_RANGE
|
||||
jmp ERXIT+4
|
||||
|
||||
;;; " string" At compile time, compile the string that follows.
|
||||
;;; at runtime, (--string,size)
|
||||
|
|
Loading…
Reference in New Issue