1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-24 11:31:31 +00:00
This commit is contained in:
Karri Kaksonen 2022-04-16 21:22:44 +03:00 committed by mrdudz
parent 057fd866da
commit a2aaeb0d1d

View File

@ -8,11 +8,11 @@
.constructor initconio .constructor initconio
.include "atari7800.inc" .include "atari7800.inc"
.import _font160 .import _font160
.import _get_tv .import _get_tv
.export _screen .export _screen
.export _zones .export _zones
.export _dll .export _dll
.bss .bss
_screen: _screen:
@ -22,43 +22,43 @@ _screen:
; Macros used to generate lists ; Macros used to generate lists
.macro DLLentry offset, addr .macro DLLentry offset, addr
.byte offset .byte offset
.byte >addr .byte >addr
.byte <addr .byte <addr
.endmacro .endmacro
.macro NullHeader offset, zero .macro NullHeader offset, zero
.byte offset .byte offset
.byte zero .byte zero
.endmacro .endmacro
.macro Header addr, palwidth, hpos .macro Header addr, palwidth, hpos
.byte <addr .byte <addr
.byte palwidth .byte palwidth
.byte >addr .byte >addr
.byte hpos .byte hpos
.endmacro .endmacro
.macro XHeader addr, flags, palwidth, hpos .macro XHeader addr, flags, palwidth, hpos
.byte <addr .byte <addr
.byte flags .byte flags
.byte >addr .byte >addr
.byte palwidth .byte palwidth
.byte hpos .byte hpos
.endmacro .endmacro
.macro TextZone row .macro TextZone row
; Text ; Text
.byte <(_screen + row * charsperline) .byte <(_screen + row * charsperline)
.byte $60 .byte $60
.byte >(_screen + row * charsperline) .byte >(_screen + row * charsperline)
.byte 12 .byte 12
.byte 0 .byte 0
; Cursor ; Cursor
.byte 254 .byte 254
.byte 0 .byte 0
.byte >_font160 .byte >_font160
.byte 0 .byte 0
.endmacro .endmacro
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
@ -68,155 +68,155 @@ _screen:
.data .data
_zones: _zones:
zone0: TextZone 0 zone0: TextZone 0
nh: NullHeader 0, 0 nh: NullHeader 0, 0
zone1: TextZone 1 zone1: TextZone 1
NullHeader 0, 0 NullHeader 0, 0
zone2: TextZone 2 zone2: TextZone 2
NullHeader 0, 0 NullHeader 0, 0
zone3: TextZone 3 zone3: TextZone 3
NullHeader 0, 0 NullHeader 0, 0
zone4: TextZone 4 zone4: TextZone 4
NullHeader 0, 0 NullHeader 0, 0
zone5: TextZone 5 zone5: TextZone 5
NullHeader 0, 0 NullHeader 0, 0
zone6: TextZone 6 zone6: TextZone 6
NullHeader 0, 0 NullHeader 0, 0
zone7: TextZone 7 zone7: TextZone 7
NullHeader 0, 0 NullHeader 0, 0
zone8: TextZone 8 zone8: TextZone 8
NullHeader 0, 0 NullHeader 0, 0
zone9: TextZone 9 zone9: TextZone 9
NullHeader 0, 0 NullHeader 0, 0
zone10: TextZone 10 zone10: TextZone 10
NullHeader 0, 0 NullHeader 0, 0
zone11: TextZone 11 zone11: TextZone 11
NullHeader 0, 0 NullHeader 0, 0
zone12: TextZone 12 zone12: TextZone 12
NullHeader 0, 0 NullHeader 0, 0
zone13: TextZone 13 zone13: TextZone 13
NullHeader 0, 0 NullHeader 0, 0
zone14: TextZone 14 zone14: TextZone 14
NullHeader 0, 0 NullHeader 0, 0
zone15: TextZone 15 zone15: TextZone 15
NullHeader 0, 0 NullHeader 0, 0
zone16: TextZone 16 zone16: TextZone 16
NullHeader 0, 0 NullHeader 0, 0
zone17: TextZone 17 zone17: TextZone 17
NullHeader 0, 0 NullHeader 0, 0
zone18: TextZone 18 zone18: TextZone 18
NullHeader 0, 0 NullHeader 0, 0
zone19: TextZone 19 zone19: TextZone 19
NullHeader 0, 0 NullHeader 0, 0
zone20: TextZone 20 zone20: TextZone 20
NullHeader 0, 0 NullHeader 0, 0
zone21: TextZone 21 zone21: TextZone 21
NullHeader 0, 0 NullHeader 0, 0
zone22: TextZone 22 zone22: TextZone 22
NullHeader 0, 0 NullHeader 0, 0
zone23: TextZone 23 zone23: TextZone 23
NullHeader 0, 0 NullHeader 0, 0
zone24: TextZone 24 zone24: TextZone 24
NullHeader 0, 0 NullHeader 0, 0
zone25: TextZone 25 zone25: TextZone 25
NullHeader 0, 0 NullHeader 0, 0
zone26: TextZone 26 zone26: TextZone 26
NullHeader 0, 0 NullHeader 0, 0
zone27: TextZone 27 zone27: TextZone 27
NullHeader 0, 0 NullHeader 0, 0
_dll: _dll:
PALscanlines: ; 25 lines PALscanlines: ; 25 lines
DLLentry 15, nh DLLentry 15, nh
DLLentry 8, nh DLLentry 8, nh
Topscanlines: ; 9 lines Topscanlines: ; 9 lines
DLLentry 8, nh DLLentry 8, nh
Displaylines: Displaylines:
DLLentry $80+7, zone0 ; NMI interrupt from end of prev zone DLLentry $80+7, zone0 ; NMI interrupt from end of prev zone
DLLentry 7, zone1 DLLentry 7, zone1
DLLentry 7, zone2 DLLentry 7, zone2
DLLentry 7, zone3 DLLentry 7, zone3
DLLentry 7, zone4 DLLentry 7, zone4
DLLentry 7, zone5 DLLentry 7, zone5
DLLentry 7, zone6 DLLentry 7, zone6
DLLentry 7, zone7 DLLentry 7, zone7
DLLentry 7, zone8 DLLentry 7, zone8
DLLentry 7, zone9 DLLentry 7, zone9
DLLentry 7, zone10 DLLentry 7, zone10
DLLentry 7, zone11 DLLentry 7, zone11
DLLentry 7, zone12 DLLentry 7, zone12
DLLentry 7, zone13 DLLentry 7, zone13
DLLentry 7, zone14 DLLentry 7, zone14
DLLentry 7, zone15 DLLentry 7, zone15
DLLentry 7, zone16 DLLentry 7, zone16
DLLentry 7, zone17 DLLentry 7, zone17
DLLentry 7, zone18 DLLentry 7, zone18
DLLentry 7, zone19 DLLentry 7, zone19
DLLentry 7, zone20 DLLentry 7, zone20
DLLentry 7, zone21 DLLentry 7, zone21
DLLentry 7, zone22 DLLentry 7, zone22
DLLentry 7, zone23 DLLentry 7, zone23
DLLentry 7, zone24 DLLentry 7, zone24
DLLentry 7, zone25 DLLentry 7, zone25
DLLentry 7, zone26 DLLentry 7, zone26
DLLentry 7, zone27 DLLentry 7, zone27
Bottomscanlines: Bottomscanlines:
DLLentry $80+15, nh ; NMI interrupt at end of display DLLentry $80+15, nh ; NMI interrupt at end of display
DLLentry 9, nh DLLentry 9, nh
DLLentry 15, nh DLLentry 15, nh
DLLentry 8, nh DLLentry 8, nh
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Set up the screen to 320a mode ; Set up the screen to 320a mode
; ;
.segment "ONCE" .segment "ONCE"
CTRL_MODE160 .set 0 CTRL_MODE160 .set 0
CTRL_MODEAC .set 3 CTRL_MODEAC .set 3
CTRL_KANGOFF .set 0 CTRL_KANGOFF .set 0
CTRL_BCBLACK .set 0 CTRL_BCBLACK .set 0
CTRL_CHAR1B .set 0 CTRL_CHAR1B .set 0
CTRL_CHAR2B .set $10 CTRL_CHAR2B .set $10
CTRL_DMAON .set $40 CTRL_DMAON .set $40
CTRL_CKOFF .set 0 CTRL_CKOFF .set 0
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Initialize the conio display lists and zones ; Initialize the conio display lists and zones
; ;
.proc initconio .proc initconio
jsr _get_tv jsr _get_tv
bne pal bne pal
lda #<Topscanlines lda #<Topscanlines
sta DPPL sta DPPL
lda #>Topscanlines lda #>Topscanlines
sta DPPH sta DPPH
jmp vblankon jmp vblankon
pal: lda #<PALscanlines pal: lda #<PALscanlines
sta DPPL sta DPPL
lda #>PALscanlines lda #>PALscanlines
sta DPPH sta DPPH
vblankon: vblankon:
lda MSTAT lda MSTAT
bmi vblankon bmi vblankon
vblankoff: vblankoff:
lda MSTAT lda MSTAT
bpl vblankoff bpl vblankoff
lda #>_font160 lda #>_font160
sta CHBASE sta CHBASE
lda #(CTRL_MODE160 | CTRL_KANGOFF | CTRL_BCBLACK | CTRL_CHAR2B | CTRL_DMAON | CTRL_CKOFF) lda #(CTRL_MODE160 | CTRL_KANGOFF | CTRL_BCBLACK | CTRL_CHAR2B | CTRL_DMAON | CTRL_CKOFF)
sta CTRL sta CTRL
lda #$00 ; Black background lda #$00 ; Black background
sta BKGRND sta BKGRND
lda #$33 ; Red lda #$33 ; Red
sta P0C1 sta P0C1
lda #$c8 ; Green lda #$c8 ; Green
sta P0C2 sta P0C2
lda #$0f ; White lda #$0f ; White
sta P0C3 sta P0C3
rts rts
.endproc .endproc