gigatron/rom/Contrib/at67/gbas/test/multTest_64k.gbas
2025-01-28 19:17:01 +03:00

54 lines
922 B
Plaintext

_runtimePath_ "../runtime"
_runtimeStart_ &hFFFF
const START=&h8000
const SIZE=1000
cls
def word(START + SIZE*0, 0, SIZE, SIZE) = rand(360) - 180
def word(START + SIZE*2, 0, SIZE, SIZE) = rand(360) - 180
def word(START + SIZE*4, 0, SIZE, SIZE) = 0
init time
result=0
for i=0 to SIZE-1
gosub math
next i
timer = get("TIMER")
'for i=0 to SIZE-1
'print deek(START + SIZE*4 + (i LSL 1));" ";
'next i
print : print timer/60;" ";timer % 60;"/60"
q=0 : r=q
n=15000 : d=153
q = n/d
r = n%d
'gosub div
print : print q;" ";r
end
math:
a = deek(START + SIZE*0 + (i LSL 1))
b = deek(START + SIZE*2 + (i LSL 1))
doke START + SIZE*4 + (i LSL 1), a / b
return
div:
q=0 : r=q
if d = 0 then return
mask = &h8000
while mask <> 0
r = r LSL 1
if (n AND mask) <> 0 then inc r
if r >= d then r = r - d : q = q OR mask
mask = mask LSR 1
wend
return