mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-02 08:20:57 +11:00
Compare commits
No commits in common. "2e23b84fc1dedd11453127e37922046042ec434c" and "ee3407bf1cd67cf242fab283691f209c908ed880" have entirely different histories.
2e23b84fc1
...
ee3407bf1c
6
blk/204
6
blk/204
@ -8,9 +8,3 @@ byte that is taken care of. We still need to adjust by another
|
||||
byte before writing the offset.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
(cont.)
|
||||
|
16
blk/205
16
blk/205
@ -1,16 +0,0 @@
|
||||
Structured flow
|
||||
|
||||
z80a also has words that behave similarly to IF..THEN and
|
||||
BEGIN..UNTIL.
|
||||
|
||||
On the IF side, we have IFZ, IFNZ, IFC, IFNC, and THEN,. When
|
||||
the opposite condition is met, a relative jump is made to
|
||||
THEN,'s PC. For example, if you have IFZ, a jump is made when
|
||||
Z is unset.
|
||||
|
||||
On the BEGIN,..AGAIN, side, it's a bit different. You start
|
||||
with your BEGIN, instruction, and then later you issue a
|
||||
JRxx, instr followed by AGAIN,. Exactly like you would do
|
||||
with a label.
|
||||
|
||||
(cont.)
|
3
blk/206
3
blk/206
@ -1,3 +0,0 @@
|
||||
On top of that, you have the very nice BREAK, instruction,
|
||||
which must also be preceeded by a JRxx, and will jump to the
|
||||
PC following the next AGAIN,
|
9
blk/246
9
blk/246
@ -1,16 +1,13 @@
|
||||
( Place BEGIN, where you want to jump back and AGAIN after
|
||||
a relative jump operator. Just like BSET and BWR. )
|
||||
: BEGIN, PC ;
|
||||
: AGAIN, PC - 1- A, ;
|
||||
|
||||
: BSET PC SWAP ! ;
|
||||
: BWR @ AGAIN, ;
|
||||
( same as BSET, but we need to write a placeholder )
|
||||
: FJR, PC 0 A, ;
|
||||
: IFZ, JRNZ, FJR, ;
|
||||
: IFNZ, JRZ, FJR, ;
|
||||
: IFC, JRNC, FJR, ;
|
||||
: IFNC, JRC, FJR, ;
|
||||
: THEN,
|
||||
DUP PC ( l l pc )
|
||||
-^ 1- ( l off )
|
||||
( warning: l is a PC offset, not a mem addr! )
|
||||
SWAP ORG @ + BIN( @ - ( off addr )
|
||||
C! ;
|
||||
|
13
blk/247
13
blk/247
@ -1,8 +1,9 @@
|
||||
: THEN,
|
||||
DUP PC ( l l pc )
|
||||
-^ 1- ( l off )
|
||||
( warning: l is a PC offset, not a mem addr! )
|
||||
SWAP ORG @ + BIN( @ - ( off addr )
|
||||
C!
|
||||
;
|
||||
: FWR BSET 0 A, ;
|
||||
: FSET @ THEN, ;
|
||||
: BREAK, FJR, 0x8000 OR ;
|
||||
: BREAK?, DUP 0x8000 AND IF
|
||||
0x7fff AND 1 ALLOT THEN, -1 ALLOT
|
||||
THEN ;
|
||||
: AGAIN, BREAK?, PC - 1- A, ;
|
||||
: BWR @ AGAIN, ;
|
||||
|
2
blk/291
2
blk/291
@ -13,4 +13,4 @@ PC ORG @ 4 + ! ( find )
|
||||
NEG,
|
||||
A DECr,
|
||||
( special case. zero len? we never find anything. )
|
||||
IFNZ, ( fail-B296 ) ( cont. )
|
||||
JRZ, L1 FWR ( fail-B296 ) ( cont. )
|
||||
|
29
blk/293
29
blk/293
@ -1,15 +1,16 @@
|
||||
IFZ,
|
||||
( match, let's compare the string then )
|
||||
DE DECss, ( Skip prev field. One less because we )
|
||||
DE DECss, ( pre-decrement )
|
||||
B C LDrr, ( loop C times )
|
||||
BEGIN,
|
||||
( pre-decrement for easier Z matching )
|
||||
DE DECss,
|
||||
HL DECss,
|
||||
LDA(DE),
|
||||
(HL) CPr,
|
||||
JRNZ, BREAK,
|
||||
DJNZ, AGAIN,
|
||||
THEN,
|
||||
JRNZ, L2 FWR ( loopend )
|
||||
( match, let's compare the string then )
|
||||
DE DECss, ( Skip prev field. One less because we )
|
||||
DE DECss, ( pre-decrement )
|
||||
B C LDrr, ( loop C times )
|
||||
BEGIN, ( loop )
|
||||
( pre-decrement for easier Z matching )
|
||||
DE DECss,
|
||||
HL DECss,
|
||||
LDA(DE),
|
||||
(HL) CPr,
|
||||
JRNZ, L3 FWR ( loopend )
|
||||
DJNZ, AGAIN, ( loop )
|
||||
L2 FSET L3 FSET ( loopend )
|
||||
|
||||
( cont. )
|
||||
|
2
blk/296
2
blk/296
@ -1,4 +1,4 @@
|
||||
THEN, ( zero length check, B291 )
|
||||
L1 FSET ( fail )
|
||||
A XORr,
|
||||
A INCr,
|
||||
L2 FSET ( end )
|
||||
|
8
blk/328
8
blk/328
@ -2,13 +2,15 @@ CODE S=
|
||||
DE POPqq,
|
||||
HL POPqq,
|
||||
chkPS,
|
||||
BEGIN,
|
||||
BEGIN, ( loop )
|
||||
LDA(DE),
|
||||
(HL) CPr,
|
||||
JRNZ, BREAK, ( not equal? break early. NZ is set. )
|
||||
JRNZ, L1 FWR ( not equal? break early to "end".
|
||||
NZ is set. )
|
||||
A ORr, ( if our char is null, stop )
|
||||
HL INCss,
|
||||
DE INCss,
|
||||
JRNZ, AGAIN,
|
||||
JRNZ, AGAIN, ( loop )
|
||||
L1 FSET ( end )
|
||||
PUSHZ,
|
||||
;CODE
|
||||
|
3
blk/662
3
blk/662
@ -1,6 +1,5 @@
|
||||
( 0000 000d dddd 0000 )
|
||||
: _Rdp ( op rd -- op' place Rd ) 4 LSHIFT OR ;
|
||||
: OPRd CREATE , DOES> @ SWAP _Rdp A,, ;
|
||||
: OPRd CREATE , DOES> @ SWAP 4 LSHIFT OR A,, ;
|
||||
0b1001010000000101 OPRd ASR, 0b1001010000000000 OPRd COM,
|
||||
0b1001010000001010 OPRd DEC, 0b1001010000000011 OPRd INC,
|
||||
0b1001001000000110 OPRd LAC, 0b1001001000000101 OPRd LAS,
|
||||
|
3
blk/663
3
blk/663
@ -1,8 +1,9 @@
|
||||
( 0000 00rd dddd rrrr )
|
||||
: OPRdRr CREATE C, DOES> C@ ( rd rr op )
|
||||
OVER 0x10 AND 3 RSHIFT OR ( rd rr op' )
|
||||
2 PICK 0x10 AND 4 RSHIFT OR ( rd rr op' )
|
||||
8 LSHIFT OR 0xff0f AND ( rd op' )
|
||||
SWAP _Rdp A,, ;
|
||||
SWAP 0xf AND 4 LSHIFT OR A,, ;
|
||||
0x1c OPRdRr ADC, 0x0c OPRdRr ADD, 0x20 OPRdRr AND,
|
||||
0x14 OPRdRr CP, 0x04 OPRdRr CPC, 0x10 OPRdRr CPSE,
|
||||
0x24 OPRdRr EOR, 0x2c OPRdRr MOV, 0x9c OPRdRr MUL,
|
||||
|
6
blk/664
6
blk/664
@ -5,9 +5,3 @@
|
||||
0x70 OPRdK ANDI, 0x30 OPRdK CPI, 0x0e OPRdK LDI,
|
||||
0x60 OPRdK ORI, 0x40 OPRdK SBCI, 0x60 OPRdK SBR,
|
||||
0x50 OPRdK SUBI,
|
||||
|
||||
( 0000 0000 AAAA Abbb )
|
||||
: OPAb CREATE C, DOES> C@ ( A b op )
|
||||
ROT 3 LSHIFT ROT OR A, A, ;
|
||||
0x98 OPAb CBI, 0x9a OPAb SBI, 0x99 OPAb SBIC,
|
||||
0x9b OPAb SBIS,
|
||||
|
11
blk/665
11
blk/665
@ -1,11 +0,0 @@
|
||||
: OPNA CREATE , DOES> @ A,, ;
|
||||
0x9598 OPNA BREAK, 0x9488 OPNA CLC, 0x94d8 OPNA CLH,
|
||||
0x94f8 OPNA CLI, 0x94a8 OPNA CLN, 0x94c8 OPNA CLS,
|
||||
0x94e8 OPNA CLT, 0x94b8 OPNA CLV, 0x9498 OPNA CLZ,
|
||||
0x9419 OPNA EIJMP, 0x9509 OPNA ICALL, 0x9519 OPNA EICALL,
|
||||
0x9409 OPNA IJMP, 0x0000 OPNA NOP, 0x9508 OPNA RET,
|
||||
0x9518 OPNA RETI, 0x9408 OPNA SEC, 0x9458 OPNA SEH,
|
||||
0x9478 OPNA SEI, 0x9428 OPNA SEN, 0x9448 OPNA SES,
|
||||
0x9468 OPNA SET, 0x9438 OPNA SEV, 0x9418 OPNA SEZ,
|
||||
0x9588 OPNA SLEEP, 0x95a8 OPNA WDR,
|
||||
|
Loading…
Reference in New Issue
Block a user