top of page
  • Writer's picturerehsd

65816 Assembly Coding Series

Updated: Jun 9, 2022

As I'm learning and implementing assembly code for my 65816 PC, I'll post periodic updates here. I'm doing OK with the assembly so far, and I have plenty to learn! If you see errors that I'm making, or have suggestions for improvement, please drop me a note! Thanks!

As I become comfortable with different modules of the code, I will post code to rehsd/PC-65816: PC based on 65816 (

#01: Keyboard input and drawing screen text

In this video, I am testing my PS/2 input and outputting text to both the LCD add-in card and my video card (320x240).

Two issues that I have identified as part of this video:

  1. I see an out-of-place pixel in the far upper-left corner of the screen. My guess is that it's due to a coding issue.

  2. When I first power on the system, it is somehow retaining the last character I typed prior to turning off the system. Weird, but I need to dig into it.

#02: Mouse input, drawing lines, and filling rectangles

In this video, I am testing my USB mouse add-in card and outputting free-form lines and filled rectangles.

The primary issue for me to work on from the video above is improving the interpretation of the mouse data to have it feel "smoother." You'll notice the mouse gravitates to moving in diagonal paths. I believe I can adjust this. I will also implement code so that the left button toggles drawing on/off.

Also, on reset I draw a pixel in the center of the screen; that one is supposed to be there. After I reset in the video, I notice a stray pixel (down and left of the center pixel). This is likely from dual-port RAM concurrent access.

#03: Mouse pointer, drawing, and start of "start" menu

The left mouse button now toggles drawing. I have a single-point mouse cursor. I have also started a "start" menu.

#04: VIA tester

Using my VIA tester add-in card, I put together a 65816 program to perform automated testing of VIAs.

#05: Added sound card control

#06: Improved mouse pointer and implementation of cached tiles in extended RAM.

I have refactored how I draw a page to support copying screen content from video pages in extended RAM. The cache stores all the background tiles (and no sprite data). Sprites are added to content in video RAM, but I can reload a tile from ERAM when needed. I use this to try out an improved mouse pointer. The mouse pointer is 8x8, and I refresh a 16x16 tile behind it. I can probably shrink the tile down to 8x8 (for mouse pointer movement) for a smoother mouse pointer; I'll try this when time permits.

#07: Cached sprites with joystick support

I have added routines to load sprites from ROM and place in extended RAM and to easily write these cached sprites to VRAM. I also added code to support my joystick add-in card. Finally, I add safety code to keep the mouse pointer within expected boundaries.

More to come!

Running Issues List

  1. Pixel in upper-left corner.

  2. Ghost key input on cold boot.

  3. ...

294 views2 comments

Recent Posts

See All


What assembler are you using?

Apr 13
Replying to

I've been using Retro Assembler for my 65816 projects.

bottom of page