updated left-shift0

This commit is contained in:
~d6 2021-12-28 15:33:42 -05:00
parent c34be54fbc
commit e1db98fec6
1 changed files with 14 additions and 25 deletions

View File

@ -112,8 +112,7 @@
( temporary registers ) ( temporary registers )
( used by most operations, except mul32 and div32 ) ( used by most operations, except mul32 and div32 )
@sh [ &r $1 @sh [ &x0 $1 &x1 $1 &x2 $1 &x3 $1
&x0 $1 &x1 $1 &x2 $1 &x3 $1
&y0 $1 &y1 $1 &y2 $1 &y3 $1 &y0 $1 &y1 $1 &y2 $1 &y3 $1
&z0 $1 &z1 $1 &z2 $1 &z3 $1 &z0 $1 &z1 $1 &z2 $1 &z3 $1
&a0 $1 &a1 $1 &a2 $2 ] &a0 $1 &a1 $1 &a2 $2 ]
@ -171,36 +170,26 @@
( shift left by 0-7 bits ) ( shift left by 0-7 bits )
@left-shift0 ( x** n^ -> x<<n ) @left-shift0 ( x** n^ -> x<<n )
#0000 ;sh/z0 STA2 #0000 ;sh/z2 STA2 #40 SFT STH ( stash n<<4 )
#40 SFT STH ( n<<4 -> r ) #00 SWP STHkr SFT2 ;sh/z2 STA2 ( store z2,z3 )
SWP SWP2 SWP ( x3 x2 x1 x0 ) #00 SWP STHkr SFT2 #00 ;sh/z2 LDA ORA2 ;sh/z1 STA2 ( store z1,z2 )
#00 SWP STHkr SFT2 #00 ;sh/z1 LDA ORA2 ;sh/z0 STA2 ( store z0,z1 )
STHkr SFT ;sh/z0 STA ( x3 x2 x1 ) STHr SFT ;sh/z0 LDA ORA ( calculate z0 )
;sh/z1 LDA ;sh/z2 LDA2
#00 SWP STHkr SFT2 ( x3 x2 00x1<<r )
;sh/z0 LDA2 ORA2 ;sh/z0 STA2 ( x3 x2 )
#00 SWP STHkr SFT2 ( x3 00x2<<r )
;sh/z1 LDA2 ORA2 ;sh/z1 STA2 ( x3 )
#00 SWP STHr SFT2 ( 00x3<<r )
;sh/z2 LDA2 ORA2 ;sh/z2 STA2 ( )
;sh/z0 LDA2 ;sh/z2 LDA2
RTN RTN
( shift left by 8-15 bits ) ( shift left by 8-15 bits )
@left-shift1 ( x** n^ -> x<<n ) @left-shift1 ( x** n^ -> x<<n )
#0000 ;sh/z0 STA2 #00 ;sh/z2 STA #0000 ;sh/z0 STA2 #00 ;sh/z2 STA
#08 SUB #40 SFT ;sh/r STA ( n<<4 -> r ) #08 SUB #40 SFT STH ( n<<4 -> r )
SWP SWP2 SWP POP ( x3 x2 x1 ) SWP SWP2 SWP POP ( x3 x2 x1 )
;sh/r LDA SFT ;sh/z0 STA ( x3 x2 ) STHkr SFT ;sh/z0 STA ( x3 x2 )
#00 SWP ;sh/r LDA SFT2 ( x3 00x2<<r ) #00 SWP STHkr SFT2 ( x3 00x2<<r )
;sh/z0 LDA2 ORA2 ;sh/z0 STA2 ( x3 ) ;sh/z0 LDA2 ORA2 ;sh/z0 STA2 ( x3 )
#00 SWP ;sh/r LDA SFT2 ( 00x3<<r ) #00 SWP STHr SFT2 ( 00x3<<r )
;sh/z1 LDA2 ORA2 ;sh/z1 STA2 ( ) ;sh/z1 LDA2 ORA2 ;sh/z1 STA2 ( )
;sh/z0 LDA2 ;sh/z2 LDA #00 ;sh/z0 LDA2 ;sh/z2 LDA #00
@ -209,12 +198,12 @@
( shift left by 16-23 bits ) ( shift left by 16-23 bits )
@left-shift2 ( x** n^ -> x<<n ) @left-shift2 ( x** n^ -> x<<n )
#0000 ;sh/z0 STA2 #0000 ;sh/z0 STA2
#10 SUB #40 SFT ;sh/r STA ( n<<4 -> r ) #10 SUB #40 SFT STH ( n<<4 -> r )
SWP2 POP2 SWP ( x3 x2 ) SWP2 POP2 SWP ( x3 x2 )
;sh/r LDA SFT ;sh/z0 STA ( x3 ) STHkr SFT ;sh/z0 STA ( x3 )
#00 SWP ;sh/r LDA SFT2 ( x3<<r ) #00 SWP STHr SFT2 ( x3<<r )
;sh/z0 LDA2 ORA2 ;sh/z0 STA2 ( ) ;sh/z0 LDA2 ORA2 ;sh/z0 STA2 ( )
;sh/z0 LDA2 #0000 ;sh/z0 LDA2 #0000