Posts

Showing posts with the label 6510

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. So this posting is not telling anything new to most of you. I am just reminiscing my own youthful awe when I made the switch.
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 border ; for win2c64 by Aart Bik ; https://www.aartbik.…

Micro-KIM Tutorial: The Memory Map

Image
Let’s revisit the Micro-KIM memory map, introduced in the third tutorial.

+-----------+
| 2K EPROM  |$1fff
| monitor   |
| program   |$1800
+-----------+
| 6532 RIOT |$17ff
| I/O, timer|
| and RAM   |$1740
+-----------+
| optional  |$173f
| I/O, timer|
| and RAM   |$1400
+-----------+
|           |$13ff
| 5K RAM    |
|           |$0000
+-----------+

Since the default kit (without any expansion) only uses the lower address bits to access 8K, memory repeats itself every 8K. You can verify this by storing and inspecting values in, for instance, addresses $0000 and $2000. Any value stored in one address will show up in the other. Although an interesting factoid, there is no reason to let Micro-KIM programs address anything outside the range $0000-$1fff.
Addresses $0000-$13ff contain 5K free RAM (another interesting factoid: the Micro-KIM actually wastes 3K of its 8K RAM chip to keep compatibility with the original KIM-1). This memory region can be used to store data and code. To verify this, while runnin…

Micro-KIM Tutorial: Available as Single PDF

If you were following (and hopefully enjoying) the Micro-KIM tutorial, you may have noticed a rather long silence after the last posting. Unfortunately, my day job and a move plus remodeling claimed most of my spare time. However, I plan to continue the tutorial really soon again!
In the meanwhile, I have made all previous tutorials available as a single PDF on my Micro-KIM website, where you can also find the source code of all examples. Future tutorials will be added to this PDF to keep the collection available as a single file.

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

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!