ehBasic on 65816

A forum for users of EhBASIC (Enhanced BASIC), a portable BASIC interpreter for 6502 microcomputers written by Lee Davison.
SpaceCoaster
Posts: 33
Joined: 11 Apr 2019

Re: ehBasic on 65816

Post by SpaceCoaster »

The link at http://sbc.rictor.org/download/EhBASIC.zip seems to be suffering from bit rot.

Does anyone have a copy of EhBASIC modified for 65816 native mode?

Cheers,
Derek
User avatar
8BIT
Posts: 1787
Joined: 30 Aug 2002
Location: Sacramento, CA
Contact:

Re: ehBasic on 65816

Post by 8BIT »

Hi Derek,

Give me a day or two, and I'll dig up my latest copy and post it here for you.

thanks!

Daryl
Please visit my website -> https://sbc.rictor.org/
kakemoms
Posts: 349
Joined: 02 Mar 2016

Re: ehBasic on 65816

Post by kakemoms »

Someone has made a reconstructed web site here: http://retro.hansotten.nl/lee-davison-web-site/
SpaceCoaster
Posts: 33
Joined: 11 Apr 2019

Re: ehBasic on 65816

Post by SpaceCoaster »

Thanks kakemoms but the code from 8BIT has modifications for the 65816 in native mode and that is of interest. I do have EhBASIC running at the moment but in 6502 emulation mode.
User avatar
8BIT
Posts: 1787
Joined: 30 Aug 2002
Location: Sacramento, CA
Contact:

Re: ehBasic on 65816

Post by 8BIT »

This is the most recent copy of the source I could find. It was written for my SBC-3. The included change log will help you with the mods I made for native mode.

Be sure to apply these to your existing source vs using mine - I added a "SYS" command to exit back to my Monitor and have my own links to LOAD and SAVE routines. Adding commands can make binary copies of BASIC programs incompatible across builds, as the command TOKENS get changed.

Good luck!

Daryl
Attachments
basic222.zip
(63 KiB) Downloaded 255 times
Please visit my website -> https://sbc.rictor.org/
SpaceCoaster
Posts: 33
Joined: 11 Apr 2019

Re: ehBasic on 65816

Post by SpaceCoaster »

Thanks Daryl, that looks great. The ChangeLog is just what I needed to understand the differences. I didn't think it would be an issue at all and then the stack initialization was mentioned and it made me wonder what else is lurking.

Cheers,
Derek
handyandy
Posts: 113
Joined: 14 Sep 2015
Location: Virginia USA

Re: ehBasic on 65816

Post by handyandy »

I looked over the EhBasic source and I don't see any explicit switch to native mode in the source code.
This isn't necessarily a problem for a 65816 as the fix for stack initialization works in native or emulation
mode. There doesn't seem to be any switches to 16 bit accumulator or index registers just 8 bit registers.

I saw some places where:

LDA #0
STA ...

could be replaced with:

STZ ...

Cheers,
Andy
User avatar
8BIT
Posts: 1787
Joined: 30 Aug 2002
Location: Sacramento, CA
Contact:

Re: ehBasic on 65816

Post by 8BIT »

Hi Andy,

On my system, it was put into native mode right after power up and stayed there. As for other optimizations, I did not do any. I only made the changes necessary for it to run in native mode. There are certainly many changes that can be made to improve performance on a 65816. Lee had written this for an NMOS 6502, so there won't be any STZ commands present, but they could be replaced for 65c02 and 65816 operation.

thanks!

Daryl
Please visit my website -> https://sbc.rictor.org/
User avatar
barrym95838
Posts: 2056
Joined: 30 Jun 2013
Location: Sacramento, CA, USA

Re: ehBasic on 65816

Post by barrym95838 »

I think floobydust (Kevin M.) has already successfully implemented many 65c02 improvements to ehBASIC, but I'm link-challenged at the moment.
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)
User avatar
floobydust
Posts: 1394
Joined: 05 Mar 2013

Re: ehBasic on 65816

Post by floobydust »

barrym95838 wrote:
I think floobydust (Kevin M.) has already successfully implemented many 65c02 improvements to ehBASIC, but I'm link-challenged at the moment.
True... I made quite a few changes to the code. It only runs on a CMOS processor now as a result. One link for download is here:

viewtopic.php?f=5&t=5346&start=15#p63899
tokafondo
Posts: 344
Joined: 11 Apr 2020

Re: ehBasic on 65816

Post by tokafondo »

floobydust wrote:
barrym95838 wrote:
I think floobydust (Kevin M.) has already successfully implemented many 65c02 improvements to ehBASIC, but I'm link-challenged at the moment.
True... I made quite a few changes to the code. It only runs on a CMOS processor now as a result. One link for download is here:

viewtopic.php?f=5&t=5346&start=15#p63899

Hi. I'd like to know what exactly should I do to compile this 65816 compliant EhBASIC version, to run it in my W65C265SXB clone.

I've read that there are several changes made, and at one point it was available for download, but now it's only the source code linked above, and I don't know if the changes are already applied, or if I should apply the changes listeed in changelog.log.

Thanks.
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

Re: ehBasic on 65816

Post by drogon »

tokafondo wrote:
floobydust wrote:
barrym95838 wrote:
I think floobydust (Kevin M.) has already successfully implemented many 65c02 improvements to ehBASIC, but I'm link-challenged at the moment.
True... I made quite a few changes to the code. It only runs on a CMOS processor now as a result. One link for download is here:

viewtopic.php?f=5&t=5346&start=15#p63899

Hi. I'd like to know what exactly should I do to compile this 65816 compliant EhBASIC version, to run it in my W65C265SXB clone.

I've read that there are several changes made, and at one point it was available for download, but now it's only the source code linked above, and I don't know if the changes are already applied, or if I should apply the changes listeed in changelog.log.

Thanks.
Just assemble it for the '816 - mostly to make sure it's not using the few instructions that are in the C02 that are not in the '816. (that tripped me up initially with some of my own code when I moved the the '816).

It won't take advantage of any '816 extra op-codes though, but it will work in Bank 0.

-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
tokafondo
Posts: 344
Joined: 11 Apr 2020

Re: ehBasic on 65816

Post by tokafondo »

drogon wrote:
Just assemble it for the '816 - mostly to make sure it's not using the few instructions that are in the C02 that are not in the '816. (that tripped me up initially with some of my own code when I moved the the '816).

It won't take advantage of any '816 extra op-codes though, but it will work in Bank 0.

-Gordon
Thanks. I'm trying several TASS versions and my results are that I could only compile the source "as is" with 64tass1.46-r38, and leaving out basldsv.asm, because of errors:

WITH .include basldsv.asm

Code: Select all

S:\Proyecto Ordenador\EhBASIC>..\64tass-1.46-r38\64tass_1.46_r38.exe -x -W basic222.asm -o ehbasic.out
6502/65C02 Turbo Assembler Version 1.3  Copyright (c) 1997 Taboo Productions
6502/65C02 Turbo Assembler Version 1.35 ANSI C port by [BiGFooT/BReeZe^2000]
6502/65C02/65816/CPU64/DTV TASM Version 1.46 r38 Fixing by Soci/Singular 2001-2010
64TASS comes with ABSOLUTELY NO WARRANTY; This is free software, and you
are welcome to redistribute it under certain conditions; See LICENSE!

Assembling file:   basic222.asm
basldsv.asm:13: (basic222.asm:22) Not defined print2byte "jsr print2byte"
basldsv.asm:17592186044430: (basic222.asm:17592186044438) Not defined print_cr "jsr print_cr"
basldsv.asm:17592186044437: (basic222.asm:17592186044438) Not defined print2byte "jsr print2byte"
basldsv.asm:17592186044438: (basic222.asm:17592186044438) Not defined print_cr "jsr print_cr"
Error messages:    4
Warning messages:  None
Passes:            2
Range:             $000000-$00001c
WITHOUT .include basldsv.asm

Code: Select all

S:\Proyecto Ordenador\EhBASIC>..\64tass-1.46-r38\64tass_1.46_r38.exe -x -W basic222.asm -o ehbasic.out
6502/65C02 Turbo Assembler Version 1.3  Copyright (c) 1997 Taboo Productions
6502/65C02 Turbo Assembler Version 1.35 ANSI C port by [BiGFooT/BReeZe^2000]
6502/65C02/65816/CPU64/DTV TASM Version 1.46 r38 Fixing by Soci/Singular 2001-2010
64TASS comes with ABSOLUTELY NO WARRANTY; This is free software, and you
are welcome to redistribute it under certain conditions; See LICENSE!

Assembling file:   basic222.asm
Error messages:    None
Warning messages:  None
Passes:            2
Range:             $009000-$00b840
As this version of TASS only output one format (that I can't figure which is), I used utils from s-record.com, to convert the output binary file to a "s-record" that I will be able to push through internal Mensch monitor:

Code: Select all

S:\Proyecto Ordenador\EhBASIC>..\bin2srec.exe ehbasic.out > ehbasic.s28

BIN2SREC 1.51 - Convert binary to Motorola S-Record file.
Copyright (c) 2000-2019 Ant Goffart - http://www.s-record.com/

Input binary file: ehbasic.out
Begin address   = 0h
End address     = 2842h
Address offset  = 0h
Maximum address = 2842h
Address bytes   = 2
Processing complete
I'm not actually sure if the ehbasic.out that I got earlier is the right one to be converted to "s-record" type. Also, the addresses mentioned in both TASS output and the previous output don't seem right to me. Should I add -b 0300 like this?? :

Code: Select all

S:\Proyecto Ordenador\EhBASIC>..\bin2srec.exe -b 0300 ehbasic.out > ehbasic.s28

BIN2SREC 1.51 - Convert binary to Motorola S-Record file.
Copyright (c) 2000-2019 Ant Goffart - http://www.s-record.com/

Input binary file: ehbasic.out
Begin address   = 300h
End address     = 2842h
Address offset  = 300h
Maximum address = 2842h
Address bytes   = 2
Processing complete
Thanks for your help.
User avatar
BitWise
In Memoriam
Posts: 996
Joined: 02 Mar 2004
Location: Berkshire, UK
Contact:

Re: ehBasic on 65816

Post by BitWise »

I had some free time this afternoon:
https://github.com/andrew-jacobs/w65c265sxb-ehbasic
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs
tokafondo
Posts: 344
Joined: 11 Apr 2020

Re: ehBasic on 65816

Post by tokafondo »

BitWise wrote:
I had some free time this afternoon:
https://github.com/andrew-jacobs/w65c265sxb-ehbasic
Thank you very, very much!!!

I'm having a problem that is, that the XMODEM transfer is VERY slow.
Portapapeles01.png
Portapapeles01.png (9.94 KiB) Viewed 15016 times
The garbage you see in the first line is that this COM port was using 9600 and then changed it to 19200.

Tinkering with the '265 hacker does actually works, but the XMODEM transfer stays like the picture for a while and then gets interrupted...

I'm using another FTDI chip for the second UART. Maybe changing to a prolific 2303...
Post Reply