Copy Link
Add to Bookmark
Report
Saxonia Issue 03 Part 032
The subject of cross-assemblers
By Rumrunner/VOID
l
Let's face it, no matter how hard Microsoft and the companies alike try to
make everybody think the same thoughts and use the same utilities with the
same (shitty) interface, there are some computers which will never leave
our minds. While the Amiga is one of these, there's ofcourse one other
giant which hit the market in the early eighties and which will always be
remembered, games which are still copied and remade often come from this
computer, so do demo-ideas and perhaps the whole concept of demos.
Everybody with respect for themselves should know the computer I'm telling
about here, it's ofcourse the magnificent Commodore 64. I myself got a
128D in 1987 and I still have it working. The common way to get into
computing was often to see a game at a friend's and then wanting a computer
for yourself. More often than not, this friend's computer was the mentioned
one.
So, having spread a little propaganda there, I want to get onto the subject.
I came across the idea of writing some small demos for the C64, especially
after seeing some work of our own coder in VOID, Dr Hirudo. So I started
looking for some assemblers and found some decent cross-assemblers to use
on my Amiga. I would prefer to write the code on the real thing, but as of
now, I don't have any ways to transfer the files to C64-disks and I don't
have an assembler at the disks I present have for the computer (that means
all the disks I have collected since the start). Anyway, while searching
for more assemblers (I always think that it's nice to have a wide selection)
and some documentation for the incredible 6510 processor, I came across
several webpages dedicated to either the 6502 (which is more or less the same
as the 6510 processor used in the C64) or to the computer specifically.
What I discovered was that the urge for continuing working on such splendid
pieces of hardware from times gone by was even bigger than I thought. I
found lots and lots of assemblers, some were meant for a specific computer
while others were spread as the all too common c-code sourcefiles. I even
found an assembler made with a Python-script, it even worked. It sadly
didn't work on the Python-version I have on Amiga though, but it's not a
big loss as I would never have used it for much more than showing it off,
Python is dead slow. So, there's a lot of cross-assemblers to get, and while
I, like already mentioned, prefer working on the computer my work is for,
there are some advantages to cross-assemblers. The perhaps biggest
advantage is that you can use the whole memory (65k) without having to
split up the program and load bits in. This is ofcourse due to that, when
working on a C64, the assembler itself must be in memory. But also remember
that the instructionset of the 6502 is simple and that a decent assembler
should not take too much memory. Other advantages are ofcourse that, if
assembling on another computer, you can leave the code up while you check
it out. You cannot do this on the C64 if you need all memory.
Like most other sides of life, there are downsides with cross-assemblers
aswell. Let's face it, even if you have equipment for transferring the
assembled file to a real C64-disk, it so happens that the easy way of using
an emulator seems tempting. Perhaps it's the only option, if like in my
case, you don't have such equipment. Then, the emulators' qualities decide
whether what you see will be displayed in the correct manner on the real
computer. There are lots of coding options available on the C64 that doesn't
work on most other computers except the ones where you know excactly what
processorspeed you are running on. Does dbf-loops ring a bell if you think
a minute of old Amiga500 demos? A plain Amiga 500 had no problem running
other Amiga, or 500's with other processors quickly hung. There are no
such problems with timingloops on a real C64, since every single one runs
on the same speed, somewhat different for PAL and NTSC machines I believe.
I know of some fastloaders that are almost impossible to get to run on
emulators because of such loops, and while many may argue that you
shouldn't code like that, I say, why shouldn't you when you know what
computer it will run on?
The quality of emulators are also important in other aspects. The best
(although slow) emulator I have found is TheA64Package, but I only have one
68000 CPU-only version of it so it's not appropriate for my use. I know
I saw one dedicated to MC680X0 processors once but it never ran and I
deleted it. I don't know what caused the problem.
The emulator I usually use is the Magic64 emulator, but it's hardly
anything to jump the roof for. On my computer, it's impossible to adjust
the screen so that I see all of the C64-screen. Whether I change the
displaysetting or adjust the monitor, the lower right corner always gets
out of screen.
So, what I hope to have achieved with this article is to let those who
didn't know, find out that there are fairly easy ways of starting to code
on the legendary machine known to the whole world. It's just some small
problems that are not too important in the start of a coding-career, but
I for one know that I will find some way of transferring the files to the
real machine and also do some code there. Even though I have just started
to learn the instructionset of the 6502, it's in a way just as exciting
as coding on the MC680X0. It's in many ways simpler, but you also have
more limitations, three registers which are the accumulator called a, and
x and y registers. In addition you have the stack, which is always located
at $100 to $1ff and the status register and program counter. You have
65k of ram (or 128k on the C128 ) and not the more advanced and easy-to-use
instructions we have on Amiga, like multiplication and division, let alone
cas-instructions. But as said, it's nice to know the 6502 and you can code
marvellous things on it, people have proven this since the eighties.
And, from what I have seen of intel-code, 6502 really helps to understand
this. As far as I know, there still aren't any real ways of adressing bytes
and bigger sizes in the instruction itself, you have to do in in the
register-part of the instruction. Imagine having to do move d3l,d0 to move
the lower part of the register. Anybody who are more into intel-assembly
are ofcourse welcome to tell me that I'm wrong here, if so should be, I
will include it in Saxonia4.
Until then, have fun and check out a legendary processor today.