User avatar
spike77
Posts: 12
Joined: Tue May 07, 2013 7:52 am

Cross-Development: C64 Assembler with the RPi?

Sat Nov 25, 2017 9:24 pm

Hello everyone :-)

i'd like to do some cross-development with the Raspberry Pi. I want to write programms in C64 Assembly Language. But in order to do so, i need at least one of the Cross-Assemblers that exist. After looking through the software repositories for Rasbian i cannot find, any C64-Cross-Assembler. I planned to test the written code with the VICE Emulator.

Do you know any programs that might be helpful for this purpose? For example do you know a specific Editor that is highlighting C64-Assembler-Syntax, maybe?

I am using a Raspberry Pi 3 with the latest Rasbian.

Thanks alot!
-
Spike

User avatar
The Traveler
Posts: 74
Joined: Sat Oct 21, 2017 3:48 pm

Re: Cross-Development: C64 Assembler with the RPi?

Sat Nov 25, 2017 9:47 pm

Here ya go: https://github.com/cliffordcarnmo/c64-devkit

I don't think you're going to find an 8-bit assembler for the C64 that runs on an ARM processor, but at least you can under Intel.

[EDIT] There is a (ancient) RISC-based ACME assembler here: https://web.archive.org/web/20150520143 ... brod/acme/ Might be useful, might not.

Or, if you want to stay retro, but learn something a bit more useful, from 2003: http://arantxa.ii.uam.es/~gdrivera/sed/docs/ARMBook.pdf

Cheers.
"Your Google-fu is weak Grasshopper. It is not the answer that enlightens, but the research.”

User avatar
scruss
Posts: 1458
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Cross-Development: C64 Assembler with the RPi?

Sat Nov 25, 2017 11:18 pm

There's also Relaunch64, but it's very Java-based, so may be slow on a Raspberry Pi.

I found this useful: Commodore 64 assembly coding on the command line. With VICE and acme installed, I got a C64 demo to compile directly to a d64 image and run quite nicely. Emacs' Assembler mode, though not 65xx specific, understands 6502 opcodes.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

Heater
Posts: 8410
Joined: Tue Jul 17, 2012 3:02 pm

Re: Cross-Development: C64 Assembler with the RPi?

Sun Nov 26, 2017 8:55 am

The Commode C64 uses a version of the 6502 micro-processor.

A quick search for "6502 assembler" immediately finds you this page: http://6502.org/tools/asm/

There is a ton of 6502 assemblers and other tools there. Written in Python, Java, C. All sorts. I'm sure there is something in there you can use.

User avatar
scruss
Posts: 1458
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Cross-Development: C64 Assembler with the RPi?

Wed Nov 29, 2017 2:20 pm

The Traveler wrote:
Sat Nov 25, 2017 9:47 pm
I don't think you're going to find an 8-bit assembler for the C64 that runs on an ARM processor, but at least you can under Intel.
Nah, acme works very well.
[EDIT] There is a (ancient) RISC-based ACME assembler here: https://web.archive.org/web/20150520143 ... brod/acme/ Might be useful, might not.
Ancient? That's positively space-age! The source builds cleanly on Raspbian, and defaults to producing Commodore PRG binaries.

Considering most 8-bit development relies upon TASM, a program whose author gave up on it around 2001, and now reliably exists only in MS-DOS versions that kick out a shareware message with every build, Linux source for acme from the mid 2000s is wonderful.
Or, if you want to stay retro, but learn something a bit more useful, from 2003: http://arantxa.ii.uam.es/~gdrivera/sed/docs/ARMBook.pdf
Pfft. 6502 teaches you that you can still do useful things with very few registers and a very weedy stack: The 6502 40th Anniversary Computer Badge
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

Heater
Posts: 8410
Joined: Tue Jul 17, 2012 3:02 pm

Re: Cross-Development: C64 Assembler with the RPi?

Wed Nov 29, 2017 2:59 pm

Why not just write you C64 code in C++ like Jason Turner does?

A Simple Commodore 64 Game in C++17: https://www.youtube.com/watch?v=zBkNBP00wJE

That is a whole PONG game with sprites and all. Compiled down to 800 bytes or so from C++.

User avatar
scruss
Posts: 1458
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Cross-Development: C64 Assembler with the RPi?

Thu Nov 30, 2017 1:00 am

Because Jason's code is far more difficult to follow than assembly language:
https://github.com/lefticus/presentatio ... /Final.cpp
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

Heater
Posts: 8410
Joined: Tue Jul 17, 2012 3:02 pm

Re: Cross-Development: C64 Assembler with the RPi?

Thu Nov 30, 2017 9:53 pm

Well, I was being a bit tongue in cheek about the C++ for the C64 thing.

As to which is more difficult to follow, I guess that depends on if you are more used to reading/writing C++ than 6502 assembler.

The point of Jason's exercise there is to show that all those that say "C++ is crap because it produces bloated and slow code" are wrong.

I think he did very well.

Now, the challenge is, are there any C64 assembler gurus out there that can create the same simple program in assembler using less bytes than C++ ?

paulslocum
Posts: 34
Joined: Sun Apr 09, 2017 10:54 pm

Re: Cross-Development: C64 Assembler with the RPi?

Thu Nov 30, 2017 10:34 pm

I used DASM for all my 65xx projects, should be easy to build on RPi:

http://dasm-dillon.sourceforge.net/

User avatar
scruss
Posts: 1458
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Cross-Development: C64 Assembler with the RPi?

Fri Dec 01, 2017 2:42 am

Heater wrote:
Thu Nov 30, 2017 9:53 pm

I think he did very well.

Now, the challenge is, are there any C64 assembler gurus out there that can create the same simple program in assembler using less bytes than C++ ?
Yeah, he did, but without his x86 to 6502 magic translator, it's of no use to anyone else. Nice party trick.

Since it's C++ that has anything to prove, I'd rather see a compiler do this: https://www.youtube.com/watch?v=sWblpsLZ-O8
You've got 256 bytes: go!
I can't see it doing very well with the required self-modifying code.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

Heater
Posts: 8410
Joined: Tue Jul 17, 2012 3:02 pm

Re: Cross-Development: C64 Assembler with the RPi?

Fri Dec 01, 2017 8:15 am

scruss,
...without his x86 to 6502 magic translator, it's of no use to anyone else.
Of course the magic translator is available as well. So we can all play if we want.
Since it's C++ that has anything to prove, I'd rather see a compiler do this: https://www.youtube.com/watch?v=sWblpsLZ-O8
That's a nice party trick as well.

Ah, it's the famous Linus Åkesson. He did a brilliant demo for the Parallax Propeller MCU a while back: http://hd0.linusakesson.net/files/lft_t ... 20x576.mp4
I can't see it doing very well with the required self-modifying code.
Luckily self-modifying code is a feature they have not yet shoehorned into the monster that is C++.

User avatar
spike77
Posts: 12
Joined: Tue May 07, 2013 7:52 am

Re: Cross-Development: C64 Assembler with the RPi?

Wed Jan 03, 2018 4:54 pm

Thanks for the answers and happy new year 2018 btw!

while crawling throught the repositories, i found two packages:
  • crasm-1.8-1
  • xa65-2.3.5-1
i guess, i will try them and see which one works better. due to there being no Gui or IDE for my purpose, i think i'll have to use the combination of Texteditor and VICE-Emulator for writing and testing the code.

:-)

Heater
Posts: 8410
Joined: Tue Jul 17, 2012 3:02 pm

Re: Cross-Development: C64 Assembler with the RPi?

Wed Jan 03, 2018 8:03 pm

IDE?

We did not have any IDE for writing 6502 and other 8 bit micro assembler back in the day.

You certainly don't need one today. Any editor will do.

Personally I would use vim and install the 6502 syntax highlighter for it: http://www.vim.org/scripts/script.php?script_id=1314

Or the latest greatest Microsoft Visual Studio Code wih the 6502 plug in :https://marketplace.visualstudio.com/it ... scode-dasm

User avatar
scruss
Posts: 1458
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Cross-Development: C64 Assembler with the RPi?

Thu Jan 04, 2018 3:04 am

Heater wrote:
Wed Jan 03, 2018 8:03 pm
We did not have any IDE for writing 6502 and other 8 bit micro assembler back in the day.
But it wasn't fun. Developing and debugging on 8-bit machines needed multiple disk drives, a printer and lots of pen and paper scratchpad work. It would be like developing on linux with only cat as an editor, cc1 as a compiler and a simple linker to make executables.

These new cross-development IDEs:
  • host the compiler/assembler on a faster machine
  • often allow the code to run in a real-time emulator, with optional breakpoints
  • sometimes add sprite and sound editors that integrate with the assembly files
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

Heater
Posts: 8410
Joined: Tue Jul 17, 2012 3:02 pm

Re: Cross-Development: C64 Assembler with the RPi?

Thu Jan 04, 2018 4:51 am

scruss,
But it wasn't fun.
Sure it was.

We were young, micro-processors were new and exciting, we had a lot to learn there.
Developing and debugging on 8-bit machines needed multiple disk drives,...
What disk drives? We had no disk drives. We had to build the computer first, CPU, RAM, ROMS etc all wired wrapped. Eventually we built a cassette tape storage system using a handful of TTL chips.
a printer...
No printer either.
..and lots of pen and paper scratchpad work.
Oh yeah, lots of that.
It would be like developing on linux with only cat as an editor,...
Strangely enough I have done that...

But you are right. I would not like to have to do all that again...

On the other hand I cross-compile and emulate/simulate all kind of things for all kind of targets and often don't use an IDE. All from the command line. Much quicker and easier than all that mousing around in an IDE.

User avatar
DougieLawson
Posts: 31028
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Cross-Development: C64 Assembler with the RPi?

Thu Jan 04, 2018 8:17 am

The worst thing was CUTS (computer users tape system) and relying on getting the recording volume level just right on the cassette recorder. You could lose so much when that audio tape was unreadable.

https://en.wikipedia.org/wiki/Kansas_City_standard
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

Heater
Posts: 8410
Joined: Tue Jul 17, 2012 3:02 pm

Re: Cross-Development: C64 Assembler with the RPi?

Thu Jan 04, 2018 9:27 am

Oh yeah. I guess we were lucky to have the luxury of having an oscilloscope available to check that what came back from the tape was in good condition. Actually, the scope was our only debugging aid until we got our debug monitor in the boot ROM working. You know, load, run, break points, read/write memory and all that.

jahboater
Posts: 2049
Joined: Wed Feb 04, 2015 6:38 pm

Re: Cross-Development: C64 Assembler with the RPi?

Thu Jan 04, 2018 9:41 am

Heater wrote:
Wed Jan 03, 2018 8:03 pm
IDE?

We did not have any IDE for writing 6502 and other 8 bit micro assembler back in the day.
I didn't even have an assembler for the first Z80 stuff I wrote. Writing code is hex is not my idea of fun.
But with only 1KB of memory (8 * 2102 chips), you couldn't write much.

Heater
Posts: 8410
Joined: Tue Jul 17, 2012 3:02 pm

Re: Cross-Development: C64 Assembler with the RPi?

Thu Jan 04, 2018 10:32 am

Same here. Except we were using the 6809.

We did get an assembler, eventually. After spending half a year translating our pseudo code to assembler then manually assembling that into HEX for the PROM programmer. By the time the assembler turned up we hardly needed it, having memorized most of the opcodes.

jahboater
Posts: 2049
Joined: Wed Feb 04, 2015 6:38 pm

Re: Cross-Development: C64 Assembler with the RPi?

Thu Jan 04, 2018 10:58 am

Heater wrote:
Thu Jan 04, 2018 10:32 am
We did get an assembler, eventually. After spending half a year translating our pseudo code to assembler then manually assembling that into HEX for the PROM programmer. By the time the assembler turned up we hardly needed it, having memorized most of the opcodes.
The worst bit was that after most changes the offsets and relative addresses all needed to be re-calculated and changed too.

Heater
Posts: 8410
Joined: Tue Jul 17, 2012 3:02 pm

Re: Cross-Development: C64 Assembler with the RPi?

Thu Jan 04, 2018 8:19 pm

Ah, well, there was the thing. The Motorola 6809 had a PC relative addressing mode. That meant one could write position independent code. One could write whatever complex subroutine, full of jumps and loops internally, and then put it anywhere in memory and it would work. Without having to fix up all those jump addresses.

Perhaps the first micro-processor with that capability.

Still one of my favourite architectures.

Return to “General programming discussion”

Who is online

Users browsing this forum: No registered users and 11 guests