mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 15:48:04 +11:00
forth: remove 0 and 1 constants
They do save space (nearly 100b), but they complicate our Forth-ification process. We'll re-add them later.
This commit is contained in:
parent
6eaabb9bbe
commit
42abbe75aa
@ -29,7 +29,7 @@ trouble of compiling defs to binary.
|
|||||||
|
|
||||||
//#define DEBUG
|
//#define DEBUG
|
||||||
// in sync with glue.asm
|
// in sync with glue.asm
|
||||||
#define RAMSTART 0x8a0
|
#define RAMSTART 0x890
|
||||||
#define STDIO_PORT 0x00
|
#define STDIO_PORT 0x00
|
||||||
// To know which part of RAM to dump, we listen to port 2, which at the end of
|
// 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)
|
// its compilation process, spits its HERE addr to port 2 (MSB first)
|
||||||
|
@ -167,23 +167,25 @@ INTERPRET:
|
|||||||
.dw FIND_
|
.dw FIND_
|
||||||
.dw CSKIP
|
.dw CSKIP
|
||||||
.dw FBR
|
.dw FBR
|
||||||
.db 18
|
.db 22
|
||||||
; It's a word, execute it
|
; It's a word, execute it
|
||||||
; For now, we only have one flag, let's take advantage of
|
; For now, we only have one flag, let's take advantage of
|
||||||
; this to keep code simple.
|
; this to keep code simple.
|
||||||
.dw ONE ; Bit 0 on
|
.dw NUMBER ; Bit 0 on
|
||||||
|
.dw 1
|
||||||
.dw FLAGS_
|
.dw FLAGS_
|
||||||
.dw STORE
|
.dw STORE
|
||||||
.dw EXECUTE
|
.dw EXECUTE
|
||||||
.dw ZERO ; Bit 0 off
|
.dw NUMBER ; Bit 0 off
|
||||||
|
.dw 0
|
||||||
.dw FLAGS_
|
.dw FLAGS_
|
||||||
.dw STORE
|
.dw STORE
|
||||||
.dw BBR
|
.dw BBR
|
||||||
.db 25
|
.db 29
|
||||||
; FBR mark, try number
|
; FBR mark, try number
|
||||||
.dw PARSEI
|
.dw PARSEI
|
||||||
.dw BBR
|
.dw BBR
|
||||||
.db 30
|
.db 34
|
||||||
; infinite loop
|
; infinite loop
|
||||||
|
|
||||||
; *** Collapse OS lib copy ***
|
; *** Collapse OS lib copy ***
|
||||||
@ -628,7 +630,8 @@ EXIT:
|
|||||||
.db 4
|
.db 4
|
||||||
QUIT:
|
QUIT:
|
||||||
.dw compiledWord
|
.dw compiledWord
|
||||||
.dw ZERO
|
.dw NUMBER
|
||||||
|
.dw 0
|
||||||
.dw FLAGS_
|
.dw FLAGS_
|
||||||
.dw STORE
|
.dw STORE
|
||||||
.dw .private
|
.dw .private
|
||||||
@ -992,7 +995,8 @@ ISWS:
|
|||||||
.dw NUMBER
|
.dw NUMBER
|
||||||
.dw 33
|
.dw 33
|
||||||
.dw CMP
|
.dw CMP
|
||||||
.dw ONE
|
.dw NUMBER
|
||||||
|
.dw 1
|
||||||
.dw PLUS
|
.dw PLUS
|
||||||
.dw NOT
|
.dw NOT
|
||||||
.dw EXIT
|
.dw EXIT
|
||||||
@ -1043,17 +1047,19 @@ WORD:
|
|||||||
; branch mark
|
; branch mark
|
||||||
.dw OVER ; ( a c a )
|
.dw OVER ; ( a c a )
|
||||||
.dw STORE ; ( a )
|
.dw STORE ; ( a )
|
||||||
.dw ONE ; ( a 1 )
|
.dw NUMBER ; ( a 1 )
|
||||||
|
.dw 1
|
||||||
.dw PLUS ; ( a+1 )
|
.dw PLUS ; ( a+1 )
|
||||||
.dw CIN ; ( a c )
|
.dw CIN ; ( a c )
|
||||||
.dw DUP ; ( a c c )
|
.dw DUP ; ( a c c )
|
||||||
.dw ISWS ; ( a c f )
|
.dw ISWS ; ( a c f )
|
||||||
.dw CSKIP ; ( a c )
|
.dw CSKIP ; ( a c )
|
||||||
.dw BBR
|
.dw BBR
|
||||||
.db 18 ; here - mark
|
.db 20 ; here - mark
|
||||||
; at this point, we have ( a WS )
|
; at this point, we have ( a WS )
|
||||||
.dw DROP
|
.dw DROP
|
||||||
.dw ZERO
|
.dw NUMBER
|
||||||
|
.dw 0
|
||||||
.dw SWAP ; ( 0 a )
|
.dw SWAP ; ( 0 a )
|
||||||
.dw STORE ; ()
|
.dw STORE ; ()
|
||||||
.dw NUMBER
|
.dw NUMBER
|
||||||
@ -1374,32 +1380,9 @@ MULT:
|
|||||||
push hl
|
push hl
|
||||||
jp next
|
jp next
|
||||||
|
|
||||||
|
|
||||||
; It might look peculiar to have specific words for "0" and "1", but although
|
|
||||||
; it slightly beefs ups the ASM part of the binary, this one-byte-save-per-use
|
|
||||||
; really adds up when we compare total size.
|
|
||||||
|
|
||||||
.db "0"
|
|
||||||
.dw $-MULT
|
|
||||||
.db 1
|
|
||||||
ZERO:
|
|
||||||
.dw nativeWord
|
|
||||||
ld hl, 0
|
|
||||||
push hl
|
|
||||||
jp next
|
|
||||||
|
|
||||||
.db "1"
|
|
||||||
.dw $-ZERO
|
|
||||||
.db 1
|
|
||||||
ONE:
|
|
||||||
.dw nativeWord
|
|
||||||
ld hl, 1
|
|
||||||
push hl
|
|
||||||
jp next
|
|
||||||
|
|
||||||
; ( a1 a2 -- b )
|
; ( a1 a2 -- b )
|
||||||
.db "SCMP"
|
.db "SCMP"
|
||||||
.dw $-ONE
|
.dw $-MULT
|
||||||
.db 4
|
.db 4
|
||||||
SCMP:
|
SCMP:
|
||||||
.dw nativeWord
|
.dw nativeWord
|
||||||
|
Loading…
Reference in New Issue
Block a user