mirror of
https://github.com/RevCurtisP/C02.git
synced 2024-11-29 16:51:10 +00:00
58 lines
2.4 KiB
Plaintext
58 lines
2.4 KiB
Plaintext
|
; VIC-20 Assembly Language Routines for VIC 6560 Chip
|
||
|
|
||
|
;VIC Chip Registers
|
||
|
VICSCH EQU $9000 ;Interlace Mode + Horizontal Screen Origin
|
||
|
VICSCV EQU $9001 ;Vertical Screen Origin
|
||
|
VICCOL EQU $9002 ;Screen Memory Location + Number of Video Columns
|
||
|
VICROW EQU $9003 ;Raster Value + Number of Video Rows + Character Size
|
||
|
VICRST EQU $9004 ;Raster Value
|
||
|
VICLOC EQU $9005 ;Screen Memory Location + Character Memory Location
|
||
|
VICLPH EQU $9006 ;Light Pen - Horizontal
|
||
|
VICLPV EQU $9007 ;Light Pen - Vertical
|
||
|
VICPD1 EQU $9008 ;Paddle 1
|
||
|
VICPD2 EQU $9009 ;Paddle 2
|
||
|
VICBSF EQU $900A ;Bass Sound Switch and Frequency
|
||
|
VICASF EQU $900B ;Alto Sound Switch and Frequency
|
||
|
VICSSF EQU $900C ;Soprano Sound Switch and Frequency
|
||
|
VICNSF EQU $900D ;Noise Switch and Frequency
|
||
|
VICAVL EQU $900E ;Auxillary Color + Sound Volume
|
||
|
VICCLR EQU $900F ;Screen Color + Reverse Mode + Border Color
|
||
|
|
||
|
;Set Screen Origin and Interlace Mode
|
||
|
;Args: A = Horizontal Screen Origin
|
||
|
; Y = Vertical Screen Origin
|
||
|
; X = Interlace Mode, 0=Off, !0=On
|
||
|
SETORG: AND #$7F ;Clear Accumulator High Bit
|
||
|
CPX #0 ;Test Interlace Mode
|
||
|
BEQ SETORH ;If Not Zero
|
||
|
ORA #$80 ; Set Accumulator High Bit
|
||
|
STA VICSCH ;Write to Horizontal Origin Register
|
||
|
STY VICSCV ;Write Y to Vertical Origin Register
|
||
|
RTS
|
||
|
|
||
|
;Set Memory Locations and Number of Columns
|
||
|
;Args: A = Screen Memory Address Offset
|
||
|
Y = Character Address Memory Offset
|
||
|
X = Number of Video Columns
|
||
|
SETSCN: LSR ;Roll Screen Offset Low Bit into Carry Flag
|
||
|
PHA ;And Save Top Four Bits on Stack
|
||
|
TXA ;Copy Columns into Accumulator
|
||
|
AND #$7F ;Clear High Bit
|
||
|
BCC SETSCC ;If Carry Set from Roll
|
||
|
ORA #$80 ; Set High Bit
|
||
|
STA VICCOL ;Write to Video Columns Register
|
||
|
PLA ;Retrieve Screen Memory Offset
|
||
|
ASL ;Shift to High Bit
|
||
|
ASL
|
||
|
ASL
|
||
|
ASL
|
||
|
PHA ;And Push onto Stack
|
||
|
TYA ;Put Character Address Offset in Accumulator
|
||
|
AND #$0F ;Clear High Nybble
|
||
|
TSX ;Get Index to Screen Address Offset
|
||
|
ORA $101,X ;Load Into Accumulator High Nybble
|
||
|
STA VICLOC ;Write to Memory Locations Register
|
||
|
PLA ;Clean up Stack
|
||
|
RTS
|
||
|
|