This is adapted from the thread ...
32-bit Variables and DIV32, Hourmeter 99999.9
http://www.picbasic.co.uk/forum/showthread.php?t=1942
Should work, but I haven't tested the modification.
Code:
BigVar VAR WORD[2] ; 32-bit (Dword)
Var1 VAR BigVar(1)
Var2 Var BigVar(0)
Result Var Word
Remainder Var Word
;----[Load a 32-bit (Dword) variable into PBP registers, Prior to DIV32]-----
Asm
PutMulResult?D macro Din
MOVE?BB Din, R2
MOVE?BB Din + 1 , R2 + 1
MOVE?BB Din + 2, R0
MOVE?BB Din + 3, R0 + 1
RST?RP
endm
EndAsm
;====[Simple loop to test Big Numbers]=======================================
Start:
Var1 = 1
Var2 = %1111101111010000
MainLoop:
LCDOUT $FE,1 ; clear screen
Gosub ShowBigNumber
PAUSE 1000
Var2 = Var2 + 1
if Var2 = 0 then Var1 = Var1 + 1
goto MainLoop
;===========================================================
;----[Display 32-bit value with 2 decimals using LCDOUT]---------------------
ShowBigNumber:
@ PutMulResult?D _BigVar
Result = DIV32 1000
Remainder = R2
LCDOUT $FE, 2 ; Home Cursor
IF Result > 0 then
LCDOUT Dec Result, DEC1 Remainder/100,".",DEC2 Remainder//100
else
LCDOUT DEC Remainder/100,".",DEC2 Remainder//100
endif
return
HTH,
DT
Bookmarks