register refactor

This commit is contained in:
~d6 2021-12-27 15:28:24 -05:00
parent ae0bb9afed
commit 00bdb689c2
1 changed files with 8 additions and 8 deletions

View File

@ -296,16 +296,16 @@
RTN
@mul32 ( x** y** -> z** )
,&y2 STR2 ,&y0 STR2 ( save ylo, yhi )
,&x2 STR2 ,&x0 STR2 ( save xlo, xhi )
,&y2 LDR2 ,&x2 LDR2 ;mul16 JSR2 ( [x2*y2] )
,&z2 STR2 ,&z0 STR2 ( sum = x2*y2, save zlo, zhi )
;sh/y2 STA2 ;sh/y0 STA2 ( save ylo, yhi )
;sh/x2 STA2 ;sh/x0 STA2 ( save xlo, xhi )
;sh/y2 LDA2 ;sh/x2 LDA2 ;mul16 JSR2 ( [x2*y2] )
;sh/z2 STA2 ;sh/z0 STA2 ( sum = x2*y2, save zlo, zhi )
,&y2 LDR2 ,&x0 LDR2 MUL2 ( [x0*y2]<<16 )
,&y0 LDR2 ,&x2 LDR2 MUL2 ( [x2*y0]<<16 )
;sh/y2 LDA2 ;sh/x0 LDA2 MUL2 ( [x0*y2]<<16 )
;sh/y0 LDA2 ;sh/x2 LDA2 MUL2 ( [x2*y0]<<16 )
( [x0*y0]<<32 will completely overflow )
ADD2 ,&z0 LDR2 ADD2 ( sum += x0*y2<<16 + x2*y0<<16 )
,&z2 LDR2
ADD2 ;sh/z0 LDA2 ADD2 ( sum += x0*y2<<16 + x2*y0<<16 )
;sh/z2 LDA2
RTN
[ &x0 $2 &x2 $2 ]
[ &y0 $2 &y2 $2 ]