forth: a little bit of ASM routine inlining
This commit is contained in:
parent
5c03b33982
commit
e5ab0dd1c9
@ -29,7 +29,7 @@ trouble of compiling defs to binary.
|
||||
|
||||
//#define DEBUG
|
||||
// in sync with glue.asm
|
||||
#define RAMSTART 0x850
|
||||
#define RAMSTART 0x840
|
||||
#define STDIO_PORT 0x00
|
||||
// To know which part of RAM to dump, we listen to port 2, which at the end of
|
||||
// its compilation process, spits its HERE addr to port 2 (MSB first)
|
||||
|
Binary file not shown.
@ -190,17 +190,6 @@ forthMain:
|
||||
.bootName:
|
||||
.db "BOOT", 0
|
||||
|
||||
; copy (HL) into DE, then exchange the two, utilising the optimised HL instructions.
|
||||
; ld must be done little endian, so least significant byte first.
|
||||
intoHL:
|
||||
push de
|
||||
ld e, (hl)
|
||||
inc hl
|
||||
ld d, (hl)
|
||||
ex de, hl
|
||||
pop de
|
||||
ret
|
||||
|
||||
; Compares strings pointed to by HL and DE until one of them hits its null char.
|
||||
; If equal, Z is set. If not equal, Z is reset. C is set if HL > DE
|
||||
strcmp:
|
||||
@ -225,19 +214,6 @@ strcmp:
|
||||
; early, set otherwise)
|
||||
ret
|
||||
|
||||
; Given a string at (HL), move HL until it points to the end of that string.
|
||||
strskip:
|
||||
push bc
|
||||
ex af, af'
|
||||
xor a ; look for null char
|
||||
ld b, a
|
||||
ld c, a
|
||||
cpir ; advances HL regardless of comparison, so goes one too far
|
||||
dec hl
|
||||
ex af, af'
|
||||
pop bc
|
||||
ret
|
||||
|
||||
; Parse string at (HL) as a decimal value and return value in DE.
|
||||
; Reads as many digits as it can and stop when:
|
||||
; 1 - A non-digit character is read
|
||||
@ -376,8 +352,10 @@ find:
|
||||
dec de \ dec de \ dec de ; prev field
|
||||
push de ; --> lvl 2
|
||||
ex de, hl
|
||||
call intoHL
|
||||
ex de, hl ; DE contains prev offset
|
||||
ld e, (hl)
|
||||
inc hl
|
||||
ld d, (hl)
|
||||
; DE contains prev offset
|
||||
pop hl ; <-- lvl 2
|
||||
; HL is prev field's addr
|
||||
; Is offset zero?
|
||||
@ -543,8 +521,13 @@ numberWord:
|
||||
litWord:
|
||||
ld hl, (IP)
|
||||
push hl
|
||||
call strskip
|
||||
inc hl ; after null termination
|
||||
; Skip to null char
|
||||
xor a ; look for null char
|
||||
ld b, a
|
||||
ld c, a
|
||||
cpir
|
||||
; CPIR advances HL regardless of comparison, so goes one char after
|
||||
; NULL. This is good, because that's what we want...
|
||||
ld (IP), hl
|
||||
jp next
|
||||
|
||||
@ -558,5 +541,5 @@ litWord:
|
||||
.dw $-EXECUTE
|
||||
.db 5
|
||||
|
||||
; Offset: 0249
|
||||
; Offset: 0237
|
||||
.out $
|
||||
|
Loading…
Reference in New Issue
Block a user