mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 12:38:05 +11:00
Add words RSHIFT and LSHIFT
This commit is contained in:
parent
4e98ef11bd
commit
24e588019b
4
blk/054
4
blk/054
@ -10,7 +10,7 @@ MOD a b -- c a % b -> c
|
||||
AND a b -- c a & b -> c
|
||||
OR a b -- c a | b -> c
|
||||
XOR a b -- c a ^ b -> c
|
||||
LSHIFT a u -- c a << u -> c
|
||||
RSHIFT a u -- c a >> u -> c
|
||||
|
||||
Shortcuts: 1+ 2+ 1- 2-
|
||||
|
||||
|
||||
|
2
blk/215
2
blk/215
@ -6,7 +6,7 @@
|
||||
( A, spits an assembled byte, A,, spits an assembled word
|
||||
Both increase PC. To debug, change C, to .X )
|
||||
: A, C, ; : A,, SPLITB A, A, ;
|
||||
: <<3 8 * ; : <<4 16 * ;
|
||||
: <<3 3 LSHIFT ; : <<4 4 LSHIFT ;
|
||||
( As a general rule, IX and IY are equivalent to spitting an
|
||||
extra 0xdd / 0xfd and then spit the equivalent of HL )
|
||||
: IX 0xdd A, HL ; : IY 0xfd A, HL ;
|
||||
|
12
blk/334
Normal file
12
blk/334
Normal file
@ -0,0 +1,12 @@
|
||||
CODE RSHIFT ( n u -- n )
|
||||
BC POPqq, ( u )
|
||||
HL POPqq, ( n )
|
||||
chkPS,
|
||||
B C LDrr,
|
||||
B INCr, B DECr, IFNZ,
|
||||
BEGIN,
|
||||
H SRLr, L RRr,
|
||||
DJNZ, AGAIN,
|
||||
THEN,
|
||||
HL PUSHqq,
|
||||
;CODE
|
13
blk/335
Normal file
13
blk/335
Normal file
@ -0,0 +1,13 @@
|
||||
CODE LSHIFT ( n u -- n )
|
||||
BC POPqq, ( u )
|
||||
HL POPqq, ( n )
|
||||
chkPS,
|
||||
B C LDrr,
|
||||
B INCr, B DECr, IFNZ,
|
||||
BEGIN,
|
||||
L SLAr, H RLr,
|
||||
DJNZ, AGAIN,
|
||||
THEN,
|
||||
HL PUSHqq,
|
||||
;CODE
|
||||
|
4
blk/379
4
blk/379
@ -9,8 +9,8 @@
|
||||
: SDCMDR7
|
||||
_sdcSel
|
||||
_cmd ( r )
|
||||
_idle 256 * _idle + ( r arg1 )
|
||||
_idle 256 * _idle + ( r arg1 arg2 )
|
||||
_idle 8 LSHIFT _idle + ( r arg1 )
|
||||
_idle 8 LSHIFT _idle + ( r arg1 arg2 )
|
||||
_sdcDesel
|
||||
;
|
||||
|
||||
|
2
blk/383
2
blk/383
@ -10,6 +10,6 @@
|
||||
SWAP 1+ ( crc a+1 )
|
||||
LOOP
|
||||
DROP ( crc1 )
|
||||
_idle 256 * _idle + ( crc2 )
|
||||
_idle 8 LSHIFT _idle + ( crc2 )
|
||||
_wait DROP _sdcDesel
|
||||
= NOT IF _err THEN ;
|
||||
|
6
blk/499
6
blk/499
@ -3,14 +3,14 @@
|
||||
( 4 256b sectors per block, 10 sec per cyl, 40 cyl max )
|
||||
10 /MOD ( sec cyl )
|
||||
DUP 39 > IF _err THEN
|
||||
256 * + ( cylsec )
|
||||
8 LSHIFT + ( cylsec )
|
||||
;
|
||||
: FD@! ( wref blk -- )
|
||||
1 @DCSTAT NOT IF _err THEN
|
||||
4 * ( wr sec )
|
||||
2 LSHIFT ( 4 * -- wr sec )
|
||||
4 0 DO ( wr sec )
|
||||
DUP I + _cylsec ( wr sec cs )
|
||||
I 256 * BLK( + ( wr sec cs addr )
|
||||
I 8 LSHIFT BLK( + ( wr sec cs addr )
|
||||
1 ROT ROT ( wr sec drv cs addr )
|
||||
4 PICK EXECUTE NOT IF _err THEN
|
||||
LOOP 2DROP ;
|
||||
|
BIN
emul/forth.bin
BIN
emul/forth.bin
Binary file not shown.
Loading…
Reference in New Issue
Block a user