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?

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.

Code:

A C000 LDA #0

CCS64 will automatically provide the next address, so you can continue typing the program thus:

Code:

STA D021LDA #2STA D021JMP 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.)

Who is online

Users browsing this forum: No registered users and 2 guests

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