Dotneteer/spectnetide

Maths issue with emulator?

Closed this issue · 6 comments

The maths doesn't seem correct when running Basic?

`
10 REM Write your ZX BASIC (Boriel's BASIC) code here

20 LET PO = 100

30 LET PP = 900

40 PRINT PO*PP`

Returns a result of: 24464

nww02 commented

Is it possible this is a variable auto-typing thing? It's been a while since I played with ZXBasic, but wondering if

15 DIM PO,PP as ulong

might fix it?

I did wonder this but I'm told what I've write works fine in standard zx basic?

nww02 commented

As I understand it, SpectNET doesn't do anything except pass the raw basic into zxbasic to generate the assembly, then takes the assembly and put it into an ASM file. It's possible there may be a bug in that version of ZXBasic, try rolling back. I tend to us 1.9.9, but I see there's a more recent "stable" version 1.14 ...

ZX BASIC is not exactly the same as Sinclair BASIC - it tries to guess the best type of number to use the first time the variable is used. Sinclair BASIC always used floating point numbers. Using DIM and the type you want will fix it.

Closed as not related to SpectNetIDE