atari5200: implement bgcolor() and textcolor()
Includes some other small fixes/cleanups.
This commit is contained in:
committed by
Oliver Schmidt
parent
edd596b2a4
commit
ec5e38617a
1
libsrc/atari5200/bgcolor.s
Normal file
1
libsrc/atari5200/bgcolor.s
Normal file
@@ -0,0 +1 @@
|
||||
.include "../atari/bgcolor.s"
|
||||
@@ -1 +1,26 @@
|
||||
.include "../atari/chline.s"
|
||||
;
|
||||
; Ullrich von Bassewitz, 08.08.1998
|
||||
;
|
||||
; void chlinexy (unsigned char x, unsigned char y, unsigned char length);
|
||||
; void chline (unsigned char length);
|
||||
;
|
||||
|
||||
.export _chlinexy, _chline
|
||||
.import gotoxy, cputdirect
|
||||
.importzp tmp1
|
||||
.include "atari5200.inc"
|
||||
|
||||
_chlinexy:
|
||||
pha ; Save the length
|
||||
jsr gotoxy ; Call this one, will pop params
|
||||
pla ; Restore the length
|
||||
|
||||
_chline:
|
||||
cmp #0 ; Is the length zero?
|
||||
beq L9 ; Jump if done
|
||||
sta tmp1
|
||||
L1: lda #CH_HLINE ; Horizontal line, screen code
|
||||
jsr cputdirect ; Direct output
|
||||
dec tmp1
|
||||
bne L1
|
||||
L9: rts
|
||||
|
||||
@@ -8,6 +8,12 @@ SCREEN_BUF_SIZE = 20 * 24
|
||||
SCREEN_BUF = $4000 - SCREEN_BUF_SIZE
|
||||
|
||||
.export screen_setup_20x24
|
||||
.export screen_width, screen_height
|
||||
.export conio_color
|
||||
|
||||
screen_width = 20
|
||||
screen_height = 24
|
||||
|
||||
|
||||
.segment "ONCE"
|
||||
|
||||
@@ -57,6 +63,9 @@ clrscr: sta (SAVMSC),y
|
||||
|
||||
rts
|
||||
|
||||
.data
|
||||
|
||||
conio_color: .byte 0
|
||||
|
||||
.segment "DLIST"
|
||||
|
||||
|
||||
@@ -11,8 +11,9 @@
|
||||
.export _cputcxy, _cputc
|
||||
.export plot, cputdirect, putchar
|
||||
.import gotoxy, _mul20
|
||||
.import conio_color
|
||||
.importzp screen_width, screen_height
|
||||
.importzp ptr4
|
||||
.import setcursor
|
||||
|
||||
.constructor screen_setup, 26
|
||||
.import screen_setup_20x24
|
||||
@@ -44,7 +45,7 @@ L4: cmp #$0A ; LF
|
||||
and #3
|
||||
tax
|
||||
tya
|
||||
and #$9f
|
||||
and #$9F
|
||||
ora ataint,x
|
||||
|
||||
cputdirect: ; accepts screen code
|
||||
@@ -53,7 +54,7 @@ cputdirect: ; accepts screen code
|
||||
; advance cursor
|
||||
inc COLCRS_5200
|
||||
lda COLCRS_5200
|
||||
cmp #20
|
||||
cmp #screen_width
|
||||
bcc plot
|
||||
lda #0
|
||||
sta COLCRS_5200
|
||||
@@ -62,12 +63,11 @@ cputdirect: ; accepts screen code
|
||||
newline:
|
||||
inc ROWCRS_5200
|
||||
lda ROWCRS_5200
|
||||
cmp #24
|
||||
cmp #screen_height
|
||||
bne plot
|
||||
lda #0
|
||||
sta ROWCRS_5200
|
||||
plot: jsr setcursor
|
||||
ldy COLCRS_5200
|
||||
plot: ldy COLCRS_5200
|
||||
ldx ROWCRS_5200
|
||||
rts
|
||||
|
||||
@@ -83,10 +83,12 @@ putchar:
|
||||
sta ptr4+1
|
||||
pla ; get char again
|
||||
|
||||
; and #$C0 ; without this we are compatible with the old version. user must not try to output a char >= $3F
|
||||
ora conio_color
|
||||
|
||||
ldy COLCRS_5200
|
||||
sta (ptr4),y
|
||||
jmp setcursor
|
||||
rts
|
||||
|
||||
.rodata
|
||||
ataint: .byte 64,0,32,96
|
||||
|
||||
|
||||
@@ -1 +1,31 @@
|
||||
.include "../atari/cvline.s"
|
||||
;
|
||||
; Ullrich von Bassewitz, 08.08.1998
|
||||
;
|
||||
; void cvlinexy (unsigned char x, unsigned char y, unsigned char length);
|
||||
; void cvline (unsigned char length);
|
||||
;
|
||||
.include "atari5200.inc"
|
||||
|
||||
.export _cvlinexy, _cvline
|
||||
.import gotoxy, putchar
|
||||
.importzp tmp1
|
||||
|
||||
_cvlinexy:
|
||||
pha ; Save the length
|
||||
jsr gotoxy ; Call this one, will pop params
|
||||
pla ; Restore the length and run into _cvline
|
||||
|
||||
_cvline:
|
||||
cmp #0 ; Is the length zero?
|
||||
beq L9 ; Jump if done
|
||||
sta tmp1
|
||||
L1: lda COLCRS_5200
|
||||
pha
|
||||
lda #CH_VLINE ; Vertical bar
|
||||
jsr putchar ; Write, no cursor advance
|
||||
pla
|
||||
sta COLCRS_5200
|
||||
inc ROWCRS_5200
|
||||
dec tmp1
|
||||
bne L1
|
||||
L9: rts
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
|
||||
.include "atari5200.inc"
|
||||
.export _gotox
|
||||
.import setcursor
|
||||
|
||||
_gotox:
|
||||
sta COLCRS_5200 ; Set X
|
||||
jmp setcursor
|
||||
rts
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
.export gotoxy, _gotoxy
|
||||
.import popa
|
||||
.import setcursor
|
||||
|
||||
gotoxy:
|
||||
jsr popa ; Get Y
|
||||
@@ -17,4 +16,4 @@ _gotoxy: ; Set the cursor position
|
||||
sta ROWCRS_5200 ; Set Y
|
||||
jsr popa ; Get X
|
||||
sta COLCRS_5200 ; Set X
|
||||
jmp setcursor
|
||||
rts
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
|
||||
.include "atari5200.inc"
|
||||
.export _gotoy
|
||||
.import setcursor
|
||||
|
||||
_gotoy:
|
||||
sta ROWCRS_5200 ; Set Y
|
||||
jmp setcursor
|
||||
rts
|
||||
|
||||
28
libsrc/atari5200/textcolor.s
Normal file
28
libsrc/atari5200/textcolor.s
Normal file
@@ -0,0 +1,28 @@
|
||||
;
|
||||
; Christian Groessler, 02-Apr-2019
|
||||
;
|
||||
; unsigned char __fastcall__ textcolor (unsigned char color);
|
||||
|
||||
.export _textcolor
|
||||
.import conio_color
|
||||
|
||||
.include "atari.inc"
|
||||
|
||||
|
||||
_textcolor:
|
||||
; move bits #0 and #1 to bits #6 and #7
|
||||
and #3
|
||||
clc
|
||||
ror a
|
||||
ror a
|
||||
ror a ; new conio_color value
|
||||
ldx conio_color ; get old value
|
||||
sta conio_color ; store new value
|
||||
txa
|
||||
; move bits #6 and #7 to bits #0 and #1
|
||||
clc
|
||||
rol a
|
||||
rol a
|
||||
rol a
|
||||
ldx #0
|
||||
rts
|
||||
13
libsrc/atari5200/wherex.s
Normal file
13
libsrc/atari5200/wherex.s
Normal file
@@ -0,0 +1,13 @@
|
||||
;
|
||||
; Carsten Strotmann, 30.12.2002
|
||||
;
|
||||
; unsigned char wherex (void);
|
||||
;
|
||||
|
||||
.export _wherex
|
||||
.include "atari5200.inc"
|
||||
|
||||
_wherex:
|
||||
lda COLCRS_5200
|
||||
ldx #0
|
||||
rts
|
||||
13
libsrc/atari5200/wherey.s
Normal file
13
libsrc/atari5200/wherey.s
Normal file
@@ -0,0 +1,13 @@
|
||||
;
|
||||
; Carsten Strotmann, 30.12.2002
|
||||
;
|
||||
; unsigned char wherey (void);
|
||||
;
|
||||
|
||||
.export _wherey
|
||||
.include "atari5200.inc"
|
||||
|
||||
_wherey:
|
||||
lda ROWCRS_5200
|
||||
ldx #0
|
||||
rts
|
||||
Reference in New Issue
Block a user