ndf-zz / asfv1

Alternate Assembler for Spin Semi FV-1
MIT License
38 stars 7 forks source link

Trouble parsing "1" as "1.0" for certain operations #6

Closed handegar closed 2 years ago

handegar commented 2 years ago

It seems like there might be an issue with parsing "1" as 1.0 for SOF, LOG and EXP (and possible others). The compiler either fails or interpret the value as "bit 1/int 1" instead of "1.0".

A nice example to reproduce this is the "dist.spn" program from the official SpinSEMI website: http://www.spinsemi.com/get_spn.php?spn=dist.spn&prodnum=SPN1001

Assembling this file triggers the following errors:

FV-1 Assembler v1.2.7
info: Reading input from /home/handegar/Downloads/dist.spn
parse error: S_10 arg -0x1 out of range for SOF on line 16
parse error: S1_14 arg -0x1 out of range for SOF on line 49
parse error: S1_14 arg -0x2 out of range for SOF on line 56
parse error: S1_14 arg -0x2 out of range for SOF on line 57
errors in input, assembly aborted

Changing these values to "1.0" makes the file compile but a disassembly of the same file shows that the other "1" values have becomed FLOAT_MIN for whatever argument they represent (ie 0.000061 for S1.14 and 0.00195 for S1.9). An example is the "WRAX" command on line 30. I assume that these "1"s should be parsed as "1.0"?

(I don't have the official SpinASM running on my Ubuntu-machine so I haven't got the chance to check with the official compiler)

handegar commented 2 years ago

Sorry about the report. I see that there is a "-s" parameter which solves this.

ndf-zz commented 2 years ago

Thanks for posting the issue, yes this is by design: asfv1 reads asfv1 files. Use -s or convert .SPN before assembling.