01. Line (line) - RetroAsmDev/C64AsmGameJourney GitHub Wiki
About
The program tries to change the color of the single border line.
As you can see on the screenshot, the line is not filled from the leftmost pixel (and the drawing continues on the next line). It is because there is a few cycles long delay caused by the execution of instructions, which set the $D020
(EXCTOL) VIC-II register. This delay is too long, so when finally the color is set the electron beam is already drawing the line in the visible area.
In the next post I will fix the problem.
Note: There are 200 scan lines (the area filled with the dark blue) on the normal 25*40 display, numbered 50 to 250, so the index of the line we draw is set 251, just below the main area.
Loader 10 SYS 2064
SYS
is a BASIC V2 command that tells the KERNAL (Commodore for the ROM-resident operating system) to execute the machine language subroutine at a specific address. When we want to run compiled assembly language program on the C64, we need to type the SYS
BASIC V2 command followed by the starting location of the program in memory.
To make it easier we make the SYS
command the part of the compiled binary file (prg
extension). We include into file tokenized command 10 SYS 2064
, which we put there as a byte array, so the compiler ignores the data and makes them unchanged part of the compiled file:
!byte $0C,$08,$0A,$00,$9E,$20,$32,$30,$36,$34,$00,$00,$00,$00,$00
When the prg
file is loaded, system handles it as a tokenized BASIC program, so the BASIC recognizes and interprets the SYS
command, which tells KERNAL system to launch the machine language program.
More information is available here: https://bigcode.wordpress.com/2016/10/22/basic-loader-for-commodore-64-assembly-programs/
Git: https://github.com/RetroAsmDev/C64AsmGameJourney/blob/master/line/main.asm