Split files

This commit is contained in:
Karri Kaksonen
2022-04-16 21:13:51 +03:00
committed by mrdudz
parent f0e16514e0
commit 02fbcad697
4 changed files with 85 additions and 92 deletions

View File

@@ -3,34 +3,34 @@
.export _clrscr .export _clrscr
.import _screen .import _screen
.import pusha0,pushax .import pusha0,pushax
.include "extzp.inc" .include "extzp.inc"
.code .code
.proc _clrscr .proc _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 #charsperline @L1: ldy #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 #charsperline adc #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

@@ -6,23 +6,16 @@
; ;
.export _cputc .export _cputc
.export _textcolor .export umula0
.import _gotoxy, gotox, gotoy, pusha0 .import _gotoxy, gotox, gotoy, pusha0
.import pushax .import pushax
.import _screen .import _screen
.import CURS_X, CURS_Y .import CURS_X, CURS_Y
.import txtcolor
.include "atari7800.inc" .include "atari7800.inc"
.include "extzp.inc" .include "extzp.inc"
.data
;-----------------------------------------------------------------------------
; Holder of the text colour offset
; 0 = red, 42 = green, 84 = white
;
txtcolor:
.byte 0
.code .code
;--------------------------------------------------------------------------- ;---------------------------------------------------------------------------
@@ -52,39 +45,6 @@ umula0:
lda ptr7800 ; Load the result lda ptr7800 ; Load the result
rts rts
;-----------------------------------------------------------------------------
; Change the text colour
;
; Logical colour names are
; 0 = red
; 1 = green
; 2 = white
;
; The routine will also return the previous textcolor
;
.proc _textcolor
beq @L2
sec
sbc #1
beq @L1
lda #84
jmp @L2
@L1: lda #42
@L2: ldy txtcolor
sta txtcolor ; Store new textcolor
tya
bne @L3
rts ; Old colour was 0
@L3: sec
sbc #42
bne @L4
lda #1
rts ; Old colour was 1
@L4: lda #2
rts ; Old colour was 2
.endproc
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Put a character on screen ; Put a character on screen
; ;

View File

@@ -32,6 +32,7 @@
.import _zones .import _zones
.import cursor .import cursor
.import pusha, incsp1, pusha0, pushax, popa .import pusha, incsp1, pusha0, pushax, popa
.import umula0
.include "atari7800.inc" .include "atari7800.inc"
.include "extzp.inc" .include "extzp.inc"
@@ -51,32 +52,6 @@ blink_time:
.code .code
;---------------------------------------------------------------------------
; 8x16 routine
umula0:
ldy #8 ; Number of bits
lda #0
lsr ptr7800 ; Get first bit into carry
@L0: bcc @L1
clc
adc ptrtmp
tax
lda ptrtmp+1 ; hi byte of left op
adc ptr7800+1
sta ptr7800+1
txa
@L1: ror ptr7800+1
ror a
ror ptr7800
dey
bne @L0
tax
lda ptr7800 ; Load the result
rts
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Calculate cursorzone address ; Calculate cursorzone address
; You also need to set the cursorzone to point to the correct cursor Header ; You also need to set the cursorzone to point to the correct cursor Header

View File

@@ -0,0 +1,58 @@
;
; Karri Kaksonen, 2022-04-16
;
;
.export _textcolor
.export txtcolor
.include "atari7800.inc"
.data
;-----------------------------------------------------------------------------
; Holder of the text colour offset
; 0 = red, 42 = green, 84 = white
;
txtcolor:
.byte 0
.code
;-----------------------------------------------------------------------------
; Change the text colour
;
; Logical colour names are
; 0 = red
; 1 = green
; 2 = white
;
; The routine will also return the previous textcolor
;
.proc _textcolor
beq @L2
sec
sbc #1
beq @L1
lda #84
jmp @L2
@L1: lda #42
@L2: ldy txtcolor
sta txtcolor ; Store new textcolor
tya
bne @L3
rts ; Old colour was 0
@L3: sec
sbc #42
bne @L4
lda #1
rts ; Old colour was 1
@L4: lda #2
rts ; Old colour was 2
.endproc
;-------------------------------------------------------------------------------
; force the init constructor to be imported
.import initconio
conio_init = initconio