2018-03-25 21:40:38 +00:00
|
|
|
.pc = $801 "Basic"
|
|
|
|
:BasicUpstart(main)
|
|
|
|
.pc = $80d "Program"
|
2019-02-16 23:49:19 +00:00
|
|
|
// Commodore 64 Registers and Constants
|
|
|
|
// Processor port data direction register
|
2018-04-01 01:58:07 +00:00
|
|
|
.label PROCPORT_DDR = 0
|
2019-02-16 23:49:19 +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-16 23:49:19 +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-16 23:49:19 +00:00
|
|
|
// RAM in $A000, $E000 I/O in $D000
|
2018-04-01 01:58:07 +00:00
|
|
|
.const PROCPORT_RAM_IO = $35
|
2019-02-16 23:49:19 +00:00
|
|
|
// RAM in $A000, $E000 CHAR ROM in $D000
|
2018-04-01 01:58:07 +00:00
|
|
|
.const PROCPORT_RAM_CHARROM = $31
|
|
|
|
.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-16 23:49:19 +00:00
|
|
|
// Color Ram
|
2018-03-25 21:40:38 +00:00
|
|
|
.label COLS = $d800
|
2019-02-16 23:49:19 +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-16 23:49:19 +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-16 23:49:19 +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-16 23:49:19 +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-16 23:49:19 +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-16 23:49:19 +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-16 23:49:19 +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-16 23:49:19 +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-16 23:49:19 +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-16 23:49:19 +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-16 23:49:19 +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-16 23:49:19 +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
|
2018-03-28 11:00:32 +00:00
|
|
|
.label print_char_cursor = 5
|
2018-04-18 23:46:41 +00:00
|
|
|
.label dtv_control = 4
|
2018-04-01 01:58:07 +00:00
|
|
|
.label print_line_cursor = $d
|
2018-03-25 21:40:38 +00:00
|
|
|
main: {
|
2018-03-26 21:49:07 +00:00
|
|
|
sei
|
2018-04-01 01:58:07 +00:00
|
|
|
lda #PROCPORT_DDR_MEMORY_MASK
|
|
|
|
sta PROCPORT_DDR
|
|
|
|
lda #PROCPORT_RAM_IO
|
|
|
|
sta PROCPORT
|
2018-03-25 21:40:38 +00:00
|
|
|
lda #DTV_FEATURE_ENABLE
|
|
|
|
sta DTV_FEATURE
|
|
|
|
b2:
|
|
|
|
jsr menu
|
|
|
|
jmp b2
|
|
|
|
}
|
|
|
|
menu: {
|
2018-03-29 07:09:07 +00:00
|
|
|
.label SCREEN = $8000
|
|
|
|
.label CHARSET = $9800
|
2018-04-18 23:46:41 +00:00
|
|
|
.label c = 2
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #($ffffffff&CHARSET)/$10000
|
2018-03-25 21:40:38 +00:00
|
|
|
sta DTV_GRAPHICS_VIC_BANK
|
2018-03-26 21:49:07 +00:00
|
|
|
lda #DTV_COLOR_BANK_DEFAULT/$400
|
|
|
|
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
|
2018-03-25 21:40:38 +00:00
|
|
|
sta DTV_CONTROL
|
|
|
|
lda #3
|
|
|
|
sta CIA2_PORT_A_DDR
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #3^CHARSET/$4000
|
2018-03-25 21:40:38 +00:00
|
|
|
sta CIA2_PORT_A
|
|
|
|
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
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #(SCREEN&$3fff)/$40|(CHARSET&$3fff)/$400
|
2018-03-26 19:41:09 +00:00
|
|
|
sta VIC_MEMORY
|
2018-04-01 10:32:45 +00:00
|
|
|
ldx #0
|
2018-03-26 21:49:07 +00:00
|
|
|
b1:
|
2018-04-01 10:32:45 +00:00
|
|
|
lda DTV_PALETTE_DEFAULT,x
|
|
|
|
sta DTV_PALETTE,x
|
|
|
|
inx
|
|
|
|
cpx #$10
|
2018-03-26 21:49:07 +00:00
|
|
|
bne b1
|
2018-03-25 21:40:38 +00:00
|
|
|
lda #<COLS
|
|
|
|
sta c
|
|
|
|
lda #>COLS
|
|
|
|
sta c+1
|
2018-03-26 21:49:07 +00:00
|
|
|
b2:
|
2018-03-25 21:40:38 +00:00
|
|
|
lda #LIGHT_GREEN
|
|
|
|
ldy #0
|
|
|
|
sta (c),y
|
|
|
|
inc c
|
|
|
|
bne !+
|
|
|
|
inc c+1
|
|
|
|
!:
|
|
|
|
lda c+1
|
|
|
|
cmp #>COLS+$3e8
|
2018-03-26 21:49:07 +00:00
|
|
|
bne b2
|
2018-03-25 21:40:38 +00:00
|
|
|
lda c
|
|
|
|
cmp #<COLS+$3e8
|
2018-03-26 21:49:07 +00:00
|
|
|
bne b2
|
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
|
2018-03-26 21:49:07 +00:00
|
|
|
b4:
|
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
|
2018-03-27 08:01:28 +00:00
|
|
|
beq b6
|
2018-03-28 22:37:04 +00:00
|
|
|
jsr mode_stdchar
|
2018-04-18 23:46:41 +00:00
|
|
|
breturn:
|
|
|
|
rts
|
2018-03-27 08:01:28 +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
|
2018-03-27 20:32:06 +00:00
|
|
|
beq b7
|
2018-03-28 22:37:04 +00:00
|
|
|
jsr mode_ecmchar
|
2018-03-27 08:01:28 +00:00
|
|
|
jmp breturn
|
2018-03-27 20:32:06 +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
|
2018-03-28 11:00:32 +00:00
|
|
|
beq b8
|
2018-03-29 07:09:07 +00:00
|
|
|
jsr mode_mcchar
|
2018-03-27 20:32:06 +00:00
|
|
|
jmp breturn
|
2018-03-28 11:00:32 +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
|
|
|
|
beq b9
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_stdbitmap
|
2018-03-28 14:43:47 +00:00
|
|
|
jmp breturn
|
|
|
|
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
|
|
|
|
beq b10
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_hicolstdchar
|
2018-03-28 22:37:04 +00:00
|
|
|
jmp breturn
|
|
|
|
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
|
|
|
|
beq b11
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_hicolecmchar
|
2018-03-28 22:37:04 +00:00
|
|
|
jmp breturn
|
|
|
|
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
|
|
|
|
beq b12
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_hicolmcchar
|
2018-03-28 22:37:04 +00:00
|
|
|
jmp breturn
|
|
|
|
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
|
|
|
|
beq b13
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_sixsfred2
|
2018-03-29 06:49:51 +00:00
|
|
|
jmp breturn
|
|
|
|
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
|
|
|
|
beq b14
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_twoplanebitmap
|
2018-03-29 06:49:51 +00:00
|
|
|
jmp breturn
|
|
|
|
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
|
|
|
|
beq b15
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_sixsfred
|
2018-03-29 07:09:07 +00:00
|
|
|
jmp breturn
|
|
|
|
b15:
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_D
|
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
|
|
|
beq b16
|
|
|
|
jsr mode_8bpppixelcell
|
|
|
|
jmp breturn
|
|
|
|
b16:
|
|
|
|
ldy #KEY_E
|
2018-03-28 11:00:32 +00:00
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2018-03-29 06:49:51 +00:00
|
|
|
bne !b4+
|
|
|
|
jmp b4
|
|
|
|
!b4:
|
2018-03-28 11:00:32 +00:00
|
|
|
jsr mode_8bppchunkybmm
|
|
|
|
jmp breturn
|
|
|
|
}
|
2019-02-16 22:23:55 +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-16 23:49:19 +00:00
|
|
|
// 8BPP Chunky Bitmap (contains 8bpp pixels)
|
2018-03-29 07:09:07 +00:00
|
|
|
.const PLANEB = $20000
|
2018-04-01 01:58:07 +00:00
|
|
|
.label _23 = $d
|
2018-03-28 11:00:32 +00:00
|
|
|
.label gfxb = 5
|
2018-04-18 23:46:41 +00:00
|
|
|
.label x = 2
|
|
|
|
.label y = 4
|
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
|
|
|
|
lda #VIC_ECM|VIC_DEN|VIC_RSEL|3
|
|
|
|
sta VIC_CONTROL
|
|
|
|
lda #VIC_MCM|VIC_CSEL
|
|
|
|
sta VIC_CONTROL2
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #PLANEB&$ffff
|
2018-03-28 11:00:32 +00:00
|
|
|
sta DTV_PLANEB_START_LO
|
|
|
|
lda #0
|
|
|
|
sta DTV_PLANEB_START_MI
|
2018-03-29 07:09:07 +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
|
|
|
|
sta BORDERCOL
|
|
|
|
tax
|
|
|
|
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
|
|
|
|
sta y
|
|
|
|
lda #<$4000
|
|
|
|
sta gfxb
|
|
|
|
lda #>$4000
|
|
|
|
sta gfxb+1
|
|
|
|
b2:
|
|
|
|
lda #<0
|
|
|
|
sta x
|
|
|
|
sta x+1
|
|
|
|
b3:
|
|
|
|
lda gfxb+1
|
|
|
|
cmp #>$8000
|
|
|
|
bne b4
|
|
|
|
lda gfxb
|
|
|
|
cmp #<$8000
|
|
|
|
bne b4
|
|
|
|
txa
|
|
|
|
jsr dtvSetCpuBankSegment1
|
|
|
|
inx
|
|
|
|
lda #<$4000
|
|
|
|
sta gfxb
|
|
|
|
lda #>$4000
|
|
|
|
sta gfxb+1
|
|
|
|
b4:
|
|
|
|
lda y
|
|
|
|
clc
|
|
|
|
adc x
|
2018-04-01 01:58:07 +00:00
|
|
|
sta _23
|
2018-03-28 11:00:32 +00:00
|
|
|
lda #0
|
|
|
|
adc x+1
|
2018-04-01 01:58:07 +00:00
|
|
|
sta _23+1
|
|
|
|
lda _23
|
2018-03-28 11:00:32 +00:00
|
|
|
ldy #0
|
|
|
|
sta (gfxb),y
|
|
|
|
inc gfxb
|
|
|
|
bne !+
|
|
|
|
inc gfxb+1
|
|
|
|
!:
|
|
|
|
inc x
|
|
|
|
bne !+
|
|
|
|
inc x+1
|
|
|
|
!:
|
|
|
|
lda x+1
|
|
|
|
cmp #>$140
|
|
|
|
bne b3
|
|
|
|
lda x
|
|
|
|
cmp #<$140
|
|
|
|
bne b3
|
|
|
|
inc y
|
|
|
|
lda y
|
|
|
|
cmp #$c8
|
|
|
|
bne b2
|
|
|
|
lda #$4000/$4000
|
|
|
|
jsr dtvSetCpuBankSegment1
|
2018-04-01 10:32:45 +00:00
|
|
|
lda #DTV_HIGHCOLOR|DTV_LINEAR|DTV_CHUNKY|DTV_COLORRAM_OFF
|
|
|
|
sta dtv_control
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_ctrl
|
|
|
|
rts
|
|
|
|
}
|
2019-02-16 22:23:55 +00:00
|
|
|
// Allow the user to control the DTV graphics using different keys
|
2018-04-01 01:58:07 +00:00
|
|
|
mode_ctrl: {
|
|
|
|
b4:
|
|
|
|
lda RASTER
|
|
|
|
cmp #$ff
|
|
|
|
bne b4
|
|
|
|
ldy #KEY_SPACE
|
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
|
|
|
beq b7
|
2018-04-18 23:46:41 +00:00
|
|
|
rts
|
2018-04-01 01:58:07 +00:00
|
|
|
b7:
|
2018-04-01 10:32:45 +00:00
|
|
|
ldx dtv_control
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_L
|
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2018-04-01 10:32:45 +00:00
|
|
|
beq b8
|
|
|
|
txa
|
|
|
|
ora #DTV_LINEAR
|
|
|
|
tax
|
|
|
|
b8:
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_H
|
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2018-04-01 10:32:45 +00:00
|
|
|
beq b9
|
|
|
|
txa
|
|
|
|
ora #DTV_HIGHCOLOR
|
|
|
|
tax
|
|
|
|
b9:
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_O
|
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2018-04-01 10:32:45 +00:00
|
|
|
beq b10
|
|
|
|
txa
|
|
|
|
ora #DTV_OVERSCAN
|
|
|
|
tax
|
|
|
|
b10:
|
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
|
2018-04-01 10:32:45 +00:00
|
|
|
beq b11
|
|
|
|
txa
|
|
|
|
ora #DTV_BORDER_OFF
|
|
|
|
tax
|
|
|
|
b11:
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_U
|
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2018-04-01 10:32:45 +00:00
|
|
|
beq b12
|
|
|
|
txa
|
|
|
|
ora #DTV_CHUNKY
|
|
|
|
tax
|
|
|
|
b12:
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_C
|
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2018-04-01 10:32:45 +00:00
|
|
|
beq b13
|
|
|
|
txa
|
|
|
|
ora #DTV_COLORRAM_OFF
|
|
|
|
tax
|
|
|
|
b13:
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy #KEY_0
|
|
|
|
jsr keyboard_key_pressed
|
|
|
|
cmp #0
|
2018-04-01 10:32:45 +00:00
|
|
|
beq b14
|
|
|
|
ldx #0
|
|
|
|
b14:
|
|
|
|
cpx dtv_control
|
|
|
|
beq b4
|
|
|
|
stx dtv_control
|
|
|
|
stx DTV_CONTROL
|
|
|
|
stx BORDERCOL
|
|
|
|
jmp b4
|
2018-03-28 11:00:32 +00:00
|
|
|
}
|
2019-02-16 22:23:55 +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
|
2018-03-28 11:00:32 +00:00
|
|
|
keyboard_key_pressed: {
|
2018-04-01 01:58:07 +00:00
|
|
|
.label colidx = 7
|
|
|
|
tya
|
2018-03-28 11:00:32 +00:00
|
|
|
and #7
|
2018-04-01 01:58:07 +00:00
|
|
|
sta colidx
|
|
|
|
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
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy colidx
|
2018-03-28 11:00:32 +00:00
|
|
|
and keyboard_matrix_col_bitmask,y
|
|
|
|
rts
|
|
|
|
}
|
2019-02-16 22:23:55 +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.
|
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-16 22:23:55 +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
|
2018-03-28 11:00:32 +00:00
|
|
|
dtvSetCpuBankSegment1: {
|
|
|
|
.label cpuBank = $ff
|
|
|
|
sta cpuBank
|
|
|
|
.byte $32, $dd
|
|
|
|
lda $ff
|
|
|
|
.byte $32, $00
|
|
|
|
rts
|
2018-03-27 20:32:06 +00:00
|
|
|
}
|
2019-02-16 22:23:55 +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-16 23:49:19 +00:00
|
|
|
// 8BPP Pixel Cell Screen (contains 40x25=1000 chars)
|
2018-03-29 07:09:07 +00:00
|
|
|
.label PLANEA = $3c00
|
2019-02-16 23:49:19 +00:00
|
|
|
// 8BPP Pixel Cell Charset (contains 256 64 byte chars)
|
2018-03-29 07:09:07 +00:00
|
|
|
.label PLANEB = $4000
|
2018-04-01 01:58:07 +00:00
|
|
|
.label _14 = 7
|
2018-04-18 23:46:41 +00:00
|
|
|
.label gfxa = 2
|
|
|
|
.label ay = 4
|
2018-03-28 11:00:32 +00:00
|
|
|
.label bits = 8
|
2018-04-18 23:46:41 +00:00
|
|
|
.label chargen = 2
|
2018-03-28 11:00:32 +00:00
|
|
|
.label gfxb = 5
|
2018-03-27 20:32:06 +00:00
|
|
|
.label col = 9
|
2018-03-28 11:00:32 +00:00
|
|
|
.label cr = 7
|
2018-04-18 23:46:41 +00:00
|
|
|
.label ch = 4
|
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
|
|
|
|
lda #VIC_ECM|VIC_DEN|VIC_RSEL|3
|
|
|
|
sta VIC_CONTROL
|
|
|
|
lda #VIC_MCM|VIC_CSEL
|
|
|
|
sta VIC_CONTROL2
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<PLANEA
|
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
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<PLANEB
|
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
|
|
|
|
sta BORDERCOL
|
|
|
|
tax
|
|
|
|
b1:
|
|
|
|
txa
|
|
|
|
sta DTV_PALETTE,x
|
|
|
|
inx
|
|
|
|
cpx #$10
|
|
|
|
bne b1
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<PLANEA
|
2018-03-27 20:32:06 +00:00
|
|
|
sta gfxa
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>PLANEA
|
2018-03-27 20:32:06 +00:00
|
|
|
sta gfxa+1
|
|
|
|
lda #0
|
|
|
|
sta ay
|
|
|
|
b2:
|
|
|
|
ldx #0
|
|
|
|
b3:
|
|
|
|
lda #$f
|
|
|
|
and ay
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
2018-04-01 01:58:07 +00:00
|
|
|
sta _14
|
2018-03-27 20:32:06 +00:00
|
|
|
txa
|
|
|
|
and #$f
|
2018-04-01 01:58:07 +00:00
|
|
|
ora _14
|
2018-03-27 20:32:06 +00:00
|
|
|
ldy #0
|
|
|
|
sta (gfxa),y
|
|
|
|
inc gfxa
|
|
|
|
bne !+
|
|
|
|
inc gfxa+1
|
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
|
|
|
bne b3
|
|
|
|
inc ay
|
|
|
|
lda ay
|
|
|
|
cmp #$19
|
|
|
|
bne b2
|
2018-04-01 01:58:07 +00:00
|
|
|
lda #PROCPORT_RAM_CHARROM
|
2018-03-27 20:32:06 +00:00
|
|
|
sta PROCPORT
|
|
|
|
lda #0
|
|
|
|
sta ch
|
|
|
|
sta col
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<PLANEB
|
2018-03-27 20:32:06 +00:00
|
|
|
sta gfxb
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>PLANEB
|
2018-03-27 20:32:06 +00:00
|
|
|
sta gfxb+1
|
|
|
|
lda #<$d000
|
|
|
|
sta chargen
|
|
|
|
lda #>$d000
|
|
|
|
sta chargen+1
|
|
|
|
b4:
|
|
|
|
lda #0
|
|
|
|
sta cr
|
|
|
|
b5:
|
|
|
|
ldy #0
|
|
|
|
lda (chargen),y
|
|
|
|
sta bits
|
|
|
|
inc chargen
|
|
|
|
bne !+
|
|
|
|
inc chargen+1
|
|
|
|
!:
|
|
|
|
ldx #0
|
|
|
|
b6:
|
|
|
|
lda #$80
|
|
|
|
and bits
|
|
|
|
cmp #0
|
2018-04-01 01:58:07 +00:00
|
|
|
beq b8
|
2018-03-27 20:32:06 +00:00
|
|
|
lda col
|
|
|
|
jmp b7
|
2018-04-01 01:58:07 +00:00
|
|
|
b8:
|
2018-03-27 20:32:06 +00:00
|
|
|
lda #0
|
|
|
|
b7:
|
|
|
|
ldy #0
|
|
|
|
sta (gfxb),y
|
|
|
|
inc gfxb
|
|
|
|
bne !+
|
|
|
|
inc gfxb+1
|
|
|
|
!:
|
|
|
|
asl bits
|
|
|
|
inc col
|
|
|
|
inx
|
|
|
|
cpx #8
|
|
|
|
bne b6
|
|
|
|
inc cr
|
|
|
|
lda cr
|
|
|
|
cmp #8
|
|
|
|
bne b5
|
|
|
|
inc ch
|
|
|
|
lda ch
|
2018-12-18 23:33:27 +00:00
|
|
|
cmp #0
|
2018-03-27 20:32:06 +00:00
|
|
|
bne b4
|
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
|
|
|
|
sta dtv_control
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_ctrl
|
2018-03-27 20:32:06 +00:00
|
|
|
rts
|
|
|
|
}
|
2019-02-16 22:23:55 +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
|
2018-04-18 23:46:41 +00:00
|
|
|
.label col = 2
|
|
|
|
.label cy = 4
|
|
|
|
.label gfxa = 2
|
|
|
|
.label ay = 4
|
|
|
|
.label gfxb = 2
|
|
|
|
.label by = 4
|
2018-04-01 01:58:07 +00:00
|
|
|
lda #DTV_HIGHCOLOR|DTV_LINEAR
|
2018-03-27 08:01:28 +00:00
|
|
|
sta DTV_CONTROL
|
|
|
|
lda #VIC_ECM|VIC_BMM|VIC_DEN|VIC_RSEL|3
|
|
|
|
sta VIC_CONTROL
|
|
|
|
lda #VIC_MCM|VIC_CSEL
|
|
|
|
sta VIC_CONTROL2
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<PLANEA
|
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
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<PLANEB
|
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
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<COLORS/$400
|
2018-03-27 08:01:28 +00:00
|
|
|
sta DTV_COLOR_BANK_LO
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>COLORS/$400
|
2018-03-27 08:01:28 +00:00
|
|
|
sta DTV_COLOR_BANK_HI
|
|
|
|
ldx #0
|
|
|
|
b1:
|
|
|
|
txa
|
|
|
|
sta DTV_PALETTE,x
|
|
|
|
inx
|
|
|
|
cpx #$10
|
|
|
|
bne b1
|
|
|
|
lda #0
|
|
|
|
sta BORDERCOL
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<COLORS
|
2018-03-27 08:01:28 +00:00
|
|
|
sta col
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>COLORS
|
2018-03-27 08:01:28 +00:00
|
|
|
sta col+1
|
|
|
|
lda #0
|
|
|
|
sta cy
|
|
|
|
b2:
|
|
|
|
ldx #0
|
|
|
|
b3:
|
|
|
|
txa
|
|
|
|
clc
|
|
|
|
adc cy
|
|
|
|
and #$f
|
|
|
|
ldy #0
|
|
|
|
sta (col),y
|
|
|
|
inc col
|
|
|
|
bne !+
|
|
|
|
inc col+1
|
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
|
|
|
bne b3
|
|
|
|
inc cy
|
|
|
|
lda cy
|
|
|
|
cmp #$19
|
|
|
|
bne b2
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<PLANEA
|
2018-03-27 08:01:28 +00:00
|
|
|
sta gfxa
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>PLANEA
|
2018-03-27 08:01:28 +00:00
|
|
|
sta gfxa+1
|
|
|
|
lda #0
|
|
|
|
sta ay
|
|
|
|
b4:
|
|
|
|
ldx #0
|
|
|
|
b5:
|
|
|
|
lda ay
|
|
|
|
lsr
|
|
|
|
and #3
|
|
|
|
tay
|
|
|
|
lda row_bitmask,y
|
|
|
|
ldy #0
|
|
|
|
sta (gfxa),y
|
|
|
|
inc gfxa
|
|
|
|
bne !+
|
|
|
|
inc gfxa+1
|
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
|
|
|
bne b5
|
|
|
|
inc ay
|
|
|
|
lda ay
|
|
|
|
cmp #$c8
|
|
|
|
bne b4
|
|
|
|
lda #0
|
|
|
|
sta by
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<PLANEB
|
2018-03-27 08:01:28 +00:00
|
|
|
sta gfxb
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>PLANEB
|
2018-03-27 08:01:28 +00:00
|
|
|
sta gfxb+1
|
|
|
|
b6:
|
|
|
|
ldx #0
|
|
|
|
b7:
|
|
|
|
lda #$1b
|
|
|
|
ldy #0
|
|
|
|
sta (gfxb),y
|
|
|
|
inc gfxb
|
|
|
|
bne !+
|
|
|
|
inc gfxb+1
|
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
|
|
|
bne b7
|
|
|
|
inc by
|
|
|
|
lda by
|
|
|
|
cmp #$c8
|
|
|
|
bne b6
|
2018-04-01 10:32:45 +00:00
|
|
|
lda #DTV_HIGHCOLOR|DTV_LINEAR
|
|
|
|
sta 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-16 22:23:55 +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
|
2018-04-01 01:58:07 +00:00
|
|
|
.label _16 = 7
|
2018-04-18 23:46:41 +00:00
|
|
|
.label col = 2
|
|
|
|
.label cy = 4
|
|
|
|
.label gfxa = 2
|
|
|
|
.label ay = 4
|
|
|
|
.label gfxb = 2
|
|
|
|
.label by = 4
|
2018-04-01 01:58:07 +00:00
|
|
|
lda #DTV_HIGHCOLOR|DTV_LINEAR
|
2018-03-25 21:40:38 +00:00
|
|
|
sta DTV_CONTROL
|
|
|
|
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
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<PLANEA
|
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
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<PLANEB
|
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
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<COLORS/$400
|
2018-03-26 21:49:07 +00:00
|
|
|
sta DTV_COLOR_BANK_LO
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>COLORS/$400
|
2018-03-26 21:49:07 +00:00
|
|
|
sta DTV_COLOR_BANK_HI
|
2018-03-28 13:21:22 +00:00
|
|
|
ldx #0
|
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
|
|
|
|
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
|
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
|
2018-03-26 21:49:07 +00:00
|
|
|
sta col
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>COLORS
|
2018-03-26 21:49:07 +00:00
|
|
|
sta col+1
|
|
|
|
lda #0
|
|
|
|
sta cy
|
|
|
|
b2:
|
|
|
|
ldx #0
|
|
|
|
b3:
|
|
|
|
lda #$f
|
|
|
|
and cy
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
2018-04-01 01:58:07 +00:00
|
|
|
sta _16
|
2018-03-26 21:49:07 +00:00
|
|
|
txa
|
|
|
|
and #$f
|
2018-04-01 01:58:07 +00:00
|
|
|
ora _16
|
2018-03-25 21:40:38 +00:00
|
|
|
ldy #0
|
2018-03-26 21:49:07 +00:00
|
|
|
sta (col),y
|
|
|
|
inc col
|
2018-03-25 21:40:38 +00:00
|
|
|
bne !+
|
2018-03-26 21:49:07 +00:00
|
|
|
inc col+1
|
2018-03-25 21:40:38 +00:00
|
|
|
!:
|
2018-03-26 21:49:07 +00:00
|
|
|
inx
|
|
|
|
cpx #$28
|
|
|
|
bne b3
|
|
|
|
inc cy
|
|
|
|
lda cy
|
|
|
|
cmp #$19
|
|
|
|
bne b2
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<PLANEA
|
2018-03-25 21:40:38 +00:00
|
|
|
sta gfxa
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>PLANEA
|
2018-03-25 21:40:38 +00:00
|
|
|
sta gfxa+1
|
|
|
|
lda #0
|
|
|
|
sta ay
|
2018-03-26 21:49:07 +00:00
|
|
|
b4:
|
2018-03-25 21:40:38 +00:00
|
|
|
ldx #0
|
2018-03-26 21:49:07 +00:00
|
|
|
b5:
|
2018-03-25 21:40:38 +00:00
|
|
|
lda #4
|
|
|
|
and ay
|
|
|
|
cmp #0
|
2018-04-21 19:38:30 +00:00
|
|
|
beq b6
|
|
|
|
lda #$ff
|
|
|
|
ldy #0
|
2018-03-25 21:40:38 +00:00
|
|
|
sta (gfxa),y
|
|
|
|
inc gfxa
|
|
|
|
bne !+
|
|
|
|
inc gfxa+1
|
|
|
|
!:
|
2018-03-26 21:49:07 +00:00
|
|
|
b7:
|
2018-03-25 21:40:38 +00:00
|
|
|
inx
|
|
|
|
cpx #$28
|
2018-03-26 21:49:07 +00:00
|
|
|
bne b5
|
2018-03-25 21:40:38 +00:00
|
|
|
inc ay
|
|
|
|
lda ay
|
|
|
|
cmp #$c8
|
2018-03-26 21:49:07 +00:00
|
|
|
bne b4
|
2018-03-25 21:40:38 +00:00
|
|
|
lda #0
|
|
|
|
sta by
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<PLANEB
|
2018-03-25 21:40:38 +00:00
|
|
|
sta gfxb
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>PLANEB
|
2018-03-25 21:40:38 +00:00
|
|
|
sta gfxb+1
|
2018-03-26 21:49:07 +00:00
|
|
|
b8:
|
2018-03-25 21:40:38 +00:00
|
|
|
ldx #0
|
2018-03-26 21:49:07 +00:00
|
|
|
b9:
|
2018-03-25 21:40:38 +00:00
|
|
|
lda #$f
|
|
|
|
ldy #0
|
|
|
|
sta (gfxb),y
|
|
|
|
inc gfxb
|
|
|
|
bne !+
|
|
|
|
inc gfxb+1
|
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
2018-03-26 21:49:07 +00:00
|
|
|
bne b9
|
2018-03-25 21:40:38 +00:00
|
|
|
inc by
|
|
|
|
lda by
|
|
|
|
cmp #$c8
|
2018-03-26 21:49:07 +00:00
|
|
|
bne b8
|
2018-04-01 10:32:45 +00:00
|
|
|
lda #DTV_HIGHCOLOR|DTV_LINEAR
|
|
|
|
sta dtv_control
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_ctrl
|
2018-03-25 21:40:38 +00:00
|
|
|
rts
|
2018-03-26 21:49:07 +00:00
|
|
|
b6:
|
2018-04-21 19:38:30 +00:00
|
|
|
lda #0
|
|
|
|
tay
|
2018-03-25 21:40:38 +00:00
|
|
|
sta (gfxa),y
|
|
|
|
inc gfxa
|
|
|
|
bne !+
|
|
|
|
inc gfxa+1
|
|
|
|
!:
|
2018-03-26 21:49:07 +00:00
|
|
|
jmp b7
|
2018-03-25 21:40:38 +00:00
|
|
|
}
|
2019-02-16 22:23:55 +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
|
2018-03-28 14:43:47 +00:00
|
|
|
.label _15 = 7
|
2018-04-18 23:46:41 +00:00
|
|
|
.label col = 2
|
|
|
|
.label cy = 4
|
|
|
|
.label gfxa = 2
|
|
|
|
.label ay = 4
|
|
|
|
.label gfxb = 2
|
|
|
|
.label by = 4
|
2018-04-01 01:58:07 +00:00
|
|
|
lda #DTV_LINEAR
|
2018-03-28 14:43:47 +00:00
|
|
|
sta DTV_CONTROL
|
|
|
|
lda #VIC_ECM|VIC_BMM|VIC_DEN|VIC_RSEL|3
|
|
|
|
sta VIC_CONTROL
|
|
|
|
lda #VIC_MCM|VIC_CSEL
|
|
|
|
sta VIC_CONTROL2
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<PLANEA
|
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
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<PLANEB
|
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
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<COLORS/$400
|
2018-03-28 14:43:47 +00:00
|
|
|
sta DTV_COLOR_BANK_LO
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>COLORS/$400
|
2018-03-28 14:43:47 +00:00
|
|
|
sta DTV_COLOR_BANK_HI
|
|
|
|
ldx #0
|
|
|
|
b1:
|
|
|
|
txa
|
|
|
|
sta DTV_PALETTE,x
|
|
|
|
inx
|
|
|
|
cpx #$10
|
|
|
|
bne b1
|
|
|
|
lda #0
|
|
|
|
sta BORDERCOL
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<COLORS
|
2018-03-28 14:43:47 +00:00
|
|
|
sta col
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>COLORS
|
2018-03-28 14:43:47 +00:00
|
|
|
sta col+1
|
|
|
|
lda #0
|
|
|
|
sta cy
|
|
|
|
b2:
|
|
|
|
ldx #0
|
|
|
|
b3:
|
|
|
|
txa
|
|
|
|
and #3
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
sta _15
|
|
|
|
lda #3
|
|
|
|
and cy
|
|
|
|
ora _15
|
|
|
|
ldy #0
|
|
|
|
sta (col),y
|
|
|
|
inc col
|
|
|
|
bne !+
|
|
|
|
inc col+1
|
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
|
|
|
bne b3
|
|
|
|
inc cy
|
|
|
|
lda cy
|
|
|
|
cmp #$19
|
|
|
|
bne b2
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<PLANEA
|
2018-03-28 14:43:47 +00:00
|
|
|
sta gfxa
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>PLANEA
|
2018-03-28 14:43:47 +00:00
|
|
|
sta gfxa+1
|
|
|
|
lda #0
|
|
|
|
sta ay
|
|
|
|
b4:
|
|
|
|
ldx #0
|
|
|
|
b5:
|
|
|
|
lda ay
|
|
|
|
lsr
|
|
|
|
and #3
|
|
|
|
tay
|
|
|
|
lda row_bitmask,y
|
|
|
|
ldy #0
|
|
|
|
sta (gfxa),y
|
|
|
|
inc gfxa
|
|
|
|
bne !+
|
|
|
|
inc gfxa+1
|
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
|
|
|
bne b5
|
|
|
|
inc ay
|
|
|
|
lda ay
|
|
|
|
cmp #$c8
|
|
|
|
bne b4
|
|
|
|
lda #0
|
|
|
|
sta by
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<PLANEB
|
2018-03-28 14:43:47 +00:00
|
|
|
sta gfxb
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>PLANEB
|
2018-03-28 14:43:47 +00:00
|
|
|
sta gfxb+1
|
|
|
|
b6:
|
|
|
|
ldx #0
|
|
|
|
b7:
|
|
|
|
lda #$1b
|
|
|
|
ldy #0
|
|
|
|
sta (gfxb),y
|
|
|
|
inc gfxb
|
|
|
|
bne !+
|
|
|
|
inc gfxb+1
|
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
|
|
|
bne b7
|
|
|
|
inc by
|
|
|
|
lda by
|
|
|
|
cmp #$c8
|
|
|
|
bne b6
|
2018-04-01 10:32:45 +00:00
|
|
|
lda #DTV_LINEAR
|
|
|
|
sta 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-16 22:23:55 +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-16 23:49:19 +00:00
|
|
|
// Charset ROM
|
2018-03-29 07:09:07 +00:00
|
|
|
.label COLORS = $8400
|
2018-03-29 06:49:51 +00:00
|
|
|
.label _26 = 7
|
2018-04-18 23:46:41 +00:00
|
|
|
.label col = 2
|
2018-03-29 06:49:51 +00:00
|
|
|
.label ch = 5
|
2018-04-18 23:46:41 +00:00
|
|
|
.label cy = 4
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #($ffffffff&CHARSET)/$10000
|
2018-03-29 06:49:51 +00:00
|
|
|
sta DTV_GRAPHICS_VIC_BANK
|
2018-03-29 07:09:07 +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
|
|
|
|
lda #3
|
|
|
|
sta CIA2_PORT_A_DDR
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #3^CHARSET/$4000
|
2018-03-29 06:49:51 +00:00
|
|
|
sta CIA2_PORT_A
|
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
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #(SCREEN&$3fff)/$40|(CHARSET&$3fff)/$400
|
2018-03-29 06:49:51 +00:00
|
|
|
sta VIC_MEMORY
|
|
|
|
ldx #0
|
|
|
|
b1:
|
|
|
|
txa
|
|
|
|
sta DTV_PALETTE,x
|
|
|
|
inx
|
|
|
|
cpx #$10
|
|
|
|
bne b1
|
|
|
|
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
|
2018-03-29 06:49:51 +00:00
|
|
|
sta ch
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>SCREEN
|
2018-03-29 06:49:51 +00:00
|
|
|
sta ch+1
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<COLORS
|
2018-03-29 06:49:51 +00:00
|
|
|
sta col
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>COLORS
|
2018-03-29 06:49:51 +00:00
|
|
|
sta col+1
|
|
|
|
lda #0
|
|
|
|
sta cy
|
|
|
|
b2:
|
|
|
|
ldx #0
|
|
|
|
b3:
|
|
|
|
lda #$f
|
|
|
|
and cy
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
sta _26
|
|
|
|
txa
|
|
|
|
and #$f
|
|
|
|
ora _26
|
|
|
|
ldy #0
|
|
|
|
sta (col),y
|
|
|
|
inc col
|
|
|
|
bne !+
|
|
|
|
inc col+1
|
|
|
|
!:
|
2018-03-29 07:09:07 +00:00
|
|
|
ldy #0
|
|
|
|
sta (ch),y
|
|
|
|
inc ch
|
|
|
|
bne !+
|
|
|
|
inc ch+1
|
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
|
|
|
bne b3
|
|
|
|
inc cy
|
|
|
|
lda cy
|
|
|
|
cmp #$19
|
|
|
|
bne b2
|
2018-04-01 10:32:45 +00:00
|
|
|
lda #DTV_HIGHCOLOR
|
|
|
|
sta dtv_control
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_ctrl
|
2018-03-29 07:09:07 +00:00
|
|
|
rts
|
|
|
|
}
|
2019-02-16 22:23:55 +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-16 23:49:19 +00:00
|
|
|
// Charset ROM
|
2018-03-29 07:09:07 +00:00
|
|
|
.label COLORS = $8400
|
|
|
|
.label _26 = 7
|
2018-04-18 23:46:41 +00:00
|
|
|
.label col = 2
|
2018-03-29 07:09:07 +00:00
|
|
|
.label ch = 5
|
2018-04-18 23:46:41 +00:00
|
|
|
.label cy = 4
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #($ffffffff&CHARSET)/$10000
|
|
|
|
sta DTV_GRAPHICS_VIC_BANK
|
|
|
|
lda #COLORS/$400
|
|
|
|
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
|
|
|
|
lda #3
|
|
|
|
sta CIA2_PORT_A_DDR
|
|
|
|
lda #3^CHARSET/$4000
|
|
|
|
sta CIA2_PORT_A
|
|
|
|
lda #VIC_DEN|VIC_RSEL|VIC_ECM|3
|
|
|
|
sta VIC_CONTROL
|
|
|
|
lda #VIC_CSEL
|
|
|
|
sta VIC_CONTROL2
|
|
|
|
lda #(SCREEN&$3fff)/$40|(CHARSET&$3fff)/$400
|
|
|
|
sta VIC_MEMORY
|
|
|
|
ldx #0
|
|
|
|
b1:
|
|
|
|
txa
|
|
|
|
sta DTV_PALETTE,x
|
|
|
|
inx
|
|
|
|
cpx #$10
|
|
|
|
bne b1
|
|
|
|
lda #0
|
|
|
|
sta BORDERCOL
|
|
|
|
lda #$50
|
|
|
|
sta BGCOL1
|
|
|
|
lda #$54
|
|
|
|
sta BGCOL2
|
|
|
|
lda #$58
|
|
|
|
sta BGCOL3
|
|
|
|
lda #$5c
|
|
|
|
sta BGCOL4
|
|
|
|
lda #<SCREEN
|
|
|
|
sta ch
|
|
|
|
lda #>SCREEN
|
|
|
|
sta ch+1
|
|
|
|
lda #<COLORS
|
|
|
|
sta col
|
|
|
|
lda #>COLORS
|
|
|
|
sta col+1
|
|
|
|
lda #0
|
|
|
|
sta cy
|
|
|
|
b2:
|
|
|
|
ldx #0
|
|
|
|
b3:
|
2018-03-29 06:49:51 +00:00
|
|
|
lda #$f
|
|
|
|
and cy
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
2018-03-29 07:09:07 +00:00
|
|
|
sta _26
|
2018-03-29 06:49:51 +00:00
|
|
|
txa
|
|
|
|
and #$f
|
2018-03-29 07:09:07 +00:00
|
|
|
ora _26
|
|
|
|
ldy #0
|
|
|
|
sta (col),y
|
|
|
|
inc col
|
|
|
|
bne !+
|
|
|
|
inc col+1
|
|
|
|
!:
|
2018-03-29 06:49:51 +00:00
|
|
|
ldy #0
|
|
|
|
sta (ch),y
|
|
|
|
inc ch
|
|
|
|
bne !+
|
|
|
|
inc ch+1
|
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
|
|
|
bne b3
|
|
|
|
inc cy
|
|
|
|
lda cy
|
|
|
|
cmp #$19
|
|
|
|
bne b2
|
2018-04-01 10:32:45 +00:00
|
|
|
lda #DTV_HIGHCOLOR
|
|
|
|
sta dtv_control
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_ctrl
|
2018-03-29 06:49:51 +00:00
|
|
|
rts
|
|
|
|
}
|
2019-02-16 22:23:55 +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-16 23:49:19 +00:00
|
|
|
// Charset ROM
|
2018-03-29 07:09:07 +00:00
|
|
|
.label COLORS = $8400
|
2018-03-28 22:37:04 +00:00
|
|
|
.label _25 = 7
|
2018-04-18 23:46:41 +00:00
|
|
|
.label col = 2
|
2018-03-28 22:37:04 +00:00
|
|
|
.label ch = 5
|
2018-04-18 23:46:41 +00:00
|
|
|
.label cy = 4
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #($ffffffff&CHARSET)/$10000
|
2018-03-28 22:37:04 +00:00
|
|
|
sta DTV_GRAPHICS_VIC_BANK
|
2018-03-29 07:09:07 +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
|
|
|
|
lda #3
|
|
|
|
sta CIA2_PORT_A_DDR
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #3^CHARSET/$4000
|
2018-03-28 22:37:04 +00:00
|
|
|
sta CIA2_PORT_A
|
|
|
|
lda #VIC_DEN|VIC_RSEL|3
|
|
|
|
sta VIC_CONTROL
|
|
|
|
lda #VIC_CSEL
|
|
|
|
sta VIC_CONTROL2
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #(SCREEN&$3fff)/$40|(CHARSET&$3fff)/$400
|
2018-03-28 22:37:04 +00:00
|
|
|
sta VIC_MEMORY
|
|
|
|
ldx #0
|
|
|
|
b1:
|
|
|
|
txa
|
|
|
|
sta DTV_PALETTE,x
|
|
|
|
inx
|
|
|
|
cpx #$10
|
|
|
|
bne b1
|
|
|
|
lda #0
|
|
|
|
sta BGCOL
|
|
|
|
sta BORDERCOL
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<SCREEN
|
2018-03-28 22:37:04 +00:00
|
|
|
sta ch
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>SCREEN
|
2018-03-28 22:37:04 +00:00
|
|
|
sta ch+1
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<COLORS
|
2018-03-28 22:37:04 +00:00
|
|
|
sta col
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>COLORS
|
2018-03-28 22:37:04 +00:00
|
|
|
sta col+1
|
|
|
|
lda #0
|
|
|
|
sta cy
|
|
|
|
b2:
|
|
|
|
ldx #0
|
|
|
|
b3:
|
|
|
|
lda #$f
|
|
|
|
and cy
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
sta _25
|
|
|
|
txa
|
|
|
|
and #$f
|
|
|
|
ora _25
|
|
|
|
ldy #0
|
|
|
|
sta (col),y
|
|
|
|
inc col
|
|
|
|
bne !+
|
|
|
|
inc col+1
|
|
|
|
!:
|
|
|
|
ldy #0
|
|
|
|
sta (ch),y
|
|
|
|
inc ch
|
|
|
|
bne !+
|
|
|
|
inc ch+1
|
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
|
|
|
bne b3
|
|
|
|
inc cy
|
|
|
|
lda cy
|
|
|
|
cmp #$19
|
|
|
|
bne b2
|
2018-04-01 10:32:45 +00:00
|
|
|
lda #DTV_HIGHCOLOR
|
|
|
|
sta dtv_control
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_ctrl
|
|
|
|
rts
|
|
|
|
}
|
2019-02-16 22:23:55 +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
|
|
|
|
.label col2 = 7
|
2018-04-18 23:46:41 +00:00
|
|
|
.label ch = 2
|
|
|
|
.label cy = 4
|
|
|
|
.label l = 4
|
2018-04-01 01:58:07 +00:00
|
|
|
lda #($ffffffff&BITMAP)/$10000
|
|
|
|
sta DTV_GRAPHICS_VIC_BANK
|
|
|
|
lda #0
|
|
|
|
sta DTV_CONTROL
|
|
|
|
lda #3
|
|
|
|
sta CIA2_PORT_A_DDR
|
|
|
|
lda #3^BITMAP/$4000
|
|
|
|
sta CIA2_PORT_A
|
|
|
|
lda #VIC_BMM|VIC_DEN|VIC_RSEL|3
|
|
|
|
sta VIC_CONTROL
|
|
|
|
lda #VIC_CSEL
|
|
|
|
sta VIC_CONTROL2
|
|
|
|
lda #(SCREEN&$3fff)/$40|(BITMAP&$3fff)/$400
|
|
|
|
sta VIC_MEMORY
|
|
|
|
ldx #0
|
|
|
|
b1:
|
|
|
|
lda DTV_PALETTE_DEFAULT,x
|
|
|
|
sta DTV_PALETTE,x
|
|
|
|
inx
|
|
|
|
cpx #$10
|
|
|
|
bne b1
|
|
|
|
lda #BLACK
|
|
|
|
sta BGCOL
|
|
|
|
sta BORDERCOL
|
|
|
|
lda #<SCREEN
|
|
|
|
sta ch
|
|
|
|
lda #>SCREEN
|
|
|
|
sta ch+1
|
|
|
|
lda #0
|
|
|
|
sta cy
|
|
|
|
b2:
|
|
|
|
ldx #0
|
|
|
|
b3:
|
|
|
|
txa
|
|
|
|
clc
|
|
|
|
adc cy
|
|
|
|
and #$f
|
|
|
|
tay
|
|
|
|
tya
|
|
|
|
eor #$ff
|
|
|
|
clc
|
|
|
|
adc #$f+1
|
|
|
|
sta col2
|
|
|
|
tya
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
ora col2
|
|
|
|
ldy #0
|
|
|
|
sta (ch),y
|
|
|
|
inc ch
|
|
|
|
bne !+
|
|
|
|
inc ch+1
|
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
|
|
|
bne b3
|
|
|
|
inc cy
|
|
|
|
lda cy
|
|
|
|
cmp #$19
|
|
|
|
bne b2
|
|
|
|
jsr bitmap_init
|
|
|
|
jsr bitmap_clear
|
|
|
|
lda #0
|
|
|
|
sta l
|
|
|
|
b4:
|
|
|
|
ldy l
|
|
|
|
lda lines_x,y
|
|
|
|
sta bitmap_line.x0
|
|
|
|
lda lines_x+1,y
|
|
|
|
sta bitmap_line.x1
|
|
|
|
lda lines_y,y
|
|
|
|
sta bitmap_line.y0
|
|
|
|
ldx l
|
|
|
|
ldy lines_y+1,x
|
|
|
|
jsr bitmap_line
|
|
|
|
inc l
|
|
|
|
lda l
|
|
|
|
cmp #lines_cnt
|
|
|
|
bcc b4
|
2018-04-01 10:32:45 +00:00
|
|
|
lda #0
|
|
|
|
sta dtv_control
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_ctrl
|
|
|
|
rts
|
|
|
|
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-16 22:23:55 +00:00
|
|
|
// Draw a line on the bitmap
|
2018-04-01 01:58:07 +00:00
|
|
|
bitmap_line: {
|
2018-04-21 19:38:30 +00:00
|
|
|
.label xd = 8
|
|
|
|
.label yd = 7
|
|
|
|
.label x0 = 9
|
2018-04-01 01:58:07 +00:00
|
|
|
.label x1 = $c
|
2018-09-26 20:01:15 +00:00
|
|
|
.label y0 = $b
|
2018-04-01 01:58:07 +00:00
|
|
|
lda x0
|
|
|
|
cmp x1
|
2018-04-21 19:38:30 +00:00
|
|
|
bcc b1
|
2018-04-01 01:58:07 +00:00
|
|
|
sec
|
2018-04-21 19:38:30 +00:00
|
|
|
sbc x1
|
2018-04-01 01:58:07 +00:00
|
|
|
sta xd
|
2018-04-21 19:38:30 +00:00
|
|
|
tya
|
|
|
|
cmp y0
|
|
|
|
beq !+
|
2018-04-01 01:58:07 +00:00
|
|
|
bcs b2
|
2018-04-21 19:38:30 +00:00
|
|
|
!:
|
2018-04-01 01:58:07 +00:00
|
|
|
tya
|
2018-04-21 19:38:30 +00:00
|
|
|
eor #$ff
|
2018-04-01 01:58:07 +00:00
|
|
|
sec
|
2018-04-21 19:38:30 +00:00
|
|
|
adc y0
|
2018-04-01 01:58:07 +00:00
|
|
|
sta yd
|
|
|
|
cmp xd
|
2018-04-21 19:38:30 +00:00
|
|
|
bcc b3
|
|
|
|
sty bitmap_line_ydxi.y
|
|
|
|
ldx x1
|
|
|
|
jsr bitmap_line_ydxi
|
2018-03-28 22:37:04 +00:00
|
|
|
breturn:
|
|
|
|
rts
|
2018-04-01 01:58:07 +00:00
|
|
|
b3:
|
2018-09-26 20:01:15 +00:00
|
|
|
lda x1
|
|
|
|
sta bitmap_line_xdyi.x
|
2018-04-21 19:38:30 +00:00
|
|
|
sty bitmap_line_xdyi.y
|
|
|
|
jsr bitmap_line_xdyi
|
2018-04-01 01:58:07 +00:00
|
|
|
jmp breturn
|
|
|
|
b2:
|
|
|
|
tya
|
|
|
|
sec
|
2018-04-21 19:38:30 +00:00
|
|
|
sbc y0
|
2018-04-01 01:58:07 +00:00
|
|
|
sta yd
|
|
|
|
cmp xd
|
2018-04-21 19:38:30 +00:00
|
|
|
bcc b6
|
|
|
|
lda y0
|
|
|
|
sta bitmap_line_ydxd.y
|
2018-04-01 01:58:07 +00:00
|
|
|
ldx x0
|
2018-04-21 19:38:30 +00:00
|
|
|
sty bitmap_line_ydxd.y1
|
|
|
|
jsr bitmap_line_ydxd
|
2018-04-01 01:58:07 +00:00
|
|
|
jmp breturn
|
|
|
|
b6:
|
2018-09-26 20:01:15 +00:00
|
|
|
lda x1
|
|
|
|
sta bitmap_line_xdyd.x
|
2018-04-21 19:38:30 +00:00
|
|
|
sty bitmap_line_xdyd.y
|
|
|
|
lda x0
|
|
|
|
sta bitmap_line_xdyd.x1
|
|
|
|
jsr bitmap_line_xdyd
|
2018-04-01 01:58:07 +00:00
|
|
|
jmp breturn
|
|
|
|
b1:
|
2018-04-21 19:38:30 +00:00
|
|
|
lda x1
|
2018-04-01 01:58:07 +00:00
|
|
|
sec
|
2018-04-21 19:38:30 +00:00
|
|
|
sbc x0
|
2018-04-01 01:58:07 +00:00
|
|
|
sta xd
|
2018-04-21 19:38:30 +00:00
|
|
|
tya
|
|
|
|
cmp y0
|
|
|
|
beq !+
|
2018-04-01 01:58:07 +00:00
|
|
|
bcs b9
|
2018-04-21 19:38:30 +00:00
|
|
|
!:
|
2018-04-01 01:58:07 +00:00
|
|
|
tya
|
2018-04-21 19:38:30 +00:00
|
|
|
eor #$ff
|
2018-04-01 01:58:07 +00:00
|
|
|
sec
|
2018-04-21 19:38:30 +00:00
|
|
|
adc y0
|
2018-04-01 01:58:07 +00:00
|
|
|
sta yd
|
|
|
|
cmp xd
|
2018-04-21 19:38:30 +00:00
|
|
|
bcc b10
|
|
|
|
sty bitmap_line_ydxd.y
|
2018-04-01 01:58:07 +00:00
|
|
|
ldx x1
|
2018-04-21 19:38:30 +00:00
|
|
|
jsr bitmap_line_ydxd
|
2018-04-01 01:58:07 +00:00
|
|
|
jmp breturn
|
|
|
|
b10:
|
2018-09-26 20:01:15 +00:00
|
|
|
lda x0
|
|
|
|
sta bitmap_line_xdyd.x
|
2018-04-21 19:38:30 +00:00
|
|
|
jsr bitmap_line_xdyd
|
2018-04-01 01:58:07 +00:00
|
|
|
jmp breturn
|
|
|
|
b9:
|
|
|
|
tya
|
|
|
|
sec
|
2018-04-21 19:38:30 +00:00
|
|
|
sbc y0
|
2018-04-01 01:58:07 +00:00
|
|
|
sta yd
|
|
|
|
cmp xd
|
2018-04-21 19:38:30 +00:00
|
|
|
bcc b13
|
|
|
|
lda y0
|
|
|
|
sta bitmap_line_ydxi.y
|
|
|
|
ldx x0
|
|
|
|
sty bitmap_line_ydxi.y1
|
|
|
|
jsr bitmap_line_ydxi
|
2018-04-01 01:58:07 +00:00
|
|
|
jmp breturn
|
|
|
|
b13:
|
2018-09-26 20:01:15 +00:00
|
|
|
lda x0
|
|
|
|
sta bitmap_line_xdyi.x
|
2018-04-21 19:38:30 +00:00
|
|
|
lda x1
|
|
|
|
sta bitmap_line_xdyi.x1
|
|
|
|
jsr bitmap_line_xdyi
|
2018-03-28 22:37:04 +00:00
|
|
|
jmp breturn
|
|
|
|
}
|
2018-04-21 19:38:30 +00:00
|
|
|
bitmap_line_xdyi: {
|
2018-09-26 20:01:15 +00:00
|
|
|
.label x = $a
|
|
|
|
.label y = $b
|
2018-04-21 19:38:30 +00:00
|
|
|
.label x1 = 9
|
|
|
|
.label xd = 8
|
|
|
|
.label yd = 7
|
2018-09-26 20:01:15 +00:00
|
|
|
.label e = $c
|
2018-04-21 19:38:30 +00:00
|
|
|
lda yd
|
2018-04-01 01:58:07 +00:00
|
|
|
lsr
|
|
|
|
sta e
|
|
|
|
b1:
|
2018-09-26 20:01:15 +00:00
|
|
|
ldx x
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy y
|
|
|
|
jsr bitmap_plot
|
2018-09-26 20:01:15 +00:00
|
|
|
inc x
|
2018-04-01 01:58:07 +00:00
|
|
|
lda e
|
|
|
|
clc
|
2018-04-21 19:38:30 +00:00
|
|
|
adc yd
|
2018-04-01 01:58:07 +00:00
|
|
|
sta e
|
2018-04-21 19:38:30 +00:00
|
|
|
lda xd
|
2018-04-01 01:58:07 +00:00
|
|
|
cmp e
|
|
|
|
bcs b2
|
2018-04-21 19:38:30 +00:00
|
|
|
inc y
|
2018-04-01 01:58:07 +00:00
|
|
|
lda e
|
|
|
|
sec
|
2018-04-21 19:38:30 +00:00
|
|
|
sbc xd
|
2018-04-01 01:58:07 +00:00
|
|
|
sta e
|
|
|
|
b2:
|
2018-09-26 20:01:15 +00:00
|
|
|
ldx x1
|
|
|
|
inx
|
|
|
|
cpx x
|
2018-04-01 01:58:07 +00:00
|
|
|
bne b1
|
|
|
|
rts
|
|
|
|
}
|
|
|
|
bitmap_plot: {
|
2018-04-18 23:46:41 +00:00
|
|
|
.label _0 = 2
|
|
|
|
.label plotter_x = 2
|
2018-04-01 01:58:07 +00:00
|
|
|
.label plotter_y = 5
|
|
|
|
lda bitmap_plot_xhi,x
|
|
|
|
sta plotter_x+1
|
|
|
|
lda bitmap_plot_xlo,x
|
|
|
|
sta plotter_x
|
|
|
|
lda bitmap_plot_yhi,y
|
|
|
|
sta plotter_y+1
|
|
|
|
lda bitmap_plot_ylo,y
|
|
|
|
sta plotter_y
|
|
|
|
lda _0
|
|
|
|
clc
|
|
|
|
adc plotter_y
|
|
|
|
sta _0
|
|
|
|
lda _0+1
|
|
|
|
adc plotter_y+1
|
|
|
|
sta _0+1
|
|
|
|
lda bitmap_plot_bit,x
|
|
|
|
ldy #0
|
|
|
|
ora (_0),y
|
|
|
|
sta (_0),y
|
|
|
|
rts
|
|
|
|
}
|
2018-04-21 19:38:30 +00:00
|
|
|
bitmap_line_ydxi: {
|
2018-09-26 20:01:15 +00:00
|
|
|
.label y = $a
|
|
|
|
.label y1 = $b
|
2018-04-21 19:38:30 +00:00
|
|
|
.label yd = 7
|
|
|
|
.label xd = 8
|
|
|
|
.label e = 9
|
2018-04-01 01:58:07 +00:00
|
|
|
lda xd
|
|
|
|
lsr
|
|
|
|
sta e
|
|
|
|
b1:
|
|
|
|
ldy y
|
|
|
|
jsr bitmap_plot
|
|
|
|
inc y
|
|
|
|
lda e
|
|
|
|
clc
|
|
|
|
adc xd
|
|
|
|
sta e
|
|
|
|
lda yd
|
|
|
|
cmp e
|
|
|
|
bcs b2
|
2018-04-21 19:38:30 +00:00
|
|
|
inx
|
2018-04-01 01:58:07 +00:00
|
|
|
lda e
|
|
|
|
sec
|
|
|
|
sbc yd
|
|
|
|
sta e
|
|
|
|
b2:
|
2018-09-26 20:01:15 +00:00
|
|
|
lda y1
|
|
|
|
clc
|
|
|
|
adc #1
|
|
|
|
cmp y
|
2018-04-01 01:58:07 +00:00
|
|
|
bne b1
|
|
|
|
rts
|
|
|
|
}
|
|
|
|
bitmap_line_xdyd: {
|
2018-09-26 20:01:15 +00:00
|
|
|
.label x = $a
|
|
|
|
.label y = $b
|
2018-04-01 01:58:07 +00:00
|
|
|
.label x1 = $c
|
2018-04-21 19:38:30 +00:00
|
|
|
.label xd = 8
|
|
|
|
.label yd = 7
|
|
|
|
.label e = 9
|
2018-04-01 01:58:07 +00:00
|
|
|
lda yd
|
|
|
|
lsr
|
|
|
|
sta e
|
|
|
|
b1:
|
2018-09-26 20:01:15 +00:00
|
|
|
ldx x
|
2018-04-01 01:58:07 +00:00
|
|
|
ldy y
|
|
|
|
jsr bitmap_plot
|
2018-09-26 20:01:15 +00:00
|
|
|
inc x
|
2018-04-01 01:58:07 +00:00
|
|
|
lda e
|
|
|
|
clc
|
|
|
|
adc yd
|
|
|
|
sta e
|
|
|
|
lda xd
|
|
|
|
cmp e
|
|
|
|
bcs b2
|
|
|
|
dec y
|
|
|
|
lda e
|
|
|
|
sec
|
|
|
|
sbc xd
|
|
|
|
sta e
|
|
|
|
b2:
|
2018-09-26 20:01:15 +00:00
|
|
|
ldx x1
|
|
|
|
inx
|
|
|
|
cpx x
|
2018-04-01 01:58:07 +00:00
|
|
|
bne b1
|
|
|
|
rts
|
|
|
|
}
|
2018-04-21 19:38:30 +00:00
|
|
|
bitmap_line_ydxd: {
|
2018-09-26 20:01:15 +00:00
|
|
|
.label y = $a
|
|
|
|
.label y1 = $b
|
2018-04-21 19:38:30 +00:00
|
|
|
.label yd = 7
|
|
|
|
.label xd = 8
|
|
|
|
.label e = 9
|
|
|
|
lda xd
|
|
|
|
lsr
|
|
|
|
sta e
|
|
|
|
b1:
|
|
|
|
ldy y
|
|
|
|
jsr bitmap_plot
|
|
|
|
inc y
|
|
|
|
lda e
|
|
|
|
clc
|
|
|
|
adc xd
|
|
|
|
sta e
|
|
|
|
lda yd
|
|
|
|
cmp e
|
|
|
|
bcs b2
|
|
|
|
dex
|
|
|
|
lda e
|
|
|
|
sec
|
|
|
|
sbc yd
|
|
|
|
sta e
|
|
|
|
b2:
|
2018-09-26 20:01:15 +00:00
|
|
|
lda y1
|
|
|
|
clc
|
|
|
|
adc #1
|
|
|
|
cmp y
|
2018-04-21 19:38:30 +00:00
|
|
|
bne b1
|
|
|
|
rts
|
|
|
|
}
|
2019-02-16 22:23:55 +00:00
|
|
|
// Clear all graphics on the bitmap
|
2018-04-01 01:58:07 +00:00
|
|
|
bitmap_clear: {
|
2018-04-18 23:46:41 +00:00
|
|
|
.label bitmap = 2
|
|
|
|
.label y = 4
|
|
|
|
.label _3 = 2
|
2018-08-22 10:40:19 +00:00
|
|
|
lda bitmap_plot_xlo
|
2018-04-01 01:58:07 +00:00
|
|
|
sta _3
|
2018-08-22 10:40:19 +00:00
|
|
|
lda bitmap_plot_xhi
|
2018-04-01 01:58:07 +00:00
|
|
|
sta _3+1
|
|
|
|
lda #0
|
|
|
|
sta y
|
|
|
|
b1:
|
|
|
|
ldx #0
|
|
|
|
b2:
|
|
|
|
lda #0
|
|
|
|
tay
|
|
|
|
sta (bitmap),y
|
|
|
|
inc bitmap
|
|
|
|
bne !+
|
|
|
|
inc bitmap+1
|
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$c8
|
|
|
|
bne b2
|
|
|
|
inc y
|
|
|
|
lda y
|
|
|
|
cmp #$28
|
|
|
|
bne b1
|
|
|
|
rts
|
|
|
|
}
|
2019-02-16 22:23:55 +00:00
|
|
|
// Initialize the bitmap plotter tables for a specific bitmap
|
2018-04-01 01:58:07 +00:00
|
|
|
bitmap_init: {
|
2018-04-18 23:46:41 +00:00
|
|
|
.label _6 = 4
|
|
|
|
.label yoffs = 2
|
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
|
|
|
|
sta yoffs
|
|
|
|
sta yoffs+1
|
|
|
|
tax
|
|
|
|
b3:
|
|
|
|
txa
|
|
|
|
and #7
|
|
|
|
sta _6
|
|
|
|
lda yoffs
|
|
|
|
ora _6
|
|
|
|
sta bitmap_plot_ylo,x
|
|
|
|
lda yoffs+1
|
|
|
|
sta bitmap_plot_yhi,x
|
|
|
|
txa
|
|
|
|
and #7
|
|
|
|
cmp #7
|
|
|
|
bne b4
|
|
|
|
clc
|
|
|
|
lda yoffs
|
|
|
|
adc #<$28*8
|
|
|
|
sta yoffs
|
|
|
|
lda yoffs+1
|
|
|
|
adc #>$28*8
|
|
|
|
sta yoffs+1
|
|
|
|
b4:
|
|
|
|
inx
|
|
|
|
cpx #0
|
|
|
|
bne b3
|
|
|
|
rts
|
|
|
|
}
|
2019-02-16 22:23:55 +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-16 23:49:19 +00:00
|
|
|
// Charset ROM
|
2018-03-29 07:19:36 +00:00
|
|
|
.label COLORS = $d800
|
2018-03-29 06:49:51 +00:00
|
|
|
.label _28 = 7
|
2018-04-18 23:46:41 +00:00
|
|
|
.label col = 2
|
2018-03-29 06:49:51 +00:00
|
|
|
.label ch = 5
|
2018-04-18 23:46:41 +00:00
|
|
|
.label cy = 4
|
2018-03-29 06:49:51 +00:00
|
|
|
lda #($ffffffff&CHARSET)/$10000
|
|
|
|
sta DTV_GRAPHICS_VIC_BANK
|
2018-03-29 07:19:36 +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
|
|
|
|
lda #3
|
|
|
|
sta CIA2_PORT_A_DDR
|
|
|
|
lda #3^CHARSET/$4000
|
|
|
|
sta CIA2_PORT_A
|
|
|
|
lda #VIC_DEN|VIC_RSEL|3
|
|
|
|
sta VIC_CONTROL
|
|
|
|
lda #VIC_CSEL|VIC_MCM
|
|
|
|
sta VIC_CONTROL2
|
|
|
|
lda #(SCREEN&$3fff)/$40|(CHARSET&$3fff)/$400
|
|
|
|
sta VIC_MEMORY
|
|
|
|
ldx #0
|
|
|
|
b1:
|
|
|
|
lda DTV_PALETTE_DEFAULT,x
|
|
|
|
sta DTV_PALETTE,x
|
|
|
|
inx
|
|
|
|
cpx #$10
|
|
|
|
bne b1
|
|
|
|
lda #0
|
|
|
|
sta BORDERCOL
|
|
|
|
lda #BLACK
|
|
|
|
sta BGCOL1
|
|
|
|
lda #GREEN
|
|
|
|
sta BGCOL2
|
|
|
|
lda #BLUE
|
|
|
|
sta BGCOL3
|
|
|
|
lda #<SCREEN
|
|
|
|
sta ch
|
|
|
|
lda #>SCREEN
|
|
|
|
sta ch+1
|
|
|
|
lda #<COLORS
|
|
|
|
sta col
|
|
|
|
lda #>COLORS
|
|
|
|
sta col+1
|
|
|
|
lda #0
|
|
|
|
sta cy
|
|
|
|
b2:
|
|
|
|
ldx #0
|
|
|
|
b3:
|
|
|
|
txa
|
|
|
|
clc
|
|
|
|
adc cy
|
|
|
|
and #$f
|
|
|
|
ldy #0
|
|
|
|
sta (col),y
|
|
|
|
inc col
|
|
|
|
bne !+
|
|
|
|
inc col+1
|
|
|
|
!:
|
|
|
|
lda #$f
|
|
|
|
and cy
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
sta _28
|
|
|
|
txa
|
|
|
|
and #$f
|
|
|
|
ora _28
|
|
|
|
ldy #0
|
|
|
|
sta (ch),y
|
|
|
|
inc ch
|
|
|
|
bne !+
|
|
|
|
inc ch+1
|
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
|
|
|
bne b3
|
|
|
|
inc cy
|
|
|
|
lda cy
|
|
|
|
cmp #$19
|
|
|
|
bne b2
|
2018-04-01 10:32:45 +00:00
|
|
|
lda #0
|
|
|
|
sta dtv_control
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_ctrl
|
2018-03-29 06:49:51 +00:00
|
|
|
rts
|
|
|
|
}
|
2019-02-16 22:23:55 +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-16 23:49:19 +00:00
|
|
|
// Charset ROM
|
2018-03-29 07:19:36 +00:00
|
|
|
.label COLORS = $d800
|
2018-03-28 22:37:04 +00:00
|
|
|
.label _28 = 7
|
2018-04-18 23:46:41 +00:00
|
|
|
.label col = 2
|
2018-03-28 22:37:04 +00:00
|
|
|
.label ch = 5
|
2018-04-18 23:46:41 +00:00
|
|
|
.label cy = 4
|
2018-03-29 07:19:36 +00:00
|
|
|
lda #($ffffffff&CHARSET)/$10000
|
2018-03-28 22:37:04 +00:00
|
|
|
sta DTV_GRAPHICS_VIC_BANK
|
2018-03-29 07:19:36 +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
|
|
|
|
lda #3
|
|
|
|
sta CIA2_PORT_A_DDR
|
2018-03-29 07:19:36 +00:00
|
|
|
lda #3^CHARSET/$4000
|
2018-03-28 22:37:04 +00:00
|
|
|
sta CIA2_PORT_A
|
|
|
|
lda #VIC_DEN|VIC_RSEL|VIC_ECM|3
|
|
|
|
sta VIC_CONTROL
|
|
|
|
lda #VIC_CSEL
|
|
|
|
sta VIC_CONTROL2
|
2018-03-29 07:19:36 +00:00
|
|
|
lda #(SCREEN&$3fff)/$40|(CHARSET&$3fff)/$400
|
2018-03-28 22:37:04 +00:00
|
|
|
sta VIC_MEMORY
|
|
|
|
ldx #0
|
|
|
|
b1:
|
|
|
|
lda DTV_PALETTE_DEFAULT,x
|
|
|
|
sta DTV_PALETTE,x
|
|
|
|
inx
|
|
|
|
cpx #$10
|
|
|
|
bne b1
|
|
|
|
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
|
2018-03-28 22:37:04 +00:00
|
|
|
sta ch
|
2018-03-29 07:19:36 +00:00
|
|
|
lda #>SCREEN
|
2018-03-28 22:37:04 +00:00
|
|
|
sta ch+1
|
2018-03-29 07:19:36 +00:00
|
|
|
lda #<COLORS
|
2018-03-28 22:37:04 +00:00
|
|
|
sta col
|
2018-03-29 07:19:36 +00:00
|
|
|
lda #>COLORS
|
2018-03-28 22:37:04 +00:00
|
|
|
sta col+1
|
|
|
|
lda #0
|
|
|
|
sta cy
|
|
|
|
b2:
|
|
|
|
ldx #0
|
|
|
|
b3:
|
|
|
|
txa
|
|
|
|
clc
|
|
|
|
adc cy
|
|
|
|
and #$f
|
|
|
|
ldy #0
|
|
|
|
sta (col),y
|
|
|
|
inc col
|
|
|
|
bne !+
|
|
|
|
inc col+1
|
|
|
|
!:
|
|
|
|
lda #$f
|
|
|
|
and cy
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
sta _28
|
|
|
|
txa
|
|
|
|
and #$f
|
|
|
|
ora _28
|
|
|
|
ldy #0
|
|
|
|
sta (ch),y
|
|
|
|
inc ch
|
|
|
|
bne !+
|
|
|
|
inc ch+1
|
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
|
|
|
bne b3
|
|
|
|
inc cy
|
|
|
|
lda cy
|
|
|
|
cmp #$19
|
|
|
|
bne b2
|
2018-04-01 10:32:45 +00:00
|
|
|
lda #0
|
|
|
|
sta dtv_control
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_ctrl
|
2018-03-28 22:37:04 +00:00
|
|
|
rts
|
|
|
|
}
|
2019-02-16 22:23:55 +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-16 23:49:19 +00:00
|
|
|
// Charset ROM
|
2018-03-29 07:19:36 +00:00
|
|
|
.label COLORS = $d800
|
2018-03-28 22:37:04 +00:00
|
|
|
.label _27 = 7
|
2018-04-18 23:46:41 +00:00
|
|
|
.label col = 2
|
2018-03-28 22:37:04 +00:00
|
|
|
.label ch = 5
|
2018-04-18 23:46:41 +00:00
|
|
|
.label cy = 4
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #($ffffffff&CHARSET)/$10000
|
2018-03-28 22:37:04 +00:00
|
|
|
sta DTV_GRAPHICS_VIC_BANK
|
2018-03-29 07:19:36 +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
|
|
|
|
lda #3
|
|
|
|
sta CIA2_PORT_A_DDR
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #3^CHARSET/$4000
|
2018-03-28 22:37:04 +00:00
|
|
|
sta CIA2_PORT_A
|
|
|
|
lda #VIC_DEN|VIC_RSEL|3
|
|
|
|
sta VIC_CONTROL
|
|
|
|
lda #VIC_CSEL
|
|
|
|
sta VIC_CONTROL2
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #(SCREEN&$3fff)/$40|(CHARSET&$3fff)/$400
|
2018-03-28 22:37:04 +00:00
|
|
|
sta VIC_MEMORY
|
|
|
|
ldx #0
|
|
|
|
b1:
|
|
|
|
lda DTV_PALETTE_DEFAULT,x
|
|
|
|
sta DTV_PALETTE,x
|
|
|
|
inx
|
|
|
|
cpx #$10
|
|
|
|
bne b1
|
|
|
|
lda #0
|
|
|
|
sta BGCOL
|
|
|
|
sta BORDERCOL
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<SCREEN
|
2018-03-28 22:37:04 +00:00
|
|
|
sta ch
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>SCREEN
|
2018-03-28 22:37:04 +00:00
|
|
|
sta ch+1
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<COLORS
|
2018-03-28 22:37:04 +00:00
|
|
|
sta col
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>COLORS
|
2018-03-28 22:37:04 +00:00
|
|
|
sta col+1
|
|
|
|
lda #0
|
|
|
|
sta cy
|
|
|
|
b2:
|
|
|
|
ldx #0
|
|
|
|
b3:
|
|
|
|
txa
|
|
|
|
clc
|
|
|
|
adc cy
|
|
|
|
and #$f
|
|
|
|
ldy #0
|
|
|
|
sta (col),y
|
|
|
|
inc col
|
|
|
|
bne !+
|
|
|
|
inc col+1
|
|
|
|
!:
|
|
|
|
lda #$f
|
|
|
|
and cy
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
sta _27
|
|
|
|
txa
|
|
|
|
and #$f
|
|
|
|
ora _27
|
|
|
|
ldy #0
|
|
|
|
sta (ch),y
|
|
|
|
inc ch
|
|
|
|
bne !+
|
|
|
|
inc ch+1
|
|
|
|
!:
|
|
|
|
inx
|
|
|
|
cpx #$28
|
|
|
|
bne b3
|
|
|
|
inc cy
|
|
|
|
lda cy
|
|
|
|
cmp #$19
|
|
|
|
bne b2
|
2018-04-01 10:32:45 +00:00
|
|
|
lda #0
|
|
|
|
sta dtv_control
|
2018-04-01 01:58:07 +00:00
|
|
|
jsr mode_ctrl
|
2018-03-28 22:37:04 +00:00
|
|
|
rts
|
|
|
|
}
|
2019-02-16 22:23:55 +00:00
|
|
|
// Print a number of zero-terminated strings, each followed by a newline.
|
|
|
|
// The sequence of lines is terminated by another zero.
|
2018-03-26 19:41:09 +00:00
|
|
|
print_str_lines: {
|
2018-04-18 23:46:41 +00:00
|
|
|
.label str = 2
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<menu.SCREEN
|
2018-03-26 19:41:09 +00:00
|
|
|
sta print_line_cursor
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>menu.SCREEN
|
2018-03-26 19:41:09 +00:00
|
|
|
sta print_line_cursor+1
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<menu.SCREEN
|
2018-03-26 19:41:09 +00:00
|
|
|
sta print_char_cursor
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>menu.SCREEN
|
2018-03-26 19:41:09 +00:00
|
|
|
sta print_char_cursor+1
|
|
|
|
lda #<MENU_TEXT
|
|
|
|
sta str
|
|
|
|
lda #>MENU_TEXT
|
|
|
|
sta str+1
|
|
|
|
b1:
|
|
|
|
ldy #0
|
|
|
|
lda (str),y
|
|
|
|
cmp #'@'
|
|
|
|
bne b4
|
2018-03-25 21:40:38 +00:00
|
|
|
rts
|
2018-03-26 19:41:09 +00:00
|
|
|
b4:
|
|
|
|
ldy #0
|
|
|
|
lda (str),y
|
|
|
|
inc str
|
|
|
|
bne !+
|
|
|
|
inc str+1
|
|
|
|
!:
|
|
|
|
cmp #'@'
|
|
|
|
beq b5
|
|
|
|
ldy #0
|
|
|
|
sta (print_char_cursor),y
|
|
|
|
inc print_char_cursor
|
|
|
|
bne !+
|
|
|
|
inc print_char_cursor+1
|
|
|
|
!:
|
|
|
|
b5:
|
|
|
|
cmp #'@'
|
|
|
|
bne b4
|
|
|
|
jsr print_ln
|
|
|
|
lda print_line_cursor
|
|
|
|
sta print_char_cursor
|
|
|
|
lda print_line_cursor+1
|
|
|
|
sta print_char_cursor+1
|
|
|
|
jmp b1
|
2018-03-25 21:40:38 +00:00
|
|
|
}
|
2019-02-16 22:23:55 +00:00
|
|
|
// Print a newline
|
2018-03-25 21:40:38 +00:00
|
|
|
print_ln: {
|
|
|
|
b1:
|
|
|
|
lda print_line_cursor
|
|
|
|
clc
|
|
|
|
adc #$28
|
|
|
|
sta print_line_cursor
|
|
|
|
bcc !+
|
|
|
|
inc print_line_cursor+1
|
|
|
|
!:
|
|
|
|
lda print_line_cursor+1
|
|
|
|
cmp print_char_cursor+1
|
|
|
|
bcc b1
|
|
|
|
bne !+
|
|
|
|
lda print_line_cursor
|
|
|
|
cmp print_char_cursor
|
|
|
|
bcc b1
|
|
|
|
!:
|
|
|
|
rts
|
|
|
|
}
|
2019-02-16 22:23:55 +00:00
|
|
|
// Clear the screen. Also resets current line/char cursor.
|
2018-03-25 21:40:38 +00:00
|
|
|
print_cls: {
|
2018-04-18 23:46:41 +00:00
|
|
|
.label sc = 2
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #<menu.SCREEN
|
2018-03-25 21:40:38 +00:00
|
|
|
sta sc
|
2018-03-29 07:09:07 +00:00
|
|
|
lda #>menu.SCREEN
|
2018-03-25 21:40:38 +00:00
|
|
|
sta sc+1
|
|
|
|
b1:
|
|
|
|
lda #' '
|
|
|
|
ldy #0
|
|
|
|
sta (sc),y
|
|
|
|
inc sc
|
|
|
|
bne !+
|
|
|
|
inc sc+1
|
|
|
|
!:
|
|
|
|
lda sc+1
|
2018-03-29 07:09:07 +00:00
|
|
|
cmp #>menu.SCREEN+$3e8
|
2018-03-25 21:40:38 +00:00
|
|
|
bne b1
|
|
|
|
lda sc
|
2018-03-29 07:09:07 +00:00
|
|
|
cmp #<menu.SCREEN+$3e8
|
2018-03-25 21:40:38 +00:00
|
|
|
bne b1
|
|
|
|
rts
|
|
|
|
}
|
2019-02-16 22:23:55 +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-16 23:49:19 +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-16 23:49:19 +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-16 23:49:19 +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-16 23:49:19 +00:00
|
|
|
// Plot and line drawing routines for HIRES bitmaps
|
|
|
|
// Currently it can only plot on the first 256 x-positions.
|
|
|
|
// 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
|
2018-03-27 08:01:28 +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@"+"@"
|