CCS64 Forum

Machine Language Help
Page 1 of 1

Author:  bmu [ Sun May 23, 2004 11:32 pm ]
Post subject:  Machine Language Help

I got my C-64 in 1984 or 1985 when I was 12 or 13. I dabbled in BASIC programming, but always wanted to try the machine language programs I saw in magazines. I could never figure this out (now I know I needed a monitor) so I moved on. I quit programming sometime as a teenager; mostly because I could never get past this machine language issue and because I could find no one who could adequately tell me the practical difference betweein GOTO and GOSUB--and I wasn't destined to be a software engineer.

Having come across this new/ old Commodore 64 world, I'd still like to write one dumb little program in machine language -- I've been frustrated for a long time!

When I use Alt M to get to the machine language monitor, can someone tell me maybe a two line program to type in and how I run it within the CCS64 Emulator?



Author:  Rebell [ Mon May 24, 2004 9:43 am ]
Post subject: 

For an compiler (crosscompiler for the C64 - use C) go there :

For programming visit :

... can this help you :shock:

Author:  bmu [ Mon May 24, 2004 10:30 pm ]
Post subject: 


I was more interested in using the CCS64 monitor. So I press Alt M, type in a small machine language program and then run it.

Or am I missing something :?:

Author:  StevenRoy [ Mon May 24, 2004 11:43 pm ]
Post subject: 

The monitor comes with minimal built-in documentation that you can access with F1.

Although the monitor is more useful as a debugging tool, you can use it to put together small programs in the emulated C64's memory.

For example, to start "Assembling" a program, use the A command, followed by an address.
A C000 LDA #0

CCS64 will automatically provide the next address, so you can continue typing the program thus:
STA D021
LDA #2
STA D021
JMP C000

At this point, press Enter again without typing anything to get out of the assembler. You can then exit the monitor to return to BASIC, and type SYS 49152 (that would be C000 in decimal) to start your little program. Whoa, strobey.

Now you can go back into the monitor and edit the program while it's running. You can change the colours, make it change the border colour instead of the background, or, if you're advanced enough, you could even find a way to make the program exit back to BASIC (with an RTS command) when you press a key on the emulated C64 keyboard.

Now, that's all well and good for experimenting, but for really complex programming, with labels and that sort of thing, it would probably be better to use a dedicated assembler (more accurately, a Machine Language compiler). For example, I use a little DOS program I wrote myself in QuickBasic to assemble P00 files from text files, although I might start using CC65 instead, considering how popular it seems to be. (That is apparently a C compiler, actually, with an included 6502 ML assembler.)

Author:  bmu [ Tue May 25, 2004 12:09 am ]
Post subject: 


THANK YOU! That was a lot better than hello world!


Page 1 of 1 All times are UTC + 2 hours
Powered by phpBB® Forum Software © phpBB Group