This is the first commit I do entirely in VE. It's a habit I'm planning on taking as it helps a lot to find usability issues.pull/116/head
@@ -13,3 +13,4 @@ MASTER INDEX | |||||
@@ -1,2 +1,16 @@ | |||||
21 How blocks are organized 22 Addressed devices | 21 How blocks are organized 22 Addressed devices | ||||
23 Branching | 23 Branching | ||||
@@ -10,3 +10,7 @@ binary (example "0b1010"), char literals are single characters | |||||
surrounded by ' (example 'X'). Char literals can't be used for | surrounded by ' (example 'X'). Char literals can't be used for | ||||
whitespaces. | whitespaces. | ||||
@@ -12,3 +12,5 @@ writes that number as a literal, followed by a reference to | |||||
Example: ": foo [COMPILE] bar;" is the equivalent of ": foo bar | Example: ": foo [COMPILE] bar;" is the equivalent of ": foo bar | ||||
;" if bar is not an immediate. However, ": foo COMPILE bar ;" | ;" if bar is not an immediate. However, ": foo COMPILE bar ;" | ||||
is the equivalent of ": foo ['] bar , ;". Got it? | is the equivalent of ": foo ['] bar , ;". Got it? | ||||
@@ -4,3 +4,13 @@ prompt control to a RS-232 device instead of the keyboard. | |||||
Interpreter output is unbuffered and only has EMIT. This | Interpreter output is unbuffered and only has EMIT. This | ||||
word can also be overriden, mostly as a companion to the | word can also be overriden, mostly as a companion to the | ||||
raison d'etre of your KEY override. | raison d'etre of your KEY override. | ||||
@@ -6,3 +6,11 @@ Although the usage of absolute LOAD calls are minimally used | |||||
(relative LOADs are preferred), they are sometimes unavoidable. | (relative LOADs are preferred), they are sometimes unavoidable. | ||||
When you span Collapse OS over multiple disks, don't forget to | When you span Collapse OS over multiple disks, don't forget to | ||||
adjust those absolute LOADs. | adjust those absolute LOADs. | ||||
@@ -11,3 +11,6 @@ try to strive towards a few goals: | |||||
4. B200-B500 are for bootstrapping | 4. B200-B500 are for bootstrapping | ||||
5. The rest is for recipes. | 5. The rest is for recipes. | ||||
6. I'm not sure yet how I'll organize multiple arches. | 6. I'm not sure yet how I'll organize multiple arches. | ||||
@@ -4,3 +4,13 @@ A@ and A! are the indirect versions of C@ and C!. Their target | |||||
word is controlled through A@* and A!* and by default point to | word is controlled through A@* and A!* and by default point to | ||||
C@ and C*. There is also a AMOVE word that is the same as MOVE | C@ and C*. There is also a AMOVE word that is the same as MOVE | ||||
but using A@ and A!. | but using A@ and A!. | ||||
@@ -9,3 +9,8 @@ The reasoning behind this intentional limit is that huge | |||||
branches are generally a indicator that a logic ought to be | branches are generally a indicator that a logic ought to be | ||||
simplified. So here's one more constraint for you to help you | simplified. So here's one more constraint for you to help you | ||||
towards simplicity. | towards simplicity. | ||||
@@ -13,3 +13,4 @@ to be used directly, but as part of another word. | |||||
@@ -3,3 +3,14 @@ INTERPRET -- Get a line from stdin, compile it in tmp memory, | |||||
then execute the compiled contents. | then execute the compiled contents. | ||||
LEAVE -- In a DO..LOOP, exit at the next LOOP call. | LEAVE -- In a DO..LOOP, exit at the next LOOP call. | ||||
QUIT -- Return to interpreter prompt immediately | QUIT -- Return to interpreter prompt immediately | ||||
@@ -6,3 +6,11 @@ ROLL Rotate PSP over n items. "1 ROLL" = SWAP, | |||||
"2 ROLL" = ROT. 0 is noop. | "2 ROLL" = ROT. 0 is noop. | ||||
@@ -8,3 +8,9 @@ MOVE a1 a2 u -- Copy u bytes from a1 to a2, starting | |||||
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+u, going down. | with a1+u, going down. | ||||
MOVE, a u -- Copy u bytes from a to HERE. | MOVE, a u -- Copy u bytes from a to HERE. | ||||
@@ -10,3 +10,7 @@ S= a1 a2 -- f Returns whether string a1 == a2. | |||||
@@ -4,3 +4,13 @@ prohibitive in terms of costs), PS_ADDR should be set to | |||||
at least 6 bytes before its actual limit. 6 bytes because we | at least 6 bytes before its actual limit. 6 bytes because we | ||||
seldom have words requiring more than 3 items from the stack. | seldom have words requiring more than 3 items from the stack. | ||||
Then, at each "exit" call we check for stack underflow. | Then, at each "exit" call we check for stack underflow. | ||||
@@ -13,3 +13,4 @@ FUTURE USES section is unused for now. | |||||
DRIVERS section is reserved for recipe-specific drivers. | DRIVERS section is reserved for recipe-specific drivers. | ||||
@@ -8,3 +8,9 @@ | |||||
In RAM-only environment, we will typically have a | In RAM-only environment, we will typically have a | ||||
"CURRENT @ HERE !" line during init to have HERE begin at the | "CURRENT @ HERE !" line during init to have HERE begin at the | ||||
end of the binary instead of RAMEND. | end of the binary instead of RAMEND. | ||||
@@ -1,2 +1,16 @@ | |||||
X ( n -- ): Delete X chars after cursor and place in IBUF. | X ( n -- ): Delete X chars after cursor and place in IBUF. | ||||
E: Run X with n = length of FBUF. | E: Run X with n = length of FBUF. | ||||
@@ -12,3 +12,5 @@ | |||||
ENDCASE | ENDCASE | ||||
AGAIN | AGAIN | ||||
; | ; | ||||
@@ -11,3 +11,6 @@ CREATE FBUF 64 ALLOT0 | |||||
EMIT | EMIT | ||||
LOOP ( lno ) 1+ . ; | LOOP ( lno ) 1+ . ; | ||||
: _zbuf 64 0 FILL ; ( buf -- ) | : _zbuf 64 0 FILL ; ( buf -- ) | ||||
@@ -10,3 +10,7 @@ | |||||
: _mvln- ( ln -- move ln 1 line up ) | : _mvln- ( ln -- move ln 1 line up ) | ||||
DUP 14 > IF DROP 15 _lpos _zbuf | DUP 14 > IF DROP 15 _lpos _zbuf | ||||
ELSE 1+ _lpos DUP 64 - 64 MOVE THEN ; | ELSE 1+ _lpos DUP 64 - 64 MOVE THEN ; | ||||
@@ -3,3 +3,14 @@ | |||||
14 I - _mvln+ | 14 I - _mvln+ | ||||
LOOP ; | LOOP ; | ||||
: U _U P ; | : U _U P ; | ||||
@@ -8,3 +8,9 @@ | |||||
UNTIL ( a1 a2 ) | UNTIL ( a1 a2 ) | ||||
DUP BLK) < IF BLK( - FBUF + -^ EDPOS ! ELSE DROP THEN ; | DUP BLK) < IF BLK( - FBUF + -^ EDPOS ! ELSE DROP THEN ; | ||||
: F FBUF _type _F EDPOS @ 64 / _pln ; | : F FBUF _type _F EDPOS @ 64 / _pln ; | ||||
@@ -11,3 +11,6 @@ | |||||
ELSE DROP 1+ ( ilen becomes rbuffsize+1 ) THEN | ELSE DROP 1+ ( ilen becomes rbuffsize+1 ) THEN | ||||
DUP IBUF EDPOS @ _cpos ROT MOVE ( ilen ) EDPOS +! BLK!! ; | DUP IBUF EDPOS @ _cpos ROT MOVE ( ilen ) EDPOS +! BLK!! ; | ||||
: I IBUF _type _I EDPOS @ 64 / _pln ; | : I IBUF _type _I EDPOS @ 64 / _pln ; | ||||
@@ -9,3 +9,8 @@ | |||||
EDPOS @ 64 / _pln ; | EDPOS @ 64 / _pln ; | ||||
: E FBUF _blen X ; | : E FBUF _blen X ; | ||||
: Y FBUF _blen icpy ; | : Y FBUF _blen icpy ; | ||||
@@ -11,6 +11,6 @@ effect. | |||||
block. Any change made to the previously selected block is | block. Any change made to the previously selected block is | ||||
saved beforehand. | saved beforehand. | ||||
'[' and ']' advances the selected block by "modifier". | |||||
'[' and ']' advances the selected block by "modifier". 't' opens | |||||
the previously opened block. | |||||
(cont.) | (cont.) |
@@ -8,3 +8,9 @@ be sure, then press 'E'. | |||||
'R' goes into replace mode at current cursor position. | 'R' goes into replace mode at current cursor position. | ||||
Following keystrokes replace current character and advance | Following keystrokes replace current character and advance | ||||
cursor. Press return to return to normal mode. | cursor. Press return to return to normal mode. | ||||
@@ -1,3 +1,16 @@ | |||||
'? UPPER NOT [IF] 33 LOAD+ [THEN] DROP ( B158 ) | '? UPPER NOT [IF] 33 LOAD+ [THEN] DROP ( B158 ) | ||||
-20 LOAD+ ( B105, block editor ) | -20 LOAD+ ( B105, block editor ) | ||||
1 6 LOADR+ | 1 6 LOADR+ | ||||
@@ -1,5 +1,5 @@ | |||||
CREATE CMD 2 C, '$' C, 0 C, | CREATE CMD 2 C, '$' C, 0 C, | ||||
VARIABLE PREVPOS | |||||
CREATE PREVPOS 0 , CREATE PREVBLK 0 , | |||||
: acc@ ACC @ 1 MAX ; | : acc@ ACC @ 1 MAX ; | ||||
: num ACC @ SWAP _pdacc IF DROP ELSE ACC ! THEN ; | : num ACC @ SWAP _pdacc IF DROP ELSE ACC ! THEN ; | ||||
: nspcs ( n -- , spit n space ) 0 DO SPC LOOP ; | : nspcs ( n -- , spit n space ) 0 DO SPC LOOP ; | ||||
@@ -9,5 +9,8 @@ VARIABLE PREVPOS | |||||
: status 0 aty ." BLK" SPC BLK> ? SPC ACC ? | : status 0 aty ." BLK" SPC BLK> ? SPC ACC ? | ||||
SPC EDPOS @ 64 /MOD . ',' EMIT . 10 nspcs ; | SPC EDPOS @ 64 /MOD . ',' EMIT . 10 nspcs ; | ||||
: contents 3 aty BLK> @ LIST 3 16 gutter ; | : contents 3 aty BLK> @ LIST 3 16 gutter ; | ||||
: selblk BLK@ contents ; | |||||
: selblk BLK> @ PREVBLK ! BLK@ contents ; | |||||
: mode! ( c -- ) 63 0 AT-XY ; | : mode! ( c -- ) 63 0 AT-XY ; | ||||
@@ -8,3 +8,9 @@ | |||||
( buf ln c ) 63 nspcs SWAP 4 SWAP AT-XY ( buf c ) | ( buf ln c ) 63 nspcs SWAP 4 SWAP AT-XY ( buf c ) | ||||
SWAP DUP _zbuf C!+ DUP 63 + SWAP DO | SWAP DUP _zbuf C!+ DUP 63 + SWAP DO | ||||
C< DUP 0x0d = IF LEAVE THEN i C! LOOP ; | C< DUP 0x0d = IF LEAVE THEN i C! LOOP ; | ||||
@@ -1,6 +1,7 @@ | |||||
: $g ACC @ selblk ; | : $g ACC @ selblk ; | ||||
: $[ BLK> @ acc@ - selblk ; | : $[ BLK> @ acc@ - selblk ; | ||||
: $] BLK> @ acc@ + selblk ; | : $] BLK> @ acc@ + selblk ; | ||||
: $t PREVBLK @ selblk ; | |||||
: $I mode! 'I' EMIT IBUF 1 buftype _I contents mode! SPC ; | : $I mode! 'I' EMIT IBUF 1 buftype _I contents mode! SPC ; | ||||
: $F mode! 'F' EMIT FBUF 2 buftype _F setpos mode! SPC ; | : $F mode! 'F' EMIT FBUF 2 buftype _F setpos mode! SPC ; | ||||
: $Y Y ; | : $Y Y ; | ||||
@@ -10,3 +11,6 @@ | |||||
: $H EDPOS @ 0x3c0 AND pos! ; | : $H EDPOS @ 0x3c0 AND pos! ; | ||||
: $L EDPOS @ 0x3f OR pos! ; | : $L EDPOS @ 0x3f OR pos! ; | ||||
@@ -10,3 +10,7 @@ | |||||
: $B EDPOS @ BLK( + acc@ 0 DO | : $B EDPOS @ BLK( + acc@ 0 DO | ||||
BEGIN C@- WS? UNTIL BEGIN C@- WS? NOT UNTIL LOOP | BEGIN C@- WS? UNTIL BEGIN C@- WS? NOT UNTIL LOOP | ||||
1+ BLK( - pos! ; | 1+ BLK( - pos! ; | ||||
@@ -13,3 +13,4 @@ | |||||
: $D $H 64 icpy | : $D $H 64 icpy | ||||
acc@ 0 DO 16 EDPOS @ 64 / DO i _mvln- LOOP LOOP | acc@ 0 DO 16 EDPOS @ 64 / DO i _mvln- LOOP LOOP | ||||
BLK!! contents ; | BLK!! contents ; | ||||
@@ -12,3 +12,5 @@ | |||||
clrscr 0 ACC ! 0 PREVPOS ! contents | clrscr 0 ACC ! 0 PREVPOS ! contents | ||||
BEGIN status bufs setpos KEY handle UNTIL | BEGIN status bufs setpos KEY handle UNTIL | ||||
0 0x08 RAM+ ! 19 aty ; | 0 0x08 RAM+ ! 19 aty ; | ||||
@@ -13,3 +13,4 @@ Some programs need them, so they will automatically LOAD them. | |||||
Because more than one program can use the same extra words, | Because more than one program can use the same extra words, | ||||
conditional loaders are recommended. If you want to load all | conditional loaders are recommended. If you want to load all | ||||
words do "152 LOAD" which conditionally loads all extra words. | words do "152 LOAD" which conditionally loads all extra words. | ||||
@@ -2,3 +2,15 @@ | |||||
'? FILL NOT [IF] 3 LOAD+ [THEN] DROP | '? FILL NOT [IF] 3 LOAD+ [THEN] DROP | ||||
'? EMPTY NOT [IF] 4 LOAD+ [THEN] DROP | '? EMPTY NOT [IF] 4 LOAD+ [THEN] DROP | ||||
'? WIPE NOT [IF] 5 LOAD+ [THEN] DROP | '? WIPE NOT [IF] 5 LOAD+ [THEN] DROP | ||||
@@ -9,3 +9,8 @@ | |||||
: ENDOF [COMPILE] ELSE ; IMMEDIATE | : ENDOF [COMPILE] ELSE ; IMMEDIATE | ||||
@@ -9,3 +9,8 @@ | |||||
; IMMEDIATE | ; IMMEDIATE | ||||
@@ -3,3 +3,14 @@ | |||||
DUP I C! | DUP I C! | ||||
LOOP DROP ; | LOOP DROP ; | ||||
: ALLOT0 ( n -- ) H@ OVER 0 FILL ALLOT ; | : ALLOT0 ( n -- ) H@ OVER 0 FILL ALLOT ; | ||||
@@ -2,3 +2,15 @@ | |||||
LIT< _sys FIND NOT IF ABORT THEN | LIT< _sys FIND NOT IF ABORT THEN | ||||
DUP HERE ! CURRENT ! ; | DUP HERE ! CURRENT ! ; | ||||
@@ -3,3 +3,14 @@ | |||||
( src dst -- ) | ( src dst -- ) | ||||
: COPY SWAP BLK@ BLK> ! BLK! ; | : COPY SWAP BLK@ BLK> ! BLK! ; | ||||
@@ -1,2 +1,16 @@ | |||||
: LOWER DUP 'A' 'Z' =><= IF 32 + THEN ; | : LOWER DUP 'A' 'Z' =><= IF 32 + THEN ; | ||||
: UPPER DUP 'a' 'z' =><= IF 32 - THEN ; | : UPPER DUP 'a' 'z' =><= IF 32 - THEN ; | ||||
@@ -11,3 +11,6 @@ Z80 Assembler | |||||
238 OP3ddnn 240 OP3nn | 238 OP3ddnn 240 OP3nn | ||||
242 Specials 246 Flow | 242 Specials 246 Flow | ||||
249 Macros | 249 Macros | ||||
@@ -1,3 +1,16 @@ | |||||
On top of that, you have the very nice BREAK, instruction, | On top of that, you have the very nice BREAK, instruction, | ||||
which must also be preceeded by a JRxx, and will jump to the | which must also be preceeded by a JRxx, and will jump to the | ||||
PC following the next AGAIN, | PC following the next AGAIN, | ||||
@@ -9,3 +9,8 @@ JR [, Z, NZ, C, NC] | |||||
DI EI EXDEHL EXX HALT | DI EI EXDEHL EXX HALT | ||||
NOP RET RETI RETN SCF | NOP RET RETI RETN SCF | ||||
@@ -1 +1,16 @@ | |||||
1 37 LOADR+ | 1 37 LOADR+ | ||||
@@ -6,3 +6,11 @@ VARIABLE L1 VARIABLE L2 VARIABLE L3 VARIABLE L4 | |||||
: BC 0 ; : DE 1 ; : HL 2 ; : AF 3 ; : SP AF ; | : BC 0 ; : DE 1 ; : HL 2 ; : AF 3 ; : SP AF ; | ||||
: CNZ 0 ; : CZ 1 ; : CNC 2 ; : CC 3 ; | : CNZ 0 ; : CZ 1 ; : CNC 2 ; : CC 3 ; | ||||
: CPO 4 ; : CPE 5 ; : CP 6 ; : CM 7 ; | : CPO 4 ; : CPE 5 ; : CP 6 ; : CM 7 ; | ||||
@@ -10,3 +10,7 @@ | |||||
0x1f OP1 RRA, 0x0f OP1 RRCA, | 0x1f OP1 RRA, 0x0f OP1 RRCA, | ||||
0x37 OP1 SCF, | 0x37 OP1 SCF, | ||||
@@ -9,3 +9,8 @@ | |||||
0x28 OP1 JRZ, 0x20 OP1 JRNZ, | 0x28 OP1 JRZ, 0x20 OP1 JRNZ, | ||||
@@ -10,3 +10,7 @@ | |||||
0x04 OP1r INCr, 0x05 OP1r DECr, | 0x04 OP1r INCr, 0x05 OP1r DECr, | ||||
: INC(IXY+), INCr, A, ; | : INC(IXY+), INCr, A, ; | ||||
: DEC(IXY+), DECr, A, ; | : DEC(IXY+), DECr, A, ; | ||||
@@ -12,3 +12,5 @@ | |||||
0xb0 OP1r0 ORr, 0x90 OP1r0 SUBr, | 0xb0 OP1r0 ORr, 0x90 OP1r0 SUBr, | ||||
0x98 OP1r0 SBCr, 0xa8 OP1r0 XORr, | 0x98 OP1r0 SBCr, 0xa8 OP1r0 XORr, | ||||
: CP(IXY+), CPr, A, ; | : CP(IXY+), CPr, A, ; | ||||
@@ -13,3 +13,4 @@ | |||||
: ADDIXss, 0xdd A, ADDHLss, ; : ADDIXIX, HL ADDIXss, ; | : ADDIXss, 0xdd A, ADDHLss, ; : ADDIXIX, HL ADDIXss, ; | ||||
: ADDIYss, 0xfd A, ADDHLss, ; : ADDIYIY, HL ADDIYss, ; | : ADDIYss, 0xfd A, ADDHLss, ; : ADDIYIY, HL ADDIYss, ; | ||||
@@ -12,3 +12,5 @@ | |||||
_1rr | _1rr | ||||
; | ; | ||||
0x40 OP1rr LDrr, | 0x40 OP1rr LDrr, | ||||
@@ -11,3 +11,6 @@ | |||||
SWAP ( ixy+- rd HL ) | SWAP ( ixy+- rd HL ) | ||||
LDIXYr, | LDIXYr, | ||||
; | ; | ||||
@@ -7,3 +7,10 @@ | |||||
0xeda8 OP2 LDD, 0xedb8 OP2 LDDR, | 0xeda8 OP2 LDD, 0xedb8 OP2 LDDR, | ||||
0xed44 OP2 NEG, | 0xed44 OP2 NEG, | ||||
0xed4d OP2 RETI, 0xed45 OP2 RETN, | 0xed4d OP2 RETI, 0xed45 OP2 RETN, | ||||
@@ -13,3 +13,4 @@ | |||||
0xee OP2n XORn, | 0xee OP2n XORn, | ||||
0xfe OP2n CPn, | 0xfe OP2n CPn, | ||||
@@ -9,3 +9,8 @@ | |||||
; | ; | ||||
0x06 OP2rn LDrn, | 0x06 OP2rn LDrn, | ||||
@@ -12,3 +12,5 @@ | |||||
0x80 OP2br RESbr, | 0x80 OP2br RESbr, | ||||
0x40 OP2br BITbr, | 0x40 OP2br BITbr, | ||||
@@ -12,3 +12,5 @@ | |||||
0xed41 OP2r OUT(C)r, | 0xed41 OP2r OUT(C)r, | ||||
0xed40 OP2r INr(C), | 0xed40 OP2r INr(C), | ||||
@@ -10,3 +10,7 @@ | |||||
0x4a OP2ss ADCHLss, | 0x4a OP2ss ADCHLss, | ||||
0x42 OP2ss SBCHLss, | 0x42 OP2ss SBCHLss, | ||||
@@ -9,3 +9,8 @@ | |||||
A,, | A,, | ||||
; | ; | ||||
0x01 OP3ddnn LDddnn, | 0x01 OP3ddnn LDddnn, | ||||
@@ -9,3 +9,8 @@ | |||||
0xc3 OP3nn JPnn, | 0xc3 OP3nn JPnn, | ||||
0x22 OP3nn LD(nn)HL, | 0x22 OP3nn LD(nn)HL, | ||||
0x2a OP3nn LDHL(nn), | 0x2a OP3nn LDHL(nn), | ||||
@@ -12,3 +12,5 @@ | |||||
: JP(IX), IX DROP JP(HL), ; | : JP(IX), IX DROP JP(HL), ; | ||||
: JP(IY), IY DROP JP(HL), ; | : JP(IY), IY DROP JP(HL), ; | ||||
@@ -13,3 +13,4 @@ | |||||
; | ; | ||||
: ;CODE JPNEXT, ; | : ;CODE JPNEXT, ; | ||||
@@ -6,3 +6,11 @@ | |||||
THEN ; | THEN ; | ||||
: AGAIN, BREAK?, PC - 1- A, ; | : AGAIN, BREAK?, PC - 1- A, ; | ||||
: BWR @ AGAIN, ; | : BWR @ AGAIN, ; | ||||
@@ -10,3 +10,7 @@ | |||||
: LDDE(HL), E (HL) LDrr, HL INCss, D (HL) LDrr, ; | : LDDE(HL), E (HL) LDrr, HL INCss, D (HL) LDrr, ; | ||||
: OUTHL, DUP A H LDrr, OUTnA, A L LDrr, OUTnA, ; | : OUTHL, DUP A H LDrr, OUTnA, A L LDrr, OUTnA, ; | ||||
: OUTDE, DUP A D LDrr, OUTnA, A E LDrr, OUTnA, ; | : OUTDE, DUP A D LDrr, OUTnA, A E LDrr, OUTnA, ; | ||||
@@ -7,3 +7,10 @@ See example in /emul/xcomp.fs | |||||
Why limit ourselves to icore? Oh, I've tried cross-compiling | Why limit ourselves to icore? Oh, I've tried cross-compiling | ||||
the whole shebang. I tried. And failed. Too dynamic. | the whole shebang. I tried. And failed. Too dynamic. | ||||
@@ -1 +1,16 @@ | |||||
1 LOAD+ 3 LOAD+ 6 LOAD+ | 1 LOAD+ 3 LOAD+ 6 LOAD+ | ||||
@@ -13,3 +13,4 @@ VARIABLE XCURRENT | |||||
XCON ' _xapply LITA | XCON ' _xapply LITA | ||||
LIT< , FIND DROP _xapply , XCOFF ; | LIT< , FIND DROP _xapply , XCOFF ; | ||||
: X[COMPILE] XCON ' _xapply , XCOFF ; | : X[COMPILE] XCON ' _xapply , XCOFF ; | ||||
@@ -12,3 +12,5 @@ never supposed to encounter an immediate at this point. | |||||
If not found, we try the same word on system dict (RAM+02). | If not found, we try the same word on system dict (RAM+02). | ||||
If found and is immediate, execute. If founf and not immediate, | If found and is immediate, execute. If founf and not immediate, | ||||
error. If not found, try number. | error. If not found, try number. | ||||
@@ -12,3 +12,5 @@ | |||||
THEN | THEN | ||||
AGAIN | AGAIN | ||||
; | ; | ||||
@@ -9,3 +9,8 @@ | |||||
CURRENT @ XCURRENT ! | CURRENT @ XCURRENT ! | ||||
@@ -10,3 +10,7 @@ up until 0x67, the (?br) wordref, pretty much everything has | |||||
to stay put. | to stay put. | ||||
To assemble, run "282 LOAD". | To assemble, run "282 LOAD". | ||||
@@ -1 +1,16 @@ | |||||
1 53 LOADR+ | 1 53 LOADR+ | ||||
@@ -13,3 +13,4 @@ NOP, NOP, ( 24, addrWord ) NOP, NOP, ( 26, unused ) | |||||
0 JPnn, ( RST 30 ) | 0 JPnn, ( RST 30 ) | ||||
0 JPnn, ( 33, execute ) NOP, NOP, ( unused ) | 0 JPnn, ( 33, execute ) NOP, NOP, ( unused ) | ||||
0 JPnn, ( RST 38 ) | 0 JPnn, ( RST 38 ) | ||||
@@ -13,3 +13,4 @@ CODE (loop) ( 0x77 ) | |||||
A 1 IX+ LDrIXY, 1 IX- CP(IXY+), JRNZ, L2 BWR ( branch ) | A 1 IX+ LDrIXY, 1 IX- CP(IXY+), JRNZ, L2 BWR ( branch ) | ||||
( don't branch ) | ( don't branch ) | ||||
IX DECss, IX DECss, IX DECss, IX DECss, JR, L1 BWR | IX DECss, IX DECss, IX DECss, IX DECss, JR, L1 BWR | ||||
@@ -12,3 +12,5 @@ PC ORG @ 0x24 + ! ( addrWord ) | |||||
IY INCss, | IY INCss, | ||||
DE PUSHqq, | DE PUSHqq, | ||||
JPNEXT, | JPNEXT, | ||||
@@ -8,3 +8,9 @@ PC ORG @ 0x22 + ! ( litWord, 0xf7, tight on the 0x100 limit ) | |||||
DE ADDIYss, | DE ADDIYss, | ||||
HL PUSHqq, | HL PUSHqq, | ||||
JPNEXT, | JPNEXT, | ||||
@@ -13,3 +13,4 @@ PC ORG @ 1 + ! ( main ) | |||||
Forth. ) | Forth. ) | ||||
BIN( @ 0x08 + LDHL(nn), | BIN( @ 0x08 + LDHL(nn), | ||||
RAMSTART 0x02 + LD(nn)HL, ( RAM+02 == CURRENT cont. ) | RAMSTART 0x02 + LD(nn)HL, ( RAM+02 == CURRENT cont. ) | ||||
@@ -2,3 +2,15 @@ | |||||
HL L1 @ LDddnn, | HL L1 @ LDddnn, | ||||
0x03 BCALL, ( 03 == find ) | 0x03 BCALL, ( 03 == find ) | ||||
0x33 BJP, ( 33 == execute ) | 0x33 BJP, ( 33 == execute ) | ||||
@@ -13,3 +13,4 @@ PC ORG @ 4 + ! ( find ) | |||||
C A LDrr, B 0 LDrn, ( C holds our length ) | C A LDrr, B 0 LDrn, ( C holds our length ) | ||||
BC ADDHLss, HL INCss, ( HL points to after-last-char ) | BC ADDHLss, HL INCss, ( HL points to after-last-char ) | ||||
( cont . ) | ( cont . ) | ||||
@@ -6,3 +6,11 @@ | |||||
LDA(DE), | LDA(DE), | ||||
0x7f ANDn, ( remove IMMEDIATE flag ) | 0x7f ANDn, ( remove IMMEDIATE flag ) | ||||
C CPr, ( cont. ) | C CPr, ( cont. ) | ||||
@@ -13,3 +13,4 @@ | |||||
DJNZ, AGAIN, | DJNZ, AGAIN, | ||||
THEN, | THEN, | ||||
( cont. ) | ( cont. ) | ||||
@@ -4,3 +4,13 @@ | |||||
L2 FSET ( end ) | L2 FSET ( end ) | ||||
HL POPqq, | HL POPqq, | ||||
RET, | RET, | ||||
@@ -11,3 +11,6 @@ PC ORG @ 0x15 + ! ( popRS ) | |||||
IX DECss, | IX DECss, | ||||
IX DECss, | IX DECss, | ||||
RET, | RET, | ||||
@@ -5,3 +5,12 @@ L2 BSET ( abortUnderflow ) | |||||
0x03 BCALL, ( find ) | 0x03 BCALL, ( find ) | ||||
0x33 BJP, ( 33 == execute ) | 0x33 BJP, ( 33 == execute ) | ||||
@@ -11,3 +11,6 @@ PC ORG @ 0x1e + ! ( chkPS ) | |||||
CNC RETcc, ( PS_ADDR >= SP? good ) | CNC RETcc, ( PS_ADDR >= SP? good ) | ||||
JR, L2 BWR ( abortUnderflow-B298 ) | JR, L2 BWR ( abortUnderflow-B298 ) | ||||
@@ -13,3 +13,4 @@ L3 BSET PC ORG @ 0x34 + ! ( execute ) | |||||
( DE points to PFA ) | ( DE points to PFA ) | ||||
JP(HL), | JP(HL), | ||||
@@ -10,3 +10,7 @@ L1 BSET PC ORG @ 0x0f + ! ( compiledWord ) | |||||
HL INCss, | HL INCss, | ||||
HL PUSHqq, IY POPqq, ( --> IP ) | HL PUSHqq, IY POPqq, ( --> IP ) | ||||
JR, L3 BWR ( execute-B301 ) | JR, L3 BWR ( execute-B301 ) | ||||
@@ -3,3 +3,14 @@ PC ORG @ 0x0c + ! ( cellWord ) | |||||
DE PUSHqq, | DE PUSHqq, | ||||
JPNEXT, | JPNEXT, | ||||
@@ -7,3 +7,10 @@ CODE EXECUTE | |||||
DE POPqq, | DE POPqq, | ||||
chkPS, | chkPS, | ||||
JR, L3 BWR ( execute-B301 ) | JR, L3 BWR ( execute-B301 ) | ||||
@@ -9,3 +9,8 @@ CODE ROT | |||||
BC PUSHqq, ( A ) | BC PUSHqq, ( A ) | ||||
;CODE | ;CODE | ||||
@@ -8,3 +8,9 @@ CODE SWAP | |||||
;CODE | ;CODE | ||||
@@ -9,3 +9,8 @@ CODE OVER | |||||
;CODE | ;CODE | ||||
@@ -13,3 +13,4 @@ CODE PICK | |||||
CC L2 @ JPccnn, ( abortUnderflow-B298 ) | CC L2 @ JPccnn, ( abortUnderflow-B298 ) | ||||
BC PUSHqq, | BC PUSHqq, | ||||
;CODE | ;CODE | ||||
@@ -13,3 +13,4 @@ CODE (roll) | |||||
HL DECss, | HL DECss, | ||||
LDDR, | LDDR, | ||||
;CODE | ;CODE | ||||
@@ -12,3 +12,5 @@ CODE 2DUP | |||||
DE PUSHqq, HL PUSHqq, | DE PUSHqq, HL PUSHqq, | ||||
;CODE | ;CODE | ||||
@@ -9,3 +9,8 @@ CODE 'S | |||||
HL PUSHqq, | HL PUSHqq, | ||||
;CODE | ;CODE | ||||
@@ -12,3 +12,5 @@ CODE AND | |||||
;CODE | ;CODE | ||||
@@ -10,3 +10,7 @@ CODE OR | |||||
H A LDrr, | H A LDrr, | ||||
HL PUSHqq, | HL PUSHqq, | ||||
;CODE | ;CODE | ||||