Posts

Showing posts with the label assembler

HELLO Micro-KIM

Image
The Micro-KIM arrived today! I did some initial experimentation with my 6502 cross-assembler and was happy that the paper tape format l recently added could be uploaded to the device without any problems. What better first program to write than "HELLO WORLD" (except only HELLO fits on the display)? It was fun figuring out how to control the display using low level 6502 programming.

Paper Tape Format Disassembler

I have extended my cross-assembler with a built-in disassembler that can directly read from paper tape format (and a few other formats). For example, the following test assembly program       .org $0200       ldx #100 loop  dex       bne loop       brk is, under option -P, assembled into paper tape format (text representation): ;060200A264CAD0FD0003A5 ;0000010001 Option -dP activates the disassembler on paper tape format represented as text, which disassembles the format above back to: $0200 a2 64  ldx #$64 $0202 ca     dex $0203 d0 fd  bne $0202 $0205 00     brk

Paper Tape Format

As a present, my wife ordered the Micro-KIM from Briel Computers for me, which is a modern replica of the KIM-1 microcomputer. Even though I learned machine code on the 6510 of the Commodore 64, I remember seeing the KIM-1 in an electronics store much earlier, and I was intrigued right away. I can't wait for it to arrive to do some vintage programming. In anticipation of the Micro-KIM's arrival, I extended my 65xx cross-assembler (available for Windows, Linux and MacOS) with the paper tape format , either in the original binary format (option -p) or in a text representation (option -P) so that its output can feed directly into the Kim's terminal interface. I simply generated the format based on old documentation and it is still untested. If someone is interested in trying it out, I would appreciate early feedback. Otherwise, I will report back when I get my Micro-KIM. For example, using the assembler on this little test assembly program: .org  $0100 .byte $FF $E...

Soft6502 and H6X file format

Image
Charles Bond wrote a nifty 6502 simulator, called Soft6502 , which I find useful for testing small programs written for the 65xx microprocessor family. The simulator supports the full 6502 instruction set and two 8-bit ports for input and output.   Programs can be entered one byte at the time through the keyboard or, more conveniently, loaded from file. The simulator uses the H6X file format , which is a simple, but surprisingly versatile way of representing 6502 code (essentially an ASCII representation of addresses followed by bytes). I have extended my 65xx cross-assembler (available for Windows, Linux, and MacOS) to support this H6X file format, so that its output can be directly fed into Soft6502.

Maze Solving in 6510

Image
Not sure why, but I suddenly felt the strong urge to see if I could still program in 6510. So I implemented a backtracking solver that finds the path in a maze from the '-' symbol to the '+' symbol (actually an undergraduate programming exercise I did long time ago on a Motorola 68000). The result running on a Commodore 64 emulator is shown below. The active search path appears as white '*' symbols, dead end positions appear as '.' symbols. And below the solution has been found. You can find the assembler source file maze.s (and a 6510 cross-assembler) on my Commodore 64 page if you are interested. You can define a different maze in the .byte section (just make sure the active search path length cannot exhaust the small stack of the Commodore 64). Also don't forget to remove the artificial delay to appreciate how fast machine code runs!

Commodore 64

Image
Remember this screen? Yes, that's right. I too became interested in computer science because of the Commodore 64. Although I still have my Commodore 64 somewhere, nowadays it is much easier to relive the good old times with an emulator, such as CCS64 (Per HÃ¥kan Sundell), VICE (the VICE team), or MP64 (an emulator under development by Michael Plet). A while back I wrote a 6510 cross-assembler win2c64 that converts an assembler source file into a target file that can run on one of these emulators or, with some work, on the real Commodore 64 (an assembler converts human readable mnemonics, labels, and simple expressions into machine code; win2c64 is a cross -assembler because it runs on a Windows platform but generates machine code for the Commodore 64). If you are interested, you can find the cross-assembler and some sample programs at Aart's C64 page .