mirror of
				https://github.com/irmen/prog8.git
				synced 2025-11-03 19:16:13 +00:00 
			
		
		
		
	cx16: added routines to get and set the default palette (new rom 49+ extapi)
This commit is contained in:
		@@ -257,6 +257,7 @@ palette {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    sub set_default16() {
 | 
					    sub set_default16() {
 | 
				
			||||||
        ; set first 16 colors to the defaults on the X16
 | 
					        ; 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 = [
 | 
					        uword[] @nosplit colors = [
 | 
				
			||||||
            $000,   ; 0 = black
 | 
					            $000,   ; 0 = black
 | 
				
			||||||
            $fff,   ; 1 = white
 | 
					            $fff,   ; 1 = white
 | 
				
			||||||
@@ -277,4 +278,12 @@ palette {
 | 
				
			|||||||
        ]
 | 
					        ]
 | 
				
			||||||
        set_rgb_nosplit(colors, len(colors), 0)
 | 
					        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
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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  {
 | 
					asmsub memory_decompress_from_func(uword datafunction @R4, uword output @R1)  clobbers(A,X,Y) -> uword @R1  {
 | 
				
			||||||
 | 
					    ; requires rom v49+
 | 
				
			||||||
    %asm {{
 | 
					    %asm {{
 | 
				
			||||||
        lda  #EXTAPI_memory_decompress_from_func
 | 
					        lda  #EXTAPI_memory_decompress_from_func
 | 
				
			||||||
        jmp  cx16.extapi
 | 
					        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 {
 | 
					asmsub get_charset() -> ubyte @A {
 | 
				
			||||||
    ;Get charset mode.  result: 0=unknown, 1=ISO, 2=PETSCII upper case/gfx, 3=PETSCII lowercase.
 | 
					    ;Get charset mode.  result: 0=unknown, 1=ISO, 2=PETSCII upper case/gfx, 3=PETSCII lowercase.
 | 
				
			||||||
    %asm {{
 | 
					    %asm {{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,8 @@
 | 
				
			|||||||
TODO
 | 
					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)
 | 
					atari customtarget: default output should be .xex not .prg (10.5 still did it correctly)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test irqs on various targets: set_irq, set_rasterirq
 | 
					test irqs on various targets: set_irq, set_rasterirq
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user