6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Nov 14, 2024 4:57 pm

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Sat Jul 20, 2019 8:16 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1485
Location: Scotland
Wondering if anyone has had any luck (or even tried!) to run existing 6502/65C02 code on a 65C816 when in native mode with 8-bit registers set?

I've "upgraded" My Ruby 6502 system to a Ruby 816 system and it's running well - still with 64K of RAM and still at 16Mhz and when out of reset and in emulation (6502) mode everything seems fine - I can load up various BASICs, run BCPL and C programs and so on, but when I enable native mode it all goes a bit weird. My OS still runs fine, but BASICs just crash and burn, (memory tends to get scribbled over) however C (generated from cc65) does work OK.

I'm suspecting its something to do with (expected?) page wraps not happening in native ('816) mode, (slim possibility of the Rockwell ZP bit instructions, but I think that's unlikely in e.g. old MS Basic) but I'm not going to spend too much time on it - just wondering if anyone else has any experience trying to do this sort of thing before I start writing native '816 code.

(And I acknowledge that it's probably a bit silly to try this in the first place when emulation mode works, however...)

Cheers,

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Sun Jul 21, 2019 12:08 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1747
Location: Sacramento, CA
I cannot speak for any other programs, but EhBASIC does have code depending on a page wrap. I had to fix it for my SBC-3 and SB-4 to work. I suspect the others could also have issues. Also, there could be some issues with TXS in native mode. I recall having to fix that too.

Daryl

_________________
Please visit my website -> https://sbc.rictor.org/


Top
 Profile  
Reply with quote  
PostPosted: Sun Jul 21, 2019 2:54 am 
Offline

Joined: Mon May 21, 2018 8:09 pm
Posts: 1462
Yes, TXS in emulation mode prepends the 8-bit index with the $01 stack page. In native mode it does not, so you would be moving the stack pointer into zero page. It's worth searching the code for that instruction.


Top
 Profile  
Reply with quote  
PostPosted: Sun Jul 21, 2019 7:58 am 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1485
Location: Scotland
That's for the replys - and yes, I know that at least BBC Basic fiddles with the stack and now knowing that EhBASIC needs fixups too is handy to know. So reassuring to hear of these issues makes me more confident of my hardware. It's run a C program all night in native mode, so I'm quite happy with that.

Time to port (re-write) my own BASIC then.

Cheers,

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Sun Jul 21, 2019 1:37 pm 
Offline

Joined: Mon Sep 14, 2015 8:50 pm
Posts: 112
Location: Virginia USA
As far as I know cc65 doesn't support 65c816 in native mode. Or does it?

Cheers,
Andy


Top
 Profile  
Reply with quote  
PostPosted: Sun Jul 21, 2019 1:45 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1485
Location: Scotland
handyandy wrote:
As far as I know cc65 doesn't support 65c816 in native mode. Or does it?

Cheers,
Andy


I don't think so, but I've not really looked - however I was running existing cc65 code I'd compiled for the 65C02 on the '816 in native mode (with the registers in8-bit mode) without any issues - which (from the above) means it's not producing code that fiddles with the stack pointer or assumes some page wrapping trickery ...

Cheers,

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Sun Jul 21, 2019 4:43 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1747
Location: Sacramento, CA
drogon wrote:
Time to port (re-write) my own BASIC then.


If you are interested, I could post the EhBASIC source for you to use or look at. There's probably a notes file with references to the modifications I had to make.

Daryl

_________________
Please visit my website -> https://sbc.rictor.org/


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: