Posts

Showing posts with the label commodore 64

Opening Top and Bottom Borders on the Commodore 64

Image
Opening up the top and bottom border is of course a trick any seasoned C64 demo writer knows. But anyone who started with BASIC before switching to 6510 probably remembers how much fun it was to get that extra space for sprites and even some simple graphics. 
The program below shows how to do this. Set up a raster interrupt right before the bottom border start. Then toggle between 24 and 25 lines of text. This tricks the VIC into forgetting to turn on the border. The opened border can be used to display sprites. By manipulating the last address of the VIC page ($3fff by default), you can even get some interesting graphics. For example, Pasi Ojala posted an article Opening the Borders with some truly amazing effects! 
Of course, opening up the side borders is the next challenge!



; little demo to open up the top/bottom border ; for win2c64 by Aart Bik ; https://www.aartbik.com/ scroly   =   $d011 raster   =   $d012 vicirq   =   $d019 irqmsk   =   $d01a ciaicr   =   $dc0d ci2icr   =   $…

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.

6502 Microcomputer

Image
It is nice to hear that others sometimes find my toy projects useful. As I reported in an earlier blog entry, a while back I implemented a 6510 cross-assembler to relive the good old times of programming a Commodore 64. Today I got an email from Antonino Brisindi who is using this assembler to burn an EPROM for his home-made 6502-based microcomputer. Below you see a picture of his impressive project in progress.



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.