use stash with all left-shift methods

This commit is contained in:
~d6 2021-12-28 15:45:15 -05:00
parent ea18846cc9
commit 3b15df7f30
1 changed files with 7 additions and 12 deletions

View File

@ -181,30 +181,25 @@
( shift left by 8-15 bits )
@left-shift1 ( x** n^ -> x<<n )
#08 SUB #40 SFT STH ( stash [n-8]<<4 )
#00 SWP STHkr SFT2 ;sh/z1 STA2 ( store z1,z2 )
#00 SWP STHkr SFT2 #00 ;sh/z1 LDA ORA2 ;sh/z0 STA2 ( store z0,z1 )
STHr SFT ;sh/z0 LDA ORA ( calculate z0 )
SWP POP ( x0 unused )
;sh/z1 LDA2 #00
RTN
( shift left by 16-23 bits )
@left-shift2 ( x** n^ -> x<<n )
#0000 ;sh/z0 STA2
#10 SUB #40 SFT STH ( n<<4 -> r )
SWP2 POP2 SWP ( x3 x2 )
STHkr SFT ;sh/z0 STA ( x3 )
#00 SWP STHr SFT2 ( x3<<r )
;sh/z0 LDA2 ORA2 ;sh/z0 STA2 ( )
;sh/z0 LDA2 #0000
#10 SUB #40 SFT STH ( stash [n-16]<<4 )
#00 SWP STHkr SFT2 ;sh/z0 STA2 ( store z0,z1 )
STHr SFT ;sh/z0 LDA ORA ( calculate z0 )
STH POP2 STHr
;sh/z1 LDA #0000
RTN
( shift left by 24-31 bits )
@left-shift3 ( x** n^ -> x<<n )
#18 SUB #10 MUL ( x0 x1 x2 x3 r=[n-24]<<4 )
#18 SUB #40 SFT ( x0 x1 x2 x3 r=[n-24]<<4 )
SFT ( x0 x1 x2 x3<<r )
SWP2 POP2 SWP POP #0000 #00
RTN