65C02 Version of EhBasic

A forum for users of EhBASIC (Enhanced BASIC), a portable BASIC interpreter for 6502 microcomputers written by Lee Davison.
User avatar
Proxy
Posts: 746
Joined: 03 Aug 2018
Location: Germany

Re: 65C02 Version of EhBasic

Post by Proxy »

floobydust wrote:
Hi Proxy,

I use a 32KB EEPROM for my C02 Pocket SBC which is addressed starting at $8000. The programmer wouldn't know where (in a memory map) that I would have it configured. So, logically, the programmer starts it at $0000, so it has an addressable range from $0000 - $7FFF. Meanwhile, the S19 record does have load address for locating the data in the EEPROM, which are in the $8000 - $FFFF range. Hence, you tell the programmer that the EEPROM has an addressable offset of $8000, so it addresses the 32KB EEPROM from $8000 - $FFFF. Hope this is clear.
oh i see, it's the same/similar problem as with a binary file then. interesting.
floobydust wrote:
Code changes.... well, as I like to say, "you can't argue with success". Filling memory... sure, the INY is quicker, but you also need to load the Y reg first, so the code may be larger, depending on register contents on entry. Not using the Y register also implies you don't disturb it's contents. It's all trade-offs. For certain routines it's advantageous to code for speed, others better to code for smaller size. For a startup routine, I generally go for smaller size as it's a one-time execute. The character input routine which is used a lot with EhBasic... you're better off optimizing for speed. Not having to set or clear the carry flag explicitly saves time as the ASL A already set it. Adding the CMP for a linefeed is just a convenience, but if your emulator used a C/R instead, it would save some additional cycles as well.
yea it's always trade-offs, it's in any programming environment.
another example, if you want a function that calculates the Sine of an 8 bit number you could either actually calculate it, or use that number as an index into an array of pre-calculated values.
floobydust wrote:
In short, there's usually multiple ways to code anything on the 6502 and the later CMOS versions with additional instructions and address modes are helpful. I tend to use the newer instructions/address modes quite a bit. I would certainly recommend putting together a small 65C02 based system at some point. My current SBC runs at 6MHz, although I have one SCC2691 that survives an 8MHz clock. My next SBC will use a newer NXP DUART and will hopefully run beyond 14MHz.

As always, enjoy the project and learn from everything you do.
having a SBC is pretty cool, mine can run at 16MHz perfectly fine. though the ROM size is rather small at 8kB. i do have an expansion port so i could add more ROM via that...
but currently i just want to get the 65C02 for Digital done so i got the Verilog code for it. and afterwards i want to look into FPGAs so i can either use my simualted CPU or finally build a simple VGA graphics card for my SBC... (and overall for anyone who wants a cheap VGA Card for their 65C02 based system)

either way i got a lot of fun projects ahead and i hope you have too!
User avatar
RichCini
Posts: 156
Joined: 03 Sep 2003
Location: Long Island, NY
Contact:

Re: 65C02 Version of EhBasic

Post by RichCini »

Hi all --

I was thinking of doing a respin of the v2.7 of my board to reduce the size to ECB (160mmx100mm) based on my work on the Retrobrew board series (I've done a few board designs for that group). So, I wanted to update the BASIC to whatever is most current, recognizing that I have a lot of patches to accommodate Serial IEC and a DOS command interpreter, plus some commands for joysticks and AVR video. I downloaded the version from @floobydust earlier in this thread (the C02 version, but I also grabbed the similar non-C version), but is there a better version to use that doesn't use WDC tools?

I really like the TASM assembler and although I saw some complaints about it in the SBC forum, there is a 64-bit version that works with more modern Windows. So, I'd like to stick with that if I could.

But, maybe the better question is should I patch my own to whatever is considered the most current version of the code base, or start from scratch and graft-in all of the IEC stuff? Maybe that's Klaus' 2.22p4 -- not sure.

Thoughts?

Thanks!


Rich
User avatar
floobydust
Posts: 1394
Joined: 05 Mar 2013

Re: 65C02 Version of EhBasic

Post by floobydust »

Hi Rich,

Actually Klaus did a p5 patch version some time ago. I also integrated those patches into the last CMOS version I did (posted here: viewtopic.php?f=5&t=5760&start=15#p76030)

This version, in addition to the p5 patches, has some other updates, including a slight performance enhancement in the equivalent chrget routine, compliments of Mike Barry. It also has LOAD and SAVE implemented against the Xmodem-CRC code in my Monitor code, which could easily be swapped out to your IEC code.

As for WDC tools, everyone has their preferred toolset, but it's not difficult to change the source over to use a different assembler.
adrianhudson
Posts: 169
Joined: 30 Apr 2022
Location: Devon. UK
Contact:

Re: 65C02 Version of EhBasic

Post by adrianhudson »

Can I just check the latest version of ehBasic for CMOS is EhBasic222p5C02.zip at viewtopic.php?f=5&t=5760&start=15#p76030 ? Is there a github repo for it that I have missed? Thanks!
User avatar
floobydust
Posts: 1394
Joined: 05 Mar 2013

Re: 65C02 Version of EhBasic

Post by floobydust »

Yes, that was the last version I worked on. I just checked my GitHub page and it's not there, just the previous P4 version. At some point, I'll update that.
Post Reply