2015-09-27 16:12:25 +00:00
|
|
|
;
|
2015-10-11 15:13:28 +00:00
|
|
|
; Groepaz/Hitmen, 11.10.2015
|
|
|
|
;
|
|
|
|
; Low level init code for soft80 screen output/console input
|
2015-09-27 16:12:25 +00:00
|
|
|
;
|
|
|
|
|
2015-10-12 18:46:53 +00:00
|
|
|
.constructor soft80_init, 8
|
2015-09-27 16:12:25 +00:00
|
|
|
.destructor soft80_shutdown
|
|
|
|
|
2015-10-11 15:13:28 +00:00
|
|
|
.import soft80_kclrscr, soft80_charset
|
2015-10-14 15:24:16 +00:00
|
|
|
.export soft80_internal_bgcolor, soft80_internal_cellcolor
|
2015-10-12 13:44:41 +00:00
|
|
|
.export soft80_internal_cursorxlsb
|
2015-09-27 16:12:25 +00:00
|
|
|
|
2015-09-27 17:34:43 +00:00
|
|
|
.importzp ptr1, ptr2, ptr3
|
|
|
|
|
2015-09-27 16:12:25 +00:00
|
|
|
.include "c64.inc"
|
|
|
|
.include "soft80.inc"
|
|
|
|
|
|
|
|
soft80_init:
|
2015-10-12 21:39:47 +00:00
|
|
|
lda soft80_first_init
|
|
|
|
bne @skp
|
|
|
|
jsr firstinit
|
|
|
|
@skp:
|
|
|
|
; the "color voodoo" in other parts of the code relies on the vram and
|
|
|
|
; colorram being set up as expected, which is why we cant use the
|
|
|
|
; _bgcolor and _textcolor functions here.
|
|
|
|
|
2015-12-02 20:34:08 +00:00
|
|
|
lda CHARCOLOR ; use current textcolor
|
|
|
|
and #$0F ; make sure the upper nibble is 0s
|
2015-10-14 15:24:16 +00:00
|
|
|
sta CHARCOLOR
|
2015-10-12 21:39:47 +00:00
|
|
|
|
2015-12-02 20:34:08 +00:00
|
|
|
lda VIC_BG_COLOR0 ; use current bgcolor
|
|
|
|
and #$0F
|
2015-10-12 21:39:47 +00:00
|
|
|
sta soft80_internal_bgcolor
|
|
|
|
asl a
|
|
|
|
asl a
|
|
|
|
asl a
|
|
|
|
asl a
|
2015-10-14 15:24:16 +00:00
|
|
|
ora CHARCOLOR
|
|
|
|
sta soft80_internal_cellcolor
|
2015-10-12 21:39:47 +00:00
|
|
|
|
2015-12-02 20:34:08 +00:00
|
|
|
lda #$3B
|
2015-09-27 16:12:25 +00:00
|
|
|
sta VIC_CTRL1
|
|
|
|
lda #$00
|
|
|
|
sta CIA2_PRA
|
|
|
|
lda #$68
|
|
|
|
sta VIC_VIDEO_ADR
|
2015-12-02 20:34:08 +00:00
|
|
|
lda #$C8
|
2015-09-27 16:12:25 +00:00
|
|
|
sta VIC_CTRL2
|
|
|
|
|
2015-10-12 21:39:47 +00:00
|
|
|
jmp soft80_kclrscr
|
|
|
|
|
|
|
|
soft80_shutdown:
|
2015-11-22 18:20:58 +00:00
|
|
|
|
2015-12-02 20:34:08 +00:00
|
|
|
lda #$07
|
|
|
|
sta CIA2_PRA
|
|
|
|
jmp $FF5B ; Initialize video I/O
|
2015-10-12 21:39:47 +00:00
|
|
|
|
2016-03-06 20:26:22 +00:00
|
|
|
.segment "ONCE"
|
2015-10-12 21:39:47 +00:00
|
|
|
firstinit:
|
2015-10-12 12:40:12 +00:00
|
|
|
; copy charset to RAM under I/O
|
2015-09-27 16:12:25 +00:00
|
|
|
sei
|
|
|
|
lda $01
|
|
|
|
pha
|
|
|
|
lda #$34
|
|
|
|
sta $01
|
|
|
|
|
2015-10-12 21:39:47 +00:00
|
|
|
inc soft80_first_init
|
|
|
|
|
2020-07-11 07:39:21 +00:00
|
|
|
; soft80_lo_charset and soft80_hi_charset are page-aligned
|
2020-07-10 18:08:44 +00:00
|
|
|
ldy #0
|
2020-07-10 17:56:34 +00:00
|
|
|
lda #<soft80_charset
|
2015-12-02 20:34:08 +00:00
|
|
|
ldx #>soft80_charset
|
2020-07-10 17:56:34 +00:00
|
|
|
sta ptr1
|
2015-12-02 20:34:08 +00:00
|
|
|
stx ptr1+1
|
|
|
|
ldx #>soft80_lo_charset
|
2020-07-10 18:08:44 +00:00
|
|
|
sty ptr2
|
2015-12-02 20:34:08 +00:00
|
|
|
stx ptr2+1
|
|
|
|
ldx #>soft80_hi_charset
|
2020-07-10 18:08:44 +00:00
|
|
|
sty ptr3
|
2015-12-02 20:34:08 +00:00
|
|
|
stx ptr3+1
|
2015-09-27 16:12:25 +00:00
|
|
|
|
2015-09-27 17:34:43 +00:00
|
|
|
ldx #4
|
2015-09-27 16:12:25 +00:00
|
|
|
@l1:
|
2015-09-27 17:34:43 +00:00
|
|
|
lda (ptr1),y
|
|
|
|
sta (ptr2),y
|
|
|
|
asl a
|
|
|
|
asl a
|
|
|
|
asl a
|
|
|
|
asl a
|
|
|
|
sta (ptr3),y
|
|
|
|
iny
|
2015-09-27 16:12:25 +00:00
|
|
|
bne @l1
|
2015-09-27 17:34:43 +00:00
|
|
|
inc ptr1+1
|
|
|
|
inc ptr2+1
|
|
|
|
inc ptr3+1
|
|
|
|
dex
|
2020-07-10 18:08:44 +00:00
|
|
|
bne @l1
|
2015-09-27 16:12:25 +00:00
|
|
|
|
2015-10-12 21:39:47 +00:00
|
|
|
; copy the kplot tables to ram under I/O
|
2015-12-02 20:34:08 +00:00
|
|
|
;ldx #0 ; is 0
|
2020-07-10 18:08:44 +00:00
|
|
|
@l2:
|
2015-10-12 21:39:47 +00:00
|
|
|
lda soft80_tables_data_start,x
|
|
|
|
sta soft80_bitmapxlo,x
|
2015-12-02 20:34:08 +00:00
|
|
|
lda soft80_tables_data_start + (soft80_tables_data_end - soft80_tables_data_start - $0100),x
|
|
|
|
sta soft80_bitmapxlo + (soft80_tables_data_end - soft80_tables_data_start - $0100),x
|
2015-10-12 21:39:47 +00:00
|
|
|
inx
|
2020-07-10 18:08:44 +00:00
|
|
|
bne @l2
|
2015-10-12 21:39:47 +00:00
|
|
|
|
2015-09-27 16:12:25 +00:00
|
|
|
pla
|
|
|
|
sta $01
|
|
|
|
cli
|
|
|
|
rts
|
|
|
|
|
2015-10-12 21:39:47 +00:00
|
|
|
; the following tables take up 267 bytes, used by kplot
|
|
|
|
soft80_tables_data_start:
|
|
|
|
|
|
|
|
soft80_bitmapxlo_data:
|
|
|
|
.repeat 80,col
|
|
|
|
.byte <((col/2)*8)
|
|
|
|
.endrepeat
|
|
|
|
soft80_bitmapxhi_data:
|
|
|
|
.repeat 80,col
|
|
|
|
.byte >((col/2)*8)
|
|
|
|
.endrepeat
|
|
|
|
soft80_vramlo_data:
|
|
|
|
.repeat 25,row
|
|
|
|
.byte <(soft80_vram+(row*40))
|
|
|
|
.endrepeat
|
|
|
|
.byte 0,0,0,0,0,0,0 ; padding to next page
|
|
|
|
soft80_vramhi_data:
|
|
|
|
.repeat 25,row
|
|
|
|
.byte >(soft80_vram+(row*40))
|
|
|
|
.endrepeat
|
|
|
|
soft80_bitmapylo_data:
|
|
|
|
.repeat 25,row
|
|
|
|
.byte <(soft80_bitmap+(row*40*8))
|
|
|
|
.endrepeat
|
|
|
|
soft80_bitmapyhi_data:
|
|
|
|
.repeat 25,row
|
|
|
|
.byte >(soft80_bitmap+(row*40*8))
|
|
|
|
.endrepeat
|
|
|
|
|
|
|
|
soft80_tables_data_end:
|
|
|
|
|
2015-10-12 13:04:55 +00:00
|
|
|
;-------------------------------------------------------------------------------
|
2016-03-06 20:26:22 +00:00
|
|
|
.segment "INIT"
|
2015-10-14 15:24:16 +00:00
|
|
|
soft80_internal_cellcolor:
|
2015-10-12 13:04:55 +00:00
|
|
|
.res 1
|
|
|
|
soft80_internal_bgcolor:
|
|
|
|
.res 1
|
2015-10-12 13:44:41 +00:00
|
|
|
soft80_internal_cursorxlsb:
|
|
|
|
.res 1
|
2015-10-12 13:04:55 +00:00
|
|
|
|
2015-10-12 21:39:47 +00:00
|
|
|
.data
|
|
|
|
soft80_first_init:
|
2015-12-02 20:34:08 +00:00
|
|
|
.byte 0 ; flag to check first init, this really must be in .data
|