Trouble compiling Microsoft BASIC....

Programming the 6502 microprocessor and its relatives in assembly and other languages.
Post Reply
User avatar
cbmeeks
Posts: 1254
Joined: 17 Aug 2005
Location: Soddy-Daisy, TN USA
Contact:

Trouble compiling Microsoft BASIC....

Post by cbmeeks »

I thought I would mess around with compiling my own version of MS BASIC going off of this page:

http://www.pagetable.com/?p=46

When I try to compile (Windows 10), I get these errors:

Code: Select all

> c:\tmp\cc65\bin\ca65.exe -D microtan msbasic.s -o c:\tmp\microtan.o

memory.s(139): Error: Range error (-9 not in [0..255])
inline.s(118): Error: Unexpected trailing garbage characters
inline.s(133): Error: Unexpected trailing garbage characters
poke.s(118): Error: Unexpected trailing garbage characters
float.s(777): Error: Range error (-4 not in [0..255])
float.s(1451): Error: Range error (-9 not in [0..255])
init.s(85): Error: Unexpected trailing garbage characters
init.s(443): Error: Unexpected trailing garbage characters


Apparently, I'm not the only one according to an Ubuntu user.

I'm more familiar with KickAssembler and never really worked with CC65.

Any suggestions on what I need to do? I haven't altered anything.

Thanks
Cat; the other white meat.
rwiker
Posts: 294
Joined: 03 Mar 2011

Re: Trouble compiling Microsoft BASIC....

Post by rwiker »

cbmeeks wrote:
I thought I would mess around with compiling my own version of MS BASIC going off of this page:

http://www.pagetable.com/?p=46

When I try to compile (Windows 10), I get these errors:

Code: Select all

> c:\tmp\cc65\bin\ca65.exe -D microtan msbasic.s -o c:\tmp\microtan.o

memory.s(139): Error: Range error (-9 not in [0..255])
inline.s(118): Error: Unexpected trailing garbage characters
inline.s(133): Error: Unexpected trailing garbage characters
poke.s(118): Error: Unexpected trailing garbage characters
float.s(777): Error: Range error (-4 not in [0..255])
float.s(1451): Error: Range error (-9 not in [0..255])
init.s(85): Error: Unexpected trailing garbage characters
init.s(443): Error: Unexpected trailing garbage characters


Apparently, I'm not the only one according to an Ubuntu user.

I'm more familiar with KickAssembler and never really worked with CC65.

Any suggestions on what I need to do? I haven't altered anything.

Thanks
Maybe microtan needs to be in uppercase?

Also, the instructions indicate that there is more involved than just running ca65 on the file msbasic.s:
Quote:
First duplicate one of the cfg files, and add it to make.sh. cbmbasic2 is a good start, as you can quite easily test the resulting images in the VICE emulator – CC65 can even provide symbol information for the VICE debugger. Add a case in defines.s to define one of CBM1, CBM2, APPLE etc., because you need one flavour of platform specific code, and include your own defines_*.s. For Commodore BASIC, you also need to define CONFIG_CBM_ALL.
User avatar
cbmeeks
Posts: 1254
Joined: 17 Aug 2005
Location: Soddy-Daisy, TN USA
Contact:

Re: Trouble compiling Microsoft BASIC....

Post by cbmeeks »

Those instructions, from what I can tell, are for creating your own version.

They also say to run the make.sh script. Since I'm on Windows, I just translated one of the commands and arbitrarily picked microtan. I also tried cbmbasic1.

I tried it in uppercase but it made no difference.

make.sh:

Code: Select all

if [ ! -d tmp ]; then
	mkdir tmp
fi

for i in cbmbasic1 cbmbasic2 kbdbasic osi kb9 applesoft microtan; do

echo $i
ca65 -D $i msbasic.s -o tmp/$i.o &&
ld65 -C $i.cfg tmp/$i.o -o tmp/$i.bin -Ln tmp/$i.lbl

done


** EDIT **

One easy fix is that it doesn't like the C style comments "/*...*/". So changing them to ";" removes those errors.


** EDIT 2 **

ca65 is clearly failing on assembling negative numbers. One of the examples is:

Code: Select all

        lda     #-9
I would have no idea what to put there instead. I'm not sure what the original intent was.

My assumption is that I could translate that to binary instead (%1111_0111) but not sure what to do on this one:

Code: Select all

        ldx     #TEMP1-FAC+1
It's evaluating to -9 as well.
Cat; the other white meat.
User avatar
BigEd
Posts: 11467
Joined: 11 Dec 2008
Location: England
Contact:

Re: Trouble compiling Microsoft BASIC....

Post by BigEd »

Just adding 256 should sort out these negative numbers. The original code will have expected them to wrap within a byte-sized value.
Example: -1 is intended to be $ff. 256-1 or -1+256 is 255, which is $ff.
User avatar
cbmeeks
Posts: 1254
Joined: 17 Aug 2005
Location: Soddy-Daisy, TN USA
Contact:

Re: Trouble compiling Microsoft BASIC....

Post by cbmeeks »

Duh.

That seemed to do the trick.

I changed one to

Code: Select all

        ldx     #-MANTISSA_BYTES + 256
and it worked.

Thanks!
Cat; the other white meat.
Post Reply