mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-04-08 14:37:40 +00:00
Merge from upstream
This commit is contained in:
commit
72dd0f044c
9
.idea/codeStyles/Project.xml
generated
9
.idea/codeStyles/Project.xml
generated
@ -4,6 +4,15 @@
|
||||
<option name="JD_ALIGN_PARAM_COMMENTS" value="false" />
|
||||
<option name="JD_DO_NOT_WRAP_ONE_LINE_COMMENTS" value="true" />
|
||||
</JavaCodeStyleSettings>
|
||||
<JetCodeStyleSettings>
|
||||
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||
<value>
|
||||
<package name="java.util" withSubpackages="false" static="false" />
|
||||
<package name="kotlinx.android.synthetic" withSubpackages="true" static="false" />
|
||||
<package name="io.ktor" withSubpackages="true" static="false" />
|
||||
</value>
|
||||
</option>
|
||||
</JetCodeStyleSettings>
|
||||
<codeStyleSettings language="JAVA">
|
||||
<option name="SPACE_BEFORE_IF_PARENTHESES" value="false" />
|
||||
<option name="SPACE_BEFORE_WHILE_PARENTHESES" value="false" />
|
||||
|
17
.idea/jarRepositories.xml
generated
17
.idea/jarRepositories.xml
generated
@ -6,16 +6,6 @@
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="project.local" />
|
||||
<option name="name" value="project" />
|
||||
<option name="url" value="file:C:\Users\svenv\OneDrive\Documents\GitHub\kickc/repo" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="project.local" />
|
||||
<option name="name" value="project" />
|
||||
<option name="url" value="file:$PROJECT_DIR$/repo" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
@ -29,12 +19,7 @@
|
||||
<remote-repository>
|
||||
<option name="id" value="project.local" />
|
||||
<option name="name" value="project" />
|
||||
<option name="url" value="file:D:\Users\svenv\OneDrive\Documents\GitHub\kickc/repo" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="redhat-ga-repository" />
|
||||
<option name="name" value="Red Hat GA repository" />
|
||||
<option name="url" value="http://maven.repository.redhat.com/ga/" />
|
||||
<option name="url" value="file:$PROJECT_DIR$/repo" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
@ -12,7 +12,6 @@
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.antlr:antlr4:4.9" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.antlr:antlr-runtime:3.5.2" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.antlr:ST4:4.3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.abego.treelayout:org.abego.treelayout.core:1.0.3" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.ibm.icu:icu4j:61.1" level="project" />
|
||||
|
6100
src/main/fragment/cache/fragment-cache-wdc65c02.asm
vendored
6100
src/main/fragment/cache/fragment-cache-wdc65c02.asm
vendored
File diff suppressed because it is too large
Load Diff
@ -34,7 +34,7 @@ import java.util.stream.Collectors;
|
||||
descriptionHeading = "%nDescription:%n%n",
|
||||
parameterListHeading = "%nParameters:%n",
|
||||
optionListHeading = "%nOptions:%n",
|
||||
version = "KickC 0.8.4 BETA"
|
||||
version = "KickC 0.8.5 BETA"
|
||||
)
|
||||
public class KickC implements Callable<Integer> {
|
||||
|
||||
|
@ -1,6 +1,10 @@
|
||||
// Atari 8-bit 400/800/XL/XE Registers and Constants
|
||||
// https://en.wikipedia.org/wiki/Atari_8-bit_family
|
||||
|
||||
#ifndef __ATARIXL__
|
||||
#error "Target platform must be atarixl"
|
||||
#endif
|
||||
|
||||
#include <atari-antic.h>
|
||||
#include <atari-gtia.h>
|
||||
#include <atari-pokey.h>
|
||||
|
@ -1,6 +1,10 @@
|
||||
// Atari 2600 Registers and Constants
|
||||
// https://web.archive.org/web/20170215054248/http://www.atariguide.com/pdfs/Atari_2600_VCS_Domestic_Field_Service_Manual.pdf
|
||||
|
||||
#ifndef __ATARI2600__
|
||||
#error "Target platform must be atari2600"
|
||||
#endif
|
||||
|
||||
#include <atari-tia.h>
|
||||
#include <mos6532.h>
|
||||
|
||||
|
@ -8,22 +8,22 @@
|
||||
void clrscr(void);
|
||||
|
||||
// Set the cursor to the specified position
|
||||
void gotoxy(unsigned byte x, unsigned byte y);
|
||||
void gotoxy(unsigned char x, unsigned char y);
|
||||
|
||||
// Return the X position of the cursor
|
||||
unsigned byte wherex(void);
|
||||
unsigned char wherex(void);
|
||||
|
||||
// Return the Y position of the cursor
|
||||
unsigned byte wherey(void);
|
||||
unsigned char wherey(void);
|
||||
|
||||
// Return the current screen size.
|
||||
void screensize(unsigned byte* x, unsigned byte* y);
|
||||
void screensize(unsigned char* x, unsigned char* y);
|
||||
|
||||
// Return the current screen size X width.
|
||||
unsigned byte screensizex();
|
||||
char screensizex();
|
||||
|
||||
// Return the current screen size Y height.
|
||||
unsigned byte screensizey();
|
||||
char screensizey();
|
||||
|
||||
// Output one character at the current cursor position. Scroll the screen if needed.
|
||||
void cputc(char c);
|
||||
@ -33,33 +33,33 @@ void cputln();
|
||||
|
||||
// Move cursor and output one character
|
||||
// Same as "gotoxy (x, y); cputc (c);"
|
||||
void cputcxy(unsigned byte x, unsigned byte y, char c);
|
||||
void cputcxy(unsigned char x, unsigned char y, char c);
|
||||
|
||||
// Output a NUL-terminated string at the current cursor position
|
||||
void cputs(const char* s);
|
||||
|
||||
// Move cursor and output a NUL-terminated string
|
||||
// Same as "gotoxy (x, y); puts (s);"
|
||||
void cputsxy(unsigned byte x, unsigned byte y, const char* s);
|
||||
void cputsxy(unsigned char x, unsigned char y, const char* s);
|
||||
|
||||
// Set the color for text output. The old color setting is returned.
|
||||
char textcolor(char color);
|
||||
unsigned char textcolor(unsigned char color);
|
||||
|
||||
// Set the color for the background. The old color setting is returned.
|
||||
char bgcolor(char color);
|
||||
unsigned char bgcolor(unsigned char color);
|
||||
|
||||
// Set the color for the border. The old color setting is returned.
|
||||
unsigned byte bordercolor(unsigned byte color);
|
||||
unsigned char bordercolor(unsigned char color);
|
||||
|
||||
// Return true if there's a key waiting, return false if not
|
||||
unsigned byte kbhit (void);
|
||||
unsigned char kbhit (void);
|
||||
|
||||
// If onoff is 1, a cursor is displayed when waiting for keyboard input.
|
||||
// If onoff is 0, the cursor is hidden when waiting for keyboard input.
|
||||
// The function returns the old cursor setting.
|
||||
unsigned byte cursor(unsigned byte onoff);
|
||||
unsigned char cursor(unsigned char onoff);
|
||||
|
||||
// If onoff is 1, scrolling is enabled when outputting past the end of the screen
|
||||
// If onoff is 0, scrolling is disabled and the cursor instead moves to (0,0)
|
||||
// The function returns the old scroll setting.
|
||||
unsigned byte scroll(unsigned byte onoff);
|
||||
unsigned char scroll(unsigned char onoff);
|
@ -38,7 +38,6 @@ char * const VERA_ADDRX_M = 0x9f21;
|
||||
// Bit 3: DECR Setting the DECR bit, will decrement instead of increment by the value set by the 'Address Increment' field.
|
||||
// Bit 0: VRAM Address (16)
|
||||
char * const VERA_ADDRX_H = 0x9f22;
|
||||
const char VERA_DECR = 0x08;
|
||||
const char VERA_INC_0 = 0x00;
|
||||
const char VERA_INC_1 = 0x10;
|
||||
const char VERA_INC_2 = 0x20;
|
||||
@ -55,6 +54,22 @@ const char VERA_INC_80 = 0xc0;
|
||||
const char VERA_INC_160 = 0xd0;
|
||||
const char VERA_INC_320 = 0xe0;
|
||||
const char VERA_INC_640 = 0xf0;
|
||||
const char VERA_DECR_0 = 0x08;
|
||||
const char VERA_DECR_1 = 0x18;
|
||||
const char VERA_DECR_2 = 0x28;
|
||||
const char VERA_DECR_4 = 0x38;
|
||||
const char VERA_DECR_8 = 0x48;
|
||||
const char VERA_DECR_16 = 0x58;
|
||||
const char VERA_DECR_32 = 0x68;
|
||||
const char VERA_DECR_64 = 0x78;
|
||||
const char VERA_DECR_128 = 0x88;
|
||||
const char VERA_DECR_256 = 0x98;
|
||||
const char VERA_DECR_512 = 0xa8;
|
||||
const char VERA_DECR_40 = 0xb8;
|
||||
const char VERA_DECR_80 = 0xc8;
|
||||
const char VERA_DECR_160 = 0xd8;
|
||||
const char VERA_DECR_320 = 0xe8;
|
||||
const char VERA_DECR_640 = 0xf8;
|
||||
// $9F23 DATA0 VRAM Data port 0
|
||||
char * const VERA_DATA0 = 0x9f23;
|
||||
// $9F24 DATA1 VRAM Data port 1
|
||||
@ -131,7 +146,7 @@ byte const VERA_LAYER_CONFIG_WIDTH_64 = 0x10;
|
||||
byte const VERA_LAYER_CONFIG_WIDTH_128 = 0x20;
|
||||
byte const VERA_LAYER_CONFIG_WIDTH_256 = 0x30;
|
||||
byte const VERA_LAYER_CONFIG_WIDTH_MASK = 0x30;
|
||||
word const VERA_CONFIG_WIDTH[4] = {32, 64, 128, 256};
|
||||
word const VERA_LAYER_CONFIG_WIDTH[4] = {32, 64, 128, 256};
|
||||
|
||||
// Bit 6-7: Map Height (0:32 tiles, 1:64 tiles, 2:128 tiles, 3:256 tiles)
|
||||
byte const VERA_LAYER_CONFIG_HEIGHT_32 = 0x00;
|
||||
@ -139,7 +154,7 @@ byte const VERA_LAYER_CONFIG_HEIGHT_64 = 0x40;
|
||||
byte const VERA_LAYER_CONFIG_HEIGHT_128 = 0x80;
|
||||
byte const VERA_LAYER_CONFIG_HEIGHT_256 = 0xC0;
|
||||
byte const VERA_LAYER_CONFIG_HEIGHT_MASK = 0xC0;
|
||||
word const VERA_CONFIG_HEIGHT[4] = {32, 64, 128, 256};
|
||||
word const VERA_LAYER_CONFIG_HEIGHT[4] = {32, 64, 128, 256};
|
||||
|
||||
// Bit 0-1: Color Depth (0: 1 bpp, 1: 2 bpp, 2: 4 bpp, 3: 8 bpp)
|
||||
byte const VERA_LAYER_COLOR_DEPTH_1BPP = 0x00;
|
||||
@ -159,7 +174,7 @@ char const VERA_L0_CONFIG_MODE_BITMAP = 0x04;
|
||||
char const VERA_L0_CONFIG_16C = 0x00;
|
||||
char const VERA_L0_CONFIG_256C = 0x08;
|
||||
// $9F2E L0_MAPBASE Layer 0 Map Base Address (16:9)
|
||||
unsigned byte * const VERA_L0_MAPBASE = 0x9f2e;
|
||||
char * const VERA_L0_MAPBASE = 0x9f2e;
|
||||
// $9F2F L0_TILEBASE Layer 0 Tile Base
|
||||
// Bit 2-7: Tile Base Address (16:11)
|
||||
// Bit 1: Tile Height (0:8 pixels, 1:16 pixels)
|
||||
@ -249,4 +264,3 @@ struct VERA_SPRITE {
|
||||
};
|
||||
// 8BPP sprite mode (add to VERA_SPRITE.ADDR to enable)
|
||||
const unsigned int VERA_SPRITE_8BPP = 0x8000;
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
// Commander X16
|
||||
// https://www.commanderx16.com/forum/index.php?/about-faq/
|
||||
// https://github.com/commanderx16/x16-docs/blob/master/Commander%20X16%20Programmer's%20Reference%20Guide.md
|
||||
|
||||
#ifndef __CX16__
|
||||
#error "Target platform must be cx16"
|
||||
#endif
|
||||
#include <cx16-vera.h>
|
||||
#include <mos6522.h>
|
||||
|
||||
@ -62,15 +64,15 @@ char vpeek(char vbank, char* vaddr);
|
||||
// - num: The number of bytes to copy
|
||||
void memcpy_to_vram(char vbank, void* vdest, void* src, unsigned int num );
|
||||
|
||||
// Copy block of memory from VRAM to VRAM
|
||||
// Copies the values from the location pointed by vget to the location pointed by vput.
|
||||
// Copy block of memory (from VRAM to VRAM)
|
||||
// Copies the values from the location pointed by src to the location pointed by dest.
|
||||
// The method uses the VERA access ports 0 and 1 to copy data from and to in VRAM.
|
||||
// - num: How much bytes to be copied.
|
||||
// - bget: 64K VRAM bank number to copy from (0/1).
|
||||
// - vget: pointer to the location to copy from. Note that the address is a 16 bit value!
|
||||
// - iget: the increment indicator, VERA needs this because addressing increment is automated by VERA at each access.
|
||||
// - bput: 64K VRAM bank number to copy to (0/1).
|
||||
// - vput: pointer to the location to copy to. Note that the address is a 16 bit value!
|
||||
// - iput: the increment indicator, VERA needs this because addressing increment is automated by VERA at each access.
|
||||
void vram_to_vram(unsigned int num, char bget, void *vget, char iget, char bput, void *vput, char iput );
|
||||
// - src_bank: 64K VRAM bank number to copy from (0/1).
|
||||
// - src: pointer to the location to copy from. Note that the address is a 16 bit value!
|
||||
// - src_increment: the increment indicator, VERA needs this because addressing increment is automated by VERA at each access.
|
||||
// - dest_bank: 64K VRAM bank number to copy to (0/1).
|
||||
// - dest: pointer to the location to copy to. Note that the address is a 16 bit value!
|
||||
// - dest_increment: the increment indicator, VERA needs this because addressing increment is automated by VERA at each access.
|
||||
// - num: The number of bytes to copy
|
||||
void memcpy_in_vram(char dest_bank, void *dest, char dest_increment, char src_bank, void *src, char src_increment, unsigned int num );
|
||||
|
||||
|
@ -28,9 +28,6 @@ inline void vera_set_layer_map_height_64(unsigned byte layer);
|
||||
inline void vera_set_layer_map_height_128(unsigned byte layer);
|
||||
inline void vera_set_layer_map_height_256(unsigned byte layer);
|
||||
|
||||
|
||||
|
||||
|
||||
// Enable the layer to be displayed on the screen.
|
||||
// - layer: 0 or 1.
|
||||
void vera_show_layer(unsigned byte layer);
|
||||
|
@ -19,7 +19,7 @@
|
||||
// The function setscreenlayermapbase(layer,mapbase) allows to configure bit 16:9 of the
|
||||
// mapbase address of the time map in VRAM of the selected layer VERA_L0_MAPBASE or VERA_L1_MAPBASE.
|
||||
char* CONIO_SCREEN_TEXT = DEFAULT_SCREEN;
|
||||
byte CONIO_SCREEN_BANK = 0; // Default screen of the CX16 emulator uses memory bank 0 for text.
|
||||
char CONIO_SCREEN_BANK = 0; // Default screen of the CX16 emulator uses memory bank 0 for text.
|
||||
// The default text color
|
||||
const char CONIO_TEXTCOLOR_DEFAULT = WHITE;
|
||||
// The default back color
|
||||
@ -47,10 +47,10 @@ void conio_x16_init() {
|
||||
unsigned char kbhit(void) {
|
||||
|
||||
char ch = 0;
|
||||
char* chptr = &ch;
|
||||
char* const chptr = &ch;
|
||||
|
||||
char* IN_DEV = $028A; // Current input device number
|
||||
char* GETIN = $FFE4; // CBM GETIN API
|
||||
char* const IN_DEV = $028A; // Current input device number
|
||||
char* const GETIN = $FFE4; // CBM GETIN API
|
||||
|
||||
kickasm(uses chptr, uses IN_DEV, uses GETIN) {{
|
||||
|
||||
@ -87,15 +87,6 @@ unsigned char kbhit(void) {
|
||||
return ch;
|
||||
}
|
||||
|
||||
// Set the color for the border. The old color setting is returned.
|
||||
unsigned char bordercolor(unsigned char color) {
|
||||
// The border color register address
|
||||
char * const CONIO_BORDERCOLOR = 0xd020;
|
||||
char old = *CONIO_BORDERCOLOR;
|
||||
*CONIO_BORDERCOLOR = color;
|
||||
return old;
|
||||
}
|
||||
|
||||
// This requires the following constants to be defined
|
||||
// - CONIO_WIDTH - The screen width
|
||||
// - CONIO_HEIGHT - The screen height
|
||||
@ -109,16 +100,16 @@ unsigned char bordercolor(unsigned char color) {
|
||||
#define CONIO_BYTES CONIO_HEIGHT*CONIO_WIDTH
|
||||
|
||||
// The current cursor x-position
|
||||
__ma unsigned byte conio_cursor_x[2] = {0,0};
|
||||
unsigned byte conio_cursor_x[2] = {0,0};
|
||||
// The current cursor y-position
|
||||
__ma unsigned byte conio_cursor_y[2] = {0,0};
|
||||
unsigned byte conio_cursor_y[2] = {0,0};
|
||||
// The current text cursor line start
|
||||
__ma unsigned word conio_line_text[2] = {0x0000,0x0000};
|
||||
unsigned word conio_line_text[2] = {0x0000,0x0000};
|
||||
// Is a cursor whown when waiting for input (0: no, other: yes)
|
||||
__ma unsigned byte conio_display_cursor = 0;
|
||||
// Is scrolling enabled when outputting beyond the end of the screen (1: yes, 0: no).
|
||||
// If disabled the cursor just moves back to (0,0) instead
|
||||
__ma unsigned byte conio_scroll_enable[2] = {1,1};
|
||||
unsigned byte conio_scroll_enable[2] = {1,1};
|
||||
// Variable holding the screen width;
|
||||
__ma unsigned byte conio_screen_width = 0;
|
||||
// Variable holding the screen height;
|
||||
@ -266,7 +257,7 @@ void insertdown() {
|
||||
for(unsigned byte i=cy; i>0; i--) {
|
||||
unsigned int line = (conio_cursor_y[conio_screen_layer] + i - 1) << conio_skip;
|
||||
unsigned char* start = CONIO_SCREEN_TEXT + line;
|
||||
vram_to_vram(width, 0, start, VERA_INC_1, 0, start+((word)1<<conio_skip), VERA_INC_1);
|
||||
memcpy_in_vram(0, start+((word)1<<conio_skip), VERA_INC_1, 0, start, VERA_INC_1, width);
|
||||
}
|
||||
clearline();
|
||||
}
|
||||
@ -278,7 +269,7 @@ void insertup() {
|
||||
for(unsigned byte i=1; i<=cy; i++) {
|
||||
unsigned int line = (i-1) << conio_skip;
|
||||
unsigned char* start = CONIO_SCREEN_TEXT + line;
|
||||
vram_to_vram(width, 0, start+((word)1<<conio_skip), VERA_INC_1, 0, start, VERA_INC_1);
|
||||
memcpy_in_vram(0, start, VERA_INC_1, 0, start+((word)1<<conio_skip), VERA_INC_1, width);
|
||||
}
|
||||
clearline();
|
||||
}
|
||||
@ -372,4 +363,11 @@ inline char bgcolor(char color) {
|
||||
return vera_set_layer_backcolor(conio_screen_layer, color);
|
||||
}
|
||||
|
||||
// Set the color for the border. The old color setting is returned.
|
||||
char bordercolor(unsigned char color) {
|
||||
// The border color register address
|
||||
char old = *VERA_DC_BORDER;
|
||||
*VERA_DC_BORDER = color;
|
||||
return old;
|
||||
}
|
||||
|
||||
|
@ -55,26 +55,30 @@ void memcpy_to_vram(char vbank, void* vdest, void* src, unsigned int num ) {
|
||||
*VERA_DATA0 = *s;
|
||||
}
|
||||
|
||||
// Copy block of memory (from RAM to VRAM)
|
||||
// Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination in VRAM.
|
||||
// - vbank: Which 64K VRAM bank to put data into (0/1)
|
||||
// - vdest: The destination address in VRAM
|
||||
// - src: The source address in RAM
|
||||
// Copy block of memory (from VRAM to VRAM)
|
||||
// Copies the values from the location pointed by src to the location pointed by dest.
|
||||
// The method uses the VERA access ports 0 and 1 to copy data from and to in VRAM.
|
||||
// - src_bank: 64K VRAM bank number to copy from (0/1).
|
||||
// - src: pointer to the location to copy from. Note that the address is a 16 bit value!
|
||||
// - src_increment: the increment indicator, VERA needs this because addressing increment is automated by VERA at each access.
|
||||
// - dest_bank: 64K VRAM bank number to copy to (0/1).
|
||||
// - dest: pointer to the location to copy to. Note that the address is a 16 bit value!
|
||||
// - dest_increment: the increment indicator, VERA needs this because addressing increment is automated by VERA at each access.
|
||||
// - num: The number of bytes to copy
|
||||
void vram_to_vram(unsigned int num, char bget, void *vget, char iget, char bput, void *vput, char iput ) {
|
||||
void memcpy_in_vram(char dest_bank, void *dest, char dest_increment, char src_bank, void *src, char src_increment, unsigned int num ) {
|
||||
// Select DATA0
|
||||
*VERA_CTRL &= ~VERA_ADDRSEL;
|
||||
// Set address
|
||||
*VERA_ADDRX_L = <vget;
|
||||
*VERA_ADDRX_M = >vget;
|
||||
*VERA_ADDRX_H = iget | bget;
|
||||
*VERA_ADDRX_L = <src;
|
||||
*VERA_ADDRX_M = >src;
|
||||
*VERA_ADDRX_H = src_increment | src_bank;
|
||||
|
||||
// Select DATA1
|
||||
*VERA_CTRL |= VERA_ADDRSEL;
|
||||
// Set address
|
||||
*VERA_ADDRX_L = <vput;
|
||||
*VERA_ADDRX_M = >vput;
|
||||
*VERA_ADDRX_H = iput | bput;
|
||||
*VERA_ADDRX_L = <dest;
|
||||
*VERA_ADDRX_M = >dest;
|
||||
*VERA_ADDRX_H = dest_increment | dest_bank;
|
||||
|
||||
// Transfer the data
|
||||
for(unsigned int i=0; i<num; i++) {
|
||||
|
@ -9,19 +9,18 @@
|
||||
// --- VERA function encapsulation ---
|
||||
|
||||
// --- VERA layer management ---
|
||||
__ma byte* vera_layer_config[2] = {VERA_L0_CONFIG, VERA_L1_CONFIG};
|
||||
__ma byte vera_layer_enable[2] = { VERA_LAYER0_ENABLE, VERA_LAYER1_ENABLE };
|
||||
byte* vera_layer_config[2] = {VERA_L0_CONFIG, VERA_L1_CONFIG};
|
||||
byte vera_layer_enable[2] = { VERA_LAYER0_ENABLE, VERA_LAYER1_ENABLE };
|
||||
|
||||
__ma byte* vera_layer_mapbase[2] = {VERA_L0_MAPBASE, VERA_L1_MAPBASE};
|
||||
__ma byte* vera_layer_tilebase[2] = {VERA_L0_TILEBASE, VERA_L1_TILEBASE};
|
||||
__ma byte* vera_layer_vscroll_l[2] = {VERA_L0_VSCROLL_L, VERA_L1_VSCROLL_L};
|
||||
__ma byte* vera_layer_vscroll_h[2] = {VERA_L0_VSCROLL_H, VERA_L1_VSCROLL_H};
|
||||
__ma byte* vera_layer_hscroll_l[2] = {VERA_L0_HSCROLL_L, VERA_L1_HSCROLL_L};
|
||||
__ma byte* vera_layer_hscroll_h[2] = {VERA_L0_HSCROLL_H, VERA_L1_HSCROLL_H};
|
||||
|
||||
__ma byte vera_layer_textcolor[2] = {WHITE, WHITE};
|
||||
__ma byte vera_layer_backcolor[2] = {BLUE, BLUE};
|
||||
byte* vera_layer_mapbase[2] = {VERA_L0_MAPBASE, VERA_L1_MAPBASE};
|
||||
byte* vera_layer_tilebase[2] = {VERA_L0_TILEBASE, VERA_L1_TILEBASE};
|
||||
byte* vera_layer_vscroll_l[2] = {VERA_L0_VSCROLL_L, VERA_L1_VSCROLL_L};
|
||||
byte* vera_layer_vscroll_h[2] = {VERA_L0_VSCROLL_H, VERA_L1_VSCROLL_H};
|
||||
byte* vera_layer_hscroll_l[2] = {VERA_L0_HSCROLL_L, VERA_L1_HSCROLL_L};
|
||||
byte* vera_layer_hscroll_h[2] = {VERA_L0_HSCROLL_H, VERA_L1_HSCROLL_H};
|
||||
|
||||
byte vera_layer_textcolor[2] = {WHITE, WHITE};
|
||||
byte vera_layer_backcolor[2] = {BLUE, BLUE};
|
||||
|
||||
// --- VERA addressing ---
|
||||
|
||||
@ -71,43 +70,43 @@ char vera_get_layer_config(char layer) {
|
||||
// - layer: Value of 0 or 1.
|
||||
inline void vera_set_layer_map_width_32(unsigned byte layer) {
|
||||
byte* addr = vera_layer_config[layer];
|
||||
*addr &= ~VERA_LAYER_CONFIG_WIDTH_MASK;
|
||||
*addr &= ~VERA_LAYER_CONFIG_WIDTH_MASK;
|
||||
*addr |= VERA_LAYER_CONFIG_WIDTH_32;
|
||||
}
|
||||
inline void vera_set_layer_map_width_64(unsigned byte layer) {
|
||||
byte* addr = vera_layer_config[layer];
|
||||
//*addr &= (~VERA_LAYER_CONFIG_WIDTH_MASK) | VERA_LAYER_CONFIG_WIDTH_64;
|
||||
*addr &= ~VERA_LAYER_CONFIG_WIDTH_MASK;
|
||||
//*addr &= (~VERA_CONFIG_WIDTH_MASK) | VERA_CONFIG_WIDTH_64;
|
||||
*addr &= ~VERA_LAYER_CONFIG_WIDTH_MASK;
|
||||
*addr |= VERA_LAYER_CONFIG_WIDTH_64;
|
||||
}
|
||||
inline void vera_set_layer_map_width_128(unsigned byte layer) {
|
||||
byte* addr = vera_layer_config[layer];
|
||||
*addr &= ~VERA_LAYER_CONFIG_WIDTH_MASK;
|
||||
*addr &= ~VERA_LAYER_CONFIG_WIDTH_MASK;
|
||||
*addr |= VERA_LAYER_CONFIG_WIDTH_128;
|
||||
}
|
||||
inline void vera_set_layer_map_width_256(unsigned byte layer) {
|
||||
byte* addr = vera_layer_config[layer];
|
||||
*addr &= ~VERA_LAYER_CONFIG_WIDTH_MASK;
|
||||
*addr &= ~VERA_LAYER_CONFIG_WIDTH_MASK;
|
||||
*addr |= VERA_LAYER_CONFIG_WIDTH_256;
|
||||
}
|
||||
inline void vera_set_layer_map_height_32(unsigned byte layer) {
|
||||
byte* addr = vera_layer_config[layer];
|
||||
*addr &= ~VERA_LAYER_CONFIG_HEIGHT_MASK;
|
||||
*addr &= ~VERA_LAYER_CONFIG_HEIGHT_MASK;
|
||||
*addr |= VERA_LAYER_CONFIG_HEIGHT_32;
|
||||
}
|
||||
inline void vera_set_layer_map_height_64(unsigned byte layer) {
|
||||
byte* addr = vera_layer_config[layer];
|
||||
*addr &= ~VERA_LAYER_CONFIG_HEIGHT_MASK;
|
||||
*addr &= ~VERA_LAYER_CONFIG_HEIGHT_MASK;
|
||||
*addr |= VERA_LAYER_CONFIG_HEIGHT_64;
|
||||
}
|
||||
inline void vera_set_layer_map_height_128(unsigned byte layer) {
|
||||
byte* addr = vera_layer_config[layer];
|
||||
*addr &= ~VERA_LAYER_CONFIG_HEIGHT_MASK;
|
||||
*addr &= ~VERA_LAYER_CONFIG_HEIGHT_MASK;
|
||||
*addr |= VERA_LAYER_CONFIG_HEIGHT_128;
|
||||
}
|
||||
inline void vera_set_layer_map_height_256(unsigned byte layer) {
|
||||
byte* addr = vera_layer_config[layer];
|
||||
*addr &= ~VERA_LAYER_CONFIG_HEIGHT_MASK;
|
||||
*addr &= ~VERA_LAYER_CONFIG_HEIGHT_MASK;
|
||||
*addr |= VERA_LAYER_CONFIG_HEIGHT_256;
|
||||
}
|
||||
|
||||
@ -116,13 +115,13 @@ inline void vera_set_layer_map_height_256(unsigned byte layer) {
|
||||
word vera_get_layer_map_width(unsigned byte layer) {
|
||||
byte* config = vera_layer_config[layer];
|
||||
byte mask = (byte)VERA_LAYER_CONFIG_WIDTH_MASK;
|
||||
return VERA_CONFIG_WIDTH[ (*config & mask) >> 4];
|
||||
return VERA_LAYER_CONFIG_WIDTH[ (*config & mask) >> 4];
|
||||
}
|
||||
|
||||
word vera_get_layer_map_height(unsigned byte layer) {
|
||||
byte* config = vera_layer_config[layer];
|
||||
byte mask = VERA_LAYER_CONFIG_HEIGHT_MASK;
|
||||
return VERA_CONFIG_HEIGHT[ (*config & mask) >> 6];
|
||||
return VERA_LAYER_CONFIG_HEIGHT[ (*config & mask) >> 6];
|
||||
}
|
||||
|
||||
// Set the color depth of the layer in terms of bit per pixel (BPP) of the tile base.
|
||||
|
@ -458,6 +458,17 @@ public class TestPrograms {
|
||||
compileAndCompare("examples/nes/nes-demo.c");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCx16VeraLayers() throws IOException, URISyntaxException {
|
||||
compileAndCompare("examples/cx16/veralayers.c");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCx16TileMap() throws IOException, URISyntaxException {
|
||||
compileAndCompare("examples/cx16/tilemap.c");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testCx16Sprites() throws IOException, URISyntaxException {
|
||||
compileAndCompare("examples/cx16/sprites.c");
|
||||
|
@ -112,9 +112,4 @@ __interrupt(rom_sys_cx16) void irq_vsync() {
|
||||
|
||||
// Reset the VSYNC interrupt
|
||||
*VERA_ISR = VERA_VSYNC;
|
||||
// Exit CX16 KERNAL IRQ
|
||||
asm {
|
||||
// soft exit (keep kernal running)
|
||||
jmp $e034
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,8 +7,10 @@
|
||||
// The CX16 starts in tile map mode, 1BPP in 16 color mode, and uses 8x8 tiles.
|
||||
// The map base is address 0x00000 in VERA VRAM, the tile map is address 0x0F800.
|
||||
|
||||
#pragma target(cx16)
|
||||
#include <conio.h>
|
||||
#include <veralib.h>
|
||||
#include <printf.h>
|
||||
#include <stdio.h>
|
||||
#include <6502.h>
|
||||
|
||||
void main() {
|
||||
@ -114,7 +116,6 @@ volatile int speed = 2;
|
||||
// VSYNC Interrupt Routine
|
||||
__interrupt(rom_sys_cx16) void irq_vsync() {
|
||||
|
||||
|
||||
scroll_x += delta_x;
|
||||
scroll_y += delta_y;
|
||||
|
||||
|
@ -7,7 +7,9 @@
|
||||
// The CX16 starts in tile map mode, 1BPP in 16 color mode, and uses 8x8 tiles.
|
||||
// The map base is address 0x00000 in VERA VRAM, the tile map is address 0x0F800.
|
||||
|
||||
#include <printf.h>
|
||||
#pragma target(cx16)
|
||||
#include <conio.h>
|
||||
#include <stdio.h>
|
||||
#include <veralib.h>
|
||||
|
||||
void main() {
|
||||
|
@ -1,4 +1,3 @@
|
||||
Inlined call call __init
|
||||
|
||||
CONTROL FLOW GRAPH SSA
|
||||
|
||||
@ -55,7 +54,7 @@ memcpy_to_vram::@return: scope:[memcpy_to_vram] from memcpy_to_vram::@1
|
||||
to:@return
|
||||
|
||||
void main()
|
||||
main: scope:[main] from __start::@1
|
||||
main: scope:[main] from __start
|
||||
main::vaddr#0 = DEFAULT_SCREEN
|
||||
main::i#0 = 0
|
||||
to:main::@1
|
||||
@ -104,15 +103,11 @@ main::@return: scope:[main] from main::@6
|
||||
|
||||
void __start()
|
||||
__start: scope:[__start] from
|
||||
to:__start::__init1
|
||||
__start::__init1: scope:[__start] from __start
|
||||
to:__start::@1
|
||||
__start::@1: scope:[__start] from __start::__init1
|
||||
call main
|
||||
to:__start::@2
|
||||
__start::@2: scope:[__start] from __start::@1
|
||||
to:__start::@1
|
||||
__start::@1: scope:[__start] from __start
|
||||
to:__start::@return
|
||||
__start::@return: scope:[__start] from __start::@2
|
||||
__start::@return: scope:[__start] from __start::@1
|
||||
return
|
||||
to:@return
|
||||
|
||||
@ -265,9 +260,7 @@ Eliminating unused constant memcpy_to_vram::vbank#0
|
||||
Successful SSA optimization PassNEliminateUnusedVars
|
||||
Removing unused procedure __start
|
||||
Removing unused procedure block __start
|
||||
Removing unused procedure block __start::__init1
|
||||
Removing unused procedure block __start::@1
|
||||
Removing unused procedure block __start::@2
|
||||
Removing unused procedure block __start::@return
|
||||
Successful SSA optimization PassNEliminateEmptyStart
|
||||
Resolving string sizeof() sizeof main::MSG2
|
||||
|
Loading…
x
Reference in New Issue
Block a user