1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 23:29:39 +00:00
This commit is contained in:
Karri Kaksonen 2022-04-18 12:05:36 +03:00
parent 45c4f7d46f
commit dbd39c63a9
5 changed files with 2359 additions and 2359 deletions

View File

@ -3,34 +3,34 @@
.export _mono_clrscr
.import _screen
.import pusha0,pushax
.include "extzp.inc"
.import _screen
.import pusha0,pushax
.include "extzp.inc"
.code
.code
.proc _mono_clrscr
.proc _mono_clrscr
lda #<_screen
ldx #>_screen
sta ptr7800
stx ptr7800+1
ldx #screenrows
@L1: ldy #mono_charsperline
lda #0
@L2: sta (ptr7800),y
dey
bne @L2
lda ptr7800
clc
adc #mono_charsperline
bcc @L3
inc ptr7800+1
@L3: dex
bne @L1
rts
lda #<_screen
ldx #>_screen
sta ptr7800
stx ptr7800+1
ldx #screenrows
@L1: ldy #mono_charsperline
lda #0
@L2: sta (ptr7800),y
dey
bne @L2
lda ptr7800
clc
adc #mono_charsperline
bcc @L3
inc ptr7800+1
@L3: dex
bne @L1
rts
.endproc
.endproc
;-------------------------------------------------------------------------------
; force the init constructor to be imported

View File

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

View File

@ -7,20 +7,20 @@
.export _mono_cputc
.import _mono_gotoxy, _mono_gotox, _mono_gotoy, pusha0
.import pushax
.import _mono_screen
.import pushax
.import _mono_screen
.include "atari7800.inc"
.include "extzp.inc"
.code
.code
;---------------------------------------------------------------------------
; 8x16 routine
umula0:
ldy #8 ; Number of bits
lda #0
lda #0
lsr ptr7800 ; Get first bit into carry
@L0: bcc @L1
@ -28,7 +28,7 @@ umula0:
adc ptrtmp
tax
lda ptrtmp+1 ; hi byte of left op
clc
clc
adc ptr7800+1
sta ptr7800+1
txa
@ -49,54 +49,54 @@ umula0:
;
.proc _mono_cputc
cmp #$0A ; LF
cmp #$0A ; LF
bne @L4
@L1: lda #0 ; newline
jsr _mono_gotox
lda CURS_Y
cmp #(screenrows-1)
@L1: lda #0 ; newline
jsr _mono_gotox
lda CURS_Y
cmp #(screenrows-1)
bne @L2
lda #0
beq @L3
@L2: clc
adc #1
@L3: jmp _mono_gotoy
lda #0
beq @L3
@L2: clc
adc #1
@L3: jmp _mono_gotoy
@L4:
pha
pha
lda #0
sta ptr7800+1
sta ptrtmp+1
lda CURS_Y ; Find position on screen buffer
sta ptr7800
lda #mono_charsperline
sta ptrtmp
jsr umula0
clc
adc CURS_X
bcc @L11
inx
@L11: clc
adc #<(_mono_screen)
sta ptr7800
bcc @L12
inx
@L12: txa
clc
adc #>(_mono_screen)
sta ptr7800+1
lda #0
sta ptr7800+1
sta ptrtmp+1
lda CURS_Y ; Find position on screen buffer
sta ptr7800
lda #mono_charsperline
sta ptrtmp
jsr umula0
clc
adc CURS_X
bcc @L11
inx
@L11: clc
adc #<(_mono_screen)
sta ptr7800
bcc @L12
inx
@L12: txa
clc
adc #>(_mono_screen)
sta ptr7800+1
pla ; Print character on screen
ldy #0
sta (ptr7800),y
pla ; Print character on screen
ldy #0
sta (ptr7800),y
lda CURS_X ; Increment cursor
cmp #(mono_charsperline-1)
beq @L1
clc
adc #1
jmp _mono_gotox
lda CURS_X ; Increment cursor
cmp #(mono_charsperline-1)
beq @L1
clc
adc #1
jmp _mono_gotox
.endproc

File diff suppressed because it is too large Load Diff

View File

@ -27,31 +27,31 @@
.constructor mono_init_cursor
.interruptor mono_blink_cursor
.importzp sp
.import _mono_zones
.import cursor
.import pusha, incsp1, pusha0, pushax, popa
.importzp sp
.import _mono_zones
.import cursor
.import pusha, incsp1, pusha0, pushax, popa
.include "atari7800.inc"
.include "extzp.inc"
.macpack generic
.data
.data
;-----------------------------------------------------------------------------
; The variables used by cursor functions
;
blink_time:
.byte 140
.byte 140
.code
.code
;---------------------------------------------------------------------------
; 8x16 routine
umula0:
ldy #8 ; Number of bits
lda #0
lda #0
lsr ptr7800 ; Get first bit into carry
@L0: bcc @L1
@ -81,25 +81,25 @@ umula0:
; A = CURS_Y
.proc calccursorzone
sta ptr7800
lda #16
sta ptrtmp
lda #0
sta ptr7800+1
sta ptrtmp+1
jsr umula0
clc
adc #10
bcc @L1
inx
@L1: clc
adc #<_mono_zones
sta cursorzone ; calculate new cursorzone
txa
clc
adc #>_mono_zones
sta cursorzone+1
rts
sta ptr7800
lda #16
sta ptrtmp
lda #0
sta ptr7800+1
sta ptrtmp+1
jsr umula0
clc
adc #10
bcc @L1
inx
@L1: clc
adc #<_mono_zones
sta cursorzone ; calculate new cursorzone
txa
clc
adc #>_mono_zones
sta cursorzone+1
rts
.endproc
@ -120,21 +120,21 @@ umula0:
;
.proc _mono_gotoy
pha
lda CURS_Y
jsr calccursorzone
ldy #1
lda #0
sta (cursorzone),y ; disable cursor
pla
sta CURS_Y
jsr calccursorzone
lda cursor
beq @L1
lda #31 ; enable cursor
@L1: ldy #1
sta (cursorzone),y
rts
pha
lda CURS_Y
jsr calccursorzone
ldy #1
lda #0
sta (cursorzone),y ; disable cursor
pla
sta CURS_Y
jsr calccursorzone
lda cursor
beq @L1
lda #31 ; enable cursor
@L1: ldy #1
sta (cursorzone),y
rts
.endproc
@ -145,51 +145,51 @@ umula0:
;
.proc _mono_gotox
sta CURS_X
ldy #3
clc
rol
rol
sta (cursorzone),y
rts
sta CURS_X
ldy #3
clc
rol
rol
sta (cursorzone),y
rts
.endproc
;-----------------------------------------------------------------------------
; Set cursor to desired position (X,Y)
;
.proc _mono_gotoxy
.proc _mono_gotoxy
jsr _mono_gotoy
jsr popa
jsr _mono_gotox
rts
.endproc
jsr _mono_gotoy
jsr popa
jsr _mono_gotox
rts
.endproc
.proc mono_gotoxy
jsr popa
jmp _mono_gotoxy
.endproc
.proc mono_gotoxy
jsr popa
jmp _mono_gotoxy
.endproc
;-----------------------------------------------------------------------------
; Initialize cursorzone at startup
; Offset to cursor zone 5.
;
.proc mono_blink_cursor
inc blink_time
bne @L3
lda #140
sta blink_time
ldy #0
lda (cursorzone),y
cmp #32
bne @L1
lda #95
bne @L2
@L1: lda #32
@L2: sta (cursorzone),y
@L3: rts
.endproc
.proc mono_blink_cursor
inc blink_time
bne @L3
lda #140
sta blink_time
ldy #0
lda (cursorzone),y
cmp #32
bne @L1
lda #95
bne @L2
@L1: lda #32
@L2: sta (cursorzone),y
@L3: rts
.endproc
;-----------------------------------------------------------------------------
; Initialize cursorzone at startup
@ -197,9 +197,9 @@ umula0:
;
.segment "ONCE"
mono_init_cursor:
lda #0
jsr calccursorzone
rts
lda #0
jsr calccursorzone
rts
;-----------------------------------------------------------------------------
; force the init constructor to be imported