This commit is contained in:
Karri Kaksonen
2022-04-18 12:05:36 +03:00
committed by mrdudz
parent f2f358262e
commit 2e51b2b17c
5 changed files with 2359 additions and 2359 deletions

View File

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

View File

@@ -9,11 +9,11 @@
.constructor mono_initconio .constructor mono_initconio
.include "atari7800.inc" .include "atari7800.inc"
.include "extzp.inc" .include "extzp.inc"
.import _mono_font .import _mono_font
.import _get_tv .import _get_tv
.export _mono_screen .export _mono_screen
.export _mono_zones .export _mono_zones
.export _mono_dll .export _mono_dll
.bss .bss
_mono_screen: _mono_screen:
@@ -23,48 +23,48 @@ _mono_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 <(_mono_screen + 2 * row * charsperline) .byte <(_mono_screen + 2 * row * charsperline)
.byte $60 .byte $60
.byte >(_mono_screen + 2 * row * charsperline) .byte >(_mono_screen + 2 * row * charsperline)
.byte 12 .byte 12
.byte 0 .byte 0
.byte <(_mono_screen + 2 * row * charsperline + charsperline) .byte <(_mono_screen + 2 * row * charsperline + charsperline)
.byte $60 .byte $60
.byte >(_mono_screen + 2 * row * charsperline + charsperline) .byte >(_mono_screen + 2 * row * charsperline + charsperline)
.byte 12 .byte 12
.byte 80 .byte 80
; Cursor ; Cursor
.byte 95 .byte 95
.byte 0 .byte 0
.byte >_mono_font .byte >_mono_font
.byte 0 .byte 0
.endmacro .endmacro
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
@@ -74,153 +74,153 @@ _mono_screen:
.data .data
_mono_zones: _mono_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
_mono_dll: _mono_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 mono_initconio .proc mono_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 #>_mono_font lda #>_mono_font
sta CHBASE sta CHBASE
lda #(CTRL_MODEAC | CTRL_KANGOFF | CTRL_BCBLACK | CTRL_CHAR1B | CTRL_DMAON | CTRL_CKOFF) lda #(CTRL_MODEAC | CTRL_KANGOFF | CTRL_BCBLACK | CTRL_CHAR1B | CTRL_DMAON | CTRL_CKOFF)
sta CTRL sta CTRL
lda #$00 ; Black background lda #$00 ; Black background
sta BKGRND sta BKGRND
sta CURS_X sta CURS_X
sta CURS_Y sta CURS_Y
lda #$0f ; White lda #$0f ; White
sta P0C1 sta P0C1
rts rts
.endproc .endproc

View File

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

File diff suppressed because it is too large Load Diff

View File

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