Updated the cx16 library to the upstream project's prerelease 38.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
;
|
||||
; 2019-09-23, Greg King
|
||||
; 2020-10-13, Greg King
|
||||
;
|
||||
; void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void __fastcall__ cputc (char c);
|
||||
@@ -11,52 +11,47 @@
|
||||
.import gotoxy, PLOT
|
||||
|
||||
.include "cx16.inc"
|
||||
.macpack generic
|
||||
|
||||
|
||||
; First, move to a new position.
|
||||
; Move to a cursor position, then print a character.
|
||||
|
||||
_cputcxy:
|
||||
pha ; Save C
|
||||
jsr gotoxy ; Set cursor, drop x and y
|
||||
pla ; Restore C
|
||||
pla
|
||||
|
||||
; Print a character.
|
||||
; Print a character -- also used as an internal function.
|
||||
|
||||
_cputc: cmp #$0D ; LF?
|
||||
_cputc: cmp #$0D ; X16 '\n'?
|
||||
beq newline
|
||||
cmp #$0A ; CR?
|
||||
beq plotx0
|
||||
cmp #$0A ; X16 '\r'?
|
||||
beq cr
|
||||
|
||||
; Printable char of some sort
|
||||
; Printable char. of some sort.
|
||||
; Convert it from PetSCII into a screen-code.
|
||||
|
||||
cmp #' '
|
||||
blt cputdirect ; Other control char
|
||||
convert:
|
||||
tay
|
||||
bmi L10
|
||||
cmp #$60
|
||||
blt L2
|
||||
and #<~%00100000
|
||||
bra cputdirect
|
||||
|
||||
; Handle character if high bit set
|
||||
|
||||
L10: and #<~%10000000 ; Remove high bit
|
||||
ora #%01000000
|
||||
bra cputdirect
|
||||
|
||||
L2: and #<~%01000000
|
||||
lsr a ; Divide by 256/8
|
||||
lsr a
|
||||
lsr a
|
||||
lsr a
|
||||
lsr a
|
||||
tax ; .X = %00000xxx
|
||||
tya
|
||||
eor pet_to_screen,x
|
||||
|
||||
cputdirect:
|
||||
jsr putchar ; Write character to screen, return .Y
|
||||
|
||||
; Advance cursor position.
|
||||
; Advance the cursor position.
|
||||
|
||||
iny
|
||||
cpy LLEN ; Reached end of line?
|
||||
bne L3
|
||||
jsr newline ; Next line
|
||||
ldy #$00 ; + CR
|
||||
jsr newline ; Wrap around
|
||||
|
||||
cr: ldy #$00
|
||||
L3: sty CURS_X
|
||||
rts
|
||||
|
||||
@@ -70,7 +65,6 @@ newline:
|
||||
|
||||
; Set the cursor's position, calculate RAM pointer.
|
||||
|
||||
plotx0: stz CURS_X
|
||||
plot: ldy CURS_X
|
||||
ldx CURS_Y
|
||||
clc
|
||||
@@ -96,3 +90,9 @@ putchar:
|
||||
lda CHARCOLOR
|
||||
sta VERA::DATA0
|
||||
rts
|
||||
|
||||
|
||||
.rodata
|
||||
pet_to_screen:
|
||||
.byte %10000000,%00000000,%01000000,%00100000 ; PetSCII -> screen-code
|
||||
.byte %01000000,%11000000,%10000000,%10000000
|
||||
|
||||
Reference in New Issue
Block a user