2019-02-17 23:12:29 +00:00
|
|
|
// Exploring C64DTV Screen Modes
|
2018-03-25 21:40:38 +00:00
|
|
|
.pc = $801 "Basic"
|
|
|
|
:BasicUpstart(main)
|
|
|
|
.pc = $80d "Program"
|
2019-02-17 23:12:29 +00:00
|
|
|
// Processor port data direction register
|
2018-04-01 01:58:07 +00:00
|
|
|
.label PROCPORT_DDR = 0
|
2019-02-17 23:12:29 +00:00
|
|
|
// Mask for PROCESSOR_PORT_DDR which allows only memory configuration to be written
|
2018-04-01 01:58:07 +00:00
|
|
|
.const PROCPORT_DDR_MEMORY_MASK = 7
|
2019-02-17 23:12:29 +00:00
|
|
|
// Processor Port Register controlling RAM/ROM configuration and the datasette
|
2018-03-27 20:32:06 +00:00
|
|
|
.label PROCPORT = 1
|
2019-02-17 23:12:29 +00:00
|
|
|
// RAM in $A000, $E000 I/O in $D000
|
2019-07-30 13:01:43 +00:00
|
|
|
.const PROCPORT_RAM_IO = 5
|
2019-02-17 23:12:29 +00:00
|
|
|
// RAM in $A000, $E000 CHAR ROM in $D000
|
2019-07-30 13:01:43 +00:00
|
|
|
.const PROCPORT_RAM_CHARROM = 1
|
2018-04-01 01:58:07 +00:00
|
|
|
.label RASTER = $d012
|
2018-03-25 21:40:38 +00:00
|
|
|
.label BORDERCOL = $d020
|
|
|
|
.label BGCOL = $d021
|
|
|
|
.label BGCOL1 = $d021
|
|
|
|
.label BGCOL2 = $d022
|
2018-03-28 22:37:04 +00:00
|
|
|
.label BGCOL3 = $d023
|
|
|
|
.label BGCOL4 = $d024
|
2018-03-26 19:41:09 +00:00
|
|
|
.label VIC_CONTROL = $d011
|
2018-03-25 21:40:38 +00:00
|
|
|
.const VIC_ECM = $40
|
|
|
|
.const VIC_BMM = $20
|
|
|
|
.const VIC_DEN = $10
|
|
|
|
.const VIC_RSEL = 8
|
2018-03-26 19:41:09 +00:00
|
|
|
.label VIC_CONTROL2 = $d016
|
2018-03-27 08:01:28 +00:00
|
|
|
.const VIC_MCM = $10
|
2018-03-25 21:40:38 +00:00
|
|
|
.const VIC_CSEL = 8
|
2018-03-26 19:41:09 +00:00
|
|
|
.label VIC_MEMORY = $d018
|
2019-02-17 23:12:29 +00:00
|
|
|
// Color Ram
|
2018-03-25 21:40:38 +00:00
|
|
|
.label COLS = $d800
|
2019-02-17 23:12:29 +00:00
|
|
|
// CIA#1 Port A: keyboard matrix columns and joystick #2
|
2018-03-25 21:40:38 +00:00
|
|
|
.label CIA1_PORT_A = $dc00
|
2019-02-17 23:12:29 +00:00
|
|
|
// CIA#1 Port B: keyboard matrix rows and joystick #1.
|
2018-03-25 21:40:38 +00:00
|
|
|
.label CIA1_PORT_B = $dc01
|
2019-02-17 23:12:29 +00:00
|
|
|
// CIA#2 Port A: Serial bus, RS-232, VIC memory bank
|
2018-03-25 21:40:38 +00:00
|
|
|
.label CIA2_PORT_A = $dd00
|
2019-02-17 23:12:29 +00:00
|
|
|
// CIA #2 Port A data direction register.
|
2018-03-25 21:40:38 +00:00
|
|
|
.label CIA2_PORT_A_DDR = $dd02
|
2019-02-17 23:12:29 +00:00
|
|
|
// The colors of the C64
|
2018-03-29 06:49:51 +00:00
|
|
|
.const BLACK = 0
|
|
|
|
.const GREEN = 5
|
|
|
|
.const BLUE = 6
|
2018-03-25 21:40:38 +00:00
|
|
|
.const LIGHT_GREEN = $d
|
2019-02-17 23:12:29 +00:00
|
|
|
// Feature enables or disables the extra C64 DTV features
|
2018-03-25 21:40:38 +00:00
|
|
|
.label DTV_FEATURE = $d03f
|
|
|
|
.const DTV_FEATURE_ENABLE = 1
|
2019-02-17 23:12:29 +00:00
|
|
|
// Controls the graphics modes of the C64 DTV
|
2018-03-25 21:40:38 +00:00
|
|
|
.label DTV_CONTROL = $d03c
|
2018-04-01 01:58:07 +00:00
|
|
|
.const DTV_LINEAR = 1
|
|
|
|
.const DTV_BORDER_OFF = 2
|
|
|
|
.const DTV_HIGHCOLOR = 4
|
|
|
|
.const DTV_OVERSCAN = 8
|
|
|
|
.const DTV_COLORRAM_OFF = $10
|
|
|
|
.const DTV_CHUNKY = $40
|
2019-02-17 23:12:29 +00:00
|
|
|
// Defines colors for the 16 first colors ($00-$0f)
|
2018-03-26 21:49:07 +00:00
|
|
|
.label DTV_PALETTE = $d200
|
2019-02-17 23:12:29 +00:00
|
|
|
// Linear Graphics Plane A Counter Control
|
2018-03-25 21:40:38 +00:00
|
|
|
.label DTV_PLANEA_START_LO = $d03a
|
|
|
|
.label DTV_PLANEA_START_MI = $d03b
|
|
|
|
.label DTV_PLANEA_START_HI = $d045
|
|
|
|
.label DTV_PLANEA_STEP = $d046
|
|
|
|
.label DTV_PLANEA_MODULO_LO = $d038
|
|
|
|
.label DTV_PLANEA_MODULO_HI = $d039
|
2019-02-17 23:12:29 +00:00
|
|
|
// Linear Graphics Plane B Counter Control
|
2018-03-25 21:40:38 +00:00
|
|
|
.label DTV_PLANEB_START_LO = $d049
|
|
|
|
.label DTV_PLANEB_START_MI = $d04a
|
|
|
|
.label DTV_PLANEB_START_HI = $d04b
|
|
|
|
.label DTV_PLANEB_STEP = $d04c
|
|
|
|
.label DTV_PLANEB_MODULO_LO = $d047
|
|
|
|
.label DTV_PLANEB_MODULO_HI = $d048
|
2019-02-17 23:12:29 +00:00
|
|
|
// Select memory bank where color data is fetched from (bits 11:0)
|
|
|
|
// Memory address of Color RAM is ColorBank*$400
|
2018-03-26 21:49:07 +00:00
|
|
|
.label DTV_COLOR_BANK_LO = $d036
|
|
|
|
.label DTV_COLOR_BANK_HI = $d037
|
2018-03-28 22:37:04 +00:00
|
|
|
.const DTV_COLOR_BANK_DEFAULT = $1d800
|
2019-02-17 23:12:29 +00:00
|
|
|
// Selects memory bank for normal VIC color mode and lower data for high color modes. (bits 5:0)
|
|
|
|
// Memory address of VIC Graphics is GraphicsBank*$10000
|
2018-03-25 21:40:38 +00:00
|
|
|
.label DTV_GRAPHICS_VIC_BANK = $d03d
|
2018-03-29 06:49:51 +00:00
|
|
|
.const KEY_3 = 8
|
2018-03-28 14:43:47 +00:00
|
|
|
.const KEY_A = $a
|
2018-04-01 01:58:07 +00:00
|
|
|
.const KEY_4 = $b
|
2018-03-28 11:00:32 +00:00
|
|
|
.const KEY_E = $e
|
2018-03-27 20:32:06 +00:00
|
|
|
.const KEY_D = $12
|
2018-03-28 22:37:04 +00:00
|
|
|
.const KEY_6 = $13
|
2018-03-25 21:40:38 +00:00
|
|
|
.const KEY_C = $14
|
2018-03-29 06:49:51 +00:00
|
|
|
.const KEY_7 = $18
|
2018-03-29 07:09:07 +00:00
|
|
|
.const KEY_8 = $1b
|
2018-03-27 08:01:28 +00:00
|
|
|
.const KEY_B = $1c
|
2018-04-01 01:58:07 +00:00
|
|
|
.const KEY_H = $1d
|
|
|
|
.const KEY_U = $1e
|
|
|
|
.const KEY_0 = $23
|
|
|
|
.const KEY_O = $26
|
|
|
|
.const KEY_L = $2a
|
2018-03-28 22:37:04 +00:00
|
|
|
.const KEY_1 = $38
|
|
|
|
.const KEY_2 = $3b
|
2018-03-25 21:40:38 +00:00
|
|
|
.const KEY_SPACE = $3c
|
2019-07-31 11:47:21 +00:00
|
|
|
.label print_char_cursor = 4
|
|
|
|
.label dtv_control = $d
|
|
|
|
.label print_line_cursor = 9
|
2018-03-25 21:40:38 +00:00
|
|
|
main: {
|
2018-03-26 21:49:07 +00:00
|
|
|
sei
|
2019-02-17 23:12:29 +00:00
|
|
|
// Disable normal interrupt (prevent keyboard reading glitches and allows to hide basic/kernal)
|
|
|
|
// Disable kernal & basic
|
2018-04-01 01:58:07 +00:00
|
|
|
lda #PROCPORT_DDR_MEMORY_MASK
|
|
|
|
sta PROCPORT_DDR
|
|
|
|
lda #PROCPORT_RAM_IO
|
|
|
|
sta PROCPORT
|
2019-02-17 23:12:29 +00:00
|
|
|
// Enable DTV extended modes
|
2018-03-25 21:40:38 +00:00
|
|
|
lda #DTV_FEATURE_ENABLE
|
|
|
|
sta DTV_FEATURE
|
2019-03-31 15:10:41 +00:00
|
|
|
b1:
|
2018-03-25 21:40:38 +00:00
|
|
|
jsr menu
|
2019-03-31 15:10:41 +00:00
|
|
|
jmp b1
|
2018-03-25 21:40:38 +00:00
|
|
|
}
|
|
|
|
menu: {
|
2018-03-29 07:09:07 +00:00
|
|
|
.label SCREEN = $8000
|
|
|
|
.label CHARSET = $9800
|
2019-07-31 11:47:21 +00:00
|
|
|
.label c = 4
|
2019-02-17 23:12:29 +00:00
|
|
|
// Charset ROM
|
|
|
|
// DTV Graphics Bank
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #0
|
2018-03-25 21:40:38 +00:00
|
|
|
sta DTV_GRAPHICS_VIC_BANK
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Color Bank
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #<DTV_COLOR_BANK_DEFAULT/$400
|
2018-03-26 21:49:07 +00:00
|
|
|
sta DTV_COLOR_BANK_LO
|
2018-03-25 21:40:38 +00:00
|
|
|
lda #0
|
2018-03-26 21:49:07 +00:00
|
|
|
sta DTV_COLOR_BANK_HI
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Graphics Mode
|
2018-03-25 21:40:38 +00:00
|
|
|
sta DTV_CONTROL
|
2019-02-17 23:12:29 +00:00
|
|
|
// VIC Graphics Bank
|
2018-03-25 21:40:38 +00:00
|
|
|
lda #3
|
|
|
|
sta CIA2_PORT_A_DDR
|
2019-02-17 23:12:29 +00:00
|
|
|
// Set VIC Bank bits to output - all others to input
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #3^CHARSET/$4000
|
2018-03-25 21:40:38 +00:00
|
|
|
sta CIA2_PORT_A
|
2019-02-17 23:12:29 +00:00
|
|
|
// Set VIC Bank
|
|
|
|
// VIC Graphics Mode
|
2018-03-25 21:40:38 +00:00
|
|
|
lda #VIC_DEN|VIC_RSEL|3
|
2018-03-26 19:41:09 +00:00
|
|
|
sta VIC_CONTROL
|
2018-03-25 21:40:38 +00:00
|
|
|
lda #VIC_CSEL
|
2018-03-26 19:41:09 +00:00
|
|
|
sta VIC_CONTROL2
|
2019-02-17 23:12:29 +00:00
|
|
|
// VIC Memory Pointers
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #(CHARSET&$3fff)/$400
|
2018-03-26 19:41:09 +00:00
|
|
|
sta VIC_MEMORY
|
2018-04-01 10:32:45 +00:00
|
|
|
ldx #0
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Palette - default
|
2019-03-31 15:57:54 +00:00
|
|
|
b1:
|
2018-04-01 10:32:45 +00:00
|
|
|
lda DTV_PALETTE_DEFAULT,x
|
|
|
|
sta DTV_PALETTE,x
|
|
|
|
inx
|
|
|
|
cpx #$10
|
2019-03-31 15:57:54 +00:00
|
|
|
bne b1
|
2018-03-25 21:40:38 +00:00
|
|
|
lda #<COLS
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z c
|
2018-03-25 21:40:38 +00:00
|
|
|
lda #>COLS
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z c+1
|
2019-02-17 23:12:29 +00:00
|
|
|
// Char Colors
|
2019-08-25 20:21:56 +00:00
|
|
|
b2:
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z c+1
|
2018-03-25 21:40:38 +00:00
|
|
|
cmp #>COLS+$3e8
|
2019-08-25 20:21:56 +00:00
|
|
|
beq !b3+
|
|
|
|
jmp b3
|
|
|
|
!b3:
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z c
|
2018-03-25 21:40:38 +00:00
|
|
|
cmp #<COLS+$3e8
|
2019-08-25 20:21:56 +00:00
|
|
|
beq !b3+
|
|
|
|
jmp b3
|
|
|
|
!b3:
|
2019-02-17 23:12:29 +00:00
|
|
|
// Screen colors
|
2018-03-25 21:40:38 +00:00
|
|
|
lda #0
|
|
|
|
sta BGCOL
|
|
|
|
sta BORDERCOL
|
|
|
|
jsr print_set_screen
|
|
|
|
jsr print_cls
|
2018-03-26 19:41:09 +00:00
|
|
|
jsr print_str_lines
|
2019-08-07 09:27:55 +00:00
|
|
|
b5:
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_1
|
2018-03-25 21:40:38 +00:00
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2019-08-07 09:27:55 +00:00
|
|
|
beq b6
|
2018-03-28 22:37:04 +00:00
|
|
|
jsr mode_stdchar
|
2018-04-18 23:46:41 +00:00
|
|
|
rts
|
2019-08-07 09:27:55 +00:00
|
|
|
b6:
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_2
|
2018-03-27 08:01:28 +00:00
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2019-08-07 09:27:55 +00:00
|
|
|
beq b7
|
2018-03-28 22:37:04 +00:00
|
|
|
jsr mode_ecmchar
|
2019-04-02 06:28:13 +00:00
|
|
|
rts
|
2019-08-07 09:27:55 +00:00
|
|
|
b7:
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_3
|
2018-03-27 20:32:06 +00:00
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2019-08-07 09:27:55 +00:00
|
|
|
beq b8
|
2018-03-29 07:09:07 +00:00
|
|
|
jsr mode_mcchar
|
2019-04-02 06:28:13 +00:00
|
|
|
rts
|
2019-08-07 09:27:55 +00:00
|
|
|
b8:
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_4
|
2018-03-28 14:43:47 +00:00
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2019-08-07 09:27:55 +00:00
|
|
|
beq b9
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_stdbitmap
|
2019-04-02 06:28:13 +00:00
|
|
|
rts
|
2019-08-07 09:27:55 +00:00
|
|
|
b9:
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_6
|
2018-03-28 22:37:04 +00:00
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2019-08-07 09:27:55 +00:00
|
|
|
beq b10
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_hicolstdchar
|
2019-04-02 06:28:13 +00:00
|
|
|
rts
|
2019-08-07 09:27:55 +00:00
|
|
|
b10:
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_7
|
2018-03-28 22:37:04 +00:00
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2019-08-07 09:27:55 +00:00
|
|
|
beq b11
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_hicolecmchar
|
2019-04-02 06:28:13 +00:00
|
|
|
rts
|
2019-08-07 09:27:55 +00:00
|
|
|
b11:
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_8
|
2018-03-28 22:37:04 +00:00
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2019-08-07 09:27:55 +00:00
|
|
|
beq b12
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_hicolmcchar
|
2019-04-02 06:28:13 +00:00
|
|
|
rts
|
2019-08-07 09:27:55 +00:00
|
|
|
b12:
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_A
|
2018-03-29 06:49:51 +00:00
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2019-08-07 09:27:55 +00:00
|
|
|
beq b13
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_sixsfred2
|
2019-04-02 06:28:13 +00:00
|
|
|
rts
|
2019-08-07 09:27:55 +00:00
|
|
|
b13:
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_B
|
2018-03-29 06:49:51 +00:00
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2019-08-07 09:27:55 +00:00
|
|
|
beq b14
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_twoplanebitmap
|
2019-04-02 06:28:13 +00:00
|
|
|
rts
|
2019-08-07 09:27:55 +00:00
|
|
|
b14:
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_C
|
2018-03-29 07:09:07 +00:00
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2019-08-07 09:27:55 +00:00
|
|
|
beq b15
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_sixsfred
|
2019-04-02 06:28:13 +00:00
|
|
|
rts
|
2019-08-07 09:27:55 +00:00
|
|
|
b15:
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_D
|
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2019-08-07 09:27:55 +00:00
|
|
|
beq b16
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_8bpppixelcell
|
2019-04-02 06:28:13 +00:00
|
|
|
rts
|
2019-08-07 09:27:55 +00:00
|
|
|
b16:
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_E
|
2018-03-28 11:00:32 +00:00
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2019-08-07 09:27:55 +00:00
|
|
|
bne !b5+
|
|
|
|
jmp b5
|
|
|
|
!b5:
|
2018-03-28 11:00:32 +00:00
|
|
|
jsr mode_8bppchunkybmm
|
2019-04-02 06:28:13 +00:00
|
|
|
rts
|
2019-08-25 20:21:56 +00:00
|
|
|
b3:
|
|
|
|
lda #LIGHT_GREEN
|
|
|
|
ldy #0
|
|
|
|
sta (c),y
|
|
|
|
inc.z c
|
|
|
|
bne !+
|
|
|
|
inc.z c+1
|
|
|
|
!:
|
|
|
|
jmp b2
|
2018-03-28 11:00:32 +00:00
|
|
|
}
|
2019-02-17 23:12:29 +00:00
|
|
|
//Chunky 8bpp Bitmap Mode (BMM = 0, ECM/MCM/HICOL/LINEAR/CHUNK/COLDIS = 1)
|
|
|
|
// Resolution: 320x200
|
|
|
|
// Linear Adressing
|
|
|
|
// CharData/PlaneB Pixel Shifter (8):
|
|
|
|
// - 8bpp color PlaneB[7:0]
|
|
|
|
// To set up a linear video frame buffer the step size must be set to 8.
|
2018-03-28 11:00:32 +00:00
|
|
|
mode_8bppchunkybmm: {
|
2019-02-17 23:12:29 +00:00
|
|
|
// 8BPP Chunky Bitmap (contains 8bpp pixels)
|
2018-03-29 07:09:07 +00:00
|
|
|
.const PLANEB = $20000
|
2019-07-31 11:47:21 +00:00
|
|
|
.label _26 = 9
|
|
|
|
.label gfxb = $b
|
|
|
|
.label x = 4
|
|
|
|
.label y = $d
|
2018-04-01 01:58:07 +00:00
|
|
|
lda #DTV_HIGHCOLOR|DTV_LINEAR|DTV_CHUNKY|DTV_COLORRAM_OFF
|
2018-03-28 11:00:32 +00:00
|
|
|
sta DTV_CONTROL
|
2019-02-17 23:12:29 +00:00
|
|
|
// VIC Graphics Mode
|
2018-03-28 11:00:32 +00:00
|
|
|
lda #VIC_ECM|VIC_DEN|VIC_RSEL|3
|
|
|
|
sta VIC_CONTROL
|
|
|
|
lda #VIC_MCM|VIC_CSEL
|
|
|
|
sta VIC_CONTROL2
|
2019-02-17 23:12:29 +00:00
|
|
|
// Linear Graphics Plane B Counter
|
2018-03-28 11:00:32 +00:00
|
|
|
lda #0
|
2019-05-24 18:57:43 +00:00
|
|
|
sta DTV_PLANEB_START_LO
|
2018-03-28 11:00:32 +00:00
|
|
|
sta DTV_PLANEB_START_MI
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #<PLANEB>>$10
|
2018-03-28 11:00:32 +00:00
|
|
|
sta DTV_PLANEB_START_HI
|
|
|
|
lda #8
|
|
|
|
sta DTV_PLANEB_STEP
|
|
|
|
lda #0
|
|
|
|
sta DTV_PLANEB_MODULO_LO
|
|
|
|
sta DTV_PLANEB_MODULO_HI
|
2019-02-17 23:12:29 +00:00
|
|
|
// Border color
|
2018-03-28 11:00:32 +00:00
|
|
|
sta BORDERCOL
|
|
|
|
tax
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Palette - Grey Tones
|
2018-03-28 11:00:32 +00:00
|
|
|
b1:
|
|
|
|
txa
|
|
|
|
sta DTV_PALETTE,x
|
|
|
|
inx
|
|
|
|
cpx #$10
|
|
|
|
bne b1
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #PLANEB/$4000
|
2018-03-28 11:00:32 +00:00
|
|
|
jsr dtvSetCpuBankSegment1
|
2018-03-29 07:09:07 +00:00
|
|
|
ldx #PLANEB/$4000+1
|
2018-03-28 11:00:32 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z y
|
2018-03-28 11:00:32 +00:00
|
|
|
lda #<$4000
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z gfxb
|
2018-03-28 11:00:32 +00:00
|
|
|
lda #>$4000
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z gfxb+1
|
2019-03-29 23:15:53 +00:00
|
|
|
b3:
|
2019-06-02 22:44:46 +00:00
|
|
|
lda #<0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z x
|
|
|
|
sta.z x+1
|
2019-03-29 23:15:53 +00:00
|
|
|
b4:
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z gfxb+1
|
2018-03-28 11:00:32 +00:00
|
|
|
cmp #>$8000
|
2019-03-29 23:15:53 +00:00
|
|
|
bne b5
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z gfxb
|
2018-03-28 11:00:32 +00:00
|
|
|
cmp #<$8000
|
2019-03-29 23:15:53 +00:00
|
|
|
bne b5
|
2018-03-28 11:00:32 +00:00
|
|
|
txa
|
|
|
|
jsr dtvSetCpuBankSegment1
|
|
|
|
inx
|
|
|
|
lda #<$4000
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z gfxb
|
2018-03-28 11:00:32 +00:00
|
|
|
lda #>$4000
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z gfxb+1
|
2019-03-29 23:15:53 +00:00
|
|
|
b5:
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z y
|
2018-03-28 11:00:32 +00:00
|
|
|
clc
|
2019-08-07 19:00:19 +00:00
|
|
|
adc.z x
|
|
|
|
sta.z _26
|
2018-03-28 11:00:32 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
adc.z x+1
|
|
|
|
sta.z _26+1
|
|
|
|
lda.z _26
|
2018-03-28 11:00:32 +00:00
|
|
|
ldy #0
|
|
|
|
sta (gfxb),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z gfxb
|
2018-03-28 11:00:32 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z gfxb+1
|
2018-03-28 11:00:32 +00:00
|
|
|
!:
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z x
|
2018-03-28 11:00:32 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z x+1
|
2018-03-28 11:00:32 +00:00
|
|
|
!:
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z x+1
|
2018-03-28 11:00:32 +00:00
|
|
|
cmp #>$140
|
2019-03-29 23:15:53 +00:00
|
|
|
bne b4
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z x
|
2018-03-28 11:00:32 +00:00
|
|
|
cmp #<$140
|
2019-03-29 23:15:53 +00:00
|
|
|
bne b4
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z y
|
2019-03-26 22:49:44 +00:00
|
|
|
lda #$c8
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z y
|
2019-03-29 23:15:53 +00:00
|
|
|
bne b3
|
2018-03-28 11:00:32 +00:00
|
|
|
lda #$4000/$4000
|
|
|
|
jsr dtvSetCpuBankSegment1
|
2018-04-01 10:32:45 +00:00
|
|
|
lda #DTV_HIGHCOLOR|DTV_LINEAR|DTV_CHUNKY|DTV_COLORRAM_OFF
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z dtv_control
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_ctrl
|
|
|
|
rts
|
|
|
|
}
|
2019-02-17 23:12:29 +00:00
|
|
|
// Allow the user to control the DTV graphics using different keys
|
2018-04-01 01:58:07 +00:00
|
|
|
mode_ctrl: {
|
2019-02-17 16:53:19 +00:00
|
|
|
b1:
|
2019-02-17 23:12:29 +00:00
|
|
|
// Wait for the raster
|
2019-03-31 15:10:41 +00:00
|
|
|
b2:
|
2019-03-26 22:49:44 +00:00
|
|
|
lda #$ff
|
|
|
|
cmp RASTER
|
2019-03-31 15:10:41 +00:00
|
|
|
bne b2
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_SPACE
|
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2019-03-31 15:10:41 +00:00
|
|
|
beq b4
|
2018-04-18 23:46:41 +00:00
|
|
|
rts
|
2019-03-31 15:10:41 +00:00
|
|
|
b4:
|
2019-02-17 23:12:29 +00:00
|
|
|
// Read the current control byte
|
2019-08-07 19:00:19 +00:00
|
|
|
ldx.z dtv_control
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_L
|
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2019-03-31 15:10:41 +00:00
|
|
|
beq b5
|
2018-04-01 10:32:45 +00:00
|
|
|
txa
|
|
|
|
ora #DTV_LINEAR
|
|
|
|
tax
|
2019-03-31 15:10:41 +00:00
|
|
|
b5:
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_H
|
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2019-03-31 15:10:41 +00:00
|
|
|
beq b6
|
2018-04-01 10:32:45 +00:00
|
|
|
txa
|
|
|
|
ora #DTV_HIGHCOLOR
|
|
|
|
tax
|
2019-03-31 15:10:41 +00:00
|
|
|
b6:
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_O
|
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2019-03-31 15:10:41 +00:00
|
|
|
beq b7
|
2018-04-01 10:32:45 +00:00
|
|
|
txa
|
|
|
|
ora #DTV_OVERSCAN
|
|
|
|
tax
|
2019-03-31 15:10:41 +00:00
|
|
|
b7:
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_B
|
2018-03-28 11:00:32 +00:00
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2019-03-31 15:10:41 +00:00
|
|
|
beq b8
|
2018-04-01 10:32:45 +00:00
|
|
|
txa
|
|
|
|
ora #DTV_BORDER_OFF
|
|
|
|
tax
|
2019-03-31 15:10:41 +00:00
|
|
|
b8:
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_U
|
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2019-03-31 15:10:41 +00:00
|
|
|
beq b9
|
2018-04-01 10:32:45 +00:00
|
|
|
txa
|
|
|
|
ora #DTV_CHUNKY
|
|
|
|
tax
|
2019-03-31 15:10:41 +00:00
|
|
|
b9:
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_C
|
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2019-03-31 15:10:41 +00:00
|
|
|
beq b10
|
2018-04-01 10:32:45 +00:00
|
|
|
txa
|
|
|
|
ora #DTV_COLORRAM_OFF
|
|
|
|
tax
|
2019-03-31 15:10:41 +00:00
|
|
|
b10:
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_0
|
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2019-03-31 15:10:41 +00:00
|
|
|
beq b11
|
2018-04-01 10:32:45 +00:00
|
|
|
ldx #0
|
2019-03-31 15:10:41 +00:00
|
|
|
b11:
|
2019-08-07 19:00:19 +00:00
|
|
|
cpx.z dtv_control
|
2019-02-17 16:53:19 +00:00
|
|
|
beq b1
|
2019-08-07 19:00:19 +00:00
|
|
|
stx.z dtv_control
|
2018-04-01 10:32:45 +00:00
|
|
|
stx DTV_CONTROL
|
|
|
|
stx BORDERCOL
|
2019-02-17 16:53:19 +00:00
|
|
|
jmp b1
|
2018-03-28 11:00:32 +00:00
|
|
|
}
|
2019-02-17 23:12:29 +00:00
|
|
|
// Determines whether a specific key is currently pressed by accessing the matrix directly
|
|
|
|
// The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7)
|
|
|
|
// All keys exist as as KEY_XXX constants.
|
|
|
|
// Returns zero if the key is not pressed and a non-zero value if the key is currently pressed
|
2019-02-19 19:51:48 +00:00
|
|
|
// keyboard_key_pressed(byte register(Y) key)
|
2018-03-28 11:00:32 +00:00
|
|
|
keyboard_key_pressed: {
|
2019-07-31 11:47:21 +00:00
|
|
|
.label colidx = 6
|
2018-04-01 01:58:07 +00:00
|
|
|
tya
|
2018-03-28 11:00:32 +00:00
|
|
|
and #7
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z colidx
|
2018-04-01 01:58:07 +00:00
|
|
|
tya
|
2018-03-28 11:00:32 +00:00
|
|
|
lsr
|
|
|
|
lsr
|
|
|
|
lsr
|
2018-04-01 01:58:07 +00:00
|
|
|
tay
|
2018-03-28 11:00:32 +00:00
|
|
|
jsr keyboard_matrix_read
|
2019-08-07 19:00:19 +00:00
|
|
|
ldy.z colidx
|
2018-03-28 11:00:32 +00:00
|
|
|
and keyboard_matrix_col_bitmask,y
|
|
|
|
rts
|
|
|
|
}
|
2019-02-17 23:12:29 +00:00
|
|
|
// Read a single row of the keyboard matrix
|
|
|
|
// The row ID (0-7) of the keyboard matrix row to read. See the C64 key matrix for row IDs.
|
|
|
|
// Returns the keys pressed on the row as bits according to the C64 key matrix.
|
|
|
|
// Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write
|
|
|
|
// leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader.
|
2019-02-19 19:51:48 +00:00
|
|
|
// keyboard_matrix_read(byte register(Y) rowid)
|
2018-03-28 11:00:32 +00:00
|
|
|
keyboard_matrix_read: {
|
2018-04-01 01:58:07 +00:00
|
|
|
lda keyboard_matrix_row_bitmask,y
|
2018-03-28 11:00:32 +00:00
|
|
|
sta CIA1_PORT_A
|
|
|
|
lda CIA1_PORT_B
|
|
|
|
eor #$ff
|
|
|
|
rts
|
|
|
|
}
|
2019-02-17 23:12:29 +00:00
|
|
|
// Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff)
|
|
|
|
// This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff
|
|
|
|
// The actual memory addressed will be $4000*cpuSegmentIdx
|
2019-02-19 19:51:48 +00:00
|
|
|
// dtvSetCpuBankSegment1(byte register(A) cpuBankIdx)
|
2018-03-28 11:00:32 +00:00
|
|
|
dtvSetCpuBankSegment1: {
|
2019-02-17 23:12:29 +00:00
|
|
|
// Move CPU BANK 1 SEGMENT ($4000-$7fff)
|
2018-03-28 11:00:32 +00:00
|
|
|
.label cpuBank = $ff
|
|
|
|
sta cpuBank
|
|
|
|
.byte $32, $dd
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z $ff
|
2018-03-28 11:00:32 +00:00
|
|
|
.byte $32, $00
|
|
|
|
rts
|
2018-03-27 20:32:06 +00:00
|
|
|
}
|
2019-02-17 23:12:29 +00:00
|
|
|
//8bpp Pixel Cell Mode (BMM/COLDIS = 0, ECM/MCM/HICOL/LINEAR/CHUNK = 1)
|
|
|
|
//Pixel Cell Adressing
|
|
|
|
//CharData[8]: (PlaneA[21:0])
|
|
|
|
//GfxData[8]: (PlaneB[21:14] & CharData[7:0] & RowCounter[3:0] & PixelCounter[7:0] )
|
|
|
|
//GfxData Pixel Shifter (8):
|
|
|
|
//- 8bpp color GfxData[7:0]
|
|
|
|
//Pixel cell mode can be thought of as a text mode that uses a 8x8 pixel 8bpp font (64 bytes/char).
|
|
|
|
//The characters come from counter A and the font (or "cells") from counter B.
|
|
|
|
//Counter B step and modulo should be set to 0, counter A modulo to 0 and counter A step to 1 for normal operation.
|
2018-03-27 20:32:06 +00:00
|
|
|
mode_8bpppixelcell: {
|
2019-02-17 23:12:29 +00:00
|
|
|
// 8BPP Pixel Cell Screen (contains 40x25=1000 chars)
|
2018-03-29 07:09:07 +00:00
|
|
|
.label PLANEA = $3c00
|
2019-02-17 23:12:29 +00:00
|
|
|
// 8BPP Pixel Cell Charset (contains 256 64 byte chars)
|
2018-03-29 07:09:07 +00:00
|
|
|
.label PLANEB = $4000
|
2019-03-22 18:50:20 +00:00
|
|
|
.label CHARGEN = $d000
|
2019-07-31 11:47:21 +00:00
|
|
|
.label _15 = $e
|
2019-05-31 21:17:57 +00:00
|
|
|
.label gfxa = $b
|
2019-07-31 11:47:21 +00:00
|
|
|
.label ay = $d
|
|
|
|
.label bits = 6
|
|
|
|
.label chargen = 4
|
|
|
|
.label gfxb = 9
|
|
|
|
.label col = 7
|
|
|
|
.label cr = 3
|
|
|
|
.label ch = 2
|
2018-04-01 01:58:07 +00:00
|
|
|
lda #DTV_HIGHCOLOR|DTV_LINEAR|DTV_CHUNKY
|
2018-03-27 20:32:06 +00:00
|
|
|
sta DTV_CONTROL
|
2019-02-17 23:12:29 +00:00
|
|
|
// VIC Graphics Mode
|
2018-03-27 20:32:06 +00:00
|
|
|
lda #VIC_ECM|VIC_DEN|VIC_RSEL|3
|
|
|
|
sta VIC_CONTROL
|
|
|
|
lda #VIC_MCM|VIC_CSEL
|
|
|
|
sta VIC_CONTROL2
|
2019-02-17 23:12:29 +00:00
|
|
|
// Linear Graphics Plane A Counter
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #0
|
2018-03-27 20:32:06 +00:00
|
|
|
sta DTV_PLANEA_START_LO
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>PLANEA
|
2018-03-27 20:32:06 +00:00
|
|
|
sta DTV_PLANEA_START_MI
|
|
|
|
lda #0
|
|
|
|
sta DTV_PLANEA_START_HI
|
|
|
|
lda #1
|
|
|
|
sta DTV_PLANEA_STEP
|
|
|
|
lda #0
|
|
|
|
sta DTV_PLANEA_MODULO_LO
|
|
|
|
sta DTV_PLANEA_MODULO_HI
|
2019-02-17 23:12:29 +00:00
|
|
|
// Linear Graphics Plane B Counter
|
2018-03-27 20:32:06 +00:00
|
|
|
sta DTV_PLANEB_START_LO
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>PLANEB
|
2018-03-27 20:32:06 +00:00
|
|
|
sta DTV_PLANEB_START_MI
|
|
|
|
lda #0
|
|
|
|
sta DTV_PLANEB_START_HI
|
|
|
|
sta DTV_PLANEB_STEP
|
|
|
|
sta DTV_PLANEB_MODULO_LO
|
|
|
|
sta DTV_PLANEB_MODULO_HI
|
2019-02-17 23:12:29 +00:00
|
|
|
// Border color
|
2018-03-27 20:32:06 +00:00
|
|
|
sta BORDERCOL
|
|
|
|
tax
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Palette - Grey Tones
|
2018-03-27 20:32:06 +00:00
|
|
|
b1:
|
|
|
|
txa
|
|
|
|
sta DTV_PALETTE,x
|
|
|
|
inx
|
|
|
|
cpx #$10
|
|
|
|
bne b1
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<PLANEA
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z gfxa
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>PLANEA
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z gfxa+1
|
2018-03-27 20:32:06 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z ay
|
2019-03-31 15:10:41 +00:00
|
|
|
b2:
|
2019-03-29 23:15:53 +00:00
|
|
|
ldx #0
|
2019-03-31 15:10:41 +00:00
|
|
|
b3:
|
2018-03-27 20:32:06 +00:00
|
|
|
lda #$f
|
2019-08-07 19:00:19 +00:00
|
|
|
and.z ay
|
2018-03-27 20:32:06 +00:00
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z _15
|
2018-03-27 20:32:06 +00:00
|
|
|
txa
|
|
|
|
and #$f
|
2019-08-07 19:00:19 +00:00
|
|
|
ora.z _15
|
2018-03-27 20:32:06 +00:00
|
|
|
ldy #0
|
|
|
|
sta (gfxa),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z gfxa
|
2018-03-27 20:32:06 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z gfxa+1
|
2018-03-27 20:32:06 +00:00
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
2019-03-31 15:10:41 +00:00
|
|
|
bne b3
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z ay
|
2019-03-26 22:49:44 +00:00
|
|
|
lda #$19
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z ay
|
2019-03-31 15:10:41 +00:00
|
|
|
bne b2
|
2019-02-17 23:12:29 +00:00
|
|
|
// 8bpp cells for Plane B (charset) - ROM charset with 256 colors
|
2018-04-01 01:58:07 +00:00
|
|
|
lda #PROCPORT_RAM_CHARROM
|
2018-03-27 20:32:06 +00:00
|
|
|
sta PROCPORT
|
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z ch
|
|
|
|
sta.z col
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<PLANEB
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z gfxb
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>PLANEB
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z gfxb+1
|
2019-03-22 18:50:20 +00:00
|
|
|
lda #<CHARGEN
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z chargen
|
2019-03-22 18:50:20 +00:00
|
|
|
lda #>CHARGEN
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z chargen+1
|
2019-03-31 15:10:41 +00:00
|
|
|
b6:
|
2018-03-27 20:32:06 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z cr
|
2019-03-31 15:10:41 +00:00
|
|
|
b7:
|
2018-03-27 20:32:06 +00:00
|
|
|
ldy #0
|
|
|
|
lda (chargen),y
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z bits
|
|
|
|
inc.z chargen
|
2018-03-27 20:32:06 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z chargen+1
|
2018-03-27 20:32:06 +00:00
|
|
|
!:
|
|
|
|
ldx #0
|
2019-03-31 15:10:41 +00:00
|
|
|
b8:
|
2018-03-27 20:32:06 +00:00
|
|
|
lda #$80
|
2019-08-07 19:00:19 +00:00
|
|
|
and.z bits
|
2018-03-27 20:32:06 +00:00
|
|
|
cmp #0
|
2019-03-31 15:10:41 +00:00
|
|
|
beq b4
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z col
|
2019-03-31 15:10:41 +00:00
|
|
|
jmp b9
|
|
|
|
b4:
|
2018-03-27 20:32:06 +00:00
|
|
|
lda #0
|
2019-03-31 15:10:41 +00:00
|
|
|
b9:
|
2018-03-27 20:32:06 +00:00
|
|
|
ldy #0
|
|
|
|
sta (gfxb),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z gfxb
|
2018-03-27 20:32:06 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z gfxb+1
|
2018-03-27 20:32:06 +00:00
|
|
|
!:
|
2019-08-07 19:00:19 +00:00
|
|
|
asl.z bits
|
|
|
|
inc.z col
|
2018-03-27 20:32:06 +00:00
|
|
|
inx
|
|
|
|
cpx #8
|
2019-03-31 15:10:41 +00:00
|
|
|
bne b8
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z cr
|
2019-03-26 22:49:44 +00:00
|
|
|
lda #8
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z cr
|
2019-03-31 15:10:41 +00:00
|
|
|
bne b7
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z ch
|
|
|
|
lda.z ch
|
2018-12-18 23:33:27 +00:00
|
|
|
cmp #0
|
2019-03-31 15:10:41 +00:00
|
|
|
bne b6
|
2018-04-01 01:58:07 +00:00
|
|
|
lda #PROCPORT_RAM_IO
|
2018-03-27 20:32:06 +00:00
|
|
|
sta PROCPORT
|
2018-04-01 10:32:45 +00:00
|
|
|
lda #DTV_HIGHCOLOR|DTV_LINEAR|DTV_CHUNKY
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z dtv_control
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_ctrl
|
2018-03-27 20:32:06 +00:00
|
|
|
rts
|
|
|
|
}
|
2019-02-17 23:12:29 +00:00
|
|
|
// Sixs Fred Mode - 8bpp Packed Bitmap - Generated from the two DTV linear graphics plane counters
|
|
|
|
// Two Plane MultiColor Bitmap - 8bpp Packed Bitmap (CHUNK/COLDIS = 0, ECM/BMM/MCM/HICOL/LINEAR = 1)
|
|
|
|
// Resolution: 160x200
|
|
|
|
// Linear Adressing
|
|
|
|
// GfxData/PlaneA Pixel Shifter (2), CharData/PlaneB Pixel Shifter (2):
|
|
|
|
// - 8bpp color (ColorData[3:0],CharData/PlaneB[1:0], GfxData/PlaneA[1:0])
|
2018-03-27 08:01:28 +00:00
|
|
|
mode_sixsfred: {
|
2018-03-29 07:09:07 +00:00
|
|
|
.label PLANEA = $4000
|
|
|
|
.label PLANEB = $6000
|
|
|
|
.label COLORS = $8000
|
2019-07-31 11:47:21 +00:00
|
|
|
.label col = 4
|
|
|
|
.label cy = $d
|
|
|
|
.label gfxa = 9
|
|
|
|
.label ay = 2
|
|
|
|
.label gfxb = $b
|
|
|
|
.label by = 3
|
2018-04-01 01:58:07 +00:00
|
|
|
lda #DTV_HIGHCOLOR|DTV_LINEAR
|
2018-03-27 08:01:28 +00:00
|
|
|
sta DTV_CONTROL
|
2019-02-17 23:12:29 +00:00
|
|
|
// VIC Graphics Mode
|
2018-03-27 08:01:28 +00:00
|
|
|
lda #VIC_ECM|VIC_BMM|VIC_DEN|VIC_RSEL|3
|
|
|
|
sta VIC_CONTROL
|
|
|
|
lda #VIC_MCM|VIC_CSEL
|
|
|
|
sta VIC_CONTROL2
|
2019-02-17 23:12:29 +00:00
|
|
|
// Linear Graphics Plane A Counter
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #0
|
2018-03-27 08:01:28 +00:00
|
|
|
sta DTV_PLANEA_START_LO
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>PLANEA
|
2018-03-27 08:01:28 +00:00
|
|
|
sta DTV_PLANEA_START_MI
|
|
|
|
lda #0
|
|
|
|
sta DTV_PLANEA_START_HI
|
|
|
|
lda #1
|
|
|
|
sta DTV_PLANEA_STEP
|
|
|
|
lda #0
|
|
|
|
sta DTV_PLANEA_MODULO_LO
|
|
|
|
sta DTV_PLANEA_MODULO_HI
|
2019-02-17 23:12:29 +00:00
|
|
|
// Linear Graphics Plane B Counter
|
2018-03-27 08:01:28 +00:00
|
|
|
sta DTV_PLANEB_START_LO
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>PLANEB
|
2018-03-27 08:01:28 +00:00
|
|
|
sta DTV_PLANEB_START_MI
|
|
|
|
lda #0
|
|
|
|
sta DTV_PLANEB_START_HI
|
|
|
|
lda #1
|
|
|
|
sta DTV_PLANEB_STEP
|
|
|
|
lda #0
|
|
|
|
sta DTV_PLANEB_MODULO_LO
|
|
|
|
sta DTV_PLANEB_MODULO_HI
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Color Bank
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<COLORS/$400
|
2018-03-27 08:01:28 +00:00
|
|
|
sta DTV_COLOR_BANK_LO
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #0
|
2018-03-27 08:01:28 +00:00
|
|
|
sta DTV_COLOR_BANK_HI
|
2019-05-24 18:57:43 +00:00
|
|
|
tax
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Palette - Grey Tones
|
2018-03-27 08:01:28 +00:00
|
|
|
b1:
|
|
|
|
txa
|
|
|
|
sta DTV_PALETTE,x
|
|
|
|
inx
|
|
|
|
cpx #$10
|
|
|
|
bne b1
|
2019-02-17 23:12:29 +00:00
|
|
|
// Screen colors
|
2018-03-27 08:01:28 +00:00
|
|
|
lda #0
|
|
|
|
sta BORDERCOL
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<COLORS
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z col
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>COLORS
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z col+1
|
2018-03-27 08:01:28 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z cy
|
2018-03-27 08:01:28 +00:00
|
|
|
b3:
|
2019-03-29 23:15:53 +00:00
|
|
|
ldx #0
|
|
|
|
b4:
|
2018-03-27 08:01:28 +00:00
|
|
|
txa
|
|
|
|
clc
|
2019-08-07 19:00:19 +00:00
|
|
|
adc.z cy
|
2018-03-27 08:01:28 +00:00
|
|
|
and #$f
|
|
|
|
ldy #0
|
|
|
|
sta (col),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z col
|
2018-03-27 08:01:28 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z col+1
|
2018-03-27 08:01:28 +00:00
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
2019-03-29 23:15:53 +00:00
|
|
|
bne b4
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z cy
|
2019-03-26 22:49:44 +00:00
|
|
|
lda #$19
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z cy
|
2019-03-29 23:15:53 +00:00
|
|
|
bne b3
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<PLANEA
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z gfxa
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>PLANEA
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z gfxa+1
|
2018-03-27 08:01:28 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z ay
|
2019-03-31 15:10:41 +00:00
|
|
|
b6:
|
2018-03-27 08:01:28 +00:00
|
|
|
ldx #0
|
2019-03-31 15:10:41 +00:00
|
|
|
b7:
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z ay
|
2018-03-27 08:01:28 +00:00
|
|
|
lsr
|
|
|
|
and #3
|
|
|
|
tay
|
|
|
|
lda row_bitmask,y
|
|
|
|
ldy #0
|
|
|
|
sta (gfxa),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z gfxa
|
2018-03-27 08:01:28 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z gfxa+1
|
2018-03-27 08:01:28 +00:00
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
2019-03-31 15:10:41 +00:00
|
|
|
bne b7
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z ay
|
2019-03-26 22:49:44 +00:00
|
|
|
lda #$c8
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z ay
|
2019-03-31 15:10:41 +00:00
|
|
|
bne b6
|
2018-03-27 08:01:28 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z by
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<PLANEB
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z gfxb
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>PLANEB
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z gfxb+1
|
2019-03-31 15:10:41 +00:00
|
|
|
b9:
|
2018-03-27 08:01:28 +00:00
|
|
|
ldx #0
|
2019-03-31 15:10:41 +00:00
|
|
|
b10:
|
2018-03-27 08:01:28 +00:00
|
|
|
lda #$1b
|
|
|
|
ldy #0
|
|
|
|
sta (gfxb),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z gfxb
|
2018-03-27 08:01:28 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z gfxb+1
|
2018-03-27 08:01:28 +00:00
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
2019-03-31 15:10:41 +00:00
|
|
|
bne b10
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z by
|
2019-03-26 22:49:44 +00:00
|
|
|
lda #$c8
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z by
|
2019-03-31 15:10:41 +00:00
|
|
|
bne b9
|
2018-04-01 10:32:45 +00:00
|
|
|
lda #DTV_HIGHCOLOR|DTV_LINEAR
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z dtv_control
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_ctrl
|
2018-03-27 08:01:28 +00:00
|
|
|
rts
|
|
|
|
row_bitmask: .byte 0, $55, $aa, $ff
|
|
|
|
}
|
2019-02-17 23:12:29 +00:00
|
|
|
// Two Plane Bitmap - generated from the two DTV linear graphics plane counters
|
|
|
|
// Two Plane Bitmap Mode (CHUNK/COLDIS/MCM = 0, ECM/BMM/HICOL/LINEAR = 1)
|
|
|
|
// Resolution: 320x200
|
|
|
|
// Linear Adressing
|
|
|
|
// GfxData/PlaneA Pixel Shifter (1), CharData/PlaneB Pixel Shifter (1):
|
|
|
|
// - Plane A = 0 Plane B = 0: 8bpp BgColor0[7:0]
|
|
|
|
// - Plane A = 0 Plane B = 1: 8bpp "0000" & ColorData[7:4]
|
|
|
|
// - Plane A = 1 Plane B = 0: 8bpp "0000" & ColorData[3:0]
|
|
|
|
// - Plane A = 1 Plane B = 1: 8bpp BgColor1[7:0]
|
2018-03-25 21:40:38 +00:00
|
|
|
mode_twoplanebitmap: {
|
2018-03-29 07:09:07 +00:00
|
|
|
.label PLANEA = $4000
|
|
|
|
.label PLANEB = $6000
|
|
|
|
.label COLORS = $8000
|
2019-07-31 11:47:21 +00:00
|
|
|
.label _17 = $e
|
|
|
|
.label col = $b
|
|
|
|
.label cy = 6
|
|
|
|
.label gfxa = 9
|
|
|
|
.label ay = 7
|
|
|
|
.label gfxb = 4
|
|
|
|
.label by = 2
|
2018-04-01 01:58:07 +00:00
|
|
|
lda #DTV_HIGHCOLOR|DTV_LINEAR
|
2018-03-25 21:40:38 +00:00
|
|
|
sta DTV_CONTROL
|
2019-02-17 23:12:29 +00:00
|
|
|
// VIC Graphics Mode
|
2018-03-25 21:40:38 +00:00
|
|
|
lda #VIC_ECM|VIC_BMM|VIC_DEN|VIC_RSEL|3
|
2018-03-26 19:41:09 +00:00
|
|
|
sta VIC_CONTROL
|
2018-03-25 21:40:38 +00:00
|
|
|
lda #VIC_CSEL
|
2018-03-26 19:41:09 +00:00
|
|
|
sta VIC_CONTROL2
|
2019-02-17 23:12:29 +00:00
|
|
|
// Linear Graphics Plane A Counter
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #0
|
2018-03-25 21:40:38 +00:00
|
|
|
sta DTV_PLANEA_START_LO
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>PLANEA
|
2018-03-25 21:40:38 +00:00
|
|
|
sta DTV_PLANEA_START_MI
|
|
|
|
lda #0
|
|
|
|
sta DTV_PLANEA_START_HI
|
|
|
|
lda #1
|
|
|
|
sta DTV_PLANEA_STEP
|
|
|
|
lda #0
|
|
|
|
sta DTV_PLANEA_MODULO_LO
|
|
|
|
sta DTV_PLANEA_MODULO_HI
|
2019-02-17 23:12:29 +00:00
|
|
|
// Linear Graphics Plane B Counter
|
2018-03-25 21:40:38 +00:00
|
|
|
sta DTV_PLANEB_START_LO
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>PLANEB
|
2018-03-25 21:40:38 +00:00
|
|
|
sta DTV_PLANEB_START_MI
|
|
|
|
lda #0
|
|
|
|
sta DTV_PLANEB_START_HI
|
|
|
|
lda #1
|
|
|
|
sta DTV_PLANEB_STEP
|
|
|
|
lda #0
|
|
|
|
sta DTV_PLANEB_MODULO_LO
|
|
|
|
sta DTV_PLANEB_MODULO_HI
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Color Bank
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<COLORS/$400
|
2018-03-26 21:49:07 +00:00
|
|
|
sta DTV_COLOR_BANK_LO
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #0
|
2018-03-26 21:49:07 +00:00
|
|
|
sta DTV_COLOR_BANK_HI
|
2019-05-24 18:57:43 +00:00
|
|
|
tax
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Palette - Grey Tones
|
2018-03-26 21:49:07 +00:00
|
|
|
b1:
|
2018-03-28 13:21:22 +00:00
|
|
|
txa
|
2018-03-26 21:49:07 +00:00
|
|
|
sta DTV_PALETTE,x
|
2018-03-28 13:21:22 +00:00
|
|
|
inx
|
|
|
|
cpx #$10
|
2018-03-26 21:49:07 +00:00
|
|
|
bne b1
|
2019-02-17 23:12:29 +00:00
|
|
|
// Screen colors
|
2018-03-26 21:49:07 +00:00
|
|
|
lda #0
|
2018-03-25 21:40:38 +00:00
|
|
|
sta BORDERCOL
|
2018-03-26 21:49:07 +00:00
|
|
|
lda #$70
|
2018-03-25 21:40:38 +00:00
|
|
|
sta BGCOL1
|
2019-02-17 23:12:29 +00:00
|
|
|
// Color for bits 00
|
2018-03-26 21:49:07 +00:00
|
|
|
lda #$d4
|
2018-03-25 21:40:38 +00:00
|
|
|
sta BGCOL2
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<COLORS
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z col
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>COLORS
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z col+1
|
2018-03-26 21:49:07 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z cy
|
2018-03-26 21:49:07 +00:00
|
|
|
b3:
|
2019-03-29 23:15:53 +00:00
|
|
|
ldx #0
|
|
|
|
b4:
|
2018-03-26 21:49:07 +00:00
|
|
|
lda #$f
|
2019-08-07 19:00:19 +00:00
|
|
|
and.z cy
|
2018-03-26 21:49:07 +00:00
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z _17
|
2018-03-26 21:49:07 +00:00
|
|
|
txa
|
|
|
|
and #$f
|
2019-08-07 19:00:19 +00:00
|
|
|
ora.z _17
|
2018-03-25 21:40:38 +00:00
|
|
|
ldy #0
|
2018-03-26 21:49:07 +00:00
|
|
|
sta (col),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z col
|
2018-03-25 21:40:38 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z col+1
|
2018-03-25 21:40:38 +00:00
|
|
|
!:
|
2018-03-26 21:49:07 +00:00
|
|
|
inx
|
|
|
|
cpx #$28
|
2019-03-29 23:15:53 +00:00
|
|
|
bne b4
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z cy
|
2019-03-26 22:49:44 +00:00
|
|
|
lda #$19
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z cy
|
2019-03-29 23:15:53 +00:00
|
|
|
bne b3
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<PLANEA
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z gfxa
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>PLANEA
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z gfxa+1
|
2018-03-25 21:40:38 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z ay
|
2019-03-31 15:10:41 +00:00
|
|
|
b6:
|
2018-03-25 21:40:38 +00:00
|
|
|
ldx #0
|
2019-03-31 15:10:41 +00:00
|
|
|
b7:
|
2018-03-25 21:40:38 +00:00
|
|
|
lda #4
|
2019-08-07 19:00:19 +00:00
|
|
|
and.z ay
|
2018-03-25 21:40:38 +00:00
|
|
|
cmp #0
|
2019-03-31 15:10:41 +00:00
|
|
|
beq b8
|
2018-04-21 19:38:30 +00:00
|
|
|
lda #$ff
|
|
|
|
ldy #0
|
2018-03-25 21:40:38 +00:00
|
|
|
sta (gfxa),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z gfxa
|
2018-03-25 21:40:38 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z gfxa+1
|
2018-03-25 21:40:38 +00:00
|
|
|
!:
|
2019-03-31 15:10:41 +00:00
|
|
|
b9:
|
2018-03-25 21:40:38 +00:00
|
|
|
inx
|
|
|
|
cpx #$28
|
2019-03-31 15:10:41 +00:00
|
|
|
bne b7
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z ay
|
2019-03-26 22:49:44 +00:00
|
|
|
lda #$c8
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z ay
|
2019-03-31 15:10:41 +00:00
|
|
|
bne b6
|
2018-03-25 21:40:38 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z by
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<PLANEB
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z gfxb
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>PLANEB
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z gfxb+1
|
2019-03-31 15:10:41 +00:00
|
|
|
b12:
|
2018-03-25 21:40:38 +00:00
|
|
|
ldx #0
|
2019-03-31 15:10:41 +00:00
|
|
|
b13:
|
2018-03-25 21:40:38 +00:00
|
|
|
lda #$f
|
|
|
|
ldy #0
|
|
|
|
sta (gfxb),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z gfxb
|
2018-03-25 21:40:38 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z gfxb+1
|
2018-03-25 21:40:38 +00:00
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
2019-03-31 15:10:41 +00:00
|
|
|
bne b13
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z by
|
2019-03-26 22:49:44 +00:00
|
|
|
lda #$c8
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z by
|
2019-03-31 15:10:41 +00:00
|
|
|
bne b12
|
2018-04-01 10:32:45 +00:00
|
|
|
lda #DTV_HIGHCOLOR|DTV_LINEAR
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z dtv_control
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_ctrl
|
2018-03-25 21:40:38 +00:00
|
|
|
rts
|
2019-03-31 15:10:41 +00:00
|
|
|
b8:
|
2018-04-21 19:38:30 +00:00
|
|
|
lda #0
|
|
|
|
tay
|
2018-03-25 21:40:38 +00:00
|
|
|
sta (gfxa),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z gfxa
|
2018-03-25 21:40:38 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z gfxa+1
|
2018-03-25 21:40:38 +00:00
|
|
|
!:
|
2019-03-31 15:10:41 +00:00
|
|
|
jmp b9
|
2018-03-25 21:40:38 +00:00
|
|
|
}
|
2019-02-17 23:12:29 +00:00
|
|
|
// Sixs Fred Mode 2 - 8bpp Packed Bitmap - Generated from the two DTV linear graphics plane counters
|
|
|
|
// Two Plane MultiColor Bitmap - 8bpp Packed Bitmap (CHUNK/COLDIS/HICOL = 0, ECM/BMM/MCM/LINEAR = 1)
|
|
|
|
// Resolution: 160x200
|
|
|
|
// Linear Adressing
|
|
|
|
// PlaneA Pixel Shifter (2), PlaneB Pixel Shifter (2):
|
|
|
|
// - 8bpp color (PlaneB[1:0],ColorData[5:4],PlaneA[1:0],ColorData[1:0])
|
2018-03-28 14:43:47 +00:00
|
|
|
mode_sixsfred2: {
|
2018-03-29 07:09:07 +00:00
|
|
|
.label PLANEA = $4000
|
|
|
|
.label PLANEB = $6000
|
|
|
|
.label COLORS = $8000
|
2019-07-31 11:47:21 +00:00
|
|
|
.label _16 = 7
|
|
|
|
.label col = 9
|
|
|
|
.label cy = 2
|
|
|
|
.label gfxa = 4
|
|
|
|
.label ay = 3
|
|
|
|
.label gfxb = $b
|
|
|
|
.label by = 6
|
2018-04-01 01:58:07 +00:00
|
|
|
lda #DTV_LINEAR
|
2018-03-28 14:43:47 +00:00
|
|
|
sta DTV_CONTROL
|
2019-02-17 23:12:29 +00:00
|
|
|
// VIC Graphics Mode
|
2018-03-28 14:43:47 +00:00
|
|
|
lda #VIC_ECM|VIC_BMM|VIC_DEN|VIC_RSEL|3
|
|
|
|
sta VIC_CONTROL
|
|
|
|
lda #VIC_MCM|VIC_CSEL
|
|
|
|
sta VIC_CONTROL2
|
2019-02-17 23:12:29 +00:00
|
|
|
// Linear Graphics Plane A Counter
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #0
|
2018-03-28 14:43:47 +00:00
|
|
|
sta DTV_PLANEA_START_LO
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>PLANEA
|
2018-03-28 14:43:47 +00:00
|
|
|
sta DTV_PLANEA_START_MI
|
|
|
|
lda #0
|
|
|
|
sta DTV_PLANEA_START_HI
|
|
|
|
lda #1
|
|
|
|
sta DTV_PLANEA_STEP
|
|
|
|
lda #0
|
|
|
|
sta DTV_PLANEA_MODULO_LO
|
|
|
|
sta DTV_PLANEA_MODULO_HI
|
2019-02-17 23:12:29 +00:00
|
|
|
// Linear Graphics Plane B Counter
|
2018-03-28 14:43:47 +00:00
|
|
|
sta DTV_PLANEB_START_LO
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>PLANEB
|
2018-03-28 14:43:47 +00:00
|
|
|
sta DTV_PLANEB_START_MI
|
|
|
|
lda #0
|
|
|
|
sta DTV_PLANEB_START_HI
|
|
|
|
lda #1
|
|
|
|
sta DTV_PLANEB_STEP
|
|
|
|
lda #0
|
|
|
|
sta DTV_PLANEB_MODULO_LO
|
|
|
|
sta DTV_PLANEB_MODULO_HI
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Color Bank
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<COLORS/$400
|
2018-03-28 14:43:47 +00:00
|
|
|
sta DTV_COLOR_BANK_LO
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #0
|
2018-03-28 14:43:47 +00:00
|
|
|
sta DTV_COLOR_BANK_HI
|
2019-05-24 18:57:43 +00:00
|
|
|
tax
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Palette - Grey Tones
|
2018-03-28 14:43:47 +00:00
|
|
|
b1:
|
|
|
|
txa
|
|
|
|
sta DTV_PALETTE,x
|
|
|
|
inx
|
|
|
|
cpx #$10
|
|
|
|
bne b1
|
2019-02-17 23:12:29 +00:00
|
|
|
// Screen colors
|
2018-03-28 14:43:47 +00:00
|
|
|
lda #0
|
|
|
|
sta BORDERCOL
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<COLORS
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z col
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>COLORS
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z col+1
|
2018-03-28 14:43:47 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z cy
|
2018-03-28 14:43:47 +00:00
|
|
|
b3:
|
2019-03-29 23:15:53 +00:00
|
|
|
ldx #0
|
|
|
|
b4:
|
2018-03-28 14:43:47 +00:00
|
|
|
txa
|
|
|
|
and #3
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z _16
|
2018-03-28 14:43:47 +00:00
|
|
|
lda #3
|
2019-08-07 19:00:19 +00:00
|
|
|
and.z cy
|
|
|
|
ora.z _16
|
2018-03-28 14:43:47 +00:00
|
|
|
ldy #0
|
|
|
|
sta (col),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z col
|
2018-03-28 14:43:47 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z col+1
|
2018-03-28 14:43:47 +00:00
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
2019-03-29 23:15:53 +00:00
|
|
|
bne b4
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z cy
|
2019-03-26 22:49:44 +00:00
|
|
|
lda #$19
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z cy
|
2019-03-29 23:15:53 +00:00
|
|
|
bne b3
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<PLANEA
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z gfxa
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>PLANEA
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z gfxa+1
|
2018-03-28 14:43:47 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z ay
|
2019-03-31 15:10:41 +00:00
|
|
|
b6:
|
2018-03-28 14:43:47 +00:00
|
|
|
ldx #0
|
2019-03-31 15:10:41 +00:00
|
|
|
b7:
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z ay
|
2018-03-28 14:43:47 +00:00
|
|
|
lsr
|
|
|
|
and #3
|
|
|
|
tay
|
|
|
|
lda row_bitmask,y
|
|
|
|
ldy #0
|
|
|
|
sta (gfxa),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z gfxa
|
2018-03-28 14:43:47 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z gfxa+1
|
2018-03-28 14:43:47 +00:00
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
2019-03-31 15:10:41 +00:00
|
|
|
bne b7
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z ay
|
2019-03-26 22:49:44 +00:00
|
|
|
lda #$c8
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z ay
|
2019-03-31 15:10:41 +00:00
|
|
|
bne b6
|
2018-03-28 14:43:47 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z by
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<PLANEB
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z gfxb
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>PLANEB
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z gfxb+1
|
2019-03-31 15:10:41 +00:00
|
|
|
b9:
|
2018-03-28 14:43:47 +00:00
|
|
|
ldx #0
|
2019-03-31 15:10:41 +00:00
|
|
|
b10:
|
2018-03-28 14:43:47 +00:00
|
|
|
lda #$1b
|
|
|
|
ldy #0
|
|
|
|
sta (gfxb),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z gfxb
|
2018-03-28 14:43:47 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z gfxb+1
|
2018-03-28 14:43:47 +00:00
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
2019-03-31 15:10:41 +00:00
|
|
|
bne b10
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z by
|
2019-03-26 22:49:44 +00:00
|
|
|
lda #$c8
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z by
|
2019-03-31 15:10:41 +00:00
|
|
|
bne b9
|
2018-04-01 10:32:45 +00:00
|
|
|
lda #DTV_LINEAR
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z dtv_control
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_ctrl
|
2018-03-28 14:43:47 +00:00
|
|
|
rts
|
|
|
|
row_bitmask: .byte 0, $55, $aa, $ff
|
|
|
|
}
|
2019-02-17 23:12:29 +00:00
|
|
|
// High Color Multicolor Character Mode (LINEAR/CHUNK/COLDIS/BMM/ECM = 0, MCM/HICOL = 1)
|
|
|
|
// Resolution: 160x200 (320x200)
|
|
|
|
// Normal VIC Adressing:
|
|
|
|
// VicGfxData[16]: ( VicBank[1:0] & CharBase[2:0] & CharData[7:0] & RowCounter[2:0] )
|
|
|
|
//GfxData Pixel Shifter (1) if ColorData[3:3] = 0:
|
|
|
|
// - 0: 8bpp BgColor0[7:0]
|
|
|
|
// - 1: 8bpp ColorData[7:4] "0" & Color[2:0]
|
|
|
|
//GfxData Pixel Shifter (2) if ColorData[3:3] = 1:
|
|
|
|
// - 00: 8bpp BgColor0[7:0]
|
|
|
|
// - 01: 8bpp BgColor1[7:0]
|
|
|
|
// - 10: 8bpp BgColor2[7:0]
|
|
|
|
// - 11: 8bpp ColorData[7:4] "0" & Color[2:0]
|
2018-03-29 07:09:07 +00:00
|
|
|
mode_hicolmcchar: {
|
|
|
|
.label SCREEN = $8000
|
|
|
|
.label CHARSET = $9000
|
2019-02-17 23:12:29 +00:00
|
|
|
// Charset ROM
|
2018-03-29 07:09:07 +00:00
|
|
|
.label COLORS = $8400
|
2019-07-31 11:47:21 +00:00
|
|
|
.label _27 = 7
|
|
|
|
.label col = $b
|
|
|
|
.label ch = 4
|
|
|
|
.label cy = 3
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Graphics Bank
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #0
|
2018-03-29 06:49:51 +00:00
|
|
|
sta DTV_GRAPHICS_VIC_BANK
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Color Bank
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #<COLORS/$400
|
2018-03-29 06:49:51 +00:00
|
|
|
sta DTV_COLOR_BANK_LO
|
|
|
|
lda #0
|
|
|
|
sta DTV_COLOR_BANK_HI
|
2018-04-01 01:58:07 +00:00
|
|
|
lda #DTV_HIGHCOLOR
|
2018-03-29 06:49:51 +00:00
|
|
|
sta DTV_CONTROL
|
2019-02-17 23:12:29 +00:00
|
|
|
// VIC Graphics Bank
|
2018-03-29 06:49:51 +00:00
|
|
|
lda #3
|
|
|
|
sta CIA2_PORT_A_DDR
|
2019-02-17 23:12:29 +00:00
|
|
|
// Set VIC Bank bits to output - all others to input
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #3^CHARSET/$4000
|
2018-03-29 06:49:51 +00:00
|
|
|
sta CIA2_PORT_A
|
2019-02-17 23:12:29 +00:00
|
|
|
// Set VIC Bank
|
|
|
|
// VIC Graphics Mode
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #VIC_DEN|VIC_RSEL|3
|
2018-03-29 06:49:51 +00:00
|
|
|
sta VIC_CONTROL
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #VIC_CSEL|VIC_MCM
|
2018-03-29 06:49:51 +00:00
|
|
|
sta VIC_CONTROL2
|
2019-02-17 23:12:29 +00:00
|
|
|
// VIC Memory Pointers
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #(CHARSET&$3fff)/$400
|
2018-03-29 06:49:51 +00:00
|
|
|
sta VIC_MEMORY
|
|
|
|
ldx #0
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Palette - Grey Tones
|
2018-03-29 06:49:51 +00:00
|
|
|
b1:
|
|
|
|
txa
|
|
|
|
sta DTV_PALETTE,x
|
|
|
|
inx
|
|
|
|
cpx #$10
|
|
|
|
bne b1
|
2019-02-17 23:12:29 +00:00
|
|
|
// Screen colors
|
2018-03-29 06:49:51 +00:00
|
|
|
lda #0
|
|
|
|
sta BORDERCOL
|
|
|
|
lda #$50
|
|
|
|
sta BGCOL1
|
|
|
|
lda #$54
|
|
|
|
sta BGCOL2
|
|
|
|
lda #$58
|
|
|
|
sta BGCOL3
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<SCREEN
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z ch
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>SCREEN
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z ch+1
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<COLORS
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z col
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>COLORS
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z col+1
|
2018-03-29 06:49:51 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z cy
|
2018-03-29 06:49:51 +00:00
|
|
|
b3:
|
2019-03-29 23:15:53 +00:00
|
|
|
ldx #0
|
|
|
|
b4:
|
2018-03-29 06:49:51 +00:00
|
|
|
lda #$f
|
2019-08-07 19:00:19 +00:00
|
|
|
and.z cy
|
2018-03-29 06:49:51 +00:00
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z _27
|
2018-03-29 06:49:51 +00:00
|
|
|
txa
|
|
|
|
and #$f
|
2019-08-07 19:00:19 +00:00
|
|
|
ora.z _27
|
2018-03-29 06:49:51 +00:00
|
|
|
ldy #0
|
|
|
|
sta (col),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z col
|
2018-03-29 06:49:51 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z col+1
|
2018-03-29 06:49:51 +00:00
|
|
|
!:
|
2018-03-29 07:09:07 +00:00
|
|
|
ldy #0
|
|
|
|
sta (ch),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z ch
|
2018-03-29 07:09:07 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z ch+1
|
2018-03-29 07:09:07 +00:00
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
2019-03-29 23:15:53 +00:00
|
|
|
bne b4
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z cy
|
2019-03-26 22:49:44 +00:00
|
|
|
lda #$19
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z cy
|
2019-03-29 23:15:53 +00:00
|
|
|
bne b3
|
2018-04-01 10:32:45 +00:00
|
|
|
lda #DTV_HIGHCOLOR
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z dtv_control
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_ctrl
|
2018-03-29 07:09:07 +00:00
|
|
|
rts
|
|
|
|
}
|
2019-02-17 23:12:29 +00:00
|
|
|
// High Color Extended Background Color Character Mode (LINEAR/CHUNK/COLDIS/MCM/BMM = 0, ECM/HICOL = 1)
|
|
|
|
// Resolution: 320x200
|
|
|
|
// Normal VIC Adressing:
|
|
|
|
// VicGfxData[16]: ( VicBank[1:0] & CharBase[2:0] & "00" & CharData[5:0] & RowCounter[2:0] )
|
|
|
|
// GfxData Pixel Shifter (1)
|
|
|
|
// - 0: 8bpp Background Color
|
|
|
|
// - CharData[7:6] 00: 8bpp BgColor0[7:0]
|
|
|
|
// - CharData[7:6] 01: 8bpp BgColor1[7:0]
|
|
|
|
// - CharData[7:6] 10: 8bpp BgColor2[7:0]
|
|
|
|
// - CharData[7:6] 11: 8bpp BgColor3[7:0]
|
|
|
|
// - 1: 8bpp ColorData[7:0]
|
2018-03-29 07:09:07 +00:00
|
|
|
mode_hicolecmchar: {
|
|
|
|
.label SCREEN = $8000
|
|
|
|
.label CHARSET = $9000
|
2019-02-17 23:12:29 +00:00
|
|
|
// Charset ROM
|
2018-03-29 07:09:07 +00:00
|
|
|
.label COLORS = $8400
|
2019-07-31 11:47:21 +00:00
|
|
|
.label _27 = 8
|
|
|
|
.label col = 4
|
|
|
|
.label ch = $b
|
|
|
|
.label cy = 6
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Graphics Bank
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #0
|
2018-03-29 07:09:07 +00:00
|
|
|
sta DTV_GRAPHICS_VIC_BANK
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Color Bank
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #<COLORS/$400
|
2018-03-29 07:09:07 +00:00
|
|
|
sta DTV_COLOR_BANK_LO
|
|
|
|
lda #0
|
|
|
|
sta DTV_COLOR_BANK_HI
|
2018-04-01 01:58:07 +00:00
|
|
|
lda #DTV_HIGHCOLOR
|
2018-03-29 07:09:07 +00:00
|
|
|
sta DTV_CONTROL
|
2019-02-17 23:12:29 +00:00
|
|
|
// VIC Graphics Bank
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #3
|
|
|
|
sta CIA2_PORT_A_DDR
|
2019-02-17 23:12:29 +00:00
|
|
|
// Set VIC Bank bits to output - all others to input
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #3^CHARSET/$4000
|
|
|
|
sta CIA2_PORT_A
|
2019-02-17 23:12:29 +00:00
|
|
|
// Set VIC Bank
|
|
|
|
// VIC Graphics Mode
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #VIC_DEN|VIC_RSEL|VIC_ECM|3
|
|
|
|
sta VIC_CONTROL
|
|
|
|
lda #VIC_CSEL
|
|
|
|
sta VIC_CONTROL2
|
2019-02-17 23:12:29 +00:00
|
|
|
// VIC Memory Pointers
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #(CHARSET&$3fff)/$400
|
2018-03-29 07:09:07 +00:00
|
|
|
sta VIC_MEMORY
|
|
|
|
ldx #0
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Palette - Grey Tones
|
2018-03-29 07:09:07 +00:00
|
|
|
b1:
|
|
|
|
txa
|
|
|
|
sta DTV_PALETTE,x
|
|
|
|
inx
|
|
|
|
cpx #$10
|
|
|
|
bne b1
|
2019-02-17 23:12:29 +00:00
|
|
|
// Screen colors
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #0
|
|
|
|
sta BORDERCOL
|
|
|
|
lda #$50
|
|
|
|
sta BGCOL1
|
|
|
|
lda #$54
|
|
|
|
sta BGCOL2
|
|
|
|
lda #$58
|
|
|
|
sta BGCOL3
|
|
|
|
lda #$5c
|
|
|
|
sta BGCOL4
|
|
|
|
lda #<SCREEN
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z ch
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>SCREEN
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z ch+1
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<COLORS
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z col
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>COLORS
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z col+1
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z cy
|
2018-03-29 07:09:07 +00:00
|
|
|
b3:
|
2019-03-29 23:15:53 +00:00
|
|
|
ldx #0
|
|
|
|
b4:
|
2018-03-29 06:49:51 +00:00
|
|
|
lda #$f
|
2019-08-07 19:00:19 +00:00
|
|
|
and.z cy
|
2018-03-29 06:49:51 +00:00
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z _27
|
2018-03-29 06:49:51 +00:00
|
|
|
txa
|
|
|
|
and #$f
|
2019-08-07 19:00:19 +00:00
|
|
|
ora.z _27
|
2018-03-29 07:09:07 +00:00
|
|
|
ldy #0
|
|
|
|
sta (col),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z col
|
2018-03-29 07:09:07 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z col+1
|
2018-03-29 07:09:07 +00:00
|
|
|
!:
|
2018-03-29 06:49:51 +00:00
|
|
|
ldy #0
|
|
|
|
sta (ch),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z ch
|
2018-03-29 06:49:51 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z ch+1
|
2018-03-29 06:49:51 +00:00
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
2019-03-29 23:15:53 +00:00
|
|
|
bne b4
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z cy
|
2019-03-26 22:49:44 +00:00
|
|
|
lda #$19
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z cy
|
2019-03-29 23:15:53 +00:00
|
|
|
bne b3
|
2018-04-01 10:32:45 +00:00
|
|
|
lda #DTV_HIGHCOLOR
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z dtv_control
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_ctrl
|
2018-03-29 06:49:51 +00:00
|
|
|
rts
|
|
|
|
}
|
2019-02-17 23:12:29 +00:00
|
|
|
// High Color Standard Character Mode (LINEAR/CHUNK/COLDIS/ECM/MCM/BMM = 0, HICOL = 1)
|
|
|
|
// Resolution: 320x200
|
|
|
|
// Normal VIC Adressing:
|
|
|
|
// VicGfxData[16]: ( VicBank[1:0] & CharBase[2:0] & CharData[7:0] & RowCounter[2:0] )
|
|
|
|
// Pixel Shifter (1)
|
|
|
|
// - 0: 8bpp BgColor0[7:0]
|
|
|
|
// - 1: 8bpp ColorData[7:0]
|
2018-03-28 22:37:04 +00:00
|
|
|
mode_hicolstdchar: {
|
2018-03-29 07:09:07 +00:00
|
|
|
.label SCREEN = $8000
|
|
|
|
.label CHARSET = $9000
|
2019-02-17 23:12:29 +00:00
|
|
|
// Charset ROM
|
2018-03-29 07:09:07 +00:00
|
|
|
.label COLORS = $8400
|
2019-07-31 11:47:21 +00:00
|
|
|
.label _26 = 8
|
|
|
|
.label col = $b
|
|
|
|
.label ch = 9
|
|
|
|
.label cy = 7
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Graphics Bank
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #0
|
2018-03-28 22:37:04 +00:00
|
|
|
sta DTV_GRAPHICS_VIC_BANK
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Color Bank
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #<COLORS/$400
|
2018-03-28 22:37:04 +00:00
|
|
|
sta DTV_COLOR_BANK_LO
|
|
|
|
lda #0
|
|
|
|
sta DTV_COLOR_BANK_HI
|
2018-04-01 01:58:07 +00:00
|
|
|
lda #DTV_HIGHCOLOR
|
2018-03-28 22:37:04 +00:00
|
|
|
sta DTV_CONTROL
|
2019-02-17 23:12:29 +00:00
|
|
|
// VIC Graphics Bank
|
2018-03-28 22:37:04 +00:00
|
|
|
lda #3
|
|
|
|
sta CIA2_PORT_A_DDR
|
2019-02-17 23:12:29 +00:00
|
|
|
// Set VIC Bank bits to output - all others to input
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #3^CHARSET/$4000
|
2018-03-28 22:37:04 +00:00
|
|
|
sta CIA2_PORT_A
|
2019-02-17 23:12:29 +00:00
|
|
|
// Set VIC Bank
|
|
|
|
// VIC Graphics Mode
|
2018-03-28 22:37:04 +00:00
|
|
|
lda #VIC_DEN|VIC_RSEL|3
|
|
|
|
sta VIC_CONTROL
|
|
|
|
lda #VIC_CSEL
|
|
|
|
sta VIC_CONTROL2
|
2019-02-17 23:12:29 +00:00
|
|
|
// VIC Memory Pointers
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #(CHARSET&$3fff)/$400
|
2018-03-28 22:37:04 +00:00
|
|
|
sta VIC_MEMORY
|
|
|
|
ldx #0
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Palette - Grey Tones
|
2018-03-28 22:37:04 +00:00
|
|
|
b1:
|
|
|
|
txa
|
|
|
|
sta DTV_PALETTE,x
|
|
|
|
inx
|
|
|
|
cpx #$10
|
|
|
|
bne b1
|
2019-02-17 23:12:29 +00:00
|
|
|
// Screen colors
|
2018-03-28 22:37:04 +00:00
|
|
|
lda #0
|
|
|
|
sta BGCOL
|
|
|
|
sta BORDERCOL
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<SCREEN
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z ch
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>SCREEN
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z ch+1
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<COLORS
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z col
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>COLORS
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z col+1
|
2018-03-28 22:37:04 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z cy
|
2018-03-28 22:37:04 +00:00
|
|
|
b3:
|
2019-03-29 23:15:53 +00:00
|
|
|
ldx #0
|
|
|
|
b4:
|
2018-03-28 22:37:04 +00:00
|
|
|
lda #$f
|
2019-08-07 19:00:19 +00:00
|
|
|
and.z cy
|
2018-03-28 22:37:04 +00:00
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z _26
|
2018-03-28 22:37:04 +00:00
|
|
|
txa
|
|
|
|
and #$f
|
2019-08-07 19:00:19 +00:00
|
|
|
ora.z _26
|
2018-03-28 22:37:04 +00:00
|
|
|
ldy #0
|
|
|
|
sta (col),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z col
|
2018-03-28 22:37:04 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z col+1
|
2018-03-28 22:37:04 +00:00
|
|
|
!:
|
|
|
|
ldy #0
|
|
|
|
sta (ch),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z ch
|
2018-03-28 22:37:04 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z ch+1
|
2018-03-28 22:37:04 +00:00
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
2019-03-29 23:15:53 +00:00
|
|
|
bne b4
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z cy
|
2019-03-26 22:49:44 +00:00
|
|
|
lda #$19
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z cy
|
2019-03-29 23:15:53 +00:00
|
|
|
bne b3
|
2018-04-01 10:32:45 +00:00
|
|
|
lda #DTV_HIGHCOLOR
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z dtv_control
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_ctrl
|
|
|
|
rts
|
|
|
|
}
|
2019-02-17 23:12:29 +00:00
|
|
|
// Standard Bitmap Mode (LINEAR/HICOL/CHUNK/COLDIS/MCM/ECM = 0, BMM = 1)
|
|
|
|
// Resolution: 320x200
|
|
|
|
// Normal VIC Adressing:
|
|
|
|
// VicGfxData[16]: ( VicBank[1:0] & CharBase[2:2] & Matrix[9:0] & RowCounter[2:0] )
|
|
|
|
// Pixel Shifter (1)
|
|
|
|
// - 0: 4bpp CharData[3:0]
|
|
|
|
// - 1: 4bpp CharData[7:4]
|
2018-04-01 01:58:07 +00:00
|
|
|
mode_stdbitmap: {
|
|
|
|
.label SCREEN = $4000
|
|
|
|
.label BITMAP = $6000
|
|
|
|
.const lines_cnt = 9
|
2019-07-31 11:47:21 +00:00
|
|
|
.label col2 = $d
|
|
|
|
.label ch = 9
|
|
|
|
.label cy = 7
|
|
|
|
.label l = $e
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Graphics Bank
|
2018-04-01 01:58:07 +00:00
|
|
|
lda #0
|
2019-05-24 18:57:43 +00:00
|
|
|
sta DTV_GRAPHICS_VIC_BANK
|
2018-04-01 01:58:07 +00:00
|
|
|
sta DTV_CONTROL
|
2019-02-17 23:12:29 +00:00
|
|
|
// VIC Graphics Bank
|
2018-04-01 01:58:07 +00:00
|
|
|
lda #3
|
|
|
|
sta CIA2_PORT_A_DDR
|
2019-02-17 23:12:29 +00:00
|
|
|
// Set VIC Bank bits to output - all others to input
|
2018-04-01 01:58:07 +00:00
|
|
|
lda #3^BITMAP/$4000
|
|
|
|
sta CIA2_PORT_A
|
2019-02-17 23:12:29 +00:00
|
|
|
// Set VIC Bank
|
|
|
|
// VIC Graphics Mode
|
2018-04-01 01:58:07 +00:00
|
|
|
lda #VIC_BMM|VIC_DEN|VIC_RSEL|3
|
|
|
|
sta VIC_CONTROL
|
|
|
|
lda #VIC_CSEL
|
|
|
|
sta VIC_CONTROL2
|
2019-02-17 23:12:29 +00:00
|
|
|
// VIC Memory Pointers
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #(BITMAP&$3fff)/$400
|
2018-04-01 01:58:07 +00:00
|
|
|
sta VIC_MEMORY
|
|
|
|
ldx #0
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Palette - default
|
2018-04-01 01:58:07 +00:00
|
|
|
b1:
|
|
|
|
lda DTV_PALETTE_DEFAULT,x
|
|
|
|
sta DTV_PALETTE,x
|
|
|
|
inx
|
|
|
|
cpx #$10
|
|
|
|
bne b1
|
2019-02-17 23:12:29 +00:00
|
|
|
// Screen colors
|
2018-04-01 01:58:07 +00:00
|
|
|
lda #BLACK
|
|
|
|
sta BGCOL
|
|
|
|
sta BORDERCOL
|
|
|
|
lda #<SCREEN
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z ch
|
2018-04-01 01:58:07 +00:00
|
|
|
lda #>SCREEN
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z ch+1
|
2018-04-01 01:58:07 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z cy
|
2018-04-01 01:58:07 +00:00
|
|
|
b3:
|
2019-03-29 23:15:53 +00:00
|
|
|
ldx #0
|
|
|
|
b4:
|
2018-04-01 01:58:07 +00:00
|
|
|
txa
|
|
|
|
clc
|
2019-08-07 19:00:19 +00:00
|
|
|
adc.z cy
|
2018-04-01 01:58:07 +00:00
|
|
|
and #$f
|
|
|
|
tay
|
|
|
|
tya
|
|
|
|
eor #$ff
|
|
|
|
clc
|
|
|
|
adc #$f+1
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z col2
|
2018-04-01 01:58:07 +00:00
|
|
|
tya
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
2019-08-07 19:00:19 +00:00
|
|
|
ora.z col2
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #0
|
|
|
|
sta (ch),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z ch
|
2018-04-01 01:58:07 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z ch+1
|
2018-04-01 01:58:07 +00:00
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
2019-03-29 23:15:53 +00:00
|
|
|
bne b4
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z cy
|
2019-03-26 22:49:44 +00:00
|
|
|
lda #$19
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z cy
|
2019-03-29 23:15:53 +00:00
|
|
|
bne b3
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr bitmap_init
|
|
|
|
jsr bitmap_clear
|
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z l
|
2019-08-25 20:21:56 +00:00
|
|
|
b7:
|
|
|
|
lda.z l
|
|
|
|
cmp #lines_cnt
|
|
|
|
bcc b8
|
|
|
|
lda #0
|
|
|
|
sta.z dtv_control
|
|
|
|
jsr mode_ctrl
|
|
|
|
rts
|
2019-08-07 09:27:55 +00:00
|
|
|
b8:
|
2019-08-07 19:00:19 +00:00
|
|
|
ldy.z l
|
2018-04-01 01:58:07 +00:00
|
|
|
lda lines_x,y
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z bitmap_line.x0
|
2019-03-17 21:49:02 +00:00
|
|
|
ldx lines_x+1,y
|
2018-04-01 01:58:07 +00:00
|
|
|
lda lines_y,y
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z bitmap_line.y0
|
2019-03-17 21:49:02 +00:00
|
|
|
lda lines_y+1,y
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z bitmap_line.y1
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr bitmap_line
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z l
|
2019-08-25 20:21:56 +00:00
|
|
|
jmp b7
|
2018-04-01 01:58:07 +00:00
|
|
|
lines_x: .byte 0, $ff, $ff, 0, 0, $80, $ff, $80, 0, $80
|
|
|
|
lines_y: .byte 0, 0, $c7, $c7, 0, 0, $64, $c7, $64, 0
|
|
|
|
}
|
2019-02-17 23:12:29 +00:00
|
|
|
// Draw a line on the bitmap
|
2019-07-31 11:47:21 +00:00
|
|
|
// bitmap_line(byte zeropage(6) x0, byte register(X) x1, byte zeropage(8) y0, byte zeropage(3) y1)
|
2018-04-01 01:58:07 +00:00
|
|
|
bitmap_line: {
|
2019-07-31 11:47:21 +00:00
|
|
|
.label xd = 7
|
|
|
|
.label x0 = 6
|
|
|
|
.label y0 = 8
|
|
|
|
.label y1 = 3
|
2019-03-17 21:49:02 +00:00
|
|
|
txa
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z x0
|
2018-04-21 19:38:30 +00:00
|
|
|
beq !+
|
2019-03-17 21:49:02 +00:00
|
|
|
bcs b1
|
2018-04-21 19:38:30 +00:00
|
|
|
!:
|
2019-03-17 21:49:02 +00:00
|
|
|
txa
|
2018-04-21 19:38:30 +00:00
|
|
|
eor #$ff
|
2018-04-01 01:58:07 +00:00
|
|
|
sec
|
2019-08-07 19:00:19 +00:00
|
|
|
adc.z x0
|
|
|
|
sta.z xd
|
|
|
|
lda.z y0
|
|
|
|
cmp.z y1
|
2019-03-31 15:10:41 +00:00
|
|
|
bcc b7
|
2019-03-17 21:49:02 +00:00
|
|
|
sec
|
2019-08-07 19:00:19 +00:00
|
|
|
sbc.z y1
|
2019-03-17 21:49:02 +00:00
|
|
|
tay
|
2019-08-07 19:00:19 +00:00
|
|
|
cpy.z xd
|
2019-03-31 15:10:41 +00:00
|
|
|
bcc b8
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z y1
|
|
|
|
sta.z bitmap_line_ydxi.y
|
|
|
|
lda.z y0
|
|
|
|
sta.z bitmap_line_ydxi.y1
|
|
|
|
sty.z bitmap_line_ydxi.yd
|
2018-04-21 19:38:30 +00:00
|
|
|
jsr bitmap_line_ydxi
|
2018-03-28 22:37:04 +00:00
|
|
|
rts
|
2019-03-31 15:10:41 +00:00
|
|
|
b8:
|
2019-08-07 19:00:19 +00:00
|
|
|
stx.z bitmap_line_xdyi.x
|
|
|
|
lda.z y1
|
|
|
|
sta.z bitmap_line_xdyi.y
|
|
|
|
sty.z bitmap_line_xdyi.yd
|
2018-04-21 19:38:30 +00:00
|
|
|
jsr bitmap_line_xdyi
|
2019-04-02 06:28:13 +00:00
|
|
|
rts
|
2019-03-31 15:10:41 +00:00
|
|
|
b7:
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z y1
|
2018-04-01 01:58:07 +00:00
|
|
|
sec
|
2019-08-07 19:00:19 +00:00
|
|
|
sbc.z y0
|
2019-03-17 21:49:02 +00:00
|
|
|
tay
|
2019-08-07 19:00:19 +00:00
|
|
|
cpy.z xd
|
2019-03-31 15:10:41 +00:00
|
|
|
bcc b9
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z y0
|
|
|
|
sta.z bitmap_line_ydxd.y
|
|
|
|
ldx.z x0
|
|
|
|
lda.z y1
|
|
|
|
sta.z bitmap_line_ydxd.y1
|
|
|
|
sty.z bitmap_line_ydxd.yd
|
2018-04-21 19:38:30 +00:00
|
|
|
jsr bitmap_line_ydxd
|
2019-04-02 06:28:13 +00:00
|
|
|
rts
|
2019-03-31 15:10:41 +00:00
|
|
|
b9:
|
2019-08-07 19:00:19 +00:00
|
|
|
stx.z bitmap_line_xdyd.x
|
|
|
|
lda.z y1
|
|
|
|
sta.z bitmap_line_xdyd.y
|
|
|
|
sty.z bitmap_line_xdyd.yd
|
2018-04-21 19:38:30 +00:00
|
|
|
jsr bitmap_line_xdyd
|
2019-04-02 06:28:13 +00:00
|
|
|
rts
|
2018-04-01 01:58:07 +00:00
|
|
|
b1:
|
2019-03-17 21:49:02 +00:00
|
|
|
txa
|
2018-04-01 01:58:07 +00:00
|
|
|
sec
|
2019-08-07 19:00:19 +00:00
|
|
|
sbc.z x0
|
|
|
|
sta.z xd
|
|
|
|
lda.z y0
|
|
|
|
cmp.z y1
|
2019-03-31 15:10:41 +00:00
|
|
|
bcc b11
|
2018-04-01 01:58:07 +00:00
|
|
|
sec
|
2019-08-07 19:00:19 +00:00
|
|
|
sbc.z y1
|
2019-03-17 21:49:02 +00:00
|
|
|
tay
|
2019-08-07 19:00:19 +00:00
|
|
|
cpy.z xd
|
2019-03-31 15:10:41 +00:00
|
|
|
bcc b12
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z y1
|
|
|
|
sta.z bitmap_line_ydxd.y
|
|
|
|
sty.z bitmap_line_ydxd.yd
|
2018-04-21 19:38:30 +00:00
|
|
|
jsr bitmap_line_ydxd
|
2019-04-02 06:28:13 +00:00
|
|
|
rts
|
2019-03-31 15:10:41 +00:00
|
|
|
b12:
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z x0
|
|
|
|
sta.z bitmap_line_xdyd.x
|
|
|
|
stx.z bitmap_line_xdyd.x1
|
|
|
|
sty.z bitmap_line_xdyd.yd
|
2018-04-21 19:38:30 +00:00
|
|
|
jsr bitmap_line_xdyd
|
2019-04-02 06:28:13 +00:00
|
|
|
rts
|
2019-03-31 15:10:41 +00:00
|
|
|
b11:
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z y1
|
2018-04-01 01:58:07 +00:00
|
|
|
sec
|
2019-08-07 19:00:19 +00:00
|
|
|
sbc.z y0
|
2019-03-17 21:49:02 +00:00
|
|
|
tay
|
2019-08-07 19:00:19 +00:00
|
|
|
cpy.z xd
|
2019-03-31 15:10:41 +00:00
|
|
|
bcc b13
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z y0
|
|
|
|
sta.z bitmap_line_ydxi.y
|
|
|
|
ldx.z x0
|
|
|
|
sty.z bitmap_line_ydxi.yd
|
2018-04-21 19:38:30 +00:00
|
|
|
jsr bitmap_line_ydxi
|
2019-04-02 06:28:13 +00:00
|
|
|
rts
|
2019-03-31 15:10:41 +00:00
|
|
|
b13:
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z x0
|
|
|
|
sta.z bitmap_line_xdyi.x
|
|
|
|
stx.z bitmap_line_xdyi.x1
|
|
|
|
sty.z bitmap_line_xdyi.yd
|
2018-04-21 19:38:30 +00:00
|
|
|
jsr bitmap_line_xdyi
|
2019-04-02 06:28:13 +00:00
|
|
|
rts
|
2018-03-28 22:37:04 +00:00
|
|
|
}
|
2019-07-31 11:47:21 +00:00
|
|
|
// bitmap_line_xdyi(byte zeropage(2) x, byte zeropage(8) y, byte zeropage(6) x1, byte zeropage(7) xd, byte zeropage($d) yd)
|
2018-04-21 19:38:30 +00:00
|
|
|
bitmap_line_xdyi: {
|
2019-07-31 11:47:21 +00:00
|
|
|
.label x = 2
|
|
|
|
.label y = 8
|
|
|
|
.label x1 = 6
|
|
|
|
.label xd = 7
|
|
|
|
.label yd = $d
|
|
|
|
.label e = 3
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z yd
|
2018-04-01 01:58:07 +00:00
|
|
|
lsr
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z e
|
2018-04-01 01:58:07 +00:00
|
|
|
b1:
|
2019-08-07 19:00:19 +00:00
|
|
|
ldx.z x
|
|
|
|
ldy.z y
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr bitmap_plot
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z x
|
|
|
|
lda.z e
|
2018-04-01 01:58:07 +00:00
|
|
|
clc
|
2019-08-07 19:00:19 +00:00
|
|
|
adc.z yd
|
|
|
|
sta.z e
|
|
|
|
lda.z xd
|
|
|
|
cmp.z e
|
2018-04-01 01:58:07 +00:00
|
|
|
bcs b2
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z y
|
|
|
|
lda.z e
|
2018-04-01 01:58:07 +00:00
|
|
|
sec
|
2019-08-07 19:00:19 +00:00
|
|
|
sbc.z xd
|
|
|
|
sta.z e
|
2018-04-01 01:58:07 +00:00
|
|
|
b2:
|
2019-08-07 19:00:19 +00:00
|
|
|
ldx.z x1
|
2018-09-26 20:01:15 +00:00
|
|
|
inx
|
2019-08-07 19:00:19 +00:00
|
|
|
cpx.z x
|
2018-04-01 01:58:07 +00:00
|
|
|
bne b1
|
|
|
|
rts
|
|
|
|
}
|
2019-02-19 19:51:48 +00:00
|
|
|
// bitmap_plot(byte register(X) x, byte register(Y) y)
|
2018-04-01 01:58:07 +00:00
|
|
|
bitmap_plot: {
|
2019-07-31 11:47:21 +00:00
|
|
|
.label plotter_x = 9
|
|
|
|
.label plotter_y = $b
|
|
|
|
.label plotter = 9
|
2018-04-01 01:58:07 +00:00
|
|
|
lda bitmap_plot_xhi,x
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z plotter_x+1
|
2018-04-01 01:58:07 +00:00
|
|
|
lda bitmap_plot_xlo,x
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z plotter_x
|
2018-04-01 01:58:07 +00:00
|
|
|
lda bitmap_plot_yhi,y
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z plotter_y+1
|
2018-04-01 01:58:07 +00:00
|
|
|
lda bitmap_plot_ylo,y
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z plotter_y
|
|
|
|
lda.z plotter
|
2018-04-01 01:58:07 +00:00
|
|
|
clc
|
2019-08-07 19:00:19 +00:00
|
|
|
adc.z plotter_y
|
|
|
|
sta.z plotter
|
|
|
|
lda.z plotter+1
|
|
|
|
adc.z plotter_y+1
|
|
|
|
sta.z plotter+1
|
2018-04-01 01:58:07 +00:00
|
|
|
lda bitmap_plot_bit,x
|
|
|
|
ldy #0
|
2019-05-24 18:57:43 +00:00
|
|
|
ora (plotter),y
|
|
|
|
sta (plotter),y
|
2018-04-01 01:58:07 +00:00
|
|
|
rts
|
|
|
|
}
|
2019-07-31 11:47:21 +00:00
|
|
|
// bitmap_line_ydxi(byte zeropage(2) y, byte register(X) x, byte zeropage(3) y1, byte zeropage($d) yd, byte zeropage(7) xd)
|
2018-04-21 19:38:30 +00:00
|
|
|
bitmap_line_ydxi: {
|
2019-07-31 11:47:21 +00:00
|
|
|
.label y = 2
|
|
|
|
.label y1 = 3
|
|
|
|
.label yd = $d
|
|
|
|
.label xd = 7
|
|
|
|
.label e = 6
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z xd
|
2018-04-01 01:58:07 +00:00
|
|
|
lsr
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z e
|
2018-04-01 01:58:07 +00:00
|
|
|
b1:
|
2019-08-07 19:00:19 +00:00
|
|
|
ldy.z y
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr bitmap_plot
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z y
|
|
|
|
lda.z e
|
2018-04-01 01:58:07 +00:00
|
|
|
clc
|
2019-08-07 19:00:19 +00:00
|
|
|
adc.z xd
|
|
|
|
sta.z e
|
|
|
|
lda.z yd
|
|
|
|
cmp.z e
|
2018-04-01 01:58:07 +00:00
|
|
|
bcs b2
|
2018-04-21 19:38:30 +00:00
|
|
|
inx
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z e
|
2018-04-01 01:58:07 +00:00
|
|
|
sec
|
2019-08-07 19:00:19 +00:00
|
|
|
sbc.z yd
|
|
|
|
sta.z e
|
2018-04-01 01:58:07 +00:00
|
|
|
b2:
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z y1
|
2018-09-26 20:01:15 +00:00
|
|
|
clc
|
|
|
|
adc #1
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z y
|
2018-04-01 01:58:07 +00:00
|
|
|
bne b1
|
|
|
|
rts
|
|
|
|
}
|
2019-07-31 11:47:21 +00:00
|
|
|
// bitmap_line_xdyd(byte zeropage(2) x, byte zeropage(8) y, byte zeropage(6) x1, byte zeropage(7) xd, byte zeropage($d) yd)
|
2018-04-01 01:58:07 +00:00
|
|
|
bitmap_line_xdyd: {
|
2019-07-31 11:47:21 +00:00
|
|
|
.label x = 2
|
|
|
|
.label y = 8
|
|
|
|
.label x1 = 6
|
|
|
|
.label xd = 7
|
|
|
|
.label yd = $d
|
|
|
|
.label e = 3
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z yd
|
2018-04-01 01:58:07 +00:00
|
|
|
lsr
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z e
|
2018-04-01 01:58:07 +00:00
|
|
|
b1:
|
2019-08-07 19:00:19 +00:00
|
|
|
ldx.z x
|
|
|
|
ldy.z y
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr bitmap_plot
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z x
|
|
|
|
lda.z e
|
2018-04-01 01:58:07 +00:00
|
|
|
clc
|
2019-08-07 19:00:19 +00:00
|
|
|
adc.z yd
|
|
|
|
sta.z e
|
|
|
|
lda.z xd
|
|
|
|
cmp.z e
|
2018-04-01 01:58:07 +00:00
|
|
|
bcs b2
|
2019-08-07 19:00:19 +00:00
|
|
|
dec.z y
|
|
|
|
lda.z e
|
2018-04-01 01:58:07 +00:00
|
|
|
sec
|
2019-08-07 19:00:19 +00:00
|
|
|
sbc.z xd
|
|
|
|
sta.z e
|
2018-04-01 01:58:07 +00:00
|
|
|
b2:
|
2019-08-07 19:00:19 +00:00
|
|
|
ldx.z x1
|
2018-09-26 20:01:15 +00:00
|
|
|
inx
|
2019-08-07 19:00:19 +00:00
|
|
|
cpx.z x
|
2018-04-01 01:58:07 +00:00
|
|
|
bne b1
|
|
|
|
rts
|
|
|
|
}
|
2019-07-31 11:47:21 +00:00
|
|
|
// bitmap_line_ydxd(byte zeropage(2) y, byte register(X) x, byte zeropage(8) y1, byte zeropage($d) yd, byte zeropage(7) xd)
|
2018-04-21 19:38:30 +00:00
|
|
|
bitmap_line_ydxd: {
|
2019-07-31 11:47:21 +00:00
|
|
|
.label y = 2
|
|
|
|
.label y1 = 8
|
|
|
|
.label yd = $d
|
|
|
|
.label xd = 7
|
|
|
|
.label e = 3
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z xd
|
2018-04-21 19:38:30 +00:00
|
|
|
lsr
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z e
|
2018-04-21 19:38:30 +00:00
|
|
|
b1:
|
2019-08-07 19:00:19 +00:00
|
|
|
ldy.z y
|
2018-04-21 19:38:30 +00:00
|
|
|
jsr bitmap_plot
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z y
|
|
|
|
lda.z e
|
2018-04-21 19:38:30 +00:00
|
|
|
clc
|
2019-08-07 19:00:19 +00:00
|
|
|
adc.z xd
|
|
|
|
sta.z e
|
|
|
|
lda.z yd
|
|
|
|
cmp.z e
|
2018-04-21 19:38:30 +00:00
|
|
|
bcs b2
|
|
|
|
dex
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z e
|
2018-04-21 19:38:30 +00:00
|
|
|
sec
|
2019-08-07 19:00:19 +00:00
|
|
|
sbc.z yd
|
|
|
|
sta.z e
|
2018-04-21 19:38:30 +00:00
|
|
|
b2:
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z y1
|
2018-09-26 20:01:15 +00:00
|
|
|
clc
|
|
|
|
adc #1
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z y
|
2018-04-21 19:38:30 +00:00
|
|
|
bne b1
|
|
|
|
rts
|
|
|
|
}
|
2019-02-17 23:12:29 +00:00
|
|
|
// Clear all graphics on the bitmap
|
2018-04-01 01:58:07 +00:00
|
|
|
bitmap_clear: {
|
2019-07-31 11:47:21 +00:00
|
|
|
.label bitmap = 9
|
|
|
|
.label y = $e
|
2018-08-22 10:40:19 +00:00
|
|
|
lda bitmap_plot_xlo
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z bitmap
|
2018-08-22 10:40:19 +00:00
|
|
|
lda bitmap_plot_xhi
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z bitmap+1
|
2018-04-01 01:58:07 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z y
|
2018-04-01 01:58:07 +00:00
|
|
|
b1:
|
|
|
|
ldx #0
|
|
|
|
b2:
|
|
|
|
lda #0
|
|
|
|
tay
|
|
|
|
sta (bitmap),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z bitmap
|
2018-04-01 01:58:07 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z bitmap+1
|
2018-04-01 01:58:07 +00:00
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$c8
|
|
|
|
bne b2
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z y
|
2019-03-26 22:49:44 +00:00
|
|
|
lda #$28
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z y
|
2018-04-01 01:58:07 +00:00
|
|
|
bne b1
|
|
|
|
rts
|
|
|
|
}
|
2019-02-17 23:12:29 +00:00
|
|
|
// Initialize the bitmap plotter tables for a specific bitmap
|
2018-04-01 01:58:07 +00:00
|
|
|
bitmap_init: {
|
2019-07-31 11:47:21 +00:00
|
|
|
.label _10 = $d
|
|
|
|
.label yoffs = 9
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #$80
|
|
|
|
ldx #0
|
|
|
|
b1:
|
|
|
|
txa
|
|
|
|
and #$f8
|
|
|
|
sta bitmap_plot_xlo,x
|
|
|
|
lda #>mode_stdbitmap.BITMAP
|
|
|
|
sta bitmap_plot_xhi,x
|
|
|
|
tya
|
|
|
|
sta bitmap_plot_bit,x
|
|
|
|
tya
|
|
|
|
lsr
|
|
|
|
tay
|
|
|
|
cpy #0
|
|
|
|
bne b2
|
|
|
|
ldy #$80
|
|
|
|
b2:
|
|
|
|
inx
|
|
|
|
cpx #0
|
|
|
|
bne b1
|
|
|
|
lda #<0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z yoffs
|
|
|
|
sta.z yoffs+1
|
2018-04-01 01:58:07 +00:00
|
|
|
tax
|
2019-03-31 15:10:41 +00:00
|
|
|
b3:
|
2019-03-26 22:49:44 +00:00
|
|
|
lda #7
|
2019-08-07 19:00:19 +00:00
|
|
|
sax.z _10
|
|
|
|
lda.z yoffs
|
|
|
|
ora.z _10
|
2018-04-01 01:58:07 +00:00
|
|
|
sta bitmap_plot_ylo,x
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z yoffs+1
|
2018-04-01 01:58:07 +00:00
|
|
|
sta bitmap_plot_yhi,x
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #7
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z _10
|
2019-03-31 15:10:41 +00:00
|
|
|
bne b4
|
2018-04-01 01:58:07 +00:00
|
|
|
clc
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z yoffs
|
2018-04-01 01:58:07 +00:00
|
|
|
adc #<$28*8
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z yoffs
|
|
|
|
lda.z yoffs+1
|
2018-04-01 01:58:07 +00:00
|
|
|
adc #>$28*8
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z yoffs+1
|
2019-03-31 15:10:41 +00:00
|
|
|
b4:
|
2018-04-01 01:58:07 +00:00
|
|
|
inx
|
|
|
|
cpx #0
|
2019-03-31 15:10:41 +00:00
|
|
|
bne b3
|
2018-04-01 01:58:07 +00:00
|
|
|
rts
|
|
|
|
}
|
2019-02-17 23:12:29 +00:00
|
|
|
// Multicolor Character Mode (LINEAR/HICOL/CHUNK/COLDIS/BMM/ECM = 0, MCM = 1)
|
|
|
|
// Resolution: 160x200 (320x200)
|
|
|
|
// Normal VIC Adressing:
|
|
|
|
// VicGfxData[16]: ( VicBank[1:0] & CharBase[2:0] & CharData[7:0] & RowCounter[2:0] )
|
|
|
|
// GfxData Pixel Shifter (1) if ColorData[3:3] = 0:
|
|
|
|
// - 0: 4bpp BgColor0[3:0]
|
|
|
|
// - 1: 4bpp ColorData[2:0]
|
|
|
|
// GfxData Pixel Shifter (2) if ColorData[3:3] = 1:
|
|
|
|
// - 00: 4bpp BgColor0[3:0]
|
|
|
|
// - 01: 4bpp BgColor1[3:0]
|
|
|
|
// - 10: 4bpp BgColor2[3:0]
|
|
|
|
// - 11: 4bpp ColorData[2:0]// Standard Character Mode (LINEAR/HICOL/CHUNK/COLDIS/ECM/MCM/BMM = 0)
|
2018-03-29 07:09:07 +00:00
|
|
|
mode_mcchar: {
|
2018-03-29 06:49:51 +00:00
|
|
|
.label SCREEN = $8000
|
|
|
|
.label CHARSET = $9000
|
2019-02-17 23:12:29 +00:00
|
|
|
// Charset ROM
|
2018-03-29 07:19:36 +00:00
|
|
|
.label COLORS = $d800
|
2019-07-31 11:47:21 +00:00
|
|
|
.label _29 = $d
|
|
|
|
.label col = $b
|
|
|
|
.label ch = 4
|
|
|
|
.label cy = 7
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Graphics Bank
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #0
|
2018-03-29 06:49:51 +00:00
|
|
|
sta DTV_GRAPHICS_VIC_BANK
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Color Bank
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #<DTV_COLOR_BANK_DEFAULT/$400
|
2018-03-29 06:49:51 +00:00
|
|
|
sta DTV_COLOR_BANK_LO
|
|
|
|
lda #0
|
|
|
|
sta DTV_COLOR_BANK_HI
|
|
|
|
sta DTV_CONTROL
|
2019-02-17 23:12:29 +00:00
|
|
|
// VIC Graphics Bank
|
2018-03-29 06:49:51 +00:00
|
|
|
lda #3
|
|
|
|
sta CIA2_PORT_A_DDR
|
2019-02-17 23:12:29 +00:00
|
|
|
// Set VIC Bank bits to output - all others to input
|
2018-03-29 06:49:51 +00:00
|
|
|
lda #3^CHARSET/$4000
|
|
|
|
sta CIA2_PORT_A
|
2019-02-17 23:12:29 +00:00
|
|
|
// Set VIC Bank
|
|
|
|
// VIC Graphics Mode
|
2018-03-29 06:49:51 +00:00
|
|
|
lda #VIC_DEN|VIC_RSEL|3
|
|
|
|
sta VIC_CONTROL
|
|
|
|
lda #VIC_CSEL|VIC_MCM
|
|
|
|
sta VIC_CONTROL2
|
2019-02-17 23:12:29 +00:00
|
|
|
// VIC Memory Pointers
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #(CHARSET&$3fff)/$400
|
2018-03-29 06:49:51 +00:00
|
|
|
sta VIC_MEMORY
|
|
|
|
ldx #0
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Palette - default
|
2018-03-29 06:49:51 +00:00
|
|
|
b1:
|
|
|
|
lda DTV_PALETTE_DEFAULT,x
|
|
|
|
sta DTV_PALETTE,x
|
|
|
|
inx
|
|
|
|
cpx #$10
|
|
|
|
bne b1
|
2019-02-17 23:12:29 +00:00
|
|
|
// Screen colors
|
2018-03-29 06:49:51 +00:00
|
|
|
lda #0
|
|
|
|
sta BORDERCOL
|
|
|
|
lda #BLACK
|
|
|
|
sta BGCOL1
|
|
|
|
lda #GREEN
|
|
|
|
sta BGCOL2
|
|
|
|
lda #BLUE
|
|
|
|
sta BGCOL3
|
|
|
|
lda #<SCREEN
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z ch
|
2018-03-29 06:49:51 +00:00
|
|
|
lda #>SCREEN
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z ch+1
|
2018-03-29 06:49:51 +00:00
|
|
|
lda #<COLORS
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z col
|
2018-03-29 06:49:51 +00:00
|
|
|
lda #>COLORS
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z col+1
|
2018-03-29 06:49:51 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z cy
|
2018-03-29 06:49:51 +00:00
|
|
|
b3:
|
2019-03-29 23:15:53 +00:00
|
|
|
ldx #0
|
|
|
|
b4:
|
2018-03-29 06:49:51 +00:00
|
|
|
txa
|
|
|
|
clc
|
2019-08-07 19:00:19 +00:00
|
|
|
adc.z cy
|
2018-03-29 06:49:51 +00:00
|
|
|
and #$f
|
|
|
|
ldy #0
|
|
|
|
sta (col),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z col
|
2018-03-29 06:49:51 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z col+1
|
2018-03-29 06:49:51 +00:00
|
|
|
!:
|
|
|
|
lda #$f
|
2019-08-07 19:00:19 +00:00
|
|
|
and.z cy
|
2018-03-29 06:49:51 +00:00
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z _29
|
2018-03-29 06:49:51 +00:00
|
|
|
txa
|
|
|
|
and #$f
|
2019-08-07 19:00:19 +00:00
|
|
|
ora.z _29
|
2018-03-29 06:49:51 +00:00
|
|
|
ldy #0
|
|
|
|
sta (ch),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z ch
|
2018-03-29 06:49:51 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z ch+1
|
2018-03-29 06:49:51 +00:00
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
2019-03-29 23:15:53 +00:00
|
|
|
bne b4
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z cy
|
2019-03-26 22:49:44 +00:00
|
|
|
lda #$19
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z cy
|
2019-03-29 23:15:53 +00:00
|
|
|
bne b3
|
2018-04-01 10:32:45 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z dtv_control
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_ctrl
|
2018-03-29 06:49:51 +00:00
|
|
|
rts
|
|
|
|
}
|
2019-02-17 23:12:29 +00:00
|
|
|
// Extended Background Color Character Mode (LINEAR/HICOL/CHUNK/COLDIS/MCM/BMM = 0, ECM = 1)
|
|
|
|
// Resolution: 320x200
|
|
|
|
// Normal VIC Adressing:
|
|
|
|
// VicGfxData[16]: ( VicBank[1:0] & CharBase[2:0] & "00" & CharData[5:0] & RowCounter[2:0] )
|
|
|
|
// GfxData Pixel Shifter (1)
|
|
|
|
// - 0: 4bpp Background Color
|
|
|
|
// - CharData[7:6] 00: 4bpp BgColor0[3:0]
|
|
|
|
// - CharData[7:6] 01: 4bpp BgColor1[3:0]
|
|
|
|
// - CharData[7:6] 10: 4bpp BgColor2[3:0]
|
|
|
|
// - CharData[7:6] 11: 4bpp BgColor3[3:0]
|
|
|
|
// - 1: 4bpp ColorData[3:0]
|
2018-03-28 22:37:04 +00:00
|
|
|
mode_ecmchar: {
|
2018-03-29 07:19:36 +00:00
|
|
|
.label SCREEN = $8000
|
|
|
|
.label CHARSET = $9000
|
2019-02-17 23:12:29 +00:00
|
|
|
// Charset ROM
|
2018-03-29 07:19:36 +00:00
|
|
|
.label COLORS = $d800
|
2019-07-31 11:47:21 +00:00
|
|
|
.label _29 = $d
|
|
|
|
.label col = $b
|
|
|
|
.label ch = 4
|
|
|
|
.label cy = 8
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Graphics Bank
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #0
|
2018-03-28 22:37:04 +00:00
|
|
|
sta DTV_GRAPHICS_VIC_BANK
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Color Bank
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #<DTV_COLOR_BANK_DEFAULT/$400
|
2018-03-28 22:37:04 +00:00
|
|
|
sta DTV_COLOR_BANK_LO
|
|
|
|
lda #0
|
|
|
|
sta DTV_COLOR_BANK_HI
|
|
|
|
sta DTV_CONTROL
|
2019-02-17 23:12:29 +00:00
|
|
|
// VIC Graphics Bank
|
2018-03-28 22:37:04 +00:00
|
|
|
lda #3
|
|
|
|
sta CIA2_PORT_A_DDR
|
2019-02-17 23:12:29 +00:00
|
|
|
// Set VIC Bank bits to output - all others to input
|
2018-03-29 07:19:36 +00:00
|
|
|
lda #3^CHARSET/$4000
|
2018-03-28 22:37:04 +00:00
|
|
|
sta CIA2_PORT_A
|
2019-02-17 23:12:29 +00:00
|
|
|
// Set VIC Bank
|
|
|
|
// VIC Graphics Mode
|
2018-03-28 22:37:04 +00:00
|
|
|
lda #VIC_DEN|VIC_RSEL|VIC_ECM|3
|
|
|
|
sta VIC_CONTROL
|
|
|
|
lda #VIC_CSEL
|
|
|
|
sta VIC_CONTROL2
|
2019-02-17 23:12:29 +00:00
|
|
|
// VIC Memory Pointers
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #(CHARSET&$3fff)/$400
|
2018-03-28 22:37:04 +00:00
|
|
|
sta VIC_MEMORY
|
|
|
|
ldx #0
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Palette - default
|
2018-03-28 22:37:04 +00:00
|
|
|
b1:
|
|
|
|
lda DTV_PALETTE_DEFAULT,x
|
|
|
|
sta DTV_PALETTE,x
|
|
|
|
inx
|
|
|
|
cpx #$10
|
|
|
|
bne b1
|
2019-02-17 23:12:29 +00:00
|
|
|
// Screen colors
|
2018-03-28 22:37:04 +00:00
|
|
|
lda #0
|
|
|
|
sta BORDERCOL
|
|
|
|
sta BGCOL1
|
|
|
|
lda #2
|
|
|
|
sta BGCOL2
|
|
|
|
lda #5
|
|
|
|
sta BGCOL3
|
|
|
|
lda #6
|
|
|
|
sta BGCOL4
|
2018-03-29 07:19:36 +00:00
|
|
|
lda #<SCREEN
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z ch
|
2018-03-29 07:19:36 +00:00
|
|
|
lda #>SCREEN
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z ch+1
|
2018-03-29 07:19:36 +00:00
|
|
|
lda #<COLORS
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z col
|
2018-03-29 07:19:36 +00:00
|
|
|
lda #>COLORS
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z col+1
|
2018-03-28 22:37:04 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z cy
|
2018-03-28 22:37:04 +00:00
|
|
|
b3:
|
2019-03-29 23:15:53 +00:00
|
|
|
ldx #0
|
|
|
|
b4:
|
2018-03-28 22:37:04 +00:00
|
|
|
txa
|
|
|
|
clc
|
2019-08-07 19:00:19 +00:00
|
|
|
adc.z cy
|
2018-03-28 22:37:04 +00:00
|
|
|
and #$f
|
|
|
|
ldy #0
|
|
|
|
sta (col),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z col
|
2018-03-28 22:37:04 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z col+1
|
2018-03-28 22:37:04 +00:00
|
|
|
!:
|
|
|
|
lda #$f
|
2019-08-07 19:00:19 +00:00
|
|
|
and.z cy
|
2018-03-28 22:37:04 +00:00
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z _29
|
2018-03-28 22:37:04 +00:00
|
|
|
txa
|
|
|
|
and #$f
|
2019-08-07 19:00:19 +00:00
|
|
|
ora.z _29
|
2018-03-28 22:37:04 +00:00
|
|
|
ldy #0
|
|
|
|
sta (ch),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z ch
|
2018-03-28 22:37:04 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z ch+1
|
2018-03-28 22:37:04 +00:00
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
2019-03-29 23:15:53 +00:00
|
|
|
bne b4
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z cy
|
2019-03-26 22:49:44 +00:00
|
|
|
lda #$19
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z cy
|
2019-03-29 23:15:53 +00:00
|
|
|
bne b3
|
2018-04-01 10:32:45 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z dtv_control
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_ctrl
|
2018-03-28 22:37:04 +00:00
|
|
|
rts
|
|
|
|
}
|
2019-02-17 23:12:29 +00:00
|
|
|
// Standard Character Mode (LINEAR/HICOL/CHUNK/COLDIS/ECM/MCM/BMM = 0)
|
|
|
|
// Resolution: 320x200
|
|
|
|
// Normal VIC Adressing:
|
|
|
|
// VicGfxData[16]: ( VicBank[1:0] & CharBase[2:0] & CharData[7:0] & RowCounter[2:0] )
|
|
|
|
// Pixel Shifter (1)
|
|
|
|
// - 0: 4bpp BgColor0[3:0]
|
|
|
|
// - 1: 4bpp ColorData[3:0]
|
2018-03-28 22:37:04 +00:00
|
|
|
mode_stdchar: {
|
2018-03-29 07:09:07 +00:00
|
|
|
.label SCREEN = $8000
|
|
|
|
.label CHARSET = $9000
|
2019-02-17 23:12:29 +00:00
|
|
|
// Charset ROM
|
2018-03-29 07:19:36 +00:00
|
|
|
.label COLORS = $d800
|
2019-07-31 11:47:21 +00:00
|
|
|
.label _28 = $e
|
|
|
|
.label col = $b
|
|
|
|
.label ch = 4
|
|
|
|
.label cy = 6
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Graphics Bank
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #0
|
2018-03-28 22:37:04 +00:00
|
|
|
sta DTV_GRAPHICS_VIC_BANK
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Color Bank
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #<DTV_COLOR_BANK_DEFAULT/$400
|
2018-03-28 22:37:04 +00:00
|
|
|
sta DTV_COLOR_BANK_LO
|
|
|
|
lda #0
|
|
|
|
sta DTV_COLOR_BANK_HI
|
|
|
|
sta DTV_CONTROL
|
2019-02-17 23:12:29 +00:00
|
|
|
// VIC Graphics Bank
|
2018-03-28 22:37:04 +00:00
|
|
|
lda #3
|
|
|
|
sta CIA2_PORT_A_DDR
|
2019-02-17 23:12:29 +00:00
|
|
|
// Set VIC Bank bits to output - all others to input
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #3^CHARSET/$4000
|
2018-03-28 22:37:04 +00:00
|
|
|
sta CIA2_PORT_A
|
2019-02-17 23:12:29 +00:00
|
|
|
// Set VIC Bank
|
|
|
|
// VIC Graphics Mode
|
2018-03-28 22:37:04 +00:00
|
|
|
lda #VIC_DEN|VIC_RSEL|3
|
|
|
|
sta VIC_CONTROL
|
|
|
|
lda #VIC_CSEL
|
|
|
|
sta VIC_CONTROL2
|
2019-02-17 23:12:29 +00:00
|
|
|
// VIC Memory Pointers
|
2019-05-24 18:57:43 +00:00
|
|
|
lda #(CHARSET&$3fff)/$400
|
2018-03-28 22:37:04 +00:00
|
|
|
sta VIC_MEMORY
|
|
|
|
ldx #0
|
2019-02-17 23:12:29 +00:00
|
|
|
// DTV Palette - default
|
2018-03-28 22:37:04 +00:00
|
|
|
b1:
|
|
|
|
lda DTV_PALETTE_DEFAULT,x
|
|
|
|
sta DTV_PALETTE,x
|
|
|
|
inx
|
|
|
|
cpx #$10
|
|
|
|
bne b1
|
2019-02-17 23:12:29 +00:00
|
|
|
// Screen colors
|
2018-03-28 22:37:04 +00:00
|
|
|
lda #0
|
|
|
|
sta BGCOL
|
|
|
|
sta BORDERCOL
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<SCREEN
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z ch
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>SCREEN
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z ch+1
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<COLORS
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z col
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>COLORS
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z col+1
|
2018-03-28 22:37:04 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z cy
|
2018-03-28 22:37:04 +00:00
|
|
|
b3:
|
2019-03-29 23:15:53 +00:00
|
|
|
ldx #0
|
|
|
|
b4:
|
2018-03-28 22:37:04 +00:00
|
|
|
txa
|
|
|
|
clc
|
2019-08-07 19:00:19 +00:00
|
|
|
adc.z cy
|
2018-03-28 22:37:04 +00:00
|
|
|
and #$f
|
|
|
|
ldy #0
|
|
|
|
sta (col),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z col
|
2018-03-28 22:37:04 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z col+1
|
2018-03-28 22:37:04 +00:00
|
|
|
!:
|
|
|
|
lda #$f
|
2019-08-07 19:00:19 +00:00
|
|
|
and.z cy
|
2018-03-28 22:37:04 +00:00
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z _28
|
2018-03-28 22:37:04 +00:00
|
|
|
txa
|
|
|
|
and #$f
|
2019-08-07 19:00:19 +00:00
|
|
|
ora.z _28
|
2018-03-28 22:37:04 +00:00
|
|
|
ldy #0
|
|
|
|
sta (ch),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z ch
|
2018-03-28 22:37:04 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z ch+1
|
2018-03-28 22:37:04 +00:00
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
2019-03-29 23:15:53 +00:00
|
|
|
bne b4
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z cy
|
2019-03-26 22:49:44 +00:00
|
|
|
lda #$19
|
2019-08-07 19:00:19 +00:00
|
|
|
cmp.z cy
|
2019-03-29 23:15:53 +00:00
|
|
|
bne b3
|
2018-04-01 10:32:45 +00:00
|
|
|
lda #0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z dtv_control
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_ctrl
|
2018-03-28 22:37:04 +00:00
|
|
|
rts
|
|
|
|
}
|
2019-02-17 23:12:29 +00:00
|
|
|
// Print a number of zero-terminated strings, each followed by a newline.
|
|
|
|
// The sequence of lines is terminated by another zero.
|
2019-07-31 11:47:21 +00:00
|
|
|
// print_str_lines(byte* zeropage($b) str)
|
2018-03-26 19:41:09 +00:00
|
|
|
print_str_lines: {
|
2019-07-31 11:47:21 +00:00
|
|
|
.label str = $b
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<menu.SCREEN
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z print_line_cursor
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>menu.SCREEN
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z print_line_cursor+1
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<menu.SCREEN
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z print_char_cursor
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>menu.SCREEN
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z print_char_cursor+1
|
2018-03-26 19:41:09 +00:00
|
|
|
lda #<MENU_TEXT
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z str
|
2018-03-26 19:41:09 +00:00
|
|
|
lda #>MENU_TEXT
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z str+1
|
2018-03-26 19:41:09 +00:00
|
|
|
b1:
|
|
|
|
ldy #0
|
|
|
|
lda (str),y
|
2019-08-07 17:48:56 +00:00
|
|
|
cmp #0
|
2019-03-31 15:10:41 +00:00
|
|
|
bne b2
|
2018-03-25 21:40:38 +00:00
|
|
|
rts
|
2019-03-31 15:10:41 +00:00
|
|
|
b2:
|
2018-03-26 19:41:09 +00:00
|
|
|
ldy #0
|
|
|
|
lda (str),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z str
|
2018-03-26 19:41:09 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z str+1
|
2018-03-26 19:41:09 +00:00
|
|
|
!:
|
2019-08-07 17:48:56 +00:00
|
|
|
cmp #0
|
2019-03-31 15:10:41 +00:00
|
|
|
beq b3
|
2018-03-26 19:41:09 +00:00
|
|
|
ldy #0
|
|
|
|
sta (print_char_cursor),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z print_char_cursor
|
2018-03-26 19:41:09 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z print_char_cursor+1
|
2018-03-26 19:41:09 +00:00
|
|
|
!:
|
2019-03-31 15:10:41 +00:00
|
|
|
b3:
|
2019-08-07 17:48:56 +00:00
|
|
|
cmp #0
|
2019-03-31 15:10:41 +00:00
|
|
|
bne b2
|
2018-03-26 19:41:09 +00:00
|
|
|
jsr print_ln
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z print_line_cursor
|
|
|
|
sta.z print_char_cursor
|
|
|
|
lda.z print_line_cursor+1
|
|
|
|
sta.z print_char_cursor+1
|
2018-03-26 19:41:09 +00:00
|
|
|
jmp b1
|
2018-03-25 21:40:38 +00:00
|
|
|
}
|
2019-02-17 23:12:29 +00:00
|
|
|
// Print a newline
|
2018-03-25 21:40:38 +00:00
|
|
|
print_ln: {
|
|
|
|
b1:
|
2019-03-18 01:23:29 +00:00
|
|
|
lda #$28
|
2018-03-25 21:40:38 +00:00
|
|
|
clc
|
2019-08-07 19:00:19 +00:00
|
|
|
adc.z print_line_cursor
|
|
|
|
sta.z print_line_cursor
|
2018-03-25 21:40:38 +00:00
|
|
|
bcc !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z print_line_cursor+1
|
2018-03-25 21:40:38 +00:00
|
|
|
!:
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z print_line_cursor+1
|
|
|
|
cmp.z print_char_cursor+1
|
2018-03-25 21:40:38 +00:00
|
|
|
bcc b1
|
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z print_line_cursor
|
|
|
|
cmp.z print_char_cursor
|
2018-03-25 21:40:38 +00:00
|
|
|
bcc b1
|
|
|
|
!:
|
|
|
|
rts
|
|
|
|
}
|
2019-02-17 23:12:29 +00:00
|
|
|
// Clear the screen. Also resets current line/char cursor.
|
2018-03-25 21:40:38 +00:00
|
|
|
print_cls: {
|
2019-07-17 23:54:16 +00:00
|
|
|
jsr memset
|
|
|
|
rts
|
|
|
|
}
|
|
|
|
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.
|
|
|
|
memset: {
|
|
|
|
.const c = ' '
|
|
|
|
.const num = $3e8
|
|
|
|
.label str = menu.SCREEN
|
|
|
|
.label end = str+num
|
2019-07-31 11:47:21 +00:00
|
|
|
.label dst = 9
|
2019-07-17 23:54:16 +00:00
|
|
|
lda #<str
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z dst
|
2019-07-17 23:54:16 +00:00
|
|
|
lda #>str
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z dst+1
|
2019-08-25 20:21:56 +00:00
|
|
|
b1:
|
|
|
|
lda.z dst+1
|
|
|
|
cmp #>end
|
|
|
|
bne b2
|
|
|
|
lda.z dst
|
|
|
|
cmp #<end
|
|
|
|
bne b2
|
|
|
|
rts
|
2019-08-07 09:27:55 +00:00
|
|
|
b2:
|
2019-07-17 23:54:16 +00:00
|
|
|
lda #c
|
2018-03-25 21:40:38 +00:00
|
|
|
ldy #0
|
2019-07-17 23:54:16 +00:00
|
|
|
sta (dst),y
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z dst
|
2018-03-25 21:40:38 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z dst+1
|
2018-03-25 21:40:38 +00:00
|
|
|
!:
|
2019-08-25 20:21:56 +00:00
|
|
|
jmp b1
|
2018-03-25 21:40:38 +00:00
|
|
|
}
|
2019-02-17 23:12:29 +00:00
|
|
|
// Set the screen to print on. Also resets current line/char cursor.
|
2018-03-25 21:40:38 +00:00
|
|
|
print_set_screen: {
|
|
|
|
rts
|
|
|
|
}
|
2019-02-17 23:12:29 +00:00
|
|
|
// Default vallues for the palette
|
2018-03-26 21:49:07 +00:00
|
|
|
DTV_PALETTE_DEFAULT: .byte 0, $f, $36, $be, $58, $db, $86, $ff, $29, $26, $3b, 5, 7, $df, $9a, $a
|
2019-02-17 23:12:29 +00:00
|
|
|
// Keyboard row bitmask as expected by CIA#1 Port A when reading a specific keyboard matrix row (rows are numbered 0-7)
|
2018-03-25 21:40:38 +00:00
|
|
|
keyboard_matrix_row_bitmask: .byte $fe, $fd, $fb, $f7, $ef, $df, $bf, $7f
|
2019-02-17 23:12:29 +00:00
|
|
|
// Keyboard matrix column bitmasks for a specific keybooard matrix column when reading the keyboard. (columns are numbered 0-7)
|
2018-03-25 21:40:38 +00:00
|
|
|
keyboard_matrix_col_bitmask: .byte 1, 2, 4, 8, $10, $20, $40, $80
|
2019-02-17 23:12:29 +00:00
|
|
|
// Tables for the plotter - initialized by calling bitmap_draw_init();
|
2018-04-01 01:58:07 +00:00
|
|
|
bitmap_plot_xlo: .fill $100, 0
|
|
|
|
bitmap_plot_xhi: .fill $100, 0
|
|
|
|
bitmap_plot_ylo: .fill $100, 0
|
|
|
|
bitmap_plot_yhi: .fill $100, 0
|
|
|
|
bitmap_plot_bit: .fill $100, 0
|
2019-08-07 17:36:19 +00:00
|
|
|
MENU_TEXT: .text "C64DTV Graphics Modes CCLHBME@ OHIIMCC@ LUNCMMM@----------------------------------------@1. Standard Char (V) 0000000@2. Extended Color Char (V) 0000001@3. Multicolor Char (V) 0000010@4. Standard Bitmap (V) 0000100@5. Multicolor Bitmap (V) 0000110@6. High Color Standard Char (H) 0001000@7. High Extended Color Char (H) 0001001@8. High Multicolor Char (H) 0001010@9. High Multicolor Bitmap (H) 0001110@a. Sixs Fred 2 (D) 0010111@b. Two Plane Bitmap (D) 0011101@c. Sixs Fred (2 Plane MC BM) (D) 0011111@d. 8bpp Pixel Cell (D) 0111011@e. Chunky 8bpp Bitmap (D) 1111011@----------------------------------------@ (V) vicII (H) vicII+hicol (D) c64dtv@"
|
|
|
|
.byte 0
|