1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-01-12 11:31:11 +00:00

Removed support for auto-casting integers to pointers. Closes #659

This commit is contained in:
jespergravgaard 2021-05-11 13:36:45 +02:00
parent 497fd2b89f
commit d4b8820b1c
984 changed files with 4097 additions and 3717 deletions

View File

@ -19767,3 +19767,23 @@ sta {z1}
lda {z1}+1
adc {z2}+1
sta {z1}+1
//FRAGMENT pwuz1=pbuc1
lda #<{c1}
sta {z1}
lda #>{c1}
sta {z1}+1
//FRAGMENT vwuz1=vwuc1_plus_vbuaa
clc
adc #<{c1}
sta {z1}
lda #>{c1}
adc #0
sta {z1}+1
//FRAGMENT vwuz1=vwuc1_plus_vbuyy
tya
clc
adc #<{c1}
sta {z1}
lda #>{c1}
adc #0
sta {z1}+1

View File

@ -131,10 +131,6 @@ public class Initializers {
}
}
}
// Add pointer cast to integers
if(typeSpec.getType() instanceof SymbolTypePointer && initValue instanceof ConstantValue && SymbolType.isInteger(((ConstantValue) initValue).getType(program.getScope()))) {
initValue = new ConstantCastValue(typeSpec.getType(), (ConstantValue) initValue);
}
return initValue;
}

View File

@ -5,6 +5,7 @@ import dk.camelot64.kickc.model.ControlFlowBlock;
import dk.camelot64.kickc.model.Program;
import dk.camelot64.kickc.model.statements.Statement;
import dk.camelot64.kickc.model.statements.StatementAssignment;
import dk.camelot64.kickc.model.symbols.Variable;
import dk.camelot64.kickc.model.types.SymbolType;
import dk.camelot64.kickc.model.types.SymbolTypeConversion;
import dk.camelot64.kickc.model.types.SymbolTypeInference;
@ -30,9 +31,24 @@ public class PassNAssertTypeMatch extends Pass2SsaAssertion {
// TODO: Implement checking for calls / ...
}
}
for(Variable var : getScope().getAllVars(true)) {
if(var.getInitValue()!=null) {
checkVarInit(var);
}
}
}
private void checkVarInit(Variable variable) {
SymbolType lValueType = variable.getType();
SymbolType rValueType = variable.getInitValue().getType(getScope());
if(SymbolTypeConversion.assignmentTypeMatch(lValueType, rValueType)) return;
// Types do not match
getLog().append("ERROR! Type mismatch (" + lValueType.getTypeName() + ") cannot be assigned from (" + rValueType.getTypeName() + "). In initialization of " + variable.toString(getProgram()));
throw new CompileError("Type mismatch (" + lValueType.getTypeName() + ") cannot be assigned from (" + rValueType.getTypeName() + "). In initialization of " + variable.toString(getProgram()));
}
private void checkAssignment(StatementAssignment statement) {
LValue lValue = statement.getlValue();
SymbolType lValueType = SymbolTypeInference.inferType(getScope(), lValue);

View File

@ -76,7 +76,7 @@ public class PassNSizeOfSimplification extends Pass2SsaOptimization {
if(arraySize!=null) {
getLog().append("Resolving array sizeof() " + unary.toString(getProgram()));
ConstantRef sizeOfConstantVar = SizeOfConstants.getSizeOfConstantVar(getScope(), arrayType.getElementType());
programValue.set(new ConstantBinary((ConstantValue) arraySize, Operators.MULTIPLY, sizeOfConstantVar));
programValue.set(new ConstantBinary(arraySize, Operators.MULTIPLY, sizeOfConstantVar));
modified.set(true);
} else if(constant.getInitValue() instanceof ConstantArrayList) {
getLog().append("Resolving array sizeof() " + unary.toString(getProgram()));

View File

@ -7,13 +7,13 @@
const char CYCLES_PER_SCANLINE = 76;
// The TIA WSYNC register (for access from inline ASM)
char* const TIA_WSYNC = 0x02;
char* const TIA_WSYNC = (char*)0x02;
// The TIA RESP0 register (for access from inline ASM)
char* const TIA_RESP0 = 0x10;
char* const TIA_RESP0 = (char*)0x10;
// The TIA RESP1 register (for access from inline ASM)
char* const TIA_RESP1 = 0x11;
char* const TIA_RESP1 = (char*)0x11;
// The TIA HMP0 register (for access from inline ASM)
char* const TIA_HMP0 = 0x20;
char* const TIA_HMP0 = (char*)0x20;
struct ATARI_TIA_WRITE {
// $00 0000 00x0 Vertical Sync Set-Clear

View File

@ -10,60 +10,60 @@
#include <atari-pokey.h>
// Atari GTIA write registers
struct ATARI_GTIA_WRITE * const GTIA = 0xd000;
struct ATARI_GTIA_WRITE * const GTIA = (struct ATARI_GTIA_WRITE *)0xd000;
// Atari GTIA read registers
struct ATARI_GTIA_READ * const GTIA_READ = 0xd000;
struct ATARI_GTIA_READ * const GTIA_READ = (struct ATARI_GTIA_READ *)0xd000;
// Atari POKEY write registers
struct ATARI_POKEY_WRITE * const POKEY = 0xd200;
struct ATARI_POKEY_WRITE * const POKEY = (struct ATARI_POKEY_WRITE *)0xd200;
// Atari POKEY read registers
struct ATARI_POKEY_READ * const POKEY_READ = 0xd200;
struct ATARI_POKEY_READ * const POKEY_READ = (struct ATARI_POKEY_READ *)0xd200;
// Atari ANTIC registers
struct ATARI_ANTIC * const ANTIC = 0xd400;
struct ATARI_ANTIC * const ANTIC = (struct ATARI_ANTIC *)0xd400;
// Atari ZP registers
// 1-byte cursor row
char * ROWCRS = 0x54;
char * ROWCRS = (char*)0x54;
// 2-byte cursor column
word * COLCRS = 0x55;
word * COLCRS = (word*)0x55;
// 2-byte saved memory scan counter
char ** const SAVMSC = 0x58;
char ** const SAVMSC = (char**)0x58;
// data under cursor
char * const OLDCHR = 0x5D;
char * const OLDCHR = (char*)0x5D;
// 2-byte saved cursor memory address
char ** const OLDADR = 0x5E;
char ** const OLDADR = (char**)0x5E;
// Atari OS Shadow registers
// OS Shadow ANTIC Direct Memory Access Control ($D400)
char * const SDMCTL = 0x022f;
char * const SDMCTL = (char*)0x022f;
// OS Shadow ANTIC Character Control ($D401)
char * const CHART = 0x02f3;
char * const CHART = (char*)0x02f3;
// OS Shadow ANTIC Display List Pointer ($D402)
char ** const SDLST = 0x0230;
char ** const SDLST = (char**)0x0230;
// OS Shadow ANTIC Character Set Base Address (D409)
char * CHBAS = 0x02f4;
char * CHBAS = (char*)0x02f4;
// OS Shadow ANTIC Light Pen Horizontal Position ($D40C)
char * LPENH = 0x234;
char * LPENH = (char*)0x234;
// OS Shadow ANTIC Light Pen Vertical Position ($D40D)
char * LPENV = 0x235;
char * LPENV = (char*)0x235;
// Color register zero, color of playfield zero. Shadow for 53270 ($D016)
char * const COLOR0 = 0x2C4;
char * const COLOR0 = (char*)0x2C4;
// Shadow for 53271 ($D017). Text color in Gr.0
char * const COLOR1 = 0x2C5;
char * const COLOR1 = (char*)0x2C5;
// Shadow for 53272 ($D018). Background color in GR.0
char * const COLOR2 = 0x2C6;
char * const COLOR2 = (char*)0x2C6;
// Shadow for 53273 ($D019)
char * const COLOR3 = 0x2C7;
char * const COLOR3 = (char*)0x2C7;
// Shadow for 53274 ($D01A). Border color in GR.0
char * const COLOR4 = 0x2C8;
char * const COLOR4 = (char*)0x2C8;
// Cursor inhibit flag, 0 turns on, any other number turns off. Cursor doesn't change until it moves next.
char * const CRSINH = 0x2F0;
char * const CRSINH = (char*)0x2F0;
// Internal hardware value for the last key pressed. Set to 0xFF to clear.
char * const CH = 0x2FC;
char * const CH = (char*)0x2FC;
// Atari colours - names from Mapping the Atari.
// Add luminance values 0-14 (even only) to increase brightness

View File

@ -9,11 +9,11 @@
#include <mos6532.h>
// Atari TIA write registers
struct ATARI_TIA_WRITE * const TIA = 0x00;
struct ATARI_TIA_WRITE * const TIA = (struct ATARI_TIA_WRITE *)0x00;
// Atari TIA read registers
struct ATARI_TIA_READ * const TIA_READ = 0x00;
struct ATARI_TIA_READ * const TIA_READ = (struct ATARI_TIA_READ *)0x00;
// Atari RIOT registers
struct MOS6532_RIOT * const RIOT = 0x280;
struct MOS6532_RIOT * const RIOT = (struct MOS6532_RIOT *)0x280;

View File

@ -8,11 +8,11 @@
// Processor port data direction register
char* const PROCPORT_DDR = 0x00;
char* const PROCPORT_DDR = (char*)0x00;
// Mask for PROCESSOR_PORT_DDR which allows only memory configuration to be written
const char PROCPORT_DDR_MEMORY_MASK = 0b00000111;
// Processor Port Register controlling RAM/ROM configuration and the datasette
char* const PROCPORT = 0x01;
char* const PROCPORT = (char*)0x01;
// RAM in all three areas 0xA000, 0xD000, 0xE000
const char PROCPORT_RAM_ALL = 0b00000000;
// RAM in 0xA000, 0xE000 I/O in 0xD000
@ -25,40 +25,40 @@ const char PROCPORT_KERNEL_IO = 0b00000110;
const char PROCPORT_BASIC_KERNEL_IO = 0b00000111;
// The address of the CHARGEN character set
char* const CHARGEN = 0xd000;
char* const CHARGEN = (char*)0xd000;
// The SID MOS 6581/8580
struct MOS6581_SID * const SID = 0xd400;
struct MOS6581_SID * const SID = (struct MOS6581_SID *)0xd400;
// The VIC-II MOS 6567/6569
struct MOS6569_VICII* const VICII = 0xd000;
struct MOS6569_VICII* const VICII = (struct MOS6569_VICII*)0xd000;
// Color Ram
char * const COLORRAM = 0xd800;
char * const COLORRAM = (char*)0xd800;
// Color Ram
char * const COLS = 0xd800;
char * const COLS = (char*)0xd800;
// Default address of screen character matrix
char * const DEFAULT_SCREEN = 0x0400;
char * const DEFAULT_SCREEN = (char*)0x0400;
// Default address of the chargen font (upper case)
char * const DEFAULT_FONT_UPPER = 0x1000;
char * const DEFAULT_FONT_UPPER = (char*)0x1000;
// Default address of the chargen font (mixed case)
char * const DEFAULT_FONT_MIXED = 0x1800;
char * const DEFAULT_FONT_MIXED = (char*)0x1800;
// The CIA#1: keyboard matrix, joystick #1/#2
struct MOS6526_CIA * const CIA1 = 0xdc00;
struct MOS6526_CIA * const CIA1 = (struct MOS6526_CIA *)0xdc00;
// The CIA#2: Serial bus, RS-232, VIC memory bank
struct MOS6526_CIA * const CIA2 = 0xdd00;
struct MOS6526_CIA * const CIA2 = (struct MOS6526_CIA *)0xdd00;
// CIA#1 Interrupt for reading in ASM
char * const CIA1_INTERRUPT = 0xdc0d;
char * const CIA1_INTERRUPT = (char*)0xdc0d;
// CIA#2 timer A&B as one single 32-bit value
unsigned long* const CIA2_TIMER_AB = 0xdd04;
unsigned long* const CIA2_TIMER_AB = (unsigned long*)0xdd04;
// CIA#2 Interrupt for reading in ASM
char * const CIA2_INTERRUPT = 0xdd0d;
char * const CIA2_INTERRUPT = (char*)0xdd0d;
// The vector used when the KERNAL serves IRQ interrupts
void()** const KERNEL_IRQ = 0x0314;
void()** const KERNEL_IRQ = (void()**)0x0314;
// The vector used when the KERNAL serves NMI interrupts
void()** const KERNEL_NMI = 0x0318;
void()** const KERNEL_NMI = (void()**)0x0318;
// The vector used when the HARDWARE serves IRQ interrupts
void()** const HARDWARE_IRQ = 0xfffe;
void()** const HARDWARE_IRQ = (void()**)0xfffe;
// The colors of the C64
const char BLACK = 0x0;

View File

@ -8,12 +8,12 @@
#include <c64.h>
// Feature enables or disables the extra C64 DTV features
char* const DTV_FEATURE = $d03f;
char* const DTV_FEATURE = (char*)$d03f;
const char DTV_FEATURE_ENABLE = 1;
const char DTV_FEATURE_DISABLE_TIL_RESET = 2;
// Controls the graphics modes of the C64 DTV
char* const DTV_CONTROL = $d03c;
char* const DTV_CONTROL = (char*)$d03c;
const char DTV_LINEAR = $01;
const char DTV_BORDER_OFF = $02;
const char DTV_HIGHCOLOR = $04;
@ -23,43 +23,43 @@ const char DTV_BADLINE_OFF = $20;
const char DTV_CHUNKY = $40;
// Defines colors for the 16 first colors ($00-$0f)
char* const DTV_PALETTE = $d200;
char* const DTV_PALETTE = (char*)$d200;
// Default vallues for the palette
char DTV_PALETTE_DEFAULT[16] = { $00, $0f, $36, $be, $58, $db, $86, $ff, $29, $26, $3b, $05, $07, $df, $9a, $0a };
// Linear Graphics Plane A Counter Control
char* const DTV_PLANEA_START_LO = $d03a;
char* const DTV_PLANEA_START_MI = $d03b;
char* const DTV_PLANEA_START_HI = $d045;
char* const DTV_PLANEA_STEP = $d046;
char* const DTV_PLANEA_MODULO_LO = $d038;
char* const DTV_PLANEA_MODULO_HI = $d039;
char* const DTV_PLANEA_START_LO = (char*)$d03a;
char* const DTV_PLANEA_START_MI = (char*)$d03b;
char* const DTV_PLANEA_START_HI = (char*)$d045;
char* const DTV_PLANEA_STEP = (char*)$d046;
char* const DTV_PLANEA_MODULO_LO = (char*)$d038;
char* const DTV_PLANEA_MODULO_HI = (char*)$d039;
// Linear Graphics Plane B Counter Control
char* const DTV_PLANEB_START_LO = $d049;
char* const DTV_PLANEB_START_MI = $d04a;
char* const DTV_PLANEB_START_HI = $d04b;
char* const DTV_PLANEB_STEP = $d04c;
char* const DTV_PLANEB_MODULO_LO = $d047;
char* const DTV_PLANEB_MODULO_HI = $d048;
char* const DTV_PLANEB_START_LO = (char*)$d049;
char* const DTV_PLANEB_START_MI = (char*)$d04a;
char* const DTV_PLANEB_START_HI = (char*)$d04b;
char* const DTV_PLANEB_STEP = (char*)$d04c;
char* const DTV_PLANEB_MODULO_LO = (char*)$d047;
char* const DTV_PLANEB_MODULO_HI = (char*)$d048;
// Select memory bank where sprite data is fetched from (bits 5:0) - source only (J)
// Memory address of Sprite RAM is SpriteBank*$10000
char* const DTV_SPRITE_BANK = $d04d;
char* const DTV_SPRITE_BANK = (char*)$d04d;
// Select memory bank where color data is fetched from (bits 11:0)
// Memory address of Color RAM is ColorBank*$400
char* const DTV_COLOR_BANK_LO = $d036;
char* const DTV_COLOR_BANK_HI = $d037;
char* const DTV_COLOR_BANK_LO = (char*)$d036;
char* const DTV_COLOR_BANK_HI = (char*)$d037;
const unsigned long DTV_COLOR_BANK_DEFAULT = $1d800;
// Selects memory bank for normal VIC color mode and lower data for high color modes. (bits 5:0)
// Memory address of VIC Graphics is GraphicsBank*$10000
char* const DTV_GRAPHICS_VIC_BANK = $d03d;
char* const DTV_GRAPHICS_VIC_BANK = (char*)$d03d;
// Selects memory bank for upper data for high color modes. (bits 5:0) - source only (H)
char* const DTV_GRAPHICS_HICOL_BANK = $d03e;
char* const DTV_GRAPHICS_HICOL_BANK = (char*)$d03e;
// Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff)
// This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff
@ -67,46 +67,46 @@ char* const DTV_GRAPHICS_HICOL_BANK = $d03e;
void dtvSetCpuBankSegment1(char cpuBankIdx);
// Blitter Source A Start
char* const DTV_BLITTER_SRCA_LO = $d320;
char* const DTV_BLITTER_SRCA_MI = $d321;
char* const DTV_BLITTER_SRCA_HI = $d322;
char* const DTV_BLITTER_SRCA_LO = (char*)$d320;
char* const DTV_BLITTER_SRCA_MI = (char*)$d321;
char* const DTV_BLITTER_SRCA_HI = (char*)$d322;
// Blitter Source A Modulo
char* const DTV_BLITTER_SRCA_MOD_LO = $d323;
char* const DTV_BLITTER_SRCA_MOD_HI = $d324;
char* const DTV_BLITTER_SRCA_MOD_LO = (char*)$d323;
char* const DTV_BLITTER_SRCA_MOD_HI = (char*)$d324;
// Blitter Source A Line Length
char* const DTV_BLITTER_SRCA_LIN_LO = $d325;
char* const DTV_BLITTER_SRCA_LIN_HI = $d326;
char* const DTV_BLITTER_SRCA_LIN_LO = (char*)$d325;
char* const DTV_BLITTER_SRCA_LIN_HI = (char*)$d326;
// Blitter Source A Step ([7:4] integral part, [3:0] fractional part)
char* const DTV_BLITTER_SRCA_STEP = $d327;
char* const DTV_BLITTER_SRCA_STEP = (char*)$d327;
// Blitter Source B Start
char* const DTV_BLITTER_SRCB_LO = $d328;
char* const DTV_BLITTER_SRCB_MI = $d329;
char* const DTV_BLITTER_SRCB_HI = $d32a;
char* const DTV_BLITTER_SRCB_LO = (char*)$d328;
char* const DTV_BLITTER_SRCB_MI = (char*)$d329;
char* const DTV_BLITTER_SRCB_HI = (char*)$d32a;
// Blitter Source B Modulo
char* const DTV_BLITTER_SRCB_MOD_LO = $d32b;
char* const DTV_BLITTER_SRCB_MOD_HI = $d32c;
char* const DTV_BLITTER_SRCB_MOD_LO = (char*)$d32b;
char* const DTV_BLITTER_SRCB_MOD_HI = (char*)$d32c;
// Blitter Source B Line Length
char* const DTV_BLITTER_SRCB_LIN_LO = $d32d;
char* const DTV_BLITTER_SRCB_LIN_HI = $d32e;
char* const DTV_BLITTER_SRCB_LIN_LO = (char*)$d32d;
char* const DTV_BLITTER_SRCB_LIN_HI = (char*)$d32e;
// Blitter Source B Step ([7:4] integral part, [3:0] fractional part)
char* const DTV_BLITTER_SRCB_STEP = $d32f;
char* const DTV_BLITTER_SRCB_STEP = (char*)$d32f;
// Blitter Destination Start
char* const DTV_BLITTER_DEST_LO = $d330;
char* const DTV_BLITTER_DEST_MI = $d331;
char* const DTV_BLITTER_DEST_HI = $d332;
char* const DTV_BLITTER_DEST_LO = (char*)$d330;
char* const DTV_BLITTER_DEST_MI = (char*)$d331;
char* const DTV_BLITTER_DEST_HI = (char*)$d332;
// Blitter Source B Modulo
char* const DTV_BLITTER_DEST_MOD_LO = $d333;
char* const DTV_BLITTER_DEST_MOD_HI = $d334;
char* const DTV_BLITTER_DEST_MOD_LO = (char*)$d333;
char* const DTV_BLITTER_DEST_MOD_HI = (char*)$d334;
// Blitter Source B Line Length
char* const DTV_BLITTER_DEST_LIN_LO = $d335;
char* const DTV_BLITTER_DEST_LIN_HI = $d336;
char* const DTV_BLITTER_DEST_LIN_LO = (char*)$d335;
char* const DTV_BLITTER_DEST_LIN_HI = (char*)$d336;
// Blitter Source B Step ([7:4] integral part, [3:0] fractional part)
char* const DTV_BLITTER_DEST_STEP = $d337;
char* const DTV_BLITTER_DEST_STEP = (char*)$d337;
// Blitter Blit Length
char* const DTV_BLITTER_LEN_LO = $d338;
char* const DTV_BLITTER_LEN_HI = $d339;
char* const DTV_BLITTER_LEN_LO = (char*)$d338;
char* const DTV_BLITTER_LEN_HI = (char*)$d339;
// Blitter Control
char* const DTV_BLITTER_CONTROL = $d33a;
char* const DTV_BLITTER_CONTROL = (char*)$d33a;
// Bit[0] Force Start Strobe when set
const char DTV_BLIT_FORCE_START = %00000001;
// Bit[1] Source A Direction Positive when set
@ -124,7 +124,7 @@ const char DTV_BLIT_VBLANK = %01000000;
// Bit[7] Blitter IRQ Enable when set
const char DTV_BLIT_IRQ_EN = %10000000;
// Blitter Transparency
char* const DTV_BLITTER_TRANSPARANCY = $d33b;
char* const DTV_BLITTER_TRANSPARANCY = (char*)$d33b;
// Bit[0] Disable Channel B.
// (data into b port of ALU is forced to %00000000. ALU functions as normal)
const char DTV_BLIT_DISABLE_B = %00000001;
@ -138,7 +138,7 @@ const char DTV_BLIT_WRITE_NONTRANSPARENT = %00000100;
// Bit[2]==Bit[1]==0: write in any case
const char DTV_BLIT_TRANSPARANCY_NONE = %00000000;
// Controls the ALU operation
char* DTV_BLITTER_ALU = $d33e;
char* DTV_BLITTER_ALU = (char*)$d33e;
// Bit[2:0] Source A right Shift: 000 SourceA Data, 001 LastA[0],SourceA[7:1], ..., 111 LastA[6:0],SourceA[7]
const char DTV_BLIT_SHIFT0 = %00000000;
const char DTV_BLIT_SHIFT1 = %00000001;
@ -158,7 +158,7 @@ const char DTV_BLIT_XNOR = %00101000;
const char DTV_BLIT_ADD = %00110000;
const char DTV_BLIT_SUB = %00111000;
// Blitter Control 2
char* const DTV_BLITTER_CONTROL2 = $d33f;
char* const DTV_BLITTER_CONTROL2 = (char*)$d33f;
// Bit[0] Clear Blitter IRQ
const char DTV_BLIT_CLEAR_IRQ = %00000001;
// Bit[1] Source A Continue

View File

@ -29,15 +29,15 @@ const char LIGHT_GREY = 0xf;
// See https://github.com/commanderx16/x16-emulator/wiki/(VERA-0.8)-Registers-$9F23-and-$9F24-(and-$9F25)
// $9F20 VRAM Address (7:0)
char * const VERA_ADDRX_L = 0x9f20;
char * const VERA_ADDRX_L = (char*)0x9f20;
// $9F21 VRAM Address (15:8)
char * const VERA_ADDRX_M = 0x9f21;
char * const VERA_ADDRX_M = (char*)0x9f21;
// $9F22 VRAM Address (7:0)
// Bit 4-7: Address Increment The following is the amount incremented per value value:increment
// 0:0, 1:1, 2:2, 3:4, 4:8, 5:16, 6:32, 7:64, 8:128, 9:256, 10:512, 11:40, 12:80, 13:160, 14:320, 15:640
// 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;
char * const VERA_ADDRX_H = (char*)0x9f22;
const char VERA_INC_0 = 0x00;
const char VERA_INC_1 = 0x10;
const char VERA_INC_2 = 0x20;
@ -71,14 +71,14 @@ 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;
char * const VERA_DATA0 = (char*)0x9f23;
// $9F24 DATA1 VRAM Data port 1
char * const VERA_DATA1 = 0x9f24;
char * const VERA_DATA1 = (char*)0x9f24;
// $9F25 CTRL Control
// Bit 7: Reset
// Bit 1: DCSEL
// Bit 2: ADDRSEL
char * const VERA_CTRL = 0x9f25;
char * const VERA_CTRL = (char*)0x9f25;
const char VERA_DCSEL = 2;
const char VERA_ADDRSEL = 1;
// $9F26 IEN Interrupt Enable
@ -87,7 +87,7 @@ const char VERA_ADDRSEL = 1;
// Bit 2: SPRCOL
// Bit 1: LINE
// Bit 0: VSYNC
char * const VERA_IEN = 0x9f26;
char * const VERA_IEN = (char*)0x9f26;
const char VERA_AFLOW = 8;
const char VERA_SPRCOL = 4;
const char VERA_LINE = 2;
@ -100,12 +100,12 @@ const char VERA_VSYNC = 1;
// Bit 2: SPRCOL
// Bit 1: LINE
// Bit 0: VSYNC
char * const VERA_ISR = 0x9f27;
char * const VERA_ISR = (char*)0x9f27;
// $9F28 IRQLINE_L IRQ line (7:0)
// IRQ_LINE specifies at which line the LINE interrupt will be generated.
// Note that bit 8 of this value is present in the IEN register.
// For interlaced modes the interrupt will be generated each field and the bit 0 of IRQ_LINE is ignored.
char * const VERA_IRQLINE_L = 0x9f28;
char * const VERA_IRQLINE_L = (char*)0x9f28;
// $9F29 DC_VIDEO (DCSEL=0)
// Bit 7: Current Field Read-only bit which reflects the active interlaced field in composite and RGB modes. (0: even, 1: odd)
@ -114,7 +114,7 @@ char * const VERA_IRQLINE_L = 0x9f28;
// Bit 4: Layer0 Enable Enable output from the Layer0 renderer
// Bit 2: Chroma Disable Setting 'Chroma Disable' disables output of chroma in NTSC composite mode and will give a better picture on a monochrome display. (Setting this bit will also disable the chroma output on the S-video output.)
// Bit 0-1: Output Mode 0: Video disabled, 1: VGA output, 2: NTSC composite, 3: RGB interlaced, composite sync (via VGA connector)
char * const VERA_DC_VIDEO = 0x9f29;
char * const VERA_DC_VIDEO = (char*)0x9f29;
const char VERA_SPRITES_ENABLE = 0x40;
const char VERA_LAYER1_ENABLE = 0x20;
const char VERA_LAYER0_ENABLE = 0x10;
@ -124,19 +124,19 @@ const char VERA_OUTPUT_VGA = 0x01;
const char VERA_OUTPUT_NTSC = 0x02;
const char VERA_OUTPUT_RGB = 0x03;
// $9F2A DC_HSCALE (DCSEL=0) Active Display H-Scale
char * const VERA_DC_HSCALE = 0x9f2a;
char * const VERA_DC_HSCALE = (char*)0x9f2a;
// $9F2B DC_VSCALE (DCSEL=0) Active Display V-Scale
char * const VERA_DC_VSCALE = 0x9f2b;
char * const VERA_DC_VSCALE = (char*)0x9f2b;
// $9F2C DC_BORDER (DCSEL=0) Border Color
char * const VERA_DC_BORDER = 0x9f2c;
char * const VERA_DC_BORDER = (char*)0x9f2c;
// $9F29 DC_HSTART (DCSEL=1) Active Display H-Start (9:2)
char * const VERA_DC_HSTART = 0x9f29;
char * const VERA_DC_HSTART = (char*)0x9f29;
// $9F2A DC_HSTOP (DCSEL=1) Active Display H-Stop (9:2)
char * const VERA_DC_HSTOP = 0x9f2a;
char * const VERA_DC_HSTOP = (char*)0x9f2a;
// $9F2B DC_VSTART (DCSEL=1) Active Display V-Start (8:1)
char * const VERA_DC_VSTART = 0x9f2b;
char * const VERA_DC_VSTART = (char*)0x9f2b;
// $9F2C DC_VSTOP (DCSEL=1) Active Display V-Stop (8:1)
char * const VERA_DC_VSTOP = 0x9f2c;
char * const VERA_DC_VSTOP = (char*)0x9f2c;
// Configuration work tables
@ -165,7 +165,7 @@ byte const VERA_LAYER_COLOR_DEPTH_MASK = 0x03;
byte const VERA_LAYER_COLOR_DEPTH[4] = {1, 2, 4, 8};
// $9F2D L0_CONFIG Layer 0 Configuration
char * const VERA_L0_CONFIG = 0x9f2d;
char * const VERA_L0_CONFIG = (char*)0x9f2d;
// Bit 2: Bitmap Mode (0:tile mode, 1: bitmap mode)
char const VERA_LAYER_CONFIG_MODE_TILE = 0x00;
char const VERA_LAYER_CONFIG_MODE_BITMAP = 0x04;
@ -173,7 +173,7 @@ char const VERA_LAYER_CONFIG_MODE_BITMAP = 0x04;
char const VERA_LAYER_CONFIG_16C = 0x00;
char const VERA_LAYER_CONFIG_256C = 0x08;
// $9F2E L0_MAPBASE Layer 0 Map Base Address (16:9)
char * const VERA_L0_MAPBASE = 0x9f2e;
char * const VERA_L0_MAPBASE = (char*)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)
@ -185,49 +185,49 @@ byte const VERA_TILEBASE_HEIGHT_16 = 0x02;
byte const VERA_TILEBASE_HEIGHT_MASK = 0x02;
byte const VERA_LAYER_TILEBASE_MASK = 0xfC;
// Bit 0: Tile Width (0:8 pixels, 1:16 pixels)
char * const VERA_L0_TILEBASE = 0x9f2f;
char * const VERA_L0_TILEBASE = (char*)0x9f2f;
// $9F30 L0_HSCROLL_L Layer 0 H-Scroll (7:0)
char * const VERA_L0_HSCROLL_L = 0x9f30;
char * const VERA_L0_HSCROLL_L = (char*)0x9f30;
// $9F31 L0_HSCROLL_H Layer 0 H-Scroll (11:8)
char * const VERA_L0_HSCROLL_H = 0x9f31;
char * const VERA_L0_HSCROLL_H = (char*)0x9f31;
// $9F32 L0_VSCROLL_L Layer 0 V-Scroll (7:0)
char * const VERA_L0_VSCROLL_L = 0x9f32;
char * const VERA_L0_VSCROLL_L = (char*)0x9f32;
// $9F33 L0_VSCROLL_H Layer 0 V-Scroll (11:8)
char * const VERA_L0_VSCROLL_H = 0x9f33;
char * const VERA_L0_VSCROLL_H = (char*)0x9f33;
// $9F34 L1_CONFIG Layer 1 Configuration
char * const VERA_L1_CONFIG = 0x9f34;
char * const VERA_L1_CONFIG = (char*)0x9f34;
// $9F35 L1_MAPBASE Layer 1 Map Base Address (16:9)
char * const VERA_L1_MAPBASE = 0x9f35;
char * const VERA_L1_MAPBASE = (char*)0x9f35;
// $9F36 L1_TILEBASE Layer 1 Tile Base
// Bit 2-7: Tile Base Address (16:11)
// Bit 1: Tile Height (0:8 pixels, 1:16 pixels)
// Bit 0: Tile Width (0:8 pixels, 1:16 pixels)
char * const VERA_L1_TILEBASE = 0x9f36;
char * const VERA_L1_TILEBASE = (char*)0x9f36;
// $9F37 L1_HSCROLL_L Layer 1 H-Scroll (7:0)
char * const VERA_L1_HSCROLL_L = 0x9f37;
char * const VERA_L1_HSCROLL_L = (char*)0x9f37;
// $9F38 L1_HSCROLL_H Layer 1 H-Scroll (11:8)
char * const VERA_L1_HSCROLL_H = 0x9f38;
char * const VERA_L1_HSCROLL_H = (char*)0x9f38;
// $9F39 L1_VSCROLL_L Layer 1 V-Scroll (7:0)
char * const VERA_L1_VSCROLL_L = 0x9f39;
char * const VERA_L1_VSCROLL_L = (char*)0x9f39;
// $9F3A L1_VSCROLL_H Layer 1 V-Scroll (11:8)
char * const VERA_L1_VSCROLL_H = 0x9f3a;
char * const VERA_L1_VSCROLL_H = (char*)0x9f3a;
// $9F3B AUDIO_CTRL
// Bit 7: FIFO Full / FIFO Reset
// Bit 5: 16-Bit
// Bit 4: Stereo
// Bit 0-3: PCM Volume
char * const VERA_AUDIO_CTRL = 0x9f3b;
char * const VERA_AUDIO_CTRL = (char*)0x9f3b;
// $9F3C AUDIO_RATE PCM Sample Rate
char * const VERA_AUDIO_RATE = 0x9f3c;
char * const VERA_AUDIO_RATE = (char*)0x9f3c;
// $9F3D AUDIO_DATA Audio FIFO data (write-only)
char * const VERA_AUDIO_DATA = 0x9f3d;
char * const VERA_AUDIO_DATA = (char*)0x9f3d;
// $9F3E SPI_DATA SPI Data
char * const VERA_SPI_DATA = 0x9f3e;
char * const VERA_SPI_DATA = (char*)0x9f3e;
// $9F3F SPI_CTRL SPI Control
// Bit 7: Busy
// Bit 1: Slow clock
// Bit 0: Select
char * const VERA_SPI_CTRL = 0x9f3f;
char * const VERA_SPI_CTRL = (char*)0x9f3f;
// VERA Palette address in VRAM $1FA00 - $1FBFF
// 256 entries of 2 bytes

View File

@ -11,7 +11,7 @@
// Port A Bits 0-7 RAM bank
// Port B Bits 0-2 ROM bank
// Port B Bits 3-7 [TBD]
struct MOS6522_VIA * const VIA1 = 0x9f60;
struct MOS6522_VIA * const VIA1 = (struct MOS6522_VIA *)0x9f60;
// The VIA#2: Keyboard/Joy/Mouse
// Port A Bit 0 KBD PS/2 DAT
// Port A Bit 1 KBD PS/2 CLK
@ -25,23 +25,23 @@ struct MOS6522_VIA * const VIA1 = 0x9f60;
// Port B Bit 1 MOUSE PS/2 CLK
// Port B Bits 2-7 [TBD]
// NOTE: The pin assignment of the NES/SNES controller is likely to change.
struct MOS6522_VIA * const VIA2 = 0x9f70;
struct MOS6522_VIA * const VIA2 = (struct MOS6522_VIA *)0x9f70;
// Interrupt Vectors
// https://github.com/commanderx16/x16-emulator/wiki/(ASM-Programming)-Interrupts-and-interrupt-handling
// $FFFE (ROM) Universal interrupt vector - The vector used when the HARDWARE serves IRQ interrupts
void()** const HARDWARE_IRQ = 0xfffe;
void()** const HARDWARE_IRQ = (void()**)0xfffe;
// $0314 (RAM) IRQ vector - The vector used when the KERNAL serves IRQ interrupts
void()** const KERNEL_IRQ = 0x0314;
void()** const KERNEL_IRQ = (void()**)0x0314;
// $0316 (RAM) BRK vector - The vector used when the KERNAL serves IRQ caused by a BRK
void()** const KERNEL_BRK = 0x0316;
void()** const KERNEL_BRK = (void()**)0x0316;
// VRAM Address of the default screen
char * const DEFAULT_SCREEN = 0x0000;
char * const DEFAULT_SCREEN = (char*)0x0000;
// VRAM Bank (0/1) of the default screen
char * const DEFAULT_SCREEN_VBANK = 0;
char * const DEFAULT_SCREEN_VBANK = (char*)0;
// Put a single byte into VRAM.
// Uses VERA DATA0

View File

@ -13,43 +13,43 @@
// $D70F MATH BUSY
// Bit 7: DIVBUSY
// Bit 6: MULBUSY
char * const MATH_BUSY = 0xd70f;
char * const MATH_BUSY = (char *)0xd70f;
// $D768-$D76F DIVOUT 64-bit output of MULTINA ÷ MULTINB
// $D768-$D76B DIVOUT FRAC 32-bit output of MULTINA ÷ MULTINB
signed char volatile * const MATH_DIVOUT_FRAC_CHAR0 = 0xd768;
signed char volatile * const MATH_DIVOUT_FRAC_CHAR1 = 0xd769;
signed char volatile * const MATH_DIVOUT_FRAC_CHAR2 = 0xd76a;
signed char volatile * const MATH_DIVOUT_FRAC_CHAR3 = 0xd76b;
signed int volatile * const MATH_DIVOUT_FRAC_INT0 = 0xd768;
signed int volatile * const MATH_DIVOUT_FRAC_INT1 = 0xd76a;
signed long volatile * const MATH_DIVOUT_FRAC_LONG0 = 0xd768;
signed char volatile * const MATH_DIVOUT_FRAC_CHAR0 = (signed char*)0xd768;
signed char volatile * const MATH_DIVOUT_FRAC_CHAR1 = (signed char*)0xd769;
signed char volatile * const MATH_DIVOUT_FRAC_CHAR2 = (signed char*)0xd76a;
signed char volatile * const MATH_DIVOUT_FRAC_CHAR3 = (signed char*)0xd76b;
signed int volatile * const MATH_DIVOUT_FRAC_INT0 = (signed int*)0xd768;
signed int volatile * const MATH_DIVOUT_FRAC_INT1 = (signed int*)0xd76a;
signed long volatile * const MATH_DIVOUT_FRAC_LONG0 = (signed long*)0xd768;
// $D768-$D76F DIVOUT 64-bit output of MULTINA ÷ MULTINB
signed char volatile * const MATH_DIVOUT_WHOLE_CHAR0 = 0xd76c;
signed int volatile * const MATH_DIVOUT_WHOLE_INT0 = 0xd76c;
signed int volatile * const MATH_DIVOUT_WHOLE_INT1 = 0xd76e;
signed long volatile * const MATH_DIVOUT_WHOLE_LONG = 0xd76c;
signed char volatile * const MATH_DIVOUT_WHOLE_CHAR0 = (signed char*)0xd76c;
signed int volatile * const MATH_DIVOUT_WHOLE_INT0 = (signed int*)0xd76c;
signed int volatile * const MATH_DIVOUT_WHOLE_INT1 = (signed int*)0xd76e;
signed long volatile * const MATH_DIVOUT_WHOLE_LONG = (signed long*)0xd76c;
// $D770-$D773 MULTINA Multiplier input A / Divider numerator (32 bit)
signed char * const MATH_MULTINA_CHAR0 = 0xd770;
signed char * const MATH_MULTINA_CHAR1 = 0xd771;
signed char * const MATH_MULTINA_CHAR2 = 0xd772;
signed char * const MATH_MULTINA_CHAR3 = 0xd773;
signed int * const MATH_MULTINA_INT0 = 0xd770;
signed int * const MATH_MULTINA_INT1 = 0xd772;
signed long * const MATH_MULTINA_LONG = 0xd770;
signed char * const MATH_MULTINA_CHAR0 = (signed char*)0xd770;
signed char * const MATH_MULTINA_CHAR1 = (signed char*)0xd771;
signed char * const MATH_MULTINA_CHAR2 = (signed char*)0xd772;
signed char * const MATH_MULTINA_CHAR3 = (signed char*)0xd773;
signed int * const MATH_MULTINA_INT0 = (signed int*)0xd770;
signed int * const MATH_MULTINA_INT1 = (signed int*)0xd772;
signed long * const MATH_MULTINA_LONG = (signed long*)0xd770;
// $D774-$D777 MULTINB Multiplier input B / Divider denominator (32 bit)
signed char * const MATH_MULTINB_CHAR0 = 0xd774;
signed char * const MATH_MULTINB_CHAR1 = 0xd775;
signed char * const MATH_MULTINB_CHAR2 = 0xd776;
signed char * const MATH_MULTINB_CHAR3 = 0xd777;
signed int * const MATH_MULTINB_INT0 = 0xd774;
signed int * const MATH_MULTINB_INT1 = 0xd776;
signed long * const MATH_MULTINB_LONG = 0xd774;
signed char * const MATH_MULTINB_CHAR0 = (signed char*)0xd774;
signed char * const MATH_MULTINB_CHAR1 = (signed char*)0xd775;
signed char * const MATH_MULTINB_CHAR2 = (signed char*)0xd776;
signed char * const MATH_MULTINB_CHAR3 = (signed char*)0xd777;
signed int * const MATH_MULTINB_INT0 = (signed int*)0xd774;
signed int * const MATH_MULTINB_INT1 = (signed int*)0xd776;
signed long * const MATH_MULTINB_LONG = (signed long*)0xd774;
// $D778-$D77F MULTOUT 64-bit output of MULTINA × MULTINB
signed char volatile * const MATH_MULTOUT_CHAR0 = 0xd778;
signed int volatile * const MATH_MULTOUT_INT0 = 0xd778;
signed long volatile * const MATH_MULTOUT_LONG0 = 0xd778;
signed long volatile * const MATH_MULTOUT_LONG1 = 0xd77c;
signed char volatile * const MATH_MULTOUT_CHAR0 = (signed char*)0xd778;
signed int volatile * const MATH_MULTOUT_INT0 = (signed int*)0xd778;
signed long volatile * const MATH_MULTOUT_LONG0 = (signed long*)0xd778;
signed long volatile * const MATH_MULTOUT_LONG1 = (signed long*)0xd77c;

View File

@ -12,18 +12,18 @@
#include <mega65-math.h>
// I/O Personality selection
volatile char * const IO_KEY = 0xd02f;
volatile char * const IO_KEY = (char*)0xd02f;
// C65 Banking Register
volatile char * const IO_BANK = 0xd030;
volatile char * const IO_BANK = (char*)0xd030;
// Map 2nd KB of colour RAM $DC00-$DFFF (hiding CIA's)
const char CRAM2K = 0b00000001;
// Processor port data direction register
char* const PROCPORT_DDR = 0x00;
char* const PROCPORT_DDR = (char*)0x00;
// Mask for PROCESSOR_PORT_DDR which allows only memory configuration to be written
const char PROCPORT_DDR_MEMORY_MASK = 0b00000111;
// Processor Port Register controlling RAM/ROM configuration and the datasette
char* const PROCPORT = 0x01;
char* const PROCPORT = (char*)0x01;
// RAM in all three areas 0xA000, 0xD000, 0xE000
const char PROCPORT_RAM_ALL = 0b00000000;
// RAM in 0xA000, 0xE000 I/O in 0xD000
@ -36,50 +36,50 @@ const char PROCPORT_KERNEL_IO = 0b00000110;
const char PROCPORT_BASIC_KERNEL_IO = 0b00000111;
// The VIC-II MOS 6567/6569
struct MOS6569_VICII* const VICII = 0xd000;
struct MOS6569_VICII* const VICII = (struct MOS6569_VICII*)0xd000;
// The VIC III MOS 4567/4569
struct MOS4569_VICIII* const VICIII = 0xd000;
struct MOS4569_VICIII* const VICIII = (struct MOS4569_VICIII*)0xd000;
// The VIC IV
struct MEGA65_VICIV* const VICIV = 0xd000;
struct MEGA65_VICIV* const VICIV = (struct MEGA65_VICIV*)0xd000;
// The address of the CHARGEN character set
char * const CHARGEN = 0xd000;
char * const CHARGEN = (char*)0xd000;
// Palette RED
char * const PALETTE_RED = 0xd100;
char * const PALETTE_RED = (char*)0xd100;
// Palette GREEN
char * const PALETTE_GREEN = 0xd200;
char * const PALETTE_GREEN = (char*)0xd200;
// Palette BLUE
char * const PALETTE_BLUE = 0xd300;
char * const PALETTE_BLUE = (char*)0xd300;
// The SID MOS 6581/8580
struct MOS6581_SID * const SID = 0xd400;
struct MOS6581_SID * const SID = (struct MOS6581_SID *)0xd400;
// DMAgic F018 Controller
struct F018_DMAGIC * const DMA = 0xd700;
struct F018_DMAGIC * const DMA = (struct F018_DMAGIC *)0xd700;
// Color Ram
char * const COLORRAM = 0xd800;
char * const COLORRAM = (char*)0xd800;
// Default address of screen character matrix
#ifdef __MEGA65_C64__
char * const DEFAULT_SCREEN = 0x0400;
char * const DEFAULT_SCREEN = (char*)0x0400;
#else
char * const DEFAULT_SCREEN = 0x0800;
char * const DEFAULT_SCREEN = (char*)0x0800;
#endif
// The CIA#1: keyboard matrix, joystick #1/#2
struct MOS6526_CIA * const CIA1 = 0xdc00;
struct MOS6526_CIA * const CIA1 = (struct MOS6526_CIA *)0xdc00;
// The CIA#2: Serial bus, RS-232, VIC memory bank
struct MOS6526_CIA * const CIA2 = 0xdd00;
struct MOS6526_CIA * const CIA2 = (struct MOS6526_CIA *)0xdd00;
// CIA#1 Interrupt for reading in ASM
char * const CIA1_INTERRUPT = 0xdc0d;
char * const CIA1_INTERRUPT = (char*)0xdc0d;
// CIA#2 timer A&B as one single 32-bit value
unsigned long* const CIA2_TIMER_AB = 0xdd04;
unsigned long* const CIA2_TIMER_AB = (unsigned long*)0xdd04;
// CIA#2 Interrupt for reading in ASM
char * const CIA2_INTERRUPT = 0xdd0d;
char * const CIA2_INTERRUPT = (char*)0xdd0d;
// The vector used when the KERNAL serves IRQ interrupts
void()** const KERNEL_IRQ = 0x0314;
void()** const KERNEL_IRQ = (void()**)0x0314;
// The vector used when the KERNAL serves NMI interrupts
void()** const KERNEL_NMI = 0x0318;
void()** const KERNEL_NMI = (void()**)0x0318;
// The vector used when the HARDWARE serves IRQ interrupts
void()** const HARDWARE_IRQ = 0xfffe;
void()** const HARDWARE_IRQ = (void()**)0xfffe;
// The colors of the C64
const char BLACK = 0x0;

View File

@ -152,46 +152,46 @@ const char BORDER_YPOS_BOTTOM=250;
// The offset of the sprite pointers from the screen start address
const unsigned int OFFSET_SPRITE_PTRS = 0x3f8;
char * const SPRITES_XPOS = $d000;
char * const SPRITES_YPOS = $d001;
char * const SPRITES_XMSB = $d010;
char * const SPRITES_COLOR = $d027;
char* const SPRITES_ENABLE = $d015;
char* const SPRITES_EXPAND_Y = $d017;
char* const SPRITES_PRIORITY = $d01b;
char* const SPRITES_MC = $d01c;
char* const SPRITES_EXPAND_X = $d01d;
char * const SPRITES_XPOS = (char*)$d000;
char * const SPRITES_YPOS = (char*)$d001;
char * const SPRITES_XMSB = (char*)$d010;
char * const SPRITES_COLOR = (char*)$d027;
char* const SPRITES_ENABLE = (char*)$d015;
char* const SPRITES_EXPAND_Y = (char*)$d017;
char* const SPRITES_PRIORITY = (char*)$d01b;
char* const SPRITES_MC = (char*)$d01c;
char* const SPRITES_EXPAND_X = (char*)$d01d;
char* const RASTER = $d012;
char* const BORDER_COLOR = $d020;
char* const BG_COLOR = $d021;
char* const BG_COLOR0 = $d021;
char* const BG_COLOR1 = $d022;
char* const BG_COLOR2 = $d023;
char* const BG_COLOR3 = $d024;
char* const SPRITES_MC1 = $d025;
char* const SPRITES_MC2 = $d026;
char* const RASTER = (char*)$d012;
char* const BORDER_COLOR = (char*)$d020;
char* const BG_COLOR = (char*)$d021;
char* const BG_COLOR0 = (char*)$d021;
char* const BG_COLOR1 = (char*)$d022;
char* const BG_COLOR2 = (char*)$d023;
char* const BG_COLOR3 = (char*)$d024;
char* const SPRITES_MC1 = (char*)$d025;
char* const SPRITES_MC2 = (char*)$d026;
char* const VICII_CONTROL1 = $d011;
char* const D011 = $d011;
char* const VICII_CONTROL1 = (char*)$d011;
char* const D011 = (char*)$d011;
const char VICII_RST8 = %10000000;
const char VICII_ECM = %01000000;
const char VICII_BMM = %00100000;
const char VICII_DEN = %00010000;
const char VICII_RSEL = %00001000;
char* const VICII_CONTROL2 = $d016;
char* const D016 = $d016;
char* const VICII_CONTROL2 = (char*)$d016;
char* const D016 = (char*)$d016;
const char VICII_MCM = %00010000;
const char VICII_CSEL = %00001000;
char* const VICII_MEMORY = $d018;
char* const D018 = $d018;
char* const VICII_MEMORY = (char*)$d018;
char* const D018 = (char*)$d018;
// VIC II IRQ Status Register
char* const IRQ_STATUS = $d019;
char* const IRQ_STATUS = (char*)$d019;
// VIC II IRQ Enable Register
char* const IRQ_ENABLE = $d01a;
char* const IRQ_ENABLE = (char*)$d01a;
// Bits for the VICII IRQ Status/Enable Registers
const char IRQ_RASTER = %00000001;

View File

@ -50,29 +50,29 @@ struct MOS6581_SID {
};
// Channel 1 Frequency Low byte
char * const SID_CH1_FREQ_LO = 0xd400;
char * const SID_CH1_FREQ_LO = (char*)0xd400;
// Channel 1 Frequency High byte
char * const SID_CH1_FREQ_HI = 0xd401;
char * const SID_CH1_FREQ_HI = (char*)0xd401;
// Channel 1 Pulse Width (0-4095) Low byte
char * const SID_CH1_PULSE_WIDTH_LO = 0xd402;
char * const SID_CH1_PULSE_WIDTH_LO = (char*)0xd402;
// Channel 1 Pulse Width (0-4095) High byte
char * const SID_CH1_PULSE_WIDTH_HI = 0xd403;
char * const SID_CH1_PULSE_WIDTH_HI = (char*)0xd403;
// Channel 2 Frequency Low byte
char * const SID_CH2_FREQ_LO = 0xd407;
char * const SID_CH2_FREQ_LO = (char*)0xd407;
// Channel 2 Frequency High byte
char * const SID_CH2_FREQ_HI = 0xd408;
char * const SID_CH2_FREQ_HI = (char*)0xd408;
// Channel 2 Pulse Width (0-4095) Low byte
char * const SID_CH2_PULSE_WIDTH_LO = 0xd409;
char * const SID_CH2_PULSE_WIDTH_LO = (char*)0xd409;
// Channel 2 Pulse Width (0-4095) High byte
char * const SID_CH2_PULSE_WIDTH_HI = 0xd40a;
char * const SID_CH2_PULSE_WIDTH_HI = (char*)0xd40a;
// Channel 3 Frequency Low byte
char * const SID_CH3_FREQ_LO = 0xd40e;
char * const SID_CH3_FREQ_LO = (char*)0xd40e;
// Channel 3 Frequency High byte
char * const SID_CH3_FREQ_HI = 0xd40f;
char * const SID_CH3_FREQ_HI = (char*)0xd40f;
// Channel 3 Pulse Width (0-4095) Low byte
char * const SID_CH3_PULSE_WIDTH_LO = 0xd410;
char * const SID_CH3_PULSE_WIDTH_LO = (char*)0xd410;
// Channel 3 Pulse Width (0-4095) High byte
char * const SID_CH3_PULSE_WIDTH_HI = 0xd411;
char * const SID_CH3_PULSE_WIDTH_HI = (char*)0xd411;
// SID Channel Control Register Noise Waveform
const char SID_CONTROL_NOISE = 0x80;

View File

@ -8,13 +8,13 @@
#include <ricoh_2a03.h>
// NES Picture Processing Unit (PPU)
struct RICOH_2C02 * PPU = 0x2000;
struct RICOH_2C02 * PPU = (struct RICOH_2C02 *)0x2000;
// NES CPU and audion processing unit (APU)
struct RICOH_2A03 * APU = 0x4000;
struct RICOH_2A03 * APU = (struct RICOH_2A03 *)0x4000;
// Pointer to the start of RAM memory
char * const MEMORY = 0;
char * const MEMORY = (char *)0;
// Sprite Object Attribute Memory Structure
// The memory layout of a sprite in the PPU's OAM memory

View File

@ -13,29 +13,29 @@
#endif
// The processor port
// Used for serial I/O and controlling the cassette
struct MOS7501_PORT * const PROCESSOR_PORT = 0x00;
struct MOS7501_PORT * const PROCESSOR_PORT = (struct MOS7501_PORT *)0x00;
// Default address of screen luminance/color matrix
char * const DEFAULT_COLORRAM = 0x0800;
char * const DEFAULT_COLORRAM = (char*)0x0800;
// Default address of screen character matrix
char * const DEFAULT_SCREEN = 0x0c00;
char * const DEFAULT_SCREEN = (char*)0x0c00;
// The ACIA used for RS232 (only on the Plus/4)
struct MOS6551_ACIA * const ACIA = 0xfd00;
struct MOS6551_ACIA * const ACIA = (struct MOS6551_ACIA *)0xfd00;
// User Port PIO (P0-P7)
// Bit 2 (P2) is used to detect if play on cassette is pressed (CST sense)
struct MOS6529_PIO * const USER_PORT = 0xfd10;
struct MOS6529_PIO * const USER_PORT = (struct MOS6529_PIO *)0xfd10;
// Keyboard Port PIO (P0-P7)
// The input latch is part of the TED.
struct MOS6529_PIO * const KEYBOARD_PORT = 0xfd30;
struct MOS6529_PIO * const KEYBOARD_PORT = (struct MOS6529_PIO *)0xfd30;
// ROM configuration for the machine, which normally has the BASIC and kernal ROMs enabled.
// The ROM configuration is adjusted by writing to the registers (the value is irrelevant).
// The upper portion of the kernal ROM at $FC00-$FCFF is always enabled no matter what the memory configuration, as are the I/O registers.
struct {
struct PLUS4_ROM_BANKING {
// $FDD0 enables or disables BASIC,
char BASIC;
// $FDD1 the low function ROM,
@ -50,10 +50,12 @@ struct {
char FUNCTION_HIGH;
// $FDD6 the high cartridge ROM.
char CARTRIDGE_HIGH;
} * const ROM_BANKING = 0xfdd0;
};
struct PLUS4_ROM_BANKING * const ROM_BANKING = (struct PLUS4_ROM_BANKING *)0xfdd0;
// The TED chip controlling video and sound on the Plus/4 and Commodore 16
struct MOS7360_TED * const TED = 0xff00;
struct MOS7360_TED * const TED = (struct MOS7360_TED *)0xff00;

View File

@ -116,7 +116,7 @@ struct RICOH_2A03 {
// ------+-----+---------------------------------------------------------------
// Side effects After 3 or 4 CPU clock cycles*, the timer is reset.
// If the mode flag is set, then both "quarter frame" and "half frame" signals are also generated.
char * const FR_COUNTER = 0x4017;
char * const FR_COUNTER = (char*)0x4017;

View File

@ -7,28 +7,28 @@
// PPU Memory Map
// $0000-$0fff $1000 Pattern table 0
char * const PPU_PATTERN_TABLE_0 = 0x0000;
char * const PPU_PATTERN_TABLE_0 = (char*)0x0000;
// $1000-$1fff $1000 Pattern table 1
char * const PPU_PATTERN_TABLE_1 = 0x1000;
char * const PPU_PATTERN_TABLE_1 = (char*)0x1000;
// $2000-$23bf $03c0 Name table 0
char * const PPU_NAME_TABLE_0 = 0x2000;
char * const PPU_NAME_TABLE_0 = (char*)0x2000;
// $23c0-$23ff $0040 Attribute table 0
char * const PPU_ATTRIBUTE_TABLE_0 = 0x23c0;
char * const PPU_ATTRIBUTE_TABLE_0 = (char*)0x23c0;
// $2400-$27bf $03c0 Name table 1
char * const PPU_NAME_TABLE_1 = 0x2400;
char * const PPU_NAME_TABLE_1 = (char*)0x2400;
// $27c0-$27ff $0040 Attribute table 1
char * const PPU_ATTRIBUTE_TABLE_1 = 0x27c0;
char * const PPU_ATTRIBUTE_TABLE_1 = (char*)0x27c0;
// $2800-$2bbf $03c0 Name table 2
char * const PPU_NAME_TABLE_2 = 0x2800;
char * const PPU_NAME_TABLE_2 = (char*)0x2800;
// $2bc0-$2bff $0040 Attribute table 2
char * const PPU_ATTRIBUTE_TABLE_2 = 0x2bc0;
char * const PPU_ATTRIBUTE_TABLE_2 = (char*)0x2bc0;
// $2c00-$2fbf $03c0 Name table 3
char * const PPU_NAME_TABLE_3 = 0x2c00;
char * const PPU_NAME_TABLE_3 = (char*)0x2c00;
// $2fc0-$2fff $0040 Attribute table 3
char * const PPU_ATTRIBUTE_TABLE_3 = 0x2fc0;
char * const PPU_ATTRIBUTE_TABLE_3 = (char*)0x2fc0;
// $3000-$3eff $0f00 Mirrors of $2000-$2eff
// $3f00-$3f1f $0020 Palette RAM indexes
char * const PPU_PALETTE = 0x3f00;
char * const PPU_PALETTE = (char*)0x3f00;
// $3f20-$3fff $00e0 Mirrors of $3f00-$3f1f
struct RICOH_2C02 {
@ -136,7 +136,7 @@ struct RICOH_2C02 {
};
// PPU Status Register for reading in ASM
volatile char * const PPU_PPUSTATUS = 0x2002;
volatile char * const PPU_PPUSTATUS = (char*)0x2002;
// PPU Data Register for reading in ASM
volatile char * const PPU_PPUDATA = 0x2007;
volatile char * const PPU_PPUDATA = (char*)0x2007;

View File

@ -9,22 +9,22 @@
#endif
// Default address of screen color matrix
char * const DEFAULT_COLORRAM = 0x9600;
char * const DEFAULT_COLORRAM = (char*)0x9600;
// Address of screen color matrix if bit 7 of $9002 is 1
char * const ALTERNATIVE_COLORRAM = 0x9400;
char * const ALTERNATIVE_COLORRAM = (char*)0x9400;
// Default address of screen character matrix
char * const DEFAULT_SCREEN = 0x1e00;
char * const DEFAULT_SCREEN = (char*)0x1e00;
// The address of the CHARGEN character set
char * const CHARGEN = 0x8000;
char * const CHARGEN = (char*)0x8000;
// The MOS 6560/6561 VIC Video Interface Chip
struct MOS6561_VIC * const VIC = 0x9000;
struct MOS6561_VIC * const VIC = (struct MOS6561_VIC *)0x9000;
// The VIA#1: User port, RS-232, Joystick, Lightpen, Cassette
struct MOS6522_VIA * const VIA1 = 0x9110;
struct MOS6522_VIA * const VIA1 = (struct MOS6522_VIA *)0x9110;
// The VIA#2: Keyboard, Joystick, Cassette
struct MOS6522_VIA * const VIA2 = 0x9120;
struct MOS6522_VIA * const VIA2 = (struct MOS6522_VIA *)0x9120;
// The colors of the VIC 20
const char BLACK = 0x0;

View File

@ -5,8 +5,8 @@
#include <c64-basic-floats.h>
// Zeropage addresses used to hold lo/hi-bytes of addresses of float numbers in MEM
char* const memLo = 0xfe;
char* const memHi = 0xff;
char* const memLo = (char*)0xfe;
char* const memHi = (char*)0xff;
// Prepare MEM pointers for operations using MEM
inline void prepareMEM(unsigned int mem) {

View File

@ -28,7 +28,7 @@ char PLEX_YPOS[PLEX_COUNT];
char PLEX_PTR[PLEX_COUNT];
// The address of the sprite pointers on the current screen (screen+0x3f8).
char* volatile PLEX_SCREEN_PTR = 0x400+0x3f8;
char* volatile PLEX_SCREEN_PTR = (char*)0x400+0x3f8;
// Indexes of the plex-sprites sorted by sprite y-position. Each call to plexSort() will fix the sorting if changes to the Y-positions have ruined it.
char PLEX_SORTED_IDX[PLEX_COUNT];

View File

@ -1,7 +1,7 @@
#include <stdlib.h>
#include <string.h>
char* print_screen = $0400;
char* print_screen = (char*)$0400;
char* print_line_cursor = print_screen;
char* print_char_cursor = print_line_cursor;

View File

@ -11,7 +11,7 @@
// The actual memory addressed will be $4000*cpuSegmentIdx
void dtvSetCpuBankSegment1(char cpuBankIdx) {
// Move CPU BANK 1 SEGMENT ($4000-$7fff)
char* cpuBank = $ff;
char* cpuBank = (char*)$ff;
*cpuBank = cpuBankIdx;
asm {
// SAC $dd - A register points to 13 BANK 1 segment

View File

@ -22,7 +22,7 @@ const char CONIO_TEXTCOLOR_DEFAULT = LIGHT_BLUE;
// Set initial cursor position
void conio_c64_init() {
// Position cursor at current line
char * const BASIC_CURSOR_LINE = 0xD6;
char * const BASIC_CURSOR_LINE = (char*)0xD6;
char line = *BASIC_CURSOR_LINE;
if(line>=CONIO_HEIGHT) line=CONIO_HEIGHT-1;
gotoxy(0, line);
@ -31,9 +31,9 @@ void conio_c64_init() {
// Return true if there's a key waiting, return false if not
unsigned char kbhit (void) {
// CIA#1 Port A: keyboard matrix columns and joystick #2
char* const CIA1_PORT_A = 0xdc00;
char* const CIA1_PORT_A = (char*)0xdc00;
// CIA#1 Port B: keyboard matrix rows and joystick #1.
char* const CIA1_PORT_B = 0xdc01;
char* const CIA1_PORT_B = (char*)0xdc01;
*CIA1_PORT_A = 0;
return ~*CIA1_PORT_B;
}
@ -41,7 +41,7 @@ unsigned char kbhit (void) {
// Set the color for the background. The old color setting is returned.
unsigned char bgcolor(unsigned char color) {
// The background color register address
char * const CONIO_BGCOLOR = 0xd021;
char * const CONIO_BGCOLOR = (char*)0xd021;
char old = *CONIO_BGCOLOR;
*CONIO_BGCOLOR = color;
return old;
@ -50,7 +50,7 @@ unsigned char bgcolor(unsigned char color) {
// 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 * const CONIO_BORDERCOLOR = (char*)0xd020;
char old = *CONIO_BORDERCOLOR;
*CONIO_BORDERCOLOR = color;
return old;

View File

@ -69,7 +69,7 @@ __ma word conio_rowskip = 0;
// Set initial cursor position
void conio_x16_init() {
// Position cursor at current line
char * const BASIC_CURSOR_LINE = 0xD6;
char * const BASIC_CURSOR_LINE = (char*)0xD6;
char line = *BASIC_CURSOR_LINE;
vera_layer_mode_text(1,(dword)0x00000,(dword)0x0F800,128,64,8,8,16);
screensize(&conio_screen_width, &conio_screen_height);
@ -88,8 +88,8 @@ unsigned char kbhit(void) {
char ch = 0;
char* const chptr = &ch;
char* const IN_DEV = $028A; // Current input device number
char* const GETIN = $FFE4; // CBM GETIN API
char* const IN_DEV = (char*)$028A; // Current input device number
char* const GETIN = (char*)$FFE4; // CBM GETIN API
kickasm(uses chptr, uses IN_DEV, uses GETIN) {{

View File

@ -37,7 +37,7 @@ void conio_mega65_init() {
// Enable 2K Color RAM
*IO_BANK |= CRAM2K;
// Position cursor at current line
char * const BASIC_CURSOR_LINE = 0xeb;
char * const BASIC_CURSOR_LINE = (char*)0xeb;
char line = *BASIC_CURSOR_LINE+1;
if(line>=CONIO_HEIGHT) line=CONIO_HEIGHT-1;
gotoxy(0, line);
@ -46,9 +46,9 @@ void conio_mega65_init() {
// Return true if there's a key waiting, return false if not
unsigned char kbhit (void) {
// CIA#1 Port A: keyboard matrix columns and joystick #2
char* const CIA1_PORT_A = 0xdc00;
char* const CIA1_PORT_A = (char*)0xdc00;
// CIA#1 Port B: keyboard matrix rows and joystick #1.
char* const CIA1_PORT_B = 0xdc01;
char* const CIA1_PORT_B = (char*)0xdc01;
// Map CIA I/O
*IO_BANK &= ~CRAM2K;
// Read keyboard
@ -62,7 +62,7 @@ unsigned char kbhit (void) {
// Set the color for the background. The old color setting is returned.
unsigned char bgcolor(unsigned char color) {
// The background color register address
char * const CONIO_BGCOLOR = 0xd021;
char * const CONIO_BGCOLOR = (char*)0xd021;
char old = *CONIO_BGCOLOR;
*CONIO_BGCOLOR = color;
return old;
@ -71,7 +71,7 @@ unsigned char bgcolor(unsigned char color) {
// 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 * const CONIO_BORDERCOLOR = (char*)0xd020;
char old = *CONIO_BORDERCOLOR;
*CONIO_BORDERCOLOR = color;
return old;

View File

@ -22,7 +22,7 @@ const char CONIO_TEXTCOLOR_DEFAULT = 0;
// Set initial cursor position
void conio_plus4_init() {
// Position cursor at current line
char * const BASIC_CURSOR_LINE = 0xCD;
char * const BASIC_CURSOR_LINE = (char*)0xCD;
char line = *BASIC_CURSOR_LINE;
if(line>=CONIO_HEIGHT) line=CONIO_HEIGHT-1;
gotoxy(0, line);

View File

@ -22,7 +22,7 @@ const char CONIO_TEXTCOLOR_DEFAULT = BLUE;
// Set initial cursor position
void conio_vic20_init() {
// Position cursor at current line
char * const BASIC_CURSOR_LINE = 0xD6;
char * const BASIC_CURSOR_LINE = (char*)0xD6;
char line = *BASIC_CURSOR_LINE;
if(line>=CONIO_HEIGHT) line=CONIO_HEIGHT-1;
gotoxy(0, line);

View File

@ -50,7 +50,7 @@ void mulf_init() {
// Prepare for fast multiply with an unsigned char to a unsigned int result
void mulf8u_prepare(char a) {
char* const memA = $fd;
char* const memA = (char*)$fd;
*memA = a;
asm {
lda memA
@ -65,8 +65,8 @@ void mulf8u_prepare(char a) {
// Calculate fast multiply with a prepared unsigned char to a unsigned int result
// The prepared number is set by calling mulf8u_prepare(char a)
unsigned int mulf8u_prepared(char b) {
char* const resL = $fe;
char* const memB = $ff;
char* const resL = (char*)$fe;
char* const memB = (char*)$ff;
*memB = b;
asm {
ldx memB
@ -99,7 +99,7 @@ inline void mulf8s_prepare(signed char a) {
// Calculate fast multiply with a prepared unsigned char to a unsigned int result
// The prepared number is set by calling mulf8s_prepare(char a)
signed int mulf8s_prepared(signed char b) {
signed char* const memA = $fd;
signed char* const memA = (signed char*)$fd;
unsigned int m = mulf8u_prepared((char) b);
if(*memA<0) {
>m = (>m)-(char)b;
@ -119,9 +119,9 @@ signed int mulf8s(signed char a, signed char b) {
// Fast multiply two unsigned ints to a double unsigned int result
// Done in assembler to utilize fast addition A+X
unsigned long mulf16u(unsigned int a, unsigned int b) {
unsigned int* const memA = $f8;
unsigned int* const memB = $fa;
unsigned long* const memR = $fc;
unsigned int* const memA = (unsigned int*)$f8;
unsigned int* const memB = (unsigned int*)$fa;
unsigned long* const memR = (unsigned long*)$fc;
*memA = a;
*memB = b;
asm {

View File

@ -4,7 +4,7 @@
#include <string.h>
// Top of the heap used by malloc()
unsigned char* HEAP_TOP = 0xa000;
unsigned char* HEAP_TOP = (unsigned char*)0xa000;
// Head of the heap. Moved backward each malloc()
unsigned char* heap_head = HEAP_TOP;

View File

@ -9,6 +9,11 @@ import java.io.IOException;
*/
public class TestProgramsFast extends TestPrograms {
@Test
public void testSizeOfProblem() throws IOException {
compileAndCompare("sizeof-problem.c");
}
@Test
public void testProcedureDeclare0() throws IOException {
compileAndCompare("procedure-declare-0.c");
@ -1982,7 +1987,7 @@ public class TestProgramsFast extends TestPrograms {
@Test
public void testStructPtr12() throws IOException {
compileAndCompare("struct-ptr-12.c", log());
compileAndCompare("struct-ptr-12.c");
}
@Test

View File

@ -1,7 +1,7 @@
// Test that address vars are turned into load/store and located at hardcoded addresses
// Hard-coded zero-page address - global variable
char* const SCREEN = 0x0400;
char* const SCREEN = (char*)0x0400;
char __address(0x02) i = 3;

View File

@ -1,7 +1,7 @@
// Test that address vars are turned into load/store and located at hardcoded addresses
// Hard-coded zero-page address - local variable
char* const SCREEN = 0x0400;
char* const SCREEN = (char*)0x0400;
void main() {

View File

@ -1,6 +1,6 @@
// Test that a local array with a fixed location results in an error
int * const SCREEN = 0x0400;
int * const SCREEN = (char*)0x0400;
void main() {
// Local data array at hard-coded location should produce an error

View File

@ -1,7 +1,7 @@
// Test that address vars are turned into load/store and located at hardcoded addresses
// Hard-coded mainmem-page address - global variable
char* const SCREEN = 0x0400;
char* const SCREEN = (char*)0x0400;
char __address(0x2000) i = 3;

View File

@ -1,7 +1,7 @@
// Test that address vars are turned into load/store and located at hardcoded addresses
// Hard-coded mainmem address - local variable
char* const SCREEN = 0x0400;
char* const SCREEN = (char*)0x0400;
void main() {
char __address(0x2000) i = 3;

View File

@ -1,7 +1,7 @@
// Test declaring a variable as at a hard-coded address
// Incrementing a load/store variable will result in cause two *SIZEOF's
unsigned int* SCREEN = 0x0400;
unsigned int* SCREEN = (char*)0x0400;
void main() {
__address(0x2) char i=0;

View File

@ -7,7 +7,7 @@ void main() {
print('l');
}
char* const SCREEN = 0x0400;
char* const SCREEN = (char*)0x0400;
volatile char __address(0x03) idx;

View File

@ -7,7 +7,7 @@ void main() {
print('l');
}
char* const SCREEN = 0x0400;
char* const SCREEN = (char*)0x0400;
volatile char __address(0x3000) idx;

View File

@ -1,7 +1,7 @@
// Test declaring an array variable as at a hard-coded address
// The screen
char * const SCREEN = 0x0400;
char * const SCREEN = (char*)0x0400;
// Data to be put on the screen
char __address(0x1000) DATA[1000];

View File

@ -1,7 +1,7 @@
// Test declaring an integer array variable as at a hard-coded address
// The screen
int * const SCREEN = 0x0400;
int * const SCREEN = (int *)0x0400;
// Data to be put on the screen
int __address(0x1000) DATA[1000];

View File

@ -1,7 +1,7 @@
// Test address-of - use the pointer to get the value
void main() {
byte* SCREEN = $400;
byte* SCREEN = (char*)$400;
for( byte b: 0..10) {
byte* bp = &b;
byte c = *bp +1;

View File

@ -1,7 +1,7 @@
// Test address-of - pass the pointer as parameter
void main() {
byte* SCREEN = $400;
byte* SCREEN = (char*)$400;
byte b1 = 0;
byte b2 = 0;
byte b3 = 0;

View File

@ -3,7 +3,7 @@
byte val = 0;
void main() {
byte* const SCREEN1 = 0x0400;
byte* const SCREEN1 = (char*)0x0400;
byte* const SCREEN2 = SCREEN1+40;
byte idx = 0;
SCREEN1[idx] = val;

View File

@ -11,7 +11,7 @@ void main() {
}
int* const SCREEN = 0x0400;
int* const SCREEN = (int*)0x0400;
char idx = 0;
void print(int* p) {

View File

@ -1,7 +1,7 @@
// Test declaring an address as expression
// The screen
char * const SCREEN = 0x0400;
char * const SCREEN = (char*)0x0400;
word const var1 = 0x800;

View File

@ -52,7 +52,7 @@ struct LongLong plusLongLong(__ma struct LongLong a, __ma struct LongLong b) {
struct LongLong * SCREEN = 0x0400;
struct LongLong * SCREEN = (char*)0x0400;
void main() {
struct LongLong a = toLongLong(1000);

View File

@ -2,7 +2,7 @@
// http://8bitworkshop.com/blog/compilers/2019/03/17/cc65-optimization.html
void main() {
unsigned int* SCREEN = 0x0400;
unsigned int* SCREEN = (unsigned int*)0x0400;
for(unsigned char idx : 0..128)
SCREEN[idx] = getValue(idx);
}

View File

@ -1,6 +1,6 @@
byte b[3] = { 1, 2, 3, 4, 5 };
void main() {
byte* SCREEN = $400;
byte* SCREEN = (char*)$400;
SCREEN[0] = b[0];
}

View File

@ -1,6 +1,6 @@
byte b[];
void main() {
byte* SCREEN = $400;
byte* SCREEN = (char*)$400;
SCREEN[0] = b[0];
}

View File

@ -5,7 +5,7 @@ byte SINTAB[256] = kickasm {{
.fill 256, 128 + 128*sin(i*2*PI/256)
}};
byte* SCREEN = 0x400;
byte* SCREEN = (char*)0x400;
void main() {
SCREEN[0] = SINTAB[0];

View File

@ -6,7 +6,7 @@ __address(0x1000) char SINTAB[256] = kickasm {{
.fill 256, 128 + 128*sin(i*2*PI/256)
}};
char* SCREEN = 0x400;
char* SCREEN = (char*)0x400;
void main() {
SCREEN[0] = SINTAB[0];

View File

@ -3,7 +3,7 @@
char msg1[16] ="camelot";
char msg2[16] = { 'c', 'm', 'l' };
char* const SCREEN = 0x400;
char* const SCREEN = (char*)0x400;
void main() {
for(char i=0;msg1[i];i++)

View File

@ -3,7 +3,7 @@ byte b[3];
byte c[] = {'c', 'm', 'l'};
byte d[] = "cml"z;
byte* SCREEN = $400;
byte* SCREEN = (char*)$400;
void main() {
b[0] = 'c';

View File

@ -2,7 +2,7 @@
char[16] msg ="camelot";
char* const SCREEN = 0x400;
char* const SCREEN = (char*)0x400;
void main() {
for(char i=0;msg[i];i++)

View File

@ -1,7 +1,7 @@
// Test using an ASM mnemonic as a C symbol names
// Works if the C-lexer and the ASM-lexer are separated properly
char* const lda = 0x0400;
char* const lda = (char*)0x0400;
void main() {
char jmp = 1;

View File

@ -6,7 +6,7 @@ void main() {
}
}
char* const BG_COLOR = 0xd020;
char* const BG_COLOR = (char*)0xd020;
// Function only used inside the inline asm
void init() {

View File

@ -2,6 +2,6 @@ const byte prime = 7;
void main() {
prime = 13;
byte* screen = $0400;
byte* screen = (byte*)$0400;
*screen = prime;
}

View File

@ -1,7 +1,7 @@
// Tests that chained assignments work as intended
void main() {
byte* screen = $400;
byte* screen = (char*)$400;
byte a;
screen[0] = a = 'c';
screen[40] = a;

View File

@ -1,8 +1,8 @@
// Test compound assignment operators
byte ref[] = { 3, 4, 3, 18, 9, 1, 4, 2, 4, 5, 1 , 0};
byte* screen1 = $400;
byte* screen1 = (char*)$400;
byte* screen2 = screen1+40;
byte* cols = $d800;
byte* cols = (char*)$d800;
byte GREEN = 5;
byte RED = 2;

View File

@ -1,12 +1,12 @@
// 8 bit converted md5 calculator
void main() {
for(char* s=0x0400;s<0x0800;s++) *s=' ';
for(char* s=(char*)0x0400;s<0x0800;s++) *s=' ';
md5();
for(;;) ;
}
__ma char * line = 0x0400;
__ma char * line = (char*)0x0400;
__ma char idx = 0;
char HEX[] = "0123456789abcdef";

View File

@ -1,2 +1,2 @@
char* const BG_COLOR = 0xd021;
char* const BG_COLOR = (char*)0xd021;
const char BLACK = 0x00;

View File

@ -1,8 +1,8 @@
#include <c64.h>
byte* const SCREEN = $400;
byte* const BITMAP = $2000;
byte* const COLORS = $d800;
byte* const SCREEN = (byte*)$400;
byte* const BITMAP = (byte*)$2000;
byte* const COLORS = (byte*)$d800;
byte bitmask[] = { 128, 64, 32, 16, 8, 4, 2, 1 };

View File

@ -4,9 +4,9 @@
#include <c64.h>
byte* const SCREEN = $400;
byte* const BITMAP = $2000;
byte* const COLORS = $d800;
byte* const SCREEN = (byte*)$400;
byte* const BITMAP = (byte*)$2000;
byte* const COLORS = (byte*)$d800;
byte bitmask[] = { 128, 64, 32, 16, 8, 4, 2, 1 };

View File

@ -4,8 +4,8 @@
#include <c64.h>
#include <c64-bitmap.h>
byte* const SCREEN = $400;
byte* const BITMAP = $2000;
byte* const SCREEN = (byte*)$400;
byte* const BITMAP = (byte*)$2000;
byte next=0;

View File

@ -4,8 +4,8 @@
#include <c64.h>
#include <c64-bitmap.h>
byte* const SCREEN = $400;
byte* const BITMAP = $2000;
byte* const SCREEN = (byte*)$400;
byte* const BITMAP = (byte*)$2000;
word next=0;

View File

@ -3,8 +3,8 @@
#include <c64.h>
#include <c64-bitmap.h>
byte* BITMAP = 0x2000;
byte* SCREEN = 0x0400;
byte* BITMAP = (byte*)0x2000;
byte* SCREEN = (byte*)0x0400;
byte plots_per_frame[0x100];

View File

@ -5,8 +5,8 @@
#include <multiply.h>
#include <c64-bitmap.h>
byte* BITMAP = 0x2000;
byte* SCREEN = 0x0400;
byte* BITMAP = (byte*)0x2000;
byte* SCREEN = (byte*)0x0400;
byte plots_per_frame[0x100];

View File

@ -5,8 +5,8 @@
#include <multiply.h>
#include <c64-bitmap.h>
byte* BITMAP = 0x2000;
byte* SCREEN = 0x0400;
byte* BITMAP = (byte*)0x2000;
byte* SCREEN = (byte*)0x0400;
byte plots_per_frame[0x100];

View File

@ -4,8 +4,8 @@
#include <c64-bitmap.h>
#include <c64-print.h>
byte* BITMAP = 0x2000;
byte* SCREEN = 0x0400;
byte* BITMAP = (byte*)0x2000;
byte* SCREEN = (byte*)0x0400;
byte __align(0x100) SINTAB[0x180] = kickasm {{ .fill $180, 99.5+99.5*sin(i*2*PI/256) }};
byte* COSTAB = SINTAB+0x40;

View File

@ -1,22 +1,22 @@
byte* D011 = $d011;
byte* D011 = (byte*)$d011;
byte RST8 = %10000000;
byte ECM = %01000000;
byte BMM = %00100000;
byte DEN = %00010000;
byte RSEL = %00001000;
byte* RASTER = $d012;
byte* D016 = $d016;
byte* RASTER = (byte*)$d012;
byte* D016 = (byte*)$d016;
byte MCM = %00010000;
byte CSEL = %00001000;
byte* D018 = $d018;
byte* BG_COLOR = $d020;
byte* FGCOL = $d021;
byte* D018 = (byte*)$d018;
byte* BG_COLOR = (byte*)$d020;
byte* FGCOL = (byte*)$d021;
byte* COLS = $d800;
byte* COLS = (byte*)$d800;
byte* SCREEN = $400;
byte* const BITMAP = $2000;
byte* SCREEN = (byte*)$400;
byte* const BITMAP = (byte*)$2000;
void main() {
*BG_COLOR = 0;
@ -50,7 +50,7 @@ const byte plot_yhi[256];
const byte plot_bit[256];
void plot(byte x, byte y) {
byte* plotter_x = 0;
byte* plotter_x = (byte*)0;
word plotter_y = 0;
>plotter_x = plot_xhi[x]; // Needs word arrays arranged as two underlying byte arrays to allow byte* plotter_x = plot_x[x]; - and eventually - byte* plotter = plot_x[x] + plot_y[y];
<plotter_x = plot_xlo[x];
@ -71,7 +71,7 @@ void init_plot_tables() {
bits = $80;
}
}
byte* yoffs = $0;
byte* yoffs = (byte*)$0;
for(byte y : 0..255) {
plot_ylo[y] = y&$7 | <yoffs;
plot_yhi[y] = >yoffs;

View File

@ -1,7 +1,7 @@
// Test that bitwise NOT (~) is handled correctly
void main() {
char* const screen = 0x0400;
char* const screen = (char*)0x0400;
char b = ~0x10;
*screen = b;
}

View File

@ -1,6 +1,6 @@
void main() {
byte* SCREEN = $400;
byte* SCREEN = (char*)$400;
*SCREEN = ~1ub;
for(byte c : 1..26) {

View File

@ -1,6 +1,6 @@
// A Minimal test of boolean constants.
byte* const SCREEN = $400;
byte* const SCREEN = (char*)$400;
void main() {
bool_const_if();

View File

@ -1,7 +1,7 @@
// Test a function taking boolean parameter and returning boolean result
void main() {
byte* screen = $400;
byte* screen = (char*)$400;
for(byte i: 0..100) {
if( isSet(i, (i&1)==0)) {
screen[i] = '*';

View File

@ -1,7 +1,7 @@
// A test of boolean conditions using && || and !
void main() {
char* const screen = 0x400;
char* const screen = (char*)0x400;
for( char i : 0..20) {
if( (i<10) && ((i&1)==0) ) {
screen[i] = '*';

View File

@ -8,7 +8,7 @@ void main() {
}
void bool_and() {
byte* const screen = $400;
byte* const screen = (byte*)$400;
for( byte i : 0..20) {
if( (i<10) && ((i&1)==0) ) {
screen[i] = '*';
@ -19,7 +19,7 @@ void bool_and() {
}
void bool_or() {
byte* const screen = $428;
byte* const screen = (byte*)$428;
for( byte i : 0..20) {
if( (i<10) || ((i&1)==0) ) {
screen[i] = '*';
@ -30,7 +30,7 @@ void bool_or() {
}
void bool_not() {
byte* const screen = $450;
byte* const screen = (byte*)$450;
for( byte i : 0..20) {
if( !((i<10) || (i&1)==0)) {
screen[i] = '*';
@ -41,7 +41,7 @@ void bool_not() {
}
void bool_complex() {
byte* const screen = $478;
byte* const screen = (byte*)$478;
for( byte i : 0..20) {
if( ((i<10) && (i&1)==0) || !((i<10) || (i&1)==0) ) {
screen[i] = '*';

View File

@ -4,7 +4,7 @@
// https://gitlab.com/camelot/kickc/issues/199
void main() {
char* const screen = 0x0400;
char* const screen = (char*)0x0400;
for(char i: 0..7) {
bool b = (i&1)==1;
char c = !b ? 1 : 0 ;

View File

@ -4,7 +4,7 @@
// https://gitlab.com/camelot/kickc/issues/199
void main() {
char* const screen = 0x0400;
char* const screen = (char*)0x0400;
for(char i: 0..7) {
char b = i&1;
char c = !b ? 1 : 0 ;

View File

@ -4,7 +4,7 @@
// https://gitlab.com/camelot/kickc/issues/295
void main() {
char* const screen = 0x0400;
char* const screen = (char*)0x0400;
for(char i: 0..7) {
char b = (i&1);
screen[i] = !b;

View File

@ -1,7 +1,7 @@
// Tests a pointer to a boolean
void main() {
bool* bscreen = $400;
bool* bscreen = (bool*)$400;
bscreen[0] = true;
bscreen[1] = false;
bscreen = bscreen+2;

View File

@ -8,7 +8,7 @@ void main() {
}
void bool_and() {
byte* const screen = $400;
byte* const screen = (byte*)$400;
for( byte i : 0..20) {
bool o1 = (i<10);
bool o2 = ((i&1)==0);
@ -22,7 +22,7 @@ void bool_and() {
}
void bool_or() {
byte* const screen = $428;
byte* const screen = (byte*)$428;
for( byte i : 0..20) {
bool o1 = (i<10);
bool o2 = ((i&1)==0);
@ -36,7 +36,7 @@ void bool_or() {
}
void bool_not() {
byte* const screen = $450;
byte* const screen = (byte*)$450;
for( byte i : 0..20) {
bool o1 = (i<10);
bool o2 = (i&1)==0;
@ -50,7 +50,7 @@ void bool_not() {
}
void bool_complex() {
byte* const screen = $478;
byte* const screen = (byte*)$478;
for( byte i : 0..20) {
bool o1 = (i<10);
bool o2 = (i&1)==0;

View File

@ -1,5 +1,5 @@
byte STAR = 81;
byte SCREEN[40*25] = $0400;
byte SCREEN[40*25] = (byte*)$0400;
void main() {
byte x0 = 4;

View File

@ -1,7 +1,7 @@
void main() {
byte STAR = 81;
byte screen[40*25] = $0400;
byte screen[40*25] = (byte*)$0400;
byte x0 = 0;
byte y0 = 0;
byte x1 = 39;

View File

@ -2,9 +2,9 @@
#include <c64dtv.h>
// Plane with the screen
byte* const SCREEN = $7c00;
byte* const SCREEN = (byte*)$7c00;
// Plane with all pixels
byte* const CHARSET8 = $8000;
byte* const CHARSET8 = (byte*)$8000;
void main() {
asm { sei } // Disable normal interrupt (prevent keyboard reading glitches and allows to hide basic/kernal)
@ -95,7 +95,7 @@ void gfx_init_plane_charset8() {
// 8bpp cells for Plane B (charset) - ROM charset with 256 colors
byte gfxbCpuBank = (byte)(CHARSET8/$4000);
dtvSetCpuBankSegment1(gfxbCpuBank++);
byte* gfxa = $4000 + (((word)CHARSET8)& $3fff);
byte* gfxa = (char*)$4000 + (((word)CHARSET8)& $3fff);
byte* chargen = CHARGEN+1;
*PROCPORT = PROCPORT_RAM_CHARROM;
byte col = 0;

View File

@ -2,7 +2,7 @@
#include <c64dtv.h>
// Plane with all pixels
byte* const CHUNKY = $8000;
byte* const CHUNKY = (byte*)$8000;
void main() {
asm { sei } // Disable normal interrupt (prevent keyboard reading glitches and allows to hide basic/kernal)

View File

@ -2,7 +2,7 @@
#include <c64dtv.h>
byte* const SCREEN = $400;
byte* const SCREEN = (char*)$400;
const byte SRCA[] = "camelot rules!";
const byte SRCB[] = { $80 };

View File

@ -1,6 +1,6 @@
#include <c64dtv.h>
byte* const SCREEN = $400;
byte* const SCREEN = (char*)$400;
const byte SRCA[] = { 'c', 'a', 'm', 'e', 'l', 'o', 't', '!', ' '};
const byte SRCA_LEN = 9;
const byte SRCB[] = { $80 };

View File

@ -22,15 +22,15 @@ void main() {
}
// VIC Screens
byte* const VICII_SCREEN0 = $4000;
byte* const VICII_SCREEN1 = $4400;
byte* const VICII_SCREEN2 = $4800;
byte* const VICII_SCREEN3 = $4c00;
byte* const VICII_SCREEN4 = $5000;
byte* const VICII_SCREEN0 = (byte*)$4000;
byte* const VICII_SCREEN1 = (byte*)$4400;
byte* const VICII_SCREEN2 = (byte*)$4800;
byte* const VICII_SCREEN3 = (byte*)$4c00;
byte* const VICII_SCREEN4 = (byte*)$5000;
// VIC Charset from ROM
byte* const VICII_CHARSET_ROM = $5800;
byte* const VICII_CHARSET_ROM = (byte*)$5800;
// VIC Bitmap
byte* const VICII_BITMAP = $6000;
byte* const VICII_BITMAP = (byte*)$6000;
// 8BPP Chunky Bitmap (contains 8bpp pixels)
const dword PLANE_8BPP_CHUNKY = $20000;
@ -110,9 +110,9 @@ byte* get_VICII_charset(byte idx) {
}
// Screen containing the FORM
byte* const FORM_SCREEN = $0400;
byte* const FORM_SCREEN = (byte*)$0400;
// Charset used for the FORM
byte* const FORM_CHARSET = $1800; // Charset ROM
byte* const FORM_CHARSET = (byte*)$1800; // Charset ROM
byte FORM_TEXT[] =
" C64 DTV Graphics Mode Explorer @"
@ -500,7 +500,7 @@ void gfx_init_plane_8bppchunky() {
// 320x200 8bpp pixels for Plane
byte gfxbCpuBank = (byte)(PLANE_8BPP_CHUNKY/$4000);
dtvSetCpuBankSegment1(gfxbCpuBank++);
byte* gfxb = $4000;
byte* gfxb = (char*)$4000;
for(byte y : 0..199) {
for (word x : 0..319) {
// If we have crossed to $8000 increase the CPU BANK segment and reset to $4000
@ -520,7 +520,7 @@ void gfx_init_plane_8bppchunky() {
void gfx_init_plane_horisontal() {
byte gfxbCpuBank = (byte)(PLANE_HORISONTAL/$4000);
dtvSetCpuBankSegment1(gfxbCpuBank++);
byte* gfxa = $4000 + (PLANE_HORISONTAL & $3fff);
byte* gfxa = (char*)$4000 + (PLANE_HORISONTAL & $3fff);
for(byte ay : 0..199) {
for (byte ax : 0..39) {
if((ay&4)==0) {
@ -538,7 +538,7 @@ void gfx_init_plane_horisontal() {
void gfx_init_plane_horisontal2() {
byte gfxbCpuBank = (byte)(PLANE_HORISONTAL2/$4000);
dtvSetCpuBankSegment1(gfxbCpuBank++);
byte* gfxa = $4000 + (PLANE_HORISONTAL2 & $3fff);
byte* gfxa = (char*)$4000 + (PLANE_HORISONTAL2 & $3fff);
byte row_bitmask[] = { %00000000, %01010101, %10101010, %11111111 };
for(byte ay : 0..199) {
for (byte ax : 0..39) {
@ -554,7 +554,7 @@ void gfx_init_plane_horisontal2() {
void gfx_init_plane_vertical() {
byte gfxbCpuBank = (byte)(PLANE_VERTICAL/$4000);
dtvSetCpuBankSegment1(gfxbCpuBank++);
byte* gfxb = $4000 + (PLANE_VERTICAL & $3fff);
byte* gfxb = (char*)$4000 + (PLANE_VERTICAL & $3fff);
for(byte by : 0..199) {
for ( byte bx : 0..39) {
*gfxb++ = %00001111;
@ -569,7 +569,7 @@ void gfx_init_plane_charset8() {
// 8bpp cells for Plane B (charset) - ROM charset with 256 colors
byte gfxbCpuBank = (byte)(PLANE_CHARSET8/$4000);
dtvSetCpuBankSegment1(gfxbCpuBank++);
byte* gfxa = $4000 + (PLANE_CHARSET8 & $3fff);
byte* gfxa = (char*)$4000 + (PLANE_CHARSET8 & $3fff);
byte* chargen = CHARGEN;
*PROCPORT = PROCPORT_RAM_CHARROM;
byte col = 0;

View File

@ -42,8 +42,8 @@ byte MENU_TEXT[] =
void menu() {
byte* const SCREEN = $8000;
byte* const CHARSET = $9800; // Charset ROM
byte* const SCREEN = (byte*)$8000;
byte* const CHARSET = (byte*)$9800; // Charset ROM
// DTV Graphics Bank
*DTV_GRAPHICS_VIC_BANK = (byte)((dword)CHARSET/$10000);
// DTV Color Bank
@ -187,9 +187,9 @@ void mode_ctrl() {
// - 0: 4bpp BG_COLORor0[3:0]
// - 1: 4bpp ColorData[3:0]
void mode_stdchar() {
byte* const SCREEN = $8000;
byte* const CHARSET = $9000; // Charset ROM
byte* const COLORS = $d800;
byte* const SCREEN = (byte*)$8000;
byte* const CHARSET = (byte*)$9000; // Charset ROM
byte* const COLORS = (byte*)$d800;
// DTV Graphics Bank
*DTV_GRAPHICS_VIC_BANK = (byte)((dword)CHARSET/$10000);
// DTV Color Bank
@ -238,9 +238,9 @@ void mode_stdchar() {
// - CharData[7:6] 11: 4bpp BG_COLORor3[3:0]
// - 1: 4bpp ColorData[3:0]
void mode_ecmchar() {
byte* const SCREEN = $8000;
byte* const CHARSET = $9000; // Charset ROM
byte* const COLORS = $d800;
byte* const SCREEN = (byte*)$8000;
byte* const CHARSET = (byte*)$9000; // Charset ROM
byte* const COLORS = (byte*)$d800;
// DTV Graphics Bank
*DTV_GRAPHICS_VIC_BANK = (byte)((dword)CHARSET/$10000);
// DTV Color Bank
@ -294,9 +294,9 @@ void mode_ecmchar() {
// - 10: 4bpp BG_COLORor2[3:0]
// - 11: 4bpp ColorData[2:0]// Standard Character Mode (LINEAR/HICOL/CHUNK/COLDIS/ECM/MCM/BMM = 0)
void mode_mcchar() {
byte* const SCREEN = $8000;
byte* const CHARSET = $9000; // Charset ROM
byte* const COLORS = $d800;
byte* const SCREEN = (byte*)$8000;
byte* const CHARSET = (byte*)$9000; // Charset ROM
byte* const COLORS = (byte*)$d800;
// DTV Graphics Bank
*DTV_GRAPHICS_VIC_BANK = (byte)((dword)CHARSET/$10000);
// DTV Color Bank
@ -344,8 +344,8 @@ void mode_mcchar() {
// - 0: 4bpp CharData[3:0]
// - 1: 4bpp CharData[7:4]
void mode_stdbitmap() {
byte* const SCREEN = $4000;
byte* const BITMAP = $6000;
byte* const SCREEN = (byte*)$4000;
byte* const BITMAP = (byte*)$6000;
// DTV Graphics Bank
*DTV_GRAPHICS_VIC_BANK = (byte)((dword)BITMAP/$10000);
// DTV Graphics Mode
@ -396,9 +396,9 @@ void mode_stdbitmap() {
// - 0: 8bpp BG_COLORor0[7:0]
// - 1: 8bpp ColorData[7:0]
void mode_hicolstdchar() {
byte* const SCREEN = $8000;
byte* const CHARSET = $9000; // Charset ROM
byte* const COLORS = $8400;
byte* const SCREEN = (byte*)$8000;
byte* const CHARSET = (byte*)$9000; // Charset ROM
byte* const COLORS = (byte*)$8400;
// DTV Graphics Bank
*DTV_GRAPHICS_VIC_BANK = (byte)((dword)CHARSET/$10000);
// DTV Color Bank
@ -449,9 +449,9 @@ void mode_hicolstdchar() {
// - CharData[7:6] 11: 8bpp BG_COLORor3[7:0]
// - 1: 8bpp ColorData[7:0]
void mode_hicolecmchar() {
byte* const SCREEN = $8000;
byte* const CHARSET = $9000; // Charset ROM
byte* const COLORS = $8400;
byte* const SCREEN = (byte*)$8000;
byte* const CHARSET = (byte*)$9000; // Charset ROM
byte* const COLORS = (byte*)$8400;
// DTV Graphics Bank
*DTV_GRAPHICS_VIC_BANK = (byte)((dword)CHARSET/$10000);
// DTV Color Bank
@ -505,9 +505,9 @@ void mode_hicolecmchar() {
// - 10: 8bpp BG_COLORor2[7:0]
// - 11: 8bpp ColorData[7:4] "0" & Color[2:0]
void mode_hicolmcchar() {
byte* const SCREEN = $8000;
byte* const CHARSET = $9000; // Charset ROM
byte* const COLORS = $8400;
byte* const SCREEN = (byte*)$8000;
byte* const CHARSET = (byte*)$9000; // Charset ROM
byte* const COLORS = (byte*)$8400;
// DTV Graphics Bank
*DTV_GRAPHICS_VIC_BANK = (byte)((dword)CHARSET/$10000);
// DTV Color Bank
@ -557,9 +557,9 @@ void mode_hicolmcchar() {
// - Plane A = 1 Plane B = 0: 8bpp "0000" & ColorData[3:0]
// - Plane A = 1 Plane B = 1: 8bpp BG_COLORor1[7:0]
void mode_twoplanebitmap() {
byte* const PLANEA = $4000;
byte* const PLANEB = $6000;
byte* const COLORS = $8000;
byte* const PLANEA = (byte*)$4000;
byte* const PLANEB = (byte*)$6000;
byte* const COLORS = (byte*)$8000;
// DTV Graphics Mode
dtv_control = DTV_HIGHCOLOR | DTV_LINEAR;
*DTV_CONTROL = DTV_HIGHCOLOR | DTV_LINEAR;
@ -627,9 +627,9 @@ void mode_twoplanebitmap() {
// GfxData/PlaneA Pixel Shifter (2), CharData/PlaneB Pixel Shifter (2):
// - 8bpp color (ColorData[3:0],CharData/PlaneB[1:0], GfxData/PlaneA[1:0])
void mode_sixsfred() {
byte* const PLANEA = $4000;
byte* const PLANEB = $6000;
byte* const COLORS = $8000;
byte* const PLANEA = (byte*)$4000;
byte* const PLANEB = (byte*)$6000;
byte* const COLORS = (byte*)$8000;
// DTV Graphics Mode
dtv_control = DTV_HIGHCOLOR | DTV_LINEAR;
*DTV_CONTROL = DTV_HIGHCOLOR | DTV_LINEAR;
@ -693,9 +693,9 @@ void mode_sixsfred() {
// PlaneA Pixel Shifter (2), PlaneB Pixel Shifter (2):
// - 8bpp color (PlaneB[1:0],ColorData[5:4],PlaneA[1:0],ColorData[1:0])
void mode_sixsfred2() {
byte* const PLANEA = $4000;
byte* const PLANEB = $6000;
byte* const COLORS = $8000;
byte* const PLANEA = (byte*)$4000;
byte* const PLANEB = (byte*)$6000;
byte* const COLORS = (byte*)$8000;
// DTV Graphics Mode
dtv_control = DTV_LINEAR;
*DTV_CONTROL = DTV_LINEAR;
@ -764,9 +764,9 @@ void mode_sixsfred2() {
//Counter B step and modulo should be set to 0, counter A modulo to 0 and counter A step to 1 for normal operation.
void mode_8bpppixelcell() {
// 8BPP Pixel Cell Screen (contains 40x25=1000 chars)
byte* const PLANEA = $3c00;
byte* const PLANEA = (byte*)$3c00;
// 8BPP Pixel Cell Charset (contains 256 64 byte chars)
byte* const PLANEB = $4000;
byte* const PLANEB = (byte*)$4000;
// DTV Graphics Mode
dtv_control = DTV_HIGHCOLOR | DTV_LINEAR | DTV_CHUNKY;
*DTV_CONTROL = DTV_HIGHCOLOR | DTV_LINEAR | DTV_CHUNKY;
@ -802,7 +802,7 @@ void mode_8bpppixelcell() {
}
// 8bpp cells for Plane B (charset) - ROM charset with 256 colors
*PROCPORT = PROCPORT_RAM_CHARROM;
byte* CHARGEN = $d000;
byte* CHARGEN = (byte*)$d000;
byte* gfxb = PLANEB;
byte* chargen = CHARGEN;
byte col = 0;
@ -858,13 +858,13 @@ void mode_8bppchunkybmm() {
// 320x200 8bpp pixels for Plane B
byte gfxbCpuBank = (byte)(PLANEB/$4000);
dtvSetCpuBankSegment1(gfxbCpuBank++);
byte* gfxb = $4000;
byte* gfxb = (byte*)$4000;
for(byte y : 0..199) {
for (word x : 0..319) {
// If we have crossed to $8000 increase the CPU BANK segment and reset to $4000
if(gfxb==$8000) {
dtvSetCpuBankSegment1(gfxbCpuBank++);
gfxb = (char*)$4000;
gfxb = (byte*)$4000;
}
byte c = (byte)(x+y);
*gfxb++ = c;

View File

@ -7,7 +7,7 @@ void main() {
print( {0x12,0x34} );
}
word* const SCREEN = 0x0400;
word* const SCREEN = (word*)0x0400;
byte idx = 0;
void print(word w) {

View File

@ -2,7 +2,7 @@
// Currently the same constant parameter is passed on every call.
// Reason: Multiple versioned parameter constants x0#0, x0#1 are only output as a single constant in the ASM .const x0 = 0
byte* screen = $0400;
byte* screen = (byte*)$0400;
void main() {
line(1,2);

View File

@ -2,7 +2,7 @@
void main() {
signed byte sbs[] = { -1, -2, -3, -4};
byte* SCREEN = $0400;
byte* SCREEN = (byte*)$0400;
for(byte i : 0..3) {
SCREEN[i] = (byte) sbs[i];
}

View File

@ -3,7 +3,7 @@
byte* screens[] = { (byte*)$0400, (byte*)$1400 };
void main() {
byte* DSP = $400;
byte* DSP = (char*)$400;
DSP[0] = spritePtr(getScreen(0));
}

View File

@ -1,7 +1,7 @@
// Tests a cast that is not needed
byte* sprite = $5000;
byte* SCREEN = $4400;
byte* sprite = (byte*)$5000;
byte* SCREEN = (byte*)$4400;
void main() {
byte* sprite_ptr = SCREEN+$378;

View File

@ -1,7 +1,7 @@
// Tests that casting inside constants in the output handles precedence between cast and + correctly - should generate the following KA-expression ($ff & sumw>>1)+1
void main() {
byte* SCREEN = $400;
byte* SCREEN = (char*)$400;
byte min = 10;
byte max = 200;
word sumw = min+max;
@ -10,7 +10,7 @@ void main() {
byte sumb = min+max;
byte midb = (sumb>>1)+1;
SCREEN[1] = midb;
byte* BG_COLOR = $d021;
byte* BG_COLOR = (char*)$d021;
if(SCREEN[0]==SCREEN[1]) {
*BG_COLOR = 5;
} else {

View File

@ -1,4 +1,4 @@
byte* SCREEN = $0400;
byte* SCREEN = (byte*)$0400;
byte* SCREEN2 = SCREEN+40*3;
byte* SCREEN3 = SCREEN+40*6;
byte* SCREEN4 = SCREEN+40*9;

View File

@ -1,6 +1,6 @@
byte* PROCPORT = $01;
byte* CHARGEN = $d000;
byte* SCREEN = $0400;
byte* PROCPORT = (byte*)$01;
byte* CHARGEN = (byte*)$d000;
byte* SCREEN = (byte*)$0400;
void main() {
asm { sei }

View File

@ -1,7 +1,7 @@
// Draws a chess board in the upper left corner of the screen
void main() {
byte* screen = $0400;
byte* colors = $d800;
byte* screen = (byte*)$0400;
byte* colors = (byte*)$d800;
byte color = 1;
for( byte row: 0..7) {
for( byte column: 0..7) {

Some files were not shown because too many files have changed in this diff Show More