Updated the cx16 library to the upstream project's prerelease 38.

This commit is contained in:
Greg King 2020-10-17 10:36:11 -04:00
parent 77bfd163cd
commit 0f66f7569e
4 changed files with 43 additions and 38 deletions

View file

@ -46,6 +46,7 @@
GRAPH_SET_FONT := $FF3B GRAPH_SET_FONT := $FF3B
GRAPH_GET_CHAR_SIZE := $FF3E GRAPH_GET_CHAR_SIZE := $FF3E
GRAPH_PUT_CHAR := $FF41 GRAPH_PUT_CHAR := $FF41
MULTI_ACPTR := $FF44
RESTORE_BASIC := $FF47 RESTORE_BASIC := $FF47
CLOCK_SET_DATE_TIME := $FF4D CLOCK_SET_DATE_TIME := $FF4D
CLOCK_GET_DATE_TIME := $FF50 CLOCK_GET_DATE_TIME := $FF50

View file

@ -1,5 +1,5 @@
; ;
; CX16 r37 definitions ; CX16 r38 definitions
; ;
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
@ -439,7 +439,7 @@ NMIVec := $0318
.scope PSG ; Programmable Sound Generator .scope PSG ; Programmable Sound Generator
.struct .struct
PITCH .word PITCH .word
VOL .byte ; Left, right channels; volume VOL .byte ; Right, left sides; volume
WAVEFORM .byte ; Wave shape, pulse width WAVEFORM .byte ; Wave shape, pulse width
.endstruct .endstruct
LEFT = %01 << 6 LEFT = %01 << 6
@ -544,9 +544,11 @@ NMIVec := $0318
VERALOG .byte ; Boolean: log VERA activity VERALOG .byte ; Boolean: log VERA activity
KEYBOARDLOG .byte ; Boolean: log keyboard data KEYBOARDLOG .byte ; Boolean: log keyboard data
ECHO .byte ; Type of echo that's enabled ECHO .byte ; Type of echo that's enabled
SAVEXIT .byte ; Boolean: save on exit SAVEXIT .byte ; Boolean: save machine state on exit
GIFREC .byte ; Method of recording GIF movie GIFREC .byte ; Method of recording GIF movie
.org $9FBD .res 2
CYCLECOUNT .dword ; Running count of CPU cycles (Read-Only)
.res 1
KEYMAP .byte ; Current keyboard layout number (Read-Only) KEYMAP .byte ; Current keyboard layout number (Read-Only)
DETECT .byte 2 ; If is "16" string, then running on emulator (RO) DETECT .byte 2 ; If is "16" string, then running on emulator (RO)
.endstruct .endstruct

View file

@ -3,7 +3,7 @@
/* cx16.h */ /* cx16.h */
/* */ /* */
/* CX16 system-specific definitions */ /* CX16 system-specific definitions */
/* For prerelease 37 */ /* For prerelease 38 */
/* */ /* */
/* */ /* */
/* This software is provided "as-is", without any expressed or implied */ /* This software is provided "as-is", without any expressed or implied */
@ -283,12 +283,14 @@ struct __emul {
unsigned char debug; /* Boolean: debugging enabled */ unsigned char debug; /* Boolean: debugging enabled */
unsigned char vera_action; /* Boolean: displaying VERA activity */ unsigned char vera_action; /* Boolean: displaying VERA activity */
unsigned char keyboard; /* Boolean: displaying typed keys */ unsigned char keyboard; /* Boolean: displaying typed keys */
unsigned char echo; /* How Kernal output should be echoed to host */ unsigned char echo; /* How to send Kernal output to host */
unsigned char save_on_exit; /* Boolean: save SD card when quitting */ unsigned char save_on_exit; /* Boolean: save machine state on exit */
unsigned char gif_method; /* How GIF movie is being recorded */ unsigned char gif_method; /* How GIF movie is being recorded */
unsigned char unused[0xD - 0x6]; unsigned char const unused1[2];
unsigned char keymap; /* Keyboard layout number */ unsigned long const cycle_count; /* Running total of CPU cycles (8 MHz.) */
const char detect[2]; /* "16" if running on x16emu */ unsigned char const unused2[1];
unsigned char const keymap; /* Keyboard layout number */
char const detect[2]; /* "16" if running on x16emu */
}; };
#define EMULATOR (*(volatile struct __emul *)0x9FB0) #define EMULATOR (*(volatile struct __emul *)0x9FB0)

View file

@ -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__ cputcxy (unsigned char x, unsigned char y, char c);
; void __fastcall__ cputc (char c); ; void __fastcall__ cputc (char c);
@ -11,52 +11,47 @@
.import gotoxy, PLOT .import gotoxy, PLOT
.include "cx16.inc" .include "cx16.inc"
.macpack generic
; First, move to a new position. ; Move to a cursor position, then print a character.
_cputcxy: _cputcxy:
pha ; Save C pha ; Save C
jsr gotoxy ; Set cursor, drop x and y 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 beq newline
cmp #$0A ; CR? cmp #$0A ; X16 '\r'?
beq plotx0 beq cr
; Printable char of some sort ; Printable char. of some sort.
; Convert it from PetSCII into a screen-code.
cmp #' ' convert:
blt cputdirect ; Other control char
tay tay
bmi L10 lsr a ; Divide by 256/8
cmp #$60 lsr a
blt L2 lsr a
and #<~%00100000 lsr a
bra cputdirect lsr a
tax ; .X = %00000xxx
; Handle character if high bit set tya
eor pet_to_screen,x
L10: and #<~%10000000 ; Remove high bit
ora #%01000000
bra cputdirect
L2: and #<~%01000000
cputdirect: cputdirect:
jsr putchar ; Write character to screen, return .Y jsr putchar ; Write character to screen, return .Y
; Advance cursor position. ; Advance the cursor position.
iny iny
cpy LLEN ; Reached end of line? cpy LLEN ; Reached end of line?
bne L3 bne L3
jsr newline ; Next line jsr newline ; Wrap around
ldy #$00 ; + CR
cr: ldy #$00
L3: sty CURS_X L3: sty CURS_X
rts rts
@ -70,7 +65,6 @@ newline:
; Set the cursor's position, calculate RAM pointer. ; Set the cursor's position, calculate RAM pointer.
plotx0: stz CURS_X
plot: ldy CURS_X plot: ldy CURS_X
ldx CURS_Y ldx CURS_Y
clc clc
@ -96,3 +90,9 @@ putchar:
lda CHARCOLOR lda CHARCOLOR
sta VERA::DATA0 sta VERA::DATA0
rts rts
.rodata
pet_to_screen:
.byte %10000000,%00000000,%01000000,%00100000 ; PetSCII -> screen-code
.byte %01000000,%11000000,%10000000,%10000000