mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-02 10:20:55 +11:00
Compare commits
3 Commits
ab6a2688fe
...
feb0411530
Author | SHA1 | Date | |
---|---|---|---|
|
feb0411530 | ||
|
eaeb138a0c | ||
|
690d9e6313 |
5
blk/050
5
blk/050
@ -6,12 +6,11 @@ Memory
|
|||||||
+! n a -- Increase value of addr a by n
|
+! n a -- Increase value of addr a by n
|
||||||
C@ a -- c Set c to byte at address a
|
C@ a -- c Set c to byte at address a
|
||||||
C@+ a -- a+1 c Fetch c from a and inc a.
|
C@+ a -- a+1 c Fetch c from a and inc a.
|
||||||
|
C@- a -- a-1 c Fetch c from a and dec a.
|
||||||
C! c a -- Store byte c in address a
|
C! c a -- Store byte c in address a
|
||||||
C!+ c a -- a+1 Store byte c in a and inc a.
|
C!+ c a -- a+1 Store byte c in a and inc a.
|
||||||
|
C!- c a -- a-1 Store byte c in a and dec a.
|
||||||
CURRENT -- a Set a to wordref of last added entry.
|
CURRENT -- a Set a to wordref of last added entry.
|
||||||
CURRENT* -- a A pointer to active CURRENT*. Useful
|
CURRENT* -- a A pointer to active CURRENT*. Useful
|
||||||
when we have multiple active dicts.
|
when we have multiple active dicts.
|
||||||
FILL a n b -- Fill n bytes at addr a with val b.
|
|
||||||
HERE -- a Push HERE's address
|
|
||||||
H@ -- a HERE @
|
|
||||||
(cont.)
|
(cont.)
|
||||||
|
5
blk/051
5
blk/051
@ -1,2 +1,7 @@
|
|||||||
|
FILL a n b -- Fill n bytes at addr a with val b.
|
||||||
|
HERE -- a Push HERE's address
|
||||||
|
H@ -- a HERE @
|
||||||
MOVE a1 a2 u -- Copy u bytes from a1 to a2, starting
|
MOVE a1 a2 u -- Copy u bytes from a1 to a2, starting
|
||||||
with a1, going up.
|
with a1, going up.
|
||||||
|
MOVE- a1 a2 u -- Copy u bytes from a1 to a2, starting
|
||||||
|
with a1+u, going down.
|
||||||
|
4
blk/102
4
blk/102
@ -12,5 +12,5 @@
|
|||||||
ENDCASE
|
ENDCASE
|
||||||
AGAIN
|
AGAIN
|
||||||
;
|
;
|
||||||
|
( I masks DO..LOOP's I. Do it as late as possible. )
|
||||||
|
: I _I ;
|
||||||
|
20
blk/108
20
blk/108
@ -1,15 +1,15 @@
|
|||||||
: _ilen ( length of str in IBUF )
|
: _ilen ( length of str in IBUF )
|
||||||
IBUF BEGIN C@+ EOL? UNTIL IBUF - 1- ;
|
IBUF BEGIN C@+ EOL? UNTIL IBUF - 1- ;
|
||||||
: I
|
: _I
|
||||||
IBUF _type EDPOS @ 64 /MOD ( cno lno )
|
IBUF _type EDPOS @ 64 MOD ( cno )
|
||||||
1+ 64 * _cpos ( cno next-line-ptr )
|
63 -^ _ilen ( rbuffsize ilen )
|
||||||
SWAP 63 -^ _ilen ( nlp nb-of-chars-to-move ilen )
|
|
||||||
2DUP > IF
|
2DUP > IF
|
||||||
SWAP OVER - 1+ ( nlp ilen nbc ) 0 DO ( a ilen )
|
SWAP OVER - ( ilen chars-to-move )
|
||||||
SWAP 1- 2DUP -^ ( ilen a-1 a-ilen-1 ) C@ OVER C!
|
SWAP EDPOS @ _cpos 2DUP + ( ctm ilen a a+ilen )
|
||||||
SWAP ( a ilen )
|
3 PICK MOVE- ( ctm ilen )
|
||||||
LOOP
|
SWAP DROP ( ilen )
|
||||||
ELSE DROP ( ilen becomes nbc )
|
ELSE DROP ( ilen becomes rbuffsize )
|
||||||
THEN
|
THEN
|
||||||
SWAP DROP IBUF EDPOS @ _cpos ROT MOVE
|
DUP IBUF EDPOS @ _cpos ROT MOVE ( ilen )
|
||||||
|
EDPOS +! EDPOS @ 64 / _pln
|
||||||
;
|
;
|
||||||
|
14
blk/394
14
blk/394
@ -1,12 +1,6 @@
|
|||||||
: ABORT (resSP) QUIT ;
|
: ABORT (resSP) QUIT ;
|
||||||
|
: = CMP NOT ; : < CMP -1 = ; : > CMP 1 = ;
|
||||||
: = CMP NOT ;
|
: 0< 32767 > ; : >= < NOT ; : <= > NOT ; : 0>= 0< NOT ;
|
||||||
: < CMP -1 = ;
|
|
||||||
: > CMP 1 = ;
|
|
||||||
: 0< 32767 > ;
|
|
||||||
: >= < NOT ;
|
|
||||||
: <= > NOT ;
|
|
||||||
: 0>= 0< NOT ;
|
|
||||||
( n l h -- f )
|
( n l h -- f )
|
||||||
: >< 2 PICK > ( n l f ) ROT ROT > AND ;
|
: >< 2 PICK > ( n l f ) ROT ROT > AND ;
|
||||||
: =><= 2 PICK >= ( n l f ) ROT ROT >= AND ;
|
: =><= 2 PICK >= ( n l f ) ROT ROT >= AND ;
|
||||||
@ -14,3 +8,7 @@
|
|||||||
: C@+ DUP C@ SWAP 1+ SWAP ;
|
: C@+ DUP C@ SWAP 1+ SWAP ;
|
||||||
( c a -- a+1 )
|
( c a -- a+1 )
|
||||||
: C!+ SWAP OVER C! 1+ ;
|
: C!+ SWAP OVER C! 1+ ;
|
||||||
|
( a -- a-1 c )
|
||||||
|
: C@- DUP C@ SWAP 1- SWAP ;
|
||||||
|
( c a -- a-1 )
|
||||||
|
: C!- SWAP OVER C! 1- ;
|
||||||
|
18
blk/434
18
blk/434
@ -1,9 +1,13 @@
|
|||||||
: MOVE ( a1 a2 u -- )
|
: MOVE ( a1 a2 u -- )
|
||||||
( u ) 0 DO
|
( u ) 0 DO ( a1 a2 )
|
||||||
SWAP DUP I + C@ ( a2 a1 x )
|
SWAP C@+ ( a2 a1+1 x )
|
||||||
ROT SWAP OVER I + ( a1 a2 x a2 )
|
ROT C!+ ( a1+1 a2+1 )
|
||||||
C! ( a1 a2 )
|
LOOP 2DROP ;
|
||||||
LOOP
|
: MOVE- ( a1 a2 u -- )
|
||||||
2DROP
|
SWAP OVER + 1- ( a1 u a2+u-1 )
|
||||||
;
|
ROT 2 PICK + 1- ( u a2+u-1 a1+u-1 )
|
||||||
|
ROT ( u ) 0 DO ( a2 a1 )
|
||||||
|
C@- ( a2 a1-1 x )
|
||||||
|
ROT C!- ( a1-1 a2-1 ) SWAP ( a2 a1 )
|
||||||
|
LOOP 2DROP ;
|
||||||
: PREV 3 - DUP @ - ;
|
: PREV 3 - DUP @ - ;
|
||||||
|
BIN
emul/forth.bin
BIN
emul/forth.bin
Binary file not shown.
Loading…
Reference in New Issue
Block a user