| 1 |
;ACME 0.96.4 |
| 2 |
|
| 3 |
!ifdef lib_cbm_c64_vic_a !eof |
| 4 |
lib_cbm_c64_vic_a = 1 |
| 5 |
|
| 6 |
; This is from Christian Bauer's VIC text: { |
| 7 |
; 6566: designed for static RAM, never used in C64/128 |
| 8 |
; 6567/8562: C64, NTSC |
| 9 |
; 6569/8565: C64, PAL |
| 10 |
; 6572: Drean C64, PAL-N |
| 11 |
; 8564: C128, NTSC |
| 12 |
; 8566: C128, PAL |
| 13 |
; PAL chips generate 312 lines with 63 cycles per line. |
| 14 |
; PAL-N chips generate 312 lines with 65 cycles per line. |
| 15 |
; NTSC chips generate 263 lines with 65 cycles per line. |
| 16 |
; Very early NTSC chips (6567R56A) have an off-by-one |
| 17 |
; error, they generate 262 lines with 64 cycles per line. |
| 18 |
; } |
| 19 |
|
| 20 |
; The c128 version is officially called "VIC-IIe". |
| 21 |
; It has two additional registers and more pins. |
| 22 |
|
| 23 |
; color codes |
| 24 |
viccolor_BLACK = $0 |
| 25 |
viccolor_WHITE = $1 |
| 26 |
viccolor_RED = $2 |
| 27 |
viccolor_CYAN = $3 |
| 28 |
viccolor_PURPLE = $4 |
| 29 |
viccolor_GREEN = $5 |
| 30 |
viccolor_BLUE = $6 |
| 31 |
viccolor_YELLOW = $7 |
| 32 |
viccolor_ORANGE = $8 |
| 33 |
viccolor_BROWN = $9 |
| 34 |
viccolor_LRED = $a |
| 35 |
viccolor_GRAY1 = $b |
| 36 |
viccolor_GRAY2 = $c |
| 37 |
viccolor_LGREEN = $d |
| 38 |
viccolor_LBLUE = $e |
| 39 |
viccolor_GRAY3 = $f |
| 40 |
|
| 41 |
!addr vic_base = $d000 |
| 42 |
; sprite coordinates: |
| 43 |
vic_xs0 = vic_base + $00 |
| 44 |
vic_ys0 = vic_base + $01 |
| 45 |
vic_xs1 = vic_base + $02 |
| 46 |
vic_ys1 = vic_base + $03 |
| 47 |
vic_xs2 = vic_base + $04 |
| 48 |
vic_ys2 = vic_base + $05 |
| 49 |
vic_xs3 = vic_base + $06 |
| 50 |
vic_ys3 = vic_base + $07 |
| 51 |
vic_xs4 = vic_base + $08 |
| 52 |
vic_ys4 = vic_base + $09 |
| 53 |
vic_xs5 = vic_base + $0a |
| 54 |
vic_ys5 = vic_base + $0b |
| 55 |
vic_xs6 = vic_base + $0c |
| 56 |
vic_ys6 = vic_base + $0d |
| 57 |
vic_xs7 = vic_base + $0e |
| 58 |
vic_ys7 = vic_base + $0f |
| 59 |
vic_msb_xs = vic_base + $10 ; bit 8 of x position (one bit per sprite) |
| 60 |
vic_controlv = vic_base + $11 ; vertical control and other stuff: |
| 61 |
; %7....... "bit 8" of $d012 |
| 62 |
; %.6...... extended background color mode (1=on) |
| 63 |
; %..5..... 0 = text mode, 1 = bitmap mode |
| 64 |
; %...4.... display enable: 0 = disable (border only), 1 = enable VIC only checks this once per frame! |
| 65 |
; %....3... lines: 0 = 24, 1 = 25 ; if set, upper and lower border gain 4 pixels each |
| 66 |
; %.....210 vertical smooth scroll (default %011), screen contents are moved down by this amount |
| 67 |
vic_line = vic_base + $12 ; raster line (also see bit 7 of $d011) reading returns current value, writing sets interrupt value |
| 68 |
vic_xlp = vic_base + $13 ; light pen coordinates, x (only half the resolution) |
| 69 |
vic_ylp = vic_base + $14 ; light pen coordinates, y |
| 70 |
vic_sactive = vic_base + $15 ; sprite enable (one bit per sprite) |
| 71 |
vic_controlh = vic_base + $16 ; horizontal control and other stuff: |
| 72 |
; %76...... always set |
| 73 |
; %..5..... "test", should be 0 |
| 74 |
; %...4.... 0 = hires, 1 = multicolor |
| 75 |
; %....3... columns: 0 = 38, 1 = 40 ; if set, left border gains 7 pixels and right border gains 9 pixels |
| 76 |
; %.....210 horizontal smooth scroll (default %000), screen contents are moved to the right by this amount |
| 77 |
vic_sdy = vic_base + $17 ; sprites, double height (one bit per sprite) |
| 78 |
vic_ram = vic_base + $18 ; RAM pointer |
| 79 |
; %7654.... which K of VIC bank is video ram (default %0001) |
| 80 |
; %....321. text: which 2K of VIC bank is character set (default %010) |
| 81 |
; %.......0 text: unused |
| 82 |
; %....3... bitmap: which 8K of VIC bank is bitmap |
| 83 |
; %.....210 bitmap: unused |
| 84 |
vic_irq = vic_base + $19 ; writing back acknowledges! |
| 85 |
; %7....... 1: VIC requested interrupt |
| 86 |
; %.654.... always set |
| 87 |
; %....3... 1: light pen active |
| 88 |
; %.....2.. 1: sprite-sprite collision |
| 89 |
; %......1. 1: sprite-data collision |
| 90 |
; %.......0 1: raster interrupt |
| 91 |
vic_irqmask = vic_base + $1a |
| 92 |
; %7654.... always set |
| 93 |
; %....3... 1: enable lightpen interrupt |
| 94 |
; %.....2.. 1: enable sprite-sprite collision interrupt |
| 95 |
; %......1. 1: enable sprite-data collision interrupt |
| 96 |
; %.......0 1: enable raster interrupt |
| 97 |
vic_sback = vic_base + $1b ; sprites, background (one bit per sprite) |
| 98 |
vic_smc = vic_base + $1c ; sprites, multicolor (one bit per sprite) |
| 99 |
vic_sdx = vic_base + $1d ; sprites, double width (one bit per sprite) |
| 100 |
vic_ss_collided = vic_base + $1e ; sprites, sprite collision (one bit per sprite) reading clears register! |
| 101 |
vic_sd_collided = vic_base + $1f ; sprites, data collision (one bit per sprite) reading clears register! |
| 102 |
; color registers (high nibbles are always %1111): |
| 103 |
vic_cborder = vic_base + $20 ; border color |
| 104 |
vic_cbg = vic_base + $21 ; general background color |
| 105 |
vic_cbg0 = vic_base + $21 |
| 106 |
vic_cbg1 = vic_base + $22 ; background color 1 (for EBC and MC text mode) |
| 107 |
vic_cbg2 = vic_base + $23 ; background color 2 (for EBC and MC text mode) |
| 108 |
vic_cbg3 = vic_base + $24 ; background color 3 (for EBC mode) |
| 109 |
vic_sc01 = vic_base + $25 ; sprite color for MC-bitpattern %01 |
| 110 |
vic_sc11 = vic_base + $26 ; sprite color for MC-bitpattern %11 |
| 111 |
; individual sprite colors (in MC mode, these are used for bit pattern %10): |
| 112 |
vic_cs0 = vic_base + $27 ; sprite 0 color |
| 113 |
vic_cs1 = vic_base + $28 ; sprite 1 color |
| 114 |
vic_cs2 = vic_base + $29 ; sprite 2 color |
| 115 |
vic_cs3 = vic_base + $2a ; sprite 3 color |
| 116 |
vic_cs4 = vic_base + $2b ; sprite 4 color |
| 117 |
vic_cs5 = vic_base + $2c ; sprite 5 color |
| 118 |
vic_cs6 = vic_base + $2d ; sprite 6 color |
| 119 |
vic_cs7 = vic_base + $2e ; sprite 7 color |
| 120 |
; See <cbm/c128/vic.a> for the C128's two additional registers at $d02f/$d030. |
| 121 |
; They are accessible even in C64 mode and $d030 can garble the video output, |
| 122 |
; so be careful not to write to it accidentally in a C64 program! |