01
Today starts December Adventure ✨ a month of cozy coding. See @eli_oat@tenforward.social‘s page for details. I want to get something small done with Minicube64 this time, to learn how games for the 6502 were made. I look at some assembly last year, mainly Nick Morgan’s 6502 and compudanzas’ uxn tutorials. But most is lost by now and I had already had some problems following Minicube64’s code.
For now I just tried to paint the screen a bit through a loop, and I learned about the difference between the main loop and the VBLANK interrupt, although I have to look that up the later. So updates to the screen need to be done in the IRQ routine if I want to have something frame based. Minicube64 offer some macros to work easier with such common things.
The other thing I struggled with were adressing modes. Need to get them into my head again.
02
Ehrm. Frustration. I tried to implement grabbing the arrow keys and moving that pixel on screen around but I run into so many problems that I need to take two steps back and than maybe another three or four. I tried to cross-reference my problems with Skilldrick’s tutorial and Masswerk’s 6502 instruction set, but to no avail. There is a lot I didn’t understand and maybe I should just go through Skilldrick’s tutorial again. The Minicube64 documentation is not very beginner’s friendly, so that might be a thing that could grow out of this :)
I got myself together, researched a bit more and was at least able to properly paint the screen, one pixel per interrupt.
The magic part was hidden in the indirect indexed adressing mode. First I set up the low and high byte of the video adress.
Then I use that when drawing my pixel.
I’m pretty sure there are better ways to do that, but that’s good enough for today.
03
Continued with the sketch from yesterday and concentrated on grabing the arrow keys and moving a pixel around. Worked quite charming and I could actually concentrate on learning problems of math in assembly, branching and the carry flag.
The thing moved around as it should although I’m not understand why it works downwards but not upwards. But I know it has to do with the carry and negative flags and the way I calculate the new position.
Ah! The problem is that I position the thing by offsetting from VIDEO_MEM
by sta (VIDEO_MEM),y
. Actually I should work on the stored position in VIDEO_MEM+1
and just use indirect adressing.