cx16: added routines to get and set the default palette (new rom 49+ extapi)

This commit is contained in:
Irmen de Jong
2025-04-06 15:14:04 +02:00
parent 05eb15d4f7
commit b72877d59d
3 changed files with 32 additions and 0 deletions

View File

@@ -257,6 +257,7 @@ palette {
sub set_default16() {
; set first 16 colors to the defaults on the X16
; (doesn't use the rom table so this works on roms older than 49 as well)
uword[] @nosplit colors = [
$000, ; 0 = black
$fff, ; 1 = white
@@ -277,4 +278,12 @@ palette {
]
set_rgb_nosplit(colors, len(colors), 0)
}
; set the full 256 colors in the palette back to its default values on the X16
; NOTE: this routine requires rom version 49+
alias set_default = cx16.set_default_palette
; get the bank and address of the word-array containing the 256 default palette colors
; NOTE: this routine requires rom version 49+
alias get_default = cx16.get_default_palette
}

View File

@@ -670,12 +670,33 @@ asmsub scnsiz(ubyte width @X, ubyte heigth @Y) clobbers(A,X,Y) {
}
asmsub memory_decompress_from_func(uword datafunction @R4, uword output @R1) clobbers(A,X,Y) -> uword @R1 {
; requires rom v49+
%asm {{
lda #EXTAPI_memory_decompress_from_func
jmp cx16.extapi
}}
}
asmsub get_default_palette() -> ubyte @A, uword @XY {
; returns memory address of default palette; bank in A and address in XY
; requires rom v49+
%asm {{
sec
lda #EXTAPI_default_palette
jmp cx16.extapi
}}
}
asmsub set_default_palette() {
; sets default palette in to the Vera
; requires rom v49+
%asm {{
clc
lda #EXTAPI_default_palette
jmp cx16.extapi
}}
}
asmsub get_charset() -> ubyte @A {
;Get charset mode. result: 0=unknown, 1=ISO, 2=PETSCII upper case/gfx, 3=PETSCII lowercase.
%asm {{

View File

@@ -1,6 +1,8 @@
TODO
====
symboldump doesn't include aliased symbols (like palette.set_default)
atari customtarget: default output should be .xex not .prg (10.5 still did it correctly)
test irqs on various targets: set_irq, set_rasterirq