mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-26 21:38:05 +11:00
Compare commits
No commits in common. "a776df27d272c095eb614b60b47c19c52b7ccac2" and "98d23bc59bdad65a0a417c6ca961769e6df2aaa6" have entirely different histories.
a776df27d2
...
98d23bc59b
16
blk/328
16
blk/328
@ -1,16 +1,14 @@
|
|||||||
CODE S=
|
CODE S=
|
||||||
DE POPqq, HL POPqq, chkPS,
|
DE POPqq,
|
||||||
HL DECss, DE DECss,
|
HL POPqq,
|
||||||
LDA(DE),
|
chkPS,
|
||||||
(HL) CPr,
|
|
||||||
IFZ, ( same size? )
|
|
||||||
B A LDrr, ( loop A times )
|
|
||||||
BEGIN,
|
BEGIN,
|
||||||
HL INCss, DE INCss,
|
|
||||||
LDA(DE),
|
LDA(DE),
|
||||||
(HL) CPr,
|
(HL) CPr,
|
||||||
JRNZ, BREAK, ( not equal? break early. NZ is set. )
|
JRNZ, BREAK, ( not equal? break early. NZ is set. )
|
||||||
DJNZ, AGAIN,
|
A ORr, ( if our char is null, stop )
|
||||||
THEN,
|
HL INCss,
|
||||||
|
DE INCss,
|
||||||
|
JRNZ, AGAIN,
|
||||||
PUSHZ,
|
PUSHZ,
|
||||||
;CODE
|
;CODE
|
||||||
|
10
blk/367
10
blk/367
@ -1,10 +0,0 @@
|
|||||||
: IMMEDIATE
|
|
||||||
CURRENT @ 1-
|
|
||||||
DUP C@ 128 OR SWAP C! ;
|
|
||||||
: IMMED? 1- C@ 0x80 AND ;
|
|
||||||
: +! TUCK @ + SWAP ! ;
|
|
||||||
: -^ SWAP - ;
|
|
||||||
: / /MOD NIP ;
|
|
||||||
: MOD /MOD DROP ;
|
|
||||||
: ALLOT HERE +! ;
|
|
||||||
: LEAVE R> R> DROP I 1- >R >R ;
|
|
12
blk/368
Normal file
12
blk/368
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
: +! TUCK @ + SWAP ! ;
|
||||||
|
: [entry] ( w -- )
|
||||||
|
H@ SWAP
|
||||||
|
BEGIN C@+ ( w+1 c ) ?DUP IF C, 0 ELSE 1 THEN UNTIL DROP
|
||||||
|
H@ SWAP - ( sz )
|
||||||
|
( write prev value )
|
||||||
|
H@ CURRENT @ - ,
|
||||||
|
C, ( write size )
|
||||||
|
H@ CURRENT !
|
||||||
|
;
|
||||||
|
|
||||||
|
: (entry) WORD [entry] ;
|
23
blk/369
23
blk/369
@ -1,12 +1,11 @@
|
|||||||
: '? WORD FIND ;
|
: IMMEDIATE
|
||||||
: '
|
CURRENT @ 1-
|
||||||
'? (?br) [ 4 , ] EXIT
|
DUP C@ 128 OR SWAP C! ;
|
||||||
LIT< (wnf) FIND DROP EXECUTE
|
: IMMED? 1- C@ 0x80 AND ;
|
||||||
;
|
: -^ SWAP - ;
|
||||||
: ROLL
|
: / /MOD NIP ;
|
||||||
?DUP NOT IF EXIT THEN
|
: MOD /MOD DROP ;
|
||||||
1+ DUP PICK ( n val )
|
: ALLOT HERE +! ;
|
||||||
SWAP 2 * (roll) ( val )
|
: CREATE (entry) 11 ( 11 == cellWord ) C, ;
|
||||||
NIP ;
|
: VARIABLE CREATE 2 ALLOT ;
|
||||||
: 2OVER 3 PICK 3 PICK ;
|
: LEAVE R> R> DROP I 1- >R >R ;
|
||||||
: 2SWAP 3 ROLL 3 ROLL ;
|
|
||||||
|
26
blk/370
26
blk/370
@ -1,14 +1,12 @@
|
|||||||
: MOVE ( a1 a2 u -- )
|
: '? WORD FIND ;
|
||||||
( u ) 0 DO ( a1 a2 )
|
: '
|
||||||
SWAP C@+ ( a2 a1+1 x )
|
'? (?br) [ 4 , ] EXIT
|
||||||
ROT C!+ ( a1+1 a2+1 )
|
LIT< (wnf) FIND DROP EXECUTE
|
||||||
LOOP 2DROP ;
|
;
|
||||||
: MOVE- ( a1 a2 u -- )
|
: ROLL
|
||||||
TUCK + 1- ( a1 u a2+u-1 )
|
?DUP NOT IF EXIT THEN
|
||||||
ROT 2 PICK + 1- ( u a2+u-1 a1+u-1 )
|
1+ DUP PICK ( n val )
|
||||||
ROT ( u ) 0 DO ( a2 a1 )
|
SWAP 2 * (roll) ( val )
|
||||||
C@- ( a2 a1-1 x )
|
NIP ;
|
||||||
ROT C!- ( a1-1 a2-1 ) SWAP ( a2 a1 )
|
: 2OVER 3 PICK 3 PICK ;
|
||||||
LOOP 2DROP ;
|
: 2SWAP 3 ROLL 3 ROLL ;
|
||||||
: MOVE, ( a u -- ) H@ OVER ALLOT SWAP MOVE ;
|
|
||||||
: PREV 3 - DUP @ - ;
|
|
||||||
|
24
blk/371
24
blk/371
@ -1,10 +1,14 @@
|
|||||||
: [entry] ( w -- )
|
: MOVE ( a1 a2 u -- )
|
||||||
1- C@+ ( w+1 len ) TUCK MOVE, ( len )
|
( u ) 0 DO ( a1 a2 )
|
||||||
( write prev value )
|
SWAP C@+ ( a2 a1+1 x )
|
||||||
H@ CURRENT @ - ,
|
ROT C!+ ( a1+1 a2+1 )
|
||||||
C, ( write size )
|
LOOP 2DROP ;
|
||||||
H@ CURRENT !
|
: MOVE- ( a1 a2 u -- )
|
||||||
;
|
TUCK + 1- ( a1 u a2+u-1 )
|
||||||
: (entry) WORD [entry] ;
|
ROT 2 PICK + 1- ( u a2+u-1 a1+u-1 )
|
||||||
: CREATE (entry) 11 ( 11 == cellWord ) C, ;
|
ROT ( u ) 0 DO ( a2 a1 )
|
||||||
: VARIABLE CREATE 2 ALLOT ;
|
C@- ( a2 a1-1 x )
|
||||||
|
ROT C!- ( a1-1 a2-1 ) SWAP ( a2 a1 )
|
||||||
|
LOOP 2DROP ;
|
||||||
|
: MOVE, ( a u -- ) H@ OVER ALLOT SWAP MOVE ;
|
||||||
|
: PREV 3 - DUP @ - ;
|
||||||
|
BIN
emul/forth.bin
BIN
emul/forth.bin
Binary file not shown.
@ -42,8 +42,7 @@ static uint8_t iord_stdio()
|
|||||||
|
|
||||||
static void iowr_stdio(uint8_t val)
|
static void iowr_stdio(uint8_t val)
|
||||||
{
|
{
|
||||||
// uncomment when you need to debug staging
|
// we don't output stdout in stage0
|
||||||
// putc(val, stderr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void iowr_here(uint8_t val)
|
static void iowr_here(uint8_t val)
|
||||||
|
Loading…
Reference in New Issue
Block a user