1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 23:29:39 +00:00

Split files

This commit is contained in:
Karri Kaksonen 2022-04-16 21:13:51 +03:00
parent cdc6e1c61f
commit 422d245cab
4 changed files with 85 additions and 92 deletions

View File

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

View File

@ -6,23 +6,16 @@
;
.export _cputc
.export _textcolor
.export umula0
.import _gotoxy, gotox, gotoy, pusha0
.import pushax
.import _screen
.import CURS_X, CURS_Y
.import txtcolor
.include "atari7800.inc"
.include "extzp.inc"
.data
;-----------------------------------------------------------------------------
; Holder of the text colour offset
; 0 = red, 42 = green, 84 = white
;
txtcolor:
.byte 0
.code
;---------------------------------------------------------------------------
@ -52,39 +45,6 @@ umula0:
lda ptr7800 ; Load the result
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
;

View File

@ -32,6 +32,7 @@
.import _zones
.import cursor
.import pusha, incsp1, pusha0, pushax, popa
.import umula0
.include "atari7800.inc"
.include "extzp.inc"
@ -51,32 +52,6 @@ blink_time:
.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
; 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