Updated the cx16 library to the upstream project's prerelease 38.
This commit is contained in:
parent
77bfd163cd
commit
0f66f7569e
4 changed files with 43 additions and 38 deletions
|
@ -46,6 +46,7 @@
|
|||
GRAPH_SET_FONT := $FF3B
|
||||
GRAPH_GET_CHAR_SIZE := $FF3E
|
||||
GRAPH_PUT_CHAR := $FF41
|
||||
MULTI_ACPTR := $FF44
|
||||
RESTORE_BASIC := $FF47
|
||||
CLOCK_SET_DATE_TIME := $FF4D
|
||||
CLOCK_GET_DATE_TIME := $FF50
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
;
|
||||
; CX16 r37 definitions
|
||||
; CX16 r38 definitions
|
||||
;
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
|
@ -439,7 +439,7 @@ NMIVec := $0318
|
|||
.scope PSG ; Programmable Sound Generator
|
||||
.struct
|
||||
PITCH .word
|
||||
VOL .byte ; Left, right channels; volume
|
||||
VOL .byte ; Right, left sides; volume
|
||||
WAVEFORM .byte ; Wave shape, pulse width
|
||||
.endstruct
|
||||
LEFT = %01 << 6
|
||||
|
@ -544,9 +544,11 @@ NMIVec := $0318
|
|||
VERALOG .byte ; Boolean: log VERA activity
|
||||
KEYBOARDLOG .byte ; Boolean: log keyboard data
|
||||
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
|
||||
.org $9FBD
|
||||
.res 2
|
||||
CYCLECOUNT .dword ; Running count of CPU cycles (Read-Only)
|
||||
.res 1
|
||||
KEYMAP .byte ; Current keyboard layout number (Read-Only)
|
||||
DETECT .byte 2 ; If is "16" string, then running on emulator (RO)
|
||||
.endstruct
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/* cx16.h */
|
||||
/* */
|
||||
/* CX16 system-specific definitions */
|
||||
/* For prerelease 37 */
|
||||
/* For prerelease 38 */
|
||||
/* */
|
||||
/* */
|
||||
/* 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 vera_action; /* Boolean: displaying VERA activity */
|
||||
unsigned char keyboard; /* Boolean: displaying typed keys */
|
||||
unsigned char echo; /* How Kernal output should be echoed to host */
|
||||
unsigned char save_on_exit; /* Boolean: save SD card when quitting */
|
||||
unsigned char echo; /* How to send Kernal output to host */
|
||||
unsigned char save_on_exit; /* Boolean: save machine state on exit */
|
||||
unsigned char gif_method; /* How GIF movie is being recorded */
|
||||
unsigned char unused[0xD - 0x6];
|
||||
unsigned char keymap; /* Keyboard layout number */
|
||||
const char detect[2]; /* "16" if running on x16emu */
|
||||
unsigned char const unused1[2];
|
||||
unsigned long const cycle_count; /* Running total of CPU cycles (8 MHz.) */
|
||||
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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue