6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 22, 2024 4:04 am

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: 6800 to 6502 conversion
PostPosted: Fri Mar 14, 2014 2:15 pm 
Offline
User avatar

Joined: Sat Dec 07, 2013 4:32 pm
Posts: 246
Location: The Kettle Moraine
I have a rather complex 6800 based machine that I will probably reverse engineer and reprogram. I will have to learn 6800 machine code in the process. But, I wonder, rather than reprogramming the 6800, why not convert to a 6502, which I am already familiar with?

Without knowing anything about it (because I don't know much about it yet), what am I likely to run into converting from a 6800 to a 6502?


Top
 Profile  
Reply with quote  
PostPosted: Fri Mar 14, 2014 3:49 pm 
Offline
User avatar

Joined: Tue Mar 02, 2004 8:55 am
Posts: 996
Location: Berkshire, UK
6800:
Two 8-bit accumulators (A & B)
16-bit stack pointer
One 16-bit index register
Four addressing models: immediate, direct, extended, indexed, relative

6502:
One 8-bit accumulator
8-bit stack point with fixed location stack
Two 8-bit index registers
More addressing modes, especially indirect modes

What are you porting?

_________________
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


Top
 Profile  
Reply with quote  
PostPosted: Fri Mar 14, 2014 3:56 pm 
Offline
User avatar

Joined: Sat Dec 07, 2013 4:32 pm
Posts: 246
Location: The Kettle Moraine
It's an NC control. I want to add some functionality, and fix a few annoyances. I'll need to reverse engineer the existing software, and I'm thinking rather than just modify it, rewrite it for the 6502.
The reason is, I expect I may want to modify it in the future, and I don't think that by then I'll remember enough of what I learn now about 6800.

I don't know if hardware-wise it would make sense to convert it. Aside from building a socket adaptor for the CPU, I don't know what else I'm going to run into.


Top
 Profile  
Reply with quote  
PostPosted: Fri Mar 14, 2014 4:12 pm 
Offline
User avatar

Joined: Tue Mar 02, 2004 8:55 am
Posts: 996
Location: Berkshire, UK
What kind of input/output connections does the board have?

It might be simpler to replace the whole control board with something based on a modern micro-controller that you can program in C. It will probably take less time overall.

I've been working on a replacement board for a scrolling LED sign. The original board had a M68K, SRAM, ROM and support chips plus the power transistors to drive the LEDS. The replacement has two chips (one 28-pin dsPIC and 74 series line driver used to do 3V3 to 5V conversion) and the power transistors.

_________________
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


Top
 Profile  
Reply with quote  
PostPosted: Fri Mar 14, 2014 11:23 pm 
Offline
User avatar

Joined: Sat Dec 07, 2013 4:32 pm
Posts: 246
Location: The Kettle Moraine
I don't know any details about it yet. The programming part doesn't bother me at all. I can program the 6800 if I have to, but I'd much rather program a 6502. I'd rather do either than anything in C :D


Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 15, 2014 5:51 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1949
Location: Sacramento, CA, USA
KC9UDX wrote:
I don't know any details about it yet. The programming part doesn't bother me at all. I can program the 6800 if I have to, but I'd much rather program a 6502. I'd rather do either than anything in C :D

I am familiar with all three of those languages, and I can say that learning 6800 is a bit like learning Spanish; there are very few irregularities, and it is possible to learn how to say something useful rather quickly, if a bit awkwardly. I have programmed in 6502 assembly for 32 years, C for 25, and 6800 for two. I enjoy 6502 the most, however ... it and BASIC (35 years) were my first loves.

Mike

P.S. When I decided to go the route of learning the 6800, the steepest part of the learning curve was making the most efficient use of the condition codes, since the instruction side-effects are different than in the 6502 (the 6502 side-effects are 'perfect', IMO, so any processor that doesn't do it the 6502 way causes some head-scratching).


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 17, 2014 8:57 pm 
Offline
User avatar

Joined: Sat Dec 07, 2013 4:32 pm
Posts: 246
Location: The Kettle Moraine
barrym95838 wrote:
I have programmed in 6502 assembly for 32 years, C for 25, and 6800 for two. I enjoy 6502 the most, however ... it and BASIC (35 years) were my first loves.

I've only ( :!: ) been programming in BASIC 32 years, and sure wouldn't say I ever loved it. In fact, I've always hated it. Yet, I still end up writing massive programs in it. I taught myself 6502 by writing my own assembler (in BASIC) by reverse-engineering program listings in Compute! 25 years ago, and am most fluent in Pascal (22 years). I tried C at one point and absolutely hated it. To me, C is very clumsy bloatware. But, I'm very biased. There are a dozen or so other languages I have a lot of experience with, such as TMS1100, x86, numerous PLC languages, and probably a whole horde of ones I've forgotten... I fully expect, based on past experience with other assembly languages, that 6800 will be painful, but not impossible, to learn. My only concern is that I'll go through the trouble of learning it for this project and never use it again.

Quote:
P.S. When I decided to go the route of learning the 6800, the steepest part of the learning curve was making the most efficient use of the condition codes, since the instruction side-effects are different than in the 6502 (the 6502 side-effects are 'perfect', IMO, so any processor that doesn't do it the 6502 way causes some head-scratching).
This sounds a lot like what I was thinking when I tried to learn 68k. I gave up on that quickly. Hopefully 6800 isn't anywhere near as complex!

P.S. I still use my BASIC 6502 assembler to do all my 6502 assembling. Once upon a time, I wrote a 6502 cross assembler for the Amiga platform, but that is long gone. I've started writing my assembler in 6502 assembly several times and never finished. If and when I ever do, I'll get a lot more work done.


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: Google [Bot] and 17 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: