Add words RSHIFT and LSHIFT

This commit is contained in:
Virgil Dupras 2020-05-07 15:40:10 -04:00
parent 4e98ef11bd
commit 24e588019b
9 changed files with 35 additions and 10 deletions

View File

@ -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-

View File

@ -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 ;

View File

@ -1 +1 @@
1 51 LOADR+
1 53 LOADR+

12
blk/334 Normal file
View 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
View 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

View File

@ -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
;

View File

@ -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 ;

View File

@ -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 ;

Binary file not shown.