1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-04-22 03:38:31 +00:00

Merge remote-tracking branch 'origin/master' into master

This commit is contained in:
jespergravgaard 2020-09-25 09:12:18 +02:00
commit 18bce95623
37 changed files with 11239 additions and 854 deletions

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE 17a386c45a 17a386dc9c
//KICKC FRAGMENT CACHE 185628ba62 185628d2c2
//FRAGMENT vbuz1=vbuc1
lda #{c1}
sta {z1}

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE 17a386c45a 17a386dc9c
//KICKC FRAGMENT CACHE 185628ba62 185628d2c2
//FRAGMENT vbuz1=vbuc1
lda #{c1}
sta {z1}

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE 17a386c45a 17a386dc9c
//KICKC FRAGMENT CACHE 185628ba62 185628d2c2
//FRAGMENT vbuz1=vbuc1
lda #{c1}
sta {z1}

View File

@ -1,4 +1,4 @@
//KICKC FRAGMENT CACHE 17a386c45a 17a386dc9c
//KICKC FRAGMENT CACHE 185628ba62 185628d2c2
//FRAGMENT vbuz1=_deref_pbuc1
lda {c1}
sta {z1}

View File

@ -0,0 +1 @@
lda {m1}+1

View File

@ -0,0 +1 @@
ldx {m1}+1

View File

@ -0,0 +1 @@
ldy {m1}+1

View File

@ -0,0 +1,24 @@
lda {m2}+3
lsr
sta {m1}+3
lda {m2}+2
ror
sta {m1}+2
lda {m2}+1
ror
sta {m1}+1
lda {m2}
ror
sta {m1}
lsr {m1}+3
ror {m1}+2
ror {m1}+1
ror {m1}
lsr {m1}+3
ror {m1}+2
ror {m1}+1
ror {m1}
lsr {m1}+3
ror {m1}+2
ror {m1}+1
ror {m1}

View File

@ -0,0 +1,135 @@
// MEGA65 DMA
// Appendix J in https://mega.scryptos.com/sharefolder-link/MEGA/MEGA65+filehost/Docs/MEGA65-Book_draft.pdf
// C65 Manual http://www.zimmers.net/cbmpics/cbm/c65/c65manual.txt
// DMA lists https://raw.githubusercontent.com/MEGA65/c65-specifications/master/c65manualupdated.txt
// DMA lists https://c65gs.blogspot.com/2019/03/auto-detecting-required-revision-of.html
// DMA list options https://c65gs.blogspot.com/2018/01/improving-dmagic-controller-interface.html
// DMAgic VHDL source https://github.com/MEGA65/mega65-core/blob/master/src/vhdl/gs4510.vhdl#L4364
// Xemu emulator source https://github.com/lgblgblgb/xemu/blob/master/xemu/f018_core.c
// Registers of the MEGA65 enchanced F018 DMAgic Controller
struct F018_DMAGIC {
// $D700 ADDRLSBTRIG DMAgic DMA list address LSB, and trigger DMA (when written).
// We also clear out the upper address bits in case an enhanced job had set them.
char ADDRLSBTRIG;
// $D701 ADDRMSB DMA list address high byte (address bits 8 -- 15).
char ADDRMSB;
// $D702 ADDRBANK DMA list address bank (address bits 16 -- 22). Writing clears $D704.
char ADDRBANK;
// $D703 EN018B DMA enable F018B mode (adds sub-command byte )
// bit 0 enable F018B mode.
char EN018B;
// $D704 ADDRMB DMA list address mega-byte
char ADDRMB;
// $D705 ETRIG Set low-order byte of DMA list address, and trigger Enhanced DMA job
// Works like $D700, but enables DMA option lists.
char ETRIG;
// $D706-$D70D Unused
char UNUSED1[8];
// $D70E ADDRLSB DMA list address low byte (address bits 0 -- 7) WITHOUT STARTING A DMA JOB
// (used by Hypervisor for unfreezing DMA-using tasks)
char ADDRLSB;
// $D70F Unused
char UNUSED2;
// $D710 MISC (non-DMA) options
// $D710.0 - MISC:BADLEN Enable badline emulation
// $D710.1 - MISC:SLIEN Enable 6502-style slow (7 cycle) interrupts
// $D710.2 - MISC:VDCSEN Enable VDC interface simulation
char MISC;
};
// F018A DMA list entry
struct DMA_LIST_F018A {
// DMA command
// 0-1 command (00: copy, 01: mix (unsupported) 10: swap (unsupported) 11: fill )
// 2 chain
// 3 allow interrupt (unsupported)
char command;
// Count of bytes to copy/fill
unsigned int count;
// Source address (low byte is used as data for command fill)
char* src;
// Source address bank
// bits
// 7 src I/O
// 6 src direction
// 5 src modulo
// 4 src hold
// 0-3 address bank
char src_bank;
// Destination address
char* dest;
// Destination address bank
// bits
// 7 dest I/O
// 6 dest direction
// 5 dest modulo
// 4 dest hold
// 0-3 address bank
char dest_bank;
// Modulo value (unused)
unsigned int modulo;
};
// F018B DMA list entry
struct DMA_LIST_F018B {
// DMA command (format F018B)
// bits
// 0-1 command (00: copy, 01: mix (unsupported) 10: swap (unsupported) 11: fill )
// 2 chain
// 3 allow interrupt (unsupported)
// 4 src direction
// 5 dest direction
char command;
// Count of bytes to copy/fill
unsigned int count;
// Source address (low byte is used as data for command fill)
char* src;
// Source address bank
// bits
// 7 src I/O
// 0-6 dest address bank
char src_bank;
// Destination address
char* dest;
// Destination address bank
// bits
// 7 dest I/O
// 0-6 dest address bank
char dest_bank;
// Sub-command
// bits
// 0 src modulo (unsupported)
// 1 src hold
// 2 dest modulo (unsupported)
// 3 dest hold
char sub_command;
// Modulo value (unused)
unsigned int modulo;
};
// DMA command copy
const char DMA_COMMAND_COPY = 0x00;
// DMA command fill
const char DMA_COMMAND_FILL = 0x03;
// DMA command fill
const char DMA_COMMAND_CHAIN = 0x04;
// DMA command source direction
const char DMA_COMMAND_SRC_DIR = 0x10;
// DMA command destination direction
const char DMA_COMMAND_DEST_DIR = 0x20;
// Extended DMA Option Prefixes
// $00 = End of options
// $06 = Use $86 $xx transparency value (don't write source bytes to destination, if byte value matches $xx)
// $07 = Disable $86 $xx transparency value.
// $0A = Use F018A list format
// $0B = Use F018B list format
// $80 $xx = Set MB of source address
// $81 $xx = Set MB of destination address
// $82 $xx = Set source skip rate (/256ths of bytes)
// $83 $xx = Set source skip rate (whole bytes)
// $84 $xx = Set destination skip rate (/256ths of bytes)
// $85 $xx = Set destination skip rate (whole bytes)
// $86 $xx = Don't write to destination if byte value = $xx, and option $06 enabled

View File

@ -0,0 +1,134 @@
// MEGA65 Memory Mapper allows the 6502 CPU to access up to 256MB of memory by remapping where the eight 8K blocks point in real memory.
// The memory mapping is configured through the new MAP instruction of the MOS 4510.
// https://mega65.org/
// https://mega.scryptos.com/sharefolder-link/MEGA/MEGA65+filehost/Docs/MEGA65-Book_draft.pdf
// https://github.com/MEGA65/mega65-core/blob/master/src/vhdl/gs4510.vhdl
// http://www.zimmers.net/cbmpics/cbm/c65/c65manual.txt
// http://anyplatform.net/media/guides/cpus/65xx%20Processor%20Data.txt
// Bit representing 8K block #0 of the 64K addressable memory ($0000-$1fff)
const unsigned char MEMORYBLOCK_0000 = 0b00000001;
// Bit representing 8K block #1 of the 64K addressable memory ($2000-$3fff)
const unsigned char MEMORYBLOCK_2000 = 0b00000010;
// Bit representing 8K block #2 of the 64K addressable memory ($4000-$5fff)
const unsigned char MEMORYBLOCK_4000 = 0b00000100;
// Bit representing 8K block #3 of the 64K addressable memory ($6000-$7fff)
const unsigned char MEMORYBLOCK_6000 = 0b00001000;
// Bit representing 8K block #4 of the 64K addressable memory ($8000-$9fff)
const unsigned char MEMORYBLOCK_8000 = 0b00010000;
// Bit representing 8K block #5 of the 64K addressable memory ($a000-$bfff)
const unsigned char MEMORYBLOCK_A000 = 0b00100000;
// Bit representing 8K block #6 of the 64K addressable memory ($c000-$dfff)
const unsigned char MEMORYBLOCK_C000 = 0b01000000;
// Bit representing 8K block #7 of the 64K addressable memory ($e000-$ffff)
const unsigned char MEMORYBLOCK_E000 = 0b10000000;
// Remap some of the eight 8K memory blocks in the 64K address space of the 6502 to point somewhere else in the first 1MB memory space of the MEGA65.
// After the remapping the CPU will access the mapped memory whenever it uses instructions that access a remapped block.
// See section 2.3.4 in http://www.zimmers.net/cbmpics/cbm/c65/c65manual.txt for a description of the CPU memory remapper of the C65.
// remapBlocks: Indicates which 8K blocks of the 6502 address space to remap. Each bit represents one 8K block
// - bit 0 Memory block $0000-$1fff. Use constant MEMORYBLOCK_0000.
// - bit 1 Memory block $2000-$3fff. Use constant MEMORYBLOCK_2000.
// - bit 2 Memory block $4000-$5fff. Use constant MEMORYBLOCK_4000.
// - bit 3 Memory block $6000-$7fff. Use constant MEMORYBLOCK_6000.
// - bit 4 Memory block $8000-$9fff. Use constant MEMORYBLOCK_8000.
// - bit 5 Memory block $a000-$bfff. Use constant MEMORYBLOCK_A000.
// - bit 6 Memory block $c000-$dfff. Use constant MEMORYBLOCK_C000.
// - bit 7 Memory block $e000-$ffff. Use constant MEMORYBLOCK_E000.
// lowerPageOffset: Offset that will be added to any remapped blocks in the lower 32K of memory (block 0-3).
// The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 12bits of the passed value is used.
// - If block 0 ($0000-$1fff) is remapped it will point to lowerPageOffset*$100.
// - If block 1 ($2000-$3fff) is remapped it will point to lowerPageOffset*$100 + $2000.
// - If block 2 ($4000-$5fff) is remapped it will point to lowerPageOffset*$100 + $4000.
// - If block 3 ($6000-$7fff) is remapped it will point to lowerPageOffset*$100 + $6000.
// upperPageOffset: Offset that will be added to any remapped blocks in the upper 32K of memory (block 4-7).
// The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 12bits of the passed value is used.
// - If block 4 ($8000-$9fff) is remapped it will point to upperPageOffset*$100 + $8000
// - If block 5 ($a000-$bfff) is remapped it will point to upperPageOffset*$100 + $a000.
// - If block 6 ($c000-$dfff) is remapped it will point to upperPageOffset*$100 + $c000.
// - If block 7 ($e000-$ffff) is remapped it will point to upperPageOffset*$100 + $e000.
void memoryRemap(unsigned char remapBlocks, unsigned int lowerPageOffset, unsigned int upperPageOffset) {
char * aVal = 0xfc;
char * xVal = 0xfd;
char * yVal = 0xfe;
char * zVal = 0xff;
*aVal = <lowerPageOffset;
*xVal = (remapBlocks << 4) | (>lowerPageOffset & 0xf);
*yVal = <upperPageOffset;
*zVal = (remapBlocks & 0xf0) | (>upperPageOffset & 0xf);
asm {
lda aVal // lower blocks offset page low
ldx xVal // lower blocks to map + lower blocks offset high nibble
ldy yVal // upper blocks offset page
ldz zVal // upper blocks to map + upper blocks offset page high nibble
map
eom
}
}
// Remap a single 8K memory block in the 64K address space of the 6502 to point somewhere else in the first 1MB memory space of the MEGA65.
// All the other 8K memory blocks will not be mapped and will point to their own address in the lowest 64K of the MEGA65 memory.
// blockPage: Page address of the 8K memory block to remap (ie. the block that is remapped is $100 * the passed page address.)
// memoryPage: Page address of the memory that the block should point to in the 1MB memory space of the MEGA65.
// Ie. the memory that will be pointed to is $100 * the passed page address. Only the lower 12bits of the passed value is used.
void memoryRemapBlock(unsigned char blockPage, unsigned int memoryPage) {
// Find the page offset (the number of pages to offset the block)
unsigned int pageOffset = memoryPage-blockPage;
// Which block is being remapped? (0-7)
char block = blockPage / $20;
char blockBits = 1<<block;
memoryRemap(blockBits, pageOffset, pageOffset);
}
// Remap some of the eight 8K memory blocks in the 64K address space of the 6502 to point somewhere else in the entire 256MB memory space of the MEGA65.
// After the remapping the CPU will access the mapped memory whenever it uses instructions that access a remapped block.
// See section 2.3.4 in http://www.zimmers.net/cbmpics/cbm/c65/c65manual.txt for a description of the CPU memory remapper of the C65.
// See Appendix G in file:///Users/jespergravgaard/Downloads/MEGA65-Book_draft%20(5).pdf for a description of the CPU memory remapper of the MEGA65.
// remapBlocks: Indicates which 8K blocks of the 6502 address space to remap. Each bit represents one 8K block
// - bit 0 Memory block $0000-$1fff. Use constant MEMORYBLOCK_0000.
// - bit 1 Memory block $2000-$3fff. Use constant MEMORYBLOCK_2000.
// - bit 2 Memory block $4000-$5fff. Use constant MEMORYBLOCK_4000.
// - bit 3 Memory block $6000-$7fff. Use constant MEMORYBLOCK_6000.
// - bit 4 Memory block $8000-$9fff. Use constant MEMORYBLOCK_8000.
// - bit 5 Memory block $a000-$bfff. Use constant MEMORYBLOCK_A000.
// - bit 6 Memory block $c000-$dfff. Use constant MEMORYBLOCK_C000.
// - bit 7 Memory block $e000-$ffff. Use constant MEMORYBLOCK_E000.
// lowerPageOffset: Offset that will be added to any remapped blocks in the lower 32K of memory (block 0-3).
// The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 20bits of the passed value is used.
// - If block 0 ($0000-$1fff) is remapped it will point to lowerPageOffset*$100.
// - If block 1 ($2000-$3fff) is remapped it will point to lowerPageOffset*$100 + $2000.
// - If block 2 ($4000-$5fff) is remapped it will point to lowerPageOffset*$100 + $4000.
// - If block 3 ($6000-$7fff) is remapped it will point to lowerPageOffset*$100 + $6000.
// upperPageOffset: Offset that will be added to any remapped blocks in the upper 32K of memory (block 4-7).
// The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 20bits of the passed value is used.
// - If block 4 ($8000-$9fff) is remapped it will point to upperPageOffset*$100 + $8000
// - If block 5 ($a000-$bfff) is remapped it will point to upperPageOffset*$100 + $a000.
// - If block 6 ($c000-$dfff) is remapped it will point to upperPageOffset*$100 + $c000.
// - If block 7 ($e000-$ffff) is remapped it will point to upperPageOffset*$100 + $e000.
void memoryRemap256M(unsigned char remapBlocks, unsigned long lowerPageOffset, unsigned long upperPageOffset) {
char * lMb = 0xfa;
char * uMb = 0xfb;
char * aVal = 0xfc;
char * xVal = 0xfd;
char * yVal = 0xfe;
char * zVal = 0xff;
*lMb = >((unsigned int)(lowerPageOffset>>4));
*uMb = >((unsigned int)(upperPageOffset>>4));
*aVal = < <lowerPageOffset;
*xVal = (remapBlocks << 4) | (> <lowerPageOffset & 0xf);
*yVal = < <upperPageOffset;
*zVal = (remapBlocks & 0xf0) | (> <upperPageOffset & 0xf);
asm {
lda lMb // lower blocks offset megabytes
ldx #$0f // lower signal for MB offset
ldy uMb // upper blocks offset megabytes
ldz #$00 // upper signal for MB offset
map
lda aVal // lower blocks offset page low
ldx xVal // lower blocks to map + lower blocks offset high nibble
ldy yVal // upper blocks offset page
ldz zVal // upper blocks to map + upper blocks offset page high nibble
map
eom
}
}

View File

@ -7,6 +7,8 @@
#include <mos6581.h>
#include <mos4569.h>
#include <mega65-viciv.h>
#include <mega65-memorymapper.h>
#include <mega65-dma.h>
// I/O Personality selection
volatile char * const IO_KEY = 0xd02f;
@ -32,25 +34,26 @@ const char PROCPORT_KERNEL_IO = 0b00000110;
// BASIC in 0xA000, I/O in 0xD000, KERNEL in 0xE000
const char PROCPORT_BASIC_KERNEL_IO = 0b00000111;
// The address of the CHARGEN character set
char * const CHARGEN = 0xd000;
// The SID MOS 6581/8580
struct MOS6581_SID * const SID = 0xd400;
// The VIC-II MOS 6567/6569
struct MOS6569_VICII* const VICII = 0xd000;
// The VIC III MOS 4567/4569
struct MOS4569_VICIII* const VICIII = 0xd000;
// The VIC IV
struct MEGA65_VICIV* const VICIV = 0xd000;
// Color Ram
char * const COLORRAM = 0xd800;
// The address of the CHARGEN character set
char * const CHARGEN = 0xd000;
// Palette RED
char * const PALETTE_RED = 0xd100;
// Palette GREEN
char * const PALETTE_GREEN = 0xd200;
// Palette BLUE
char * const PALETTE_BLUE = 0xd300;
// The SID MOS 6581/8580
struct MOS6581_SID * const SID = 0xd400;
// DMAgic F018 Controller
struct F018_DMAGIC * const DMA = 0xd700;
// Color Ram
char * const COLORRAM = 0xd800;
// Default address of screen character matrix
#ifdef __MEGA65_C64__

View File

@ -237,6 +237,16 @@ public class TestPrograms {
compileAndCompare("examples/nes-demo/nes-demo.c");
}
@Test
public void testMega65BankedMusic() throws IOException, URISyntaxException {
compileAndCompare("examples/mega65/banked-music.c");
}
@Test
public void testMega65MemoryMapTest() throws IOException, URISyntaxException {
compileAndCompare("examples/mega65/memorymap-test.c");
}
@Test
public void testMega65Addressing32bit() throws IOException, URISyntaxException {
compileAndCompare("examples/mega65/32bit-addressing-mega65.c");

View File

@ -111,6 +111,7 @@
"args": [
"-vasmout",
"-Sc",
"-Si",
"-odir",
"~/c64/tmp/",
"-e",

Binary file not shown.

View File

@ -0,0 +1,99 @@
// SID music located in another bank being played in a raster IRQ using memory mapping on the MEGA65
// Music is Cybernoid II by Jeroen Tel released in 1988 by Hewson https://csdb.dk/sid/?id=28140
// SID relocated using http://www.linusakesson.net/software/sidreloc/index.php
#pragma target(mega65)
#pragma link("mega65_banked.ld")
#include <mega65.h>
void main() {
// Stop IRQ's
asm { sei }
// Map memory to BANK 0 : 0x00XXXX - giving access to I/O
memoryRemap(0,0,0);
// Enable MEGA65 features
VICIII->KEY = 0x47;
VICIII->KEY = 0x53;
// Enable 48MHz fast mode
VICIV->CONTROLB |= 0x40;
VICIV->CONTROLC |= 0x40;
// no kernal or BASIC rom visible
*PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK;
*PROCPORT = PROCPORT_RAM_IO;
// open sideborder
VICIV->SIDBDRWD_LO = 1;
// Remap [$4000-$5fff] to point to [$10000-$11fff]
memoryRemapBlock(0x40, 0x100);
// Transfer banked code/data to upper memory ($10000)
for( char *src=upperCodeData, *dst=MUSIC; dst<MUSIC_END; )
*dst++ = *src++;
// Initialize SID memory is still remapped)
(*musicInit)();
// Reset memory mapping
memoryRemap(0,0,0);
// Set up raster interrupts C64 style
// Disable CIA 1 Timer IRQ
CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR;
// Set raster line to 0xff
VICII->RASTER = 0xff;
VICII->CONTROL1 &= 0x7f;
// Enable Raster Interrupt
VICII->IRQ_ENABLE = IRQ_RASTER;
// Set the IRQ routine
*HARDWARE_IRQ = &irq;
// Enable IRQ
asm { cli }
// Loop forever - while destroying and showing unmapped MUSIC memory to screen (to demonstrate that mapping works)
char mem_destroy_i = 0;
for(;;) {
// Overwrite unmapped MUSIC memory
MUSIC[mem_destroy_i++]++;
// Show unmapped MUSIC memory
for(char i=0;i<240;i++)
DEFAULT_SCREEN[i] = MUSIC[i];
}
}
// Raster IRQ routine
interrupt(hardware_stack) void irq() {
// Acknowledge the IRQ
VICII->IRQ_STATUS = IRQ_RASTER;
// Color border
(VICII->BORDER_COLOR)++;
// Remap memory to put music at $4000
memoryRemapBlock(0x40, 0x100);
// Play remapped SID
(*musicPlay)();
// Reset memory mapping
memoryRemap(0,0,0);
// Wait for the next raster line
char raster = VICII->RASTER;
while(VICII->RASTER==raster) ;
// Color border
(VICII->BORDER_COLOR)--;
}
// Array containing the banked upper memory code/data to be transferred to upper memory before execution
char upperCodeData[] = kickasm {{
.segmentout [segments="Banked"]
}};
// Code and data to be put into upper memory, which will be banked into $4000 by mempry mapping
#pragma code_seg(CodeBanked)
#pragma data_seg(DataBanked)
// SID tune at an absolute address
__address(0x4000) char MUSIC[] = kickasm(resource "Cybernoid_II_4000.sid") {{
.const music = LoadSid("Cybernoid_II_4000.sid")
.fill music.size, music.getData(i)
}};
// Address after the end of the music
char * const MUSIC_END = 0x5200;
// Pointer to the music init routine
void()* musicInit = (void()*) MUSIC;
// Pointer to the music play routine
void()* musicPlay = (void()*) MUSIC+3;

View File

@ -0,0 +1,31 @@
// MEGA65 DMA test
// Appendix J in https://mega.scryptos.com/sharefolder-link/MEGA/MEGA65+filehost/Docs/MEGA65-Book_draft.pdf
#pragma target(mega65)
#include <mega65.h>
void main() {
// Map memory to BANK 0 : 0x00XXXX - giving access to I/O
memoryRemap(0,0,0);
// Enable enable F018B mode
DMA->EN018B = 1;
// Set address of DMA list
DMA->ADDRMB = 0;
DMA->ADDRBANK = 0;
DMA-> ADDRMSB = >&DMA_SCREEN_UP;
// Trigger the DMA (without option lists)
DMA-> ADDRLSBTRIG = <&DMA_SCREEN_UP;
// Re-enable F018A mode
DMA->EN018B = 0;
}
// DMA list entry that scrolls the default screen up
struct DMA_LIST_F018B DMA_SCREEN_UP = {
DMA_COMMAND_COPY, // command
24*80, // count
DEFAULT_SCREEN+80, // source
0, // source bank
DEFAULT_SCREEN, // destination
0, // destination bank
0, // sub-command
0 // modulo-value
};

View File

@ -0,0 +1,14 @@
// MEGA65 platform PRG executable with banked code and data starting in MEGA65 mode.
.file [name="%O", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$2001]
.segmentdef Code [start=$2017]
.segmentdef Data [startAfter="Code"]
.segmentdef Banked [segments="CodeBanked, DataBanked"]
.segmentdef CodeBanked [start=$4000]
.segmentdef DataBanked [startAfter="CodeBanked"]
.segment Basic
.byte $0a, $20, $0a, $00, $fe, $02, $20, $30, $00 // 10 BANK 0
.byte $15, $20, $14, $00, $9e, $20 // 20 SYS
.text toIntString(%E) // NNNN
.byte $00, $00, $00 //

View File

@ -1,99 +1,51 @@
// Test the MAP instruction for remapping memory
// See section 2.3.4 in http://www.zimmers.net/cbmpics/cbm/c65/c65manual.txt for a description of the CPU memory remapper of the C65.
// See Appendix G in https://mega.scryptos.com/sharefolder-link/MEGA/MEGA65+filehost/Docs/MEGA65-Book_draft.pdf for a description of the CPU memory remapper of the MEGA65.
#pragma target(mega65)
#pragma emulator("/Users/jespergravgaard/c64/mega65/xemu-hernandp/build/bin/xmega65.native -prg")
#include <mega65.h>
void main() {
/*
// Remap block at $4000 to point to $10000
// offset = $10000-$4000 = $c000
asm {
lda #$c0 // lower blocks offset page
ldx #$40 // lower blocks to map + lower blocks offset
ldy #0
ldz #0
map
eom
}
// Put data into $4000
asm {
lda #$55
sta $4000
}
*/
char * BLOCK_4000 = 0x4000;
char * BLOCK_8000 = 0x8000;
// Remap [$4000-$5fff] to point to [$10000-$11fff]
memoryRemapBlock(0x40, 0x100);
// Put '-', '*' into $10000
BLOCK_4000[0] = '-';
BLOCK_4000[1] = '*';
char * block1 = 0x4000;
char * block2 = 0x8000;
memoryBlockRemap((unsigned char)>block1, 0x100);
memoryBlockRemap((unsigned char)>block2, 0x120);
// Remap [$8000-$9fff] to point to [$10000-$11fff]
memoryRemapBlock(0x80, 0x100);
// Put '-', '*' into $10002
BLOCK_8000[2] = '-';
BLOCK_8000[3] = '*';
// TODO: The mapper can only map the lower 32K to one memory address and the upper 32K to another
// TODO: The mapper always remaps both - so it cannot be separated into two different calls (without some memory)!
block1[0] = 0x55;
block1[1] = 0xaa;
block2[0] = 0x55;
block2[1] = 0xaa;
//block2[1] = 0xaa;
//block2[2] = block1[1];
// Remap [$4000-$5fff] and [$8000-$9fff] to both point to [$10000-$11fff] (notice usage of page offsets)
memoryRemap(MEMORYBLOCK_4000|MEMORYBLOCK_8000, 0x0c0, 0x080);
// Put '-', '*' into $10004 in a convoluted way
BLOCK_8000[4] = BLOCK_4000[2];
BLOCK_4000[5] = BLOCK_8000[1];
// copy the resulting values onto the screen
for(char i=0;i<6;i++)
(DEFAULT_SCREEN+80-6)[i] = BLOCK_4000[i];
// Remap [$4000-$5fff] to both point to [$ff80000-$ff81fff] COLORAM! (notice usage of page offsets)
memoryRemap256M(MEMORYBLOCK_4000, 0xff800-0x00040, 0);
// Put colors in the upper screen line
for( char i=0; i<16; i++)
BLOCK_4000[i] = 0x40+i;
// Remap [$4000-$5fff] back to normal memory!
memoryRemap256M(0, 0, 0);
}
// Remap one of the eight 8K memory blocks in the 64K address space of the 6502 to point somewhere else in the first 1MB memory space of the MEGA65.
// After the remapping the CPU will access the mapped memory whenever it uses instructions that access the mapped block.
// blockPage: Page address of the 8K memory block to remap (ie. the block that is remapped is $100 * the passed page address.)
// Legal block page addresses are: $00: block $0000-$1fff, $20: block $2000-$3fff, ..., $e0: block $e000-$ffff
// memoryPage: Page address of the memory that the block should point to in the 1MB memory space of the MEGA65.
// Ie. the memory that will be pointed to is $100 * the passed page address. Only the lower 12bits of the passed value is used.
void memoryBlockRemap(unsigned char blockPage, unsigned int memoryPage) {
// Which block is being remapped? (0-7)
char block = blockPage / $20;
// Find the page offset (the number of pages to offset the block)
unsigned int pageOffset = memoryPage-blockPage;
if(block&4) {
// High block (4-7)
char * yVal = 0xfe;
char * zVal = 0xff;
*yVal = <pageOffset;
*zVal = 1<<(block) | (>pageOffset & 0xf);
asm {
lda #0 // lower blocks offset page low
ldx #0 // lower blocks to map + lower blocks offset page high nibble
ldy yVal // upper blocks offset page
ldz zVal // upper blocks to map + upper blocks offset page high nibble
map
eom
}
} else {
// Low block (0-3)
char * aVal = 0xfe;
char * xVal = 0xff;
*aVal = <pageOffset;
*xVal = 1<<(4|block) | (>pageOffset & 0xf);
asm {
lda aVal // lower blocks offset page low
ldx xVal // lower blocks to map + lower blocks offset high nibble
ldy #0 // upper blocks offset page
ldz #0 // upper blocks to map + upper blocks offset page high nibble
map
eom
}
}
}
// Test corner case behaviors
// - Mapping two blocks to the same memory : [$4000-$5fff] >> [$10000-$12000], [$6000-$7fff] >> [$10000-$12000]
// Test more corner case behaviors
// - [DONE] Mapping two blocks to the same memory : [$4000-$5fff] >> [$10000-$12000], [$8000-$9fff] >> [$10000-$12000]
// - Mapping two blocks to overlapping memory : [$4000-$5fff] >> [$10000-$12000], [$6000-$7f00] >> [$11000-$12ff]
// - Mapping a block to the 1MB border : [$4000-$5fff] >> [$ff000-$100fff] or [$ff000-$00fff] ?
// - Mapping a block over zeropage : [$0000-$1fff] >> [$10000-$12000]. Does zp-addressing-mode access the mapped memory?
// Add memory block remapping to the full 256MB memory

View File

@ -1,4 +1,4 @@
// Hello World for MEGA 65 - putting chars directly to the screen
// Test a few VIC 3/4 features
#pragma target(mega65)
#include <mega65.h>
@ -35,22 +35,8 @@ void main() {
for( char *col = COLORS; col<COLORS+2000; col++)
*col = <col;
/*
// Set Border-color
VICII->BORDER_COLOR = 0xff;
VICII->BG_COLOR = 0x0b;
for(;;) {
while(VICII->RASTER!=0xfe) ;
while(VICII->RASTER!=0xff) ;
(*TBDRPOS)++;
}
*/
// Loop forever
//for(;;) {
// VICII->BORDER_COLOR = VICII->RASTER;
//}
// Loop forever
for(;;)
VICII->BORDER_COLOR = VICII->RASTER;
}

View File

@ -0,0 +1,349 @@
// SID music located in another bank being played in a raster IRQ using memory mapping on the MEGA65
// Music is Cybernoid II by Jeroen Tel released in 1988 by Hewson https://csdb.dk/sid/?id=28140
// SID relocated using http://www.linusakesson.net/software/sidreloc/index.php
.cpu _45gs02
// MEGA65 platform PRG executable with banked code and data starting in MEGA65 mode.
.file [name="banked-music.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$2001]
.segmentdef Code [start=$2017]
.segmentdef Data [startAfter="Code"]
.segmentdef Banked [segments="CodeBanked, DataBanked"]
.segmentdef CodeBanked [start=$4000]
.segmentdef DataBanked [startAfter="CodeBanked"]
.segment Basic
.byte $0a, $20, $0a, $00, $fe, $02, $20, $30, $00 // 10 BANK 0
.byte $15, $20, $14, $00, $9e, $20 // 20 SYS
.text toIntString(main) // NNNN
.byte $00, $00, $00 //
// Value that disables all CIA interrupts when stored to the CIA Interrupt registers
.const CIA_INTERRUPT_CLEAR = $7f
// Bits for the VICII IRQ Status/Enable Registers
.const IRQ_RASTER = 1
// Mask for PROCESSOR_PORT_DDR which allows only memory configuration to be written
.const PROCPORT_DDR_MEMORY_MASK = 7
// RAM in 0xA000, 0xE000 I/O in 0xD000
.const PROCPORT_RAM_IO = 5
.const OFFSET_STRUCT_MOS4569_VICIII_KEY = $2f
.const OFFSET_STRUCT_MEGA65_VICIV_CONTROLB = $31
.const OFFSET_STRUCT_MEGA65_VICIV_CONTROLC = $54
.const OFFSET_STRUCT_MEGA65_VICIV_SIDBDRWD_LO = $5c
.const OFFSET_STRUCT_MOS6526_CIA_INTERRUPT = $d
.const OFFSET_STRUCT_MOS6569_VICII_RASTER = $12
.const OFFSET_STRUCT_MOS6569_VICII_CONTROL1 = $11
.const OFFSET_STRUCT_MOS6569_VICII_IRQ_ENABLE = $1a
.const OFFSET_STRUCT_MOS6569_VICII_IRQ_STATUS = $19
.const OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR = $20
// Processor port data direction register
.label PROCPORT_DDR = 0
// Processor Port Register controlling RAM/ROM configuration and the datasette
.label PROCPORT = 1
// The VIC-II MOS 6567/6569
.label VICII = $d000
// The VIC III MOS 4567/4569
.label VICIII = $d000
// The VIC IV
.label VICIV = $d000
// Default address of screen character matrix
.label DEFAULT_SCREEN = $800
// The CIA#1: keyboard matrix, joystick #1/#2
.label CIA1 = $dc00
// The vector used when the HARDWARE serves IRQ interrupts
.label HARDWARE_IRQ = $fffe
// Address after the end of the music
.label MUSIC_END = $5200
// Pointer to the music init routine
.label musicInit = MUSIC
// Pointer to the music play routine
.label musicPlay = MUSIC+3
.segment Code
// Raster IRQ routine
irq: {
pha
txa
pha
tya
pha
// VICII->IRQ_STATUS = IRQ_RASTER
// Acknowledge the IRQ
lda #IRQ_RASTER
sta VICII+OFFSET_STRUCT_MOS6569_VICII_IRQ_STATUS
// (VICII->BORDER_COLOR)++;
inc VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR
// memoryRemapBlock(0x40, 0x100)
// Remap memory to put music at $4000
jsr memoryRemapBlock
// (*musicPlay)()
// Play remapped SID
jsr musicPlay
// memoryRemap(0,0,0)
// Reset memory mapping
lda #<0
sta.z memoryRemap.upperPageOffset
sta.z memoryRemap.upperPageOffset+1
ldz #0
sta.z memoryRemap.lowerPageOffset
sta.z memoryRemap.lowerPageOffset+1
jsr memoryRemap
// raster = VICII->RASTER
// Wait for the next raster line
lda VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER
__b1:
// while(VICII->RASTER==raster)
cmp VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER
beq __b1
// (VICII->BORDER_COLOR)--;
dec VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR
// }
pla
tay
pla
tax
pla
rti
}
main: {
.label dst = 2
.label src = 4
// asm
// Stop IRQ's
sei
// memoryRemap(0,0,0)
// Map memory to BANK 0 : 0x00XXXX - giving access to I/O
lda #<0
sta.z memoryRemap.upperPageOffset
sta.z memoryRemap.upperPageOffset+1
ldz #0
sta.z memoryRemap.lowerPageOffset
sta.z memoryRemap.lowerPageOffset+1
jsr memoryRemap
// VICIII->KEY = 0x47
// Enable MEGA65 features
lda #$47
sta VICIII+OFFSET_STRUCT_MOS4569_VICIII_KEY
// VICIII->KEY = 0x53
lda #$53
sta VICIII+OFFSET_STRUCT_MOS4569_VICIII_KEY
// VICIV->CONTROLB |= 0x40
// Enable 48MHz fast mode
lda #$40
ora VICIV+OFFSET_STRUCT_MEGA65_VICIV_CONTROLB
sta VICIV+OFFSET_STRUCT_MEGA65_VICIV_CONTROLB
// VICIV->CONTROLC |= 0x40
lda #$40
ora VICIV+OFFSET_STRUCT_MEGA65_VICIV_CONTROLC
sta VICIV+OFFSET_STRUCT_MEGA65_VICIV_CONTROLC
// *PROCPORT_DDR = PROCPORT_DDR_MEMORY_MASK
// no kernal or BASIC rom visible
lda #PROCPORT_DDR_MEMORY_MASK
sta PROCPORT_DDR
// *PROCPORT = PROCPORT_RAM_IO
lda #PROCPORT_RAM_IO
sta PROCPORT
// VICIV->SIDBDRWD_LO = 1
// open sideborder
lda #1
sta VICIV+OFFSET_STRUCT_MEGA65_VICIV_SIDBDRWD_LO
// memoryRemapBlock(0x40, 0x100)
// Remap [$4000-$5fff] to point to [$10000-$11fff]
jsr memoryRemapBlock
lda #<upperCodeData
sta.z src
lda #>upperCodeData
sta.z src+1
lda #<MUSIC
sta.z dst
lda #>MUSIC
sta.z dst+1
// Transfer banked code/data to upper memory ($10000)
__b1:
// for( char *src=upperCodeData, *dst=MUSIC; dst<MUSIC_END; )
lda.z dst+1
cmp #>MUSIC_END
bcc __b2
bne !+
lda.z dst
cmp #<MUSIC_END
bcc __b2
!:
// (*musicInit)()
// Initialize SID memory is still remapped)
jsr musicInit
// memoryRemap(0,0,0)
// Reset memory mapping
lda #<0
sta.z memoryRemap.upperPageOffset
sta.z memoryRemap.upperPageOffset+1
ldz #0
sta.z memoryRemap.lowerPageOffset
sta.z memoryRemap.lowerPageOffset+1
jsr memoryRemap
// CIA1->INTERRUPT = CIA_INTERRUPT_CLEAR
// Set up raster interrupts C64 style
// Disable CIA 1 Timer IRQ
lda #CIA_INTERRUPT_CLEAR
sta CIA1+OFFSET_STRUCT_MOS6526_CIA_INTERRUPT
// VICII->RASTER = 0xff
// Set raster line to 0xff
lda #$ff
sta VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER
// VICII->CONTROL1 &= 0x7f
lda #$7f
and VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1
sta VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL1
// VICII->IRQ_ENABLE = IRQ_RASTER
// Enable Raster Interrupt
lda #IRQ_RASTER
sta VICII+OFFSET_STRUCT_MOS6569_VICII_IRQ_ENABLE
// *HARDWARE_IRQ = &irq
// Set the IRQ routine
lda #<irq
sta HARDWARE_IRQ
lda #>irq
sta HARDWARE_IRQ+1
// asm
// Enable IRQ
cli
ldx #0
__b4:
// MUSIC[mem_destroy_i++]++;
inc MUSIC,x
inx
ldy #0
// Show unmapped MUSIC memory
__b5:
// for(char i=0;i<240;i++)
cpy #$f0
bcc __b6
jmp __b4
__b6:
// DEFAULT_SCREEN[i] = MUSIC[i]
lda MUSIC,y
sta DEFAULT_SCREEN,y
// for(char i=0;i<240;i++)
iny
jmp __b5
__b2:
// *dst++ = *src++
ldy #0
lda (src),y
sta (dst),y
// *dst++ = *src++;
inw.z dst
inw.z src
jmp __b1
}
// Remap a single 8K memory block in the 64K address space of the 6502 to point somewhere else in the first 1MB memory space of the MEGA65.
// All the other 8K memory blocks will not be mapped and will point to their own address in the lowest 64K of the MEGA65 memory.
// blockPage: Page address of the 8K memory block to remap (ie. the block that is remapped is $100 * the passed page address.)
// memoryPage: Page address of the memory that the block should point to in the 1MB memory space of the MEGA65.
// Ie. the memory that will be pointed to is $100 * the passed page address. Only the lower 12bits of the passed value is used.
memoryRemapBlock: {
.const pageOffset = $100-$40
.const block = $40>>5
.const blockBits = 1<<block
// memoryRemap(blockBits, pageOffset, pageOffset)
lda #<pageOffset
sta.z memoryRemap.upperPageOffset
lda #>pageOffset
sta.z memoryRemap.upperPageOffset+1
ldz #blockBits
lda #<pageOffset
sta.z memoryRemap.lowerPageOffset
lda #>pageOffset
sta.z memoryRemap.lowerPageOffset+1
jsr memoryRemap
// }
rts
}
// Remap some of the eight 8K memory blocks in the 64K address space of the 6502 to point somewhere else in the first 1MB memory space of the MEGA65.
// After the remapping the CPU will access the mapped memory whenever it uses instructions that access a remapped block.
// See section 2.3.4 in http://www.zimmers.net/cbmpics/cbm/c65/c65manual.txt for a description of the CPU memory remapper of the C65.
// remapBlocks: Indicates which 8K blocks of the 6502 address space to remap. Each bit represents one 8K block
// - bit 0 Memory block $0000-$1fff. Use constant MEMORYBLOCK_0000.
// - bit 1 Memory block $2000-$3fff. Use constant MEMORYBLOCK_2000.
// - bit 2 Memory block $4000-$5fff. Use constant MEMORYBLOCK_4000.
// - bit 3 Memory block $6000-$7fff. Use constant MEMORYBLOCK_6000.
// - bit 4 Memory block $8000-$9fff. Use constant MEMORYBLOCK_8000.
// - bit 5 Memory block $a000-$bfff. Use constant MEMORYBLOCK_A000.
// - bit 6 Memory block $c000-$dfff. Use constant MEMORYBLOCK_C000.
// - bit 7 Memory block $e000-$ffff. Use constant MEMORYBLOCK_E000.
// lowerPageOffset: Offset that will be added to any remapped blocks in the lower 32K of memory (block 0-3).
// The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 12bits of the passed value is used.
// - If block 0 ($0000-$1fff) is remapped it will point to lowerPageOffset*$100.
// - If block 1 ($2000-$3fff) is remapped it will point to lowerPageOffset*$100 + $2000.
// - If block 2 ($4000-$5fff) is remapped it will point to lowerPageOffset*$100 + $4000.
// - If block 3 ($6000-$7fff) is remapped it will point to lowerPageOffset*$100 + $6000.
// upperPageOffset: Offset that will be added to any remapped blocks in the upper 32K of memory (block 4-7).
// The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 12bits of the passed value is used.
// - If block 4 ($8000-$9fff) is remapped it will point to upperPageOffset*$100 + $8000
// - If block 5 ($a000-$bfff) is remapped it will point to upperPageOffset*$100 + $a000.
// - If block 6 ($c000-$dfff) is remapped it will point to upperPageOffset*$100 + $c000.
// - If block 7 ($e000-$ffff) is remapped it will point to upperPageOffset*$100 + $e000.
// memoryRemap(byte register(Z) remapBlocks, word zp(6) lowerPageOffset, word zp(8) upperPageOffset)
memoryRemap: {
.label aVal = $fc
.label xVal = $fd
.label yVal = $fe
.label zVal = $ff
.label __1 = $a
.label __6 = $b
.label lowerPageOffset = 6
.label upperPageOffset = 8
// <lowerPageOffset
lda.z lowerPageOffset
// *aVal = <lowerPageOffset
sta aVal
// remapBlocks << 4
tza
asl
asl
asl
asl
sta.z __1
// >lowerPageOffset
lda.z lowerPageOffset+1
// >lowerPageOffset & 0xf
and #$f
// (remapBlocks << 4) | (>lowerPageOffset & 0xf)
ora.z __1
// *xVal = (remapBlocks << 4) | (>lowerPageOffset & 0xf)
sta xVal
// <upperPageOffset
lda.z upperPageOffset
// *yVal = <upperPageOffset
sta yVal
// remapBlocks & 0xf0
tza
and #$f0
sta.z __6
// >upperPageOffset
lda.z upperPageOffset+1
// >upperPageOffset & 0xf
and #$f
// (remapBlocks & 0xf0) | (>upperPageOffset & 0xf)
ora.z __6
// *zVal = (remapBlocks & 0xf0) | (>upperPageOffset & 0xf)
sta zVal
// asm
lda aVal
ldx xVal
ldy yVal
ldz zVal
map
eom
// }
rts
}
.segment Data
// Array containing the banked upper memory code/data to be transferred to upper memory before execution
upperCodeData:
.segmentout [segments="Banked"]
.segment DataBanked
.pc = $4000 "MUSIC"
// SID tune at an absolute address
MUSIC:
.const music = LoadSid("Cybernoid_II_4000.sid")
.fill music.size, music.getData(i)

View File

@ -0,0 +1,108 @@
interrupt(HARDWARE_STACK)(void()) irq()
irq: scope:[irq] from
[0] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_IRQ_STATUS) ← (const nomodify byte) IRQ_RASTER
[1] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) ← ++ *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR)
[2] call memoryRemapBlock
to:irq::@3
irq::@3: scope:[irq] from irq
[3] call *((const void()*) musicPlay)
[4] call memoryRemap
to:irq::@4
irq::@4: scope:[irq] from irq::@3
[5] (byte) irq::raster#0 ← *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_RASTER)
to:irq::@1
irq::@1: scope:[irq] from irq::@1 irq::@4
[6] if(*((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_RASTER)==(byte) irq::raster#0) goto irq::@1
to:irq::@2
irq::@2: scope:[irq] from irq::@1
[7] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) ← -- *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR)
to:irq::@return
irq::@return: scope:[irq] from irq::@2
[8] return
to:@return
(void()) main()
main: scope:[main] from
asm { sei }
[10] call memoryRemap
to:main::@7
main::@7: scope:[main] from main
[11] *((byte*)(const nomodify struct MOS4569_VICIII*) VICIII+(const byte) OFFSET_STRUCT_MOS4569_VICIII_KEY) ← (byte) $47
[12] *((byte*)(const nomodify struct MOS4569_VICIII*) VICIII+(const byte) OFFSET_STRUCT_MOS4569_VICIII_KEY) ← (byte) $53
[13] *((byte*)(const nomodify struct MEGA65_VICIV*) VICIV+(const byte) OFFSET_STRUCT_MEGA65_VICIV_CONTROLB) ← *((byte*)(const nomodify struct MEGA65_VICIV*) VICIV+(const byte) OFFSET_STRUCT_MEGA65_VICIV_CONTROLB) | (byte) $40
[14] *((byte*)(const nomodify struct MEGA65_VICIV*) VICIV+(const byte) OFFSET_STRUCT_MEGA65_VICIV_CONTROLC) ← *((byte*)(const nomodify struct MEGA65_VICIV*) VICIV+(const byte) OFFSET_STRUCT_MEGA65_VICIV_CONTROLC) | (byte) $40
[15] *((const nomodify byte*) PROCPORT_DDR) ← (const nomodify byte) PROCPORT_DDR_MEMORY_MASK
[16] *((const nomodify byte*) PROCPORT) ← (const nomodify byte) PROCPORT_RAM_IO
[17] *((byte*)(const nomodify struct MEGA65_VICIV*) VICIV+(const byte) OFFSET_STRUCT_MEGA65_VICIV_SIDBDRWD_LO) ← (byte) 1
[18] call memoryRemapBlock
to:main::@1
main::@1: scope:[main] from main::@2 main::@7
[19] (byte*) main::src#2 ← phi( main::@2/(byte*) main::src#1 main::@7/(const byte*) upperCodeData )
[19] (byte*) main::dst#2 ← phi( main::@2/(byte*) main::dst#1 main::@7/(const byte*) MUSIC )
[20] if((byte*) main::dst#2<(const nomodify byte*) MUSIC_END) goto main::@2
to:main::@3
main::@3: scope:[main] from main::@1
[21] call *((const void()*) musicInit)
[22] call memoryRemap
to:main::@8
main::@8: scope:[main] from main::@3
[23] *((byte*)(const nomodify struct MOS6526_CIA*) CIA1+(const byte) OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) ← (const nomodify byte) CIA_INTERRUPT_CLEAR
[24] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_RASTER) ← (byte) $ff
[25] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_CONTROL1) ← *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_CONTROL1) & (byte) $7f
[26] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_IRQ_ENABLE) ← (const nomodify byte) IRQ_RASTER
[27] *((const nomodify void()**) HARDWARE_IRQ) ← &interrupt(HARDWARE_STACK)(void()) irq()
asm { cli }
to:main::@4
main::@4: scope:[main] from main::@5 main::@8
[29] (byte) main::mem_destroy_i#2 ← phi( main::@5/(byte) main::mem_destroy_i#1 main::@8/(byte) 0 )
[30] *((const byte*) MUSIC + (byte) main::mem_destroy_i#2) ← ++ *((const byte*) MUSIC + (byte) main::mem_destroy_i#2)
[31] (byte) main::mem_destroy_i#1 ← ++ (byte) main::mem_destroy_i#2
to:main::@5
main::@5: scope:[main] from main::@4 main::@6
[32] (byte) main::i#2 ← phi( main::@4/(byte) 0 main::@6/(byte) main::i#1 )
[33] if((byte) main::i#2<(byte) $f0) goto main::@6
to:main::@4
main::@6: scope:[main] from main::@5
[34] *((const nomodify byte*) DEFAULT_SCREEN + (byte) main::i#2) ← *((const byte*) MUSIC + (byte) main::i#2)
[35] (byte) main::i#1 ← ++ (byte) main::i#2
to:main::@5
main::@2: scope:[main] from main::@1
[36] *((byte*) main::dst#2) ← *((byte*) main::src#2)
[37] (byte*) main::dst#1 ← ++ (byte*) main::dst#2
[38] (byte*) main::src#1 ← ++ (byte*) main::src#2
to:main::@1
(void()) memoryRemapBlock((byte) memoryRemapBlock::blockPage , (word) memoryRemapBlock::memoryPage)
memoryRemapBlock: scope:[memoryRemapBlock] from irq main::@7
[39] phi()
[40] call memoryRemap
to:memoryRemapBlock::@return
memoryRemapBlock::@return: scope:[memoryRemapBlock] from memoryRemapBlock
[41] return
to:@return
(void()) memoryRemap((byte) memoryRemap::remapBlocks , (word) memoryRemap::lowerPageOffset , (word) memoryRemap::upperPageOffset)
memoryRemap: scope:[memoryRemap] from irq::@3 main main::@3 memoryRemapBlock
[42] (word) memoryRemap::upperPageOffset#4 ← phi( irq::@3/(byte) 0 main/(byte) 0 main::@3/(byte) 0 memoryRemapBlock/(const word) memoryRemapBlock::pageOffset#0 )
[42] (byte) memoryRemap::remapBlocks#4 ← phi( irq::@3/(byte) 0 main/(byte) 0 main::@3/(byte) 0 memoryRemapBlock/(const byte) memoryRemapBlock::blockBits#0 )
[42] (word) memoryRemap::lowerPageOffset#4 ← phi( irq::@3/(byte) 0 main/(byte) 0 main::@3/(byte) 0 memoryRemapBlock/(const word) memoryRemapBlock::pageOffset#0 )
[43] (byte~) memoryRemap::$0 ← < (word) memoryRemap::lowerPageOffset#4
[44] *((const byte*) memoryRemap::aVal) ← (byte~) memoryRemap::$0
[45] (byte~) memoryRemap::$1 ← (byte) memoryRemap::remapBlocks#4 << (byte) 4
[46] (byte~) memoryRemap::$2 ← > (word) memoryRemap::lowerPageOffset#4
[47] (byte~) memoryRemap::$3 ← (byte~) memoryRemap::$2 & (byte) $f
[48] (byte~) memoryRemap::$4 ← (byte~) memoryRemap::$1 | (byte~) memoryRemap::$3
[49] *((const byte*) memoryRemap::xVal) ← (byte~) memoryRemap::$4
[50] (byte~) memoryRemap::$5 ← < (word) memoryRemap::upperPageOffset#4
[51] *((const byte*) memoryRemap::yVal) ← (byte~) memoryRemap::$5
[52] (byte~) memoryRemap::$6 ← (byte) memoryRemap::remapBlocks#4 & (byte) $f0
[53] (byte~) memoryRemap::$7 ← > (word) memoryRemap::upperPageOffset#4
[54] (byte~) memoryRemap::$8 ← (byte~) memoryRemap::$7 & (byte) $f
[55] (byte~) memoryRemap::$9 ← (byte~) memoryRemap::$6 | (byte~) memoryRemap::$8
[56] *((const byte*) memoryRemap::zVal) ← (byte~) memoryRemap::$9
asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
to:memoryRemap::@return
memoryRemap::@return: scope:[memoryRemap] from memoryRemap
[58] return
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,419 @@
(const nomodify struct MOS6526_CIA*) CIA1 = (struct MOS6526_CIA*) 56320
(const nomodify byte) CIA_INTERRUPT_CLEAR = (byte) $7f
(const nomodify byte*) DEFAULT_SCREEN = (byte*) 2048
(byte) DMA_LIST_F018A::command
(word) DMA_LIST_F018A::count
(byte*) DMA_LIST_F018A::dest
(byte) DMA_LIST_F018A::dest_bank
(word) DMA_LIST_F018A::modulo
(byte*) DMA_LIST_F018A::src
(byte) DMA_LIST_F018A::src_bank
(byte) DMA_LIST_F018B::command
(word) DMA_LIST_F018B::count
(byte*) DMA_LIST_F018B::dest
(byte) DMA_LIST_F018B::dest_bank
(word) DMA_LIST_F018B::modulo
(byte*) DMA_LIST_F018B::src
(byte) DMA_LIST_F018B::src_bank
(byte) DMA_LIST_F018B::sub_command
(byte) F018_DMAGIC::ADDRBANK
(byte) F018_DMAGIC::ADDRLSB
(byte) F018_DMAGIC::ADDRLSBTRIG
(byte) F018_DMAGIC::ADDRMB
(byte) F018_DMAGIC::ADDRMSB
(byte) F018_DMAGIC::EN018B
(byte) F018_DMAGIC::ETRIG
(byte) F018_DMAGIC::MISC
(const byte*) F018_DMAGIC::UNUSED1[(number) 8] = { fill( 8, 0) }
(byte) F018_DMAGIC::UNUSED2
(const nomodify void()**) HARDWARE_IRQ = (void()**) 65534
(const nomodify byte) IRQ_RASTER = (byte) 1
(byte) MEGA65_VICIV::ALPHADELAY
(byte) MEGA65_VICIV::B0PIX
(byte) MEGA65_VICIV::B0_ADDR
(byte) MEGA65_VICIV::B1PIX
(byte) MEGA65_VICIV::B1_ADDR
(byte) MEGA65_VICIV::B2PIX
(byte) MEGA65_VICIV::B2_ADDR
(byte) MEGA65_VICIV::B3PIX
(byte) MEGA65_VICIV::B3_ADDR
(byte) MEGA65_VICIV::B4PIX
(byte) MEGA65_VICIV::B4_ADDR
(byte) MEGA65_VICIV::B5PIX
(byte) MEGA65_VICIV::B5_ADDR
(byte) MEGA65_VICIV::B6PIX
(byte) MEGA65_VICIV::B6_ADDR
(byte) MEGA65_VICIV::B7PIX
(byte) MEGA65_VICIV::B7_ADDR
(byte) MEGA65_VICIV::BBDRPOS_HI
(byte) MEGA65_VICIV::BBDRPOS_LO
(byte) MEGA65_VICIV::BG_COLOR
(byte) MEGA65_VICIV::BG_COLOR1
(byte) MEGA65_VICIV::BG_COLOR2
(byte) MEGA65_VICIV::BG_COLOR3
(byte) MEGA65_VICIV::BORDER_COLOR
(byte) MEGA65_VICIV::BP16ENS
(byte) MEGA65_VICIV::BPCOMP
(byte) MEGA65_VICIV::BPX
(byte) MEGA65_VICIV::BPY
(byte) MEGA65_VICIV::CHARPTR_HILO
(byte) MEGA65_VICIV::CHARPTR_LOHI
(byte) MEGA65_VICIV::CHARPTR_LOLO
(byte) MEGA65_VICIV::CHARSTEP_HI
(byte) MEGA65_VICIV::CHARSTEP_LO
(byte) MEGA65_VICIV::CHRCOUNT
(byte) MEGA65_VICIV::CHRXSCL
(byte) MEGA65_VICIV::CHRYSCL
(byte) MEGA65_VICIV::COLPTR_HI
(byte) MEGA65_VICIV::COLPTR_LO
(byte) MEGA65_VICIV::CONTROL1
(byte) MEGA65_VICIV::CONTROL2
(byte) MEGA65_VICIV::CONTROLA
(byte) MEGA65_VICIV::CONTROLB
(byte) MEGA65_VICIV::CONTROLC
(byte) MEGA65_VICIV::DEBUG1
(byte) MEGA65_VICIV::DEBUGX
(byte) MEGA65_VICIV::DEBUGXY
(byte) MEGA65_VICIV::DEBUGY
(byte) MEGA65_VICIV::FNRASTER_HI
(byte) MEGA65_VICIV::FNRASTER_LO
(byte) MEGA65_VICIV::HPOS
(byte) MEGA65_VICIV::IRQ_ENABLE
(byte) MEGA65_VICIV::IRQ_STATUS
(byte) MEGA65_VICIV::KEY
(byte) MEGA65_VICIV::LIGHTPEN_X
(byte) MEGA65_VICIV::LIGHTPEN_Y
(byte) MEGA65_VICIV::MEMORY
(byte) MEGA65_VICIV::PALSEL
(byte) MEGA65_VICIV::RASLINE0
(byte) MEGA65_VICIV::RASTER
(byte) MEGA65_VICIV::ROWCOUNT
(byte) MEGA65_VICIV::RSTCMP
(byte) MEGA65_VICIV::RSTCOMP
(byte) MEGA65_VICIV::SBPDEBUG
(byte) MEGA65_VICIV::SCRNPTR_HIHI
(byte) MEGA65_VICIV::SCRNPTR_HILO
(byte) MEGA65_VICIV::SCRNPTR_LOHI
(byte) MEGA65_VICIV::SCRNPTR_LOLO
(byte) MEGA65_VICIV::SIDBDRWD_HI
(byte) MEGA65_VICIV::SIDBDRWD_LO
(byte) MEGA65_VICIV::SPR16EN
(byte) MEGA65_VICIV::SPRALPHAVAL
(byte) MEGA65_VICIV::SPRENALPHA
(byte) MEGA65_VICIV::SPRENV400
(byte) MEGA65_VICIV::SPRHGHT
(byte) MEGA65_VICIV::SPRHGTEN
(byte) MEGA65_VICIV::SPRITE0_COLOR
(byte) MEGA65_VICIV::SPRITE0_X
(byte) MEGA65_VICIV::SPRITE0_Y
(byte) MEGA65_VICIV::SPRITE1_COLOR
(byte) MEGA65_VICIV::SPRITE1_X
(byte) MEGA65_VICIV::SPRITE1_Y
(byte) MEGA65_VICIV::SPRITE2_COLOR
(byte) MEGA65_VICIV::SPRITE2_X
(byte) MEGA65_VICIV::SPRITE2_Y
(byte) MEGA65_VICIV::SPRITE3_COLOR
(byte) MEGA65_VICIV::SPRITE3_X
(byte) MEGA65_VICIV::SPRITE3_Y
(byte) MEGA65_VICIV::SPRITE4_COLOR
(byte) MEGA65_VICIV::SPRITE4_X
(byte) MEGA65_VICIV::SPRITE4_Y
(byte) MEGA65_VICIV::SPRITE5_COLOR
(byte) MEGA65_VICIV::SPRITE5_X
(byte) MEGA65_VICIV::SPRITE5_Y
(byte) MEGA65_VICIV::SPRITE6_COLOR
(byte) MEGA65_VICIV::SPRITE6_X
(byte) MEGA65_VICIV::SPRITE6_Y
(byte) MEGA65_VICIV::SPRITE7_COLOR
(byte) MEGA65_VICIV::SPRITE7_X
(byte) MEGA65_VICIV::SPRITE7_Y
(byte) MEGA65_VICIV::SPRITES_BG_COLLISION
(byte) MEGA65_VICIV::SPRITES_COLLISION
(byte) MEGA65_VICIV::SPRITES_ENABLE
(byte) MEGA65_VICIV::SPRITES_EXPAND_X
(byte) MEGA65_VICIV::SPRITES_EXPAND_Y
(byte) MEGA65_VICIV::SPRITES_MC
(byte) MEGA65_VICIV::SPRITES_MCOLOR1
(byte) MEGA65_VICIV::SPRITES_MCOLOR2
(byte) MEGA65_VICIV::SPRITES_PRIORITY
(byte) MEGA65_VICIV::SPRITES_XMSB
(byte) MEGA65_VICIV::SPRPTRADR_HILO
(byte) MEGA65_VICIV::SPRPTRADR_LOHI
(byte) MEGA65_VICIV::SPRPTRADR_LOLO
(byte) MEGA65_VICIV::SPRX64EN
(byte) MEGA65_VICIV::SPRXSMSBS
(byte) MEGA65_VICIV::SPRYSMSBSM
(byte) MEGA65_VICIV::SRPYMSBS
(byte) MEGA65_VICIV::SYNCPOL
(byte) MEGA65_VICIV::TBDRPOS_HI
(byte) MEGA65_VICIV::TBDRPOS_LO
(byte) MEGA65_VICIV::TEXTXPOS_HI
(byte) MEGA65_VICIV::TEXTXPOS_LO
(byte) MEGA65_VICIV::TEXTYPOS_HI
(byte) MEGA65_VICIV::TEXTYPOS_LO
(byte) MEGA65_VICIV::UNUSED
(byte) MEGA65_VICIV::VPOS
(byte) MEGA65_VICIV::VSYNDEL
(byte) MEGA65_VICIV::XPOS_HI
(byte) MEGA65_VICIV::XPOS_LO
(byte) MOS4569_VICIII::B0PIX
(byte) MOS4569_VICIII::B0_ADDR
(byte) MOS4569_VICIII::B1PIX
(byte) MOS4569_VICIII::B1_ADDR
(byte) MOS4569_VICIII::B2PIX
(byte) MOS4569_VICIII::B2_ADDR
(byte) MOS4569_VICIII::B3PIX
(byte) MOS4569_VICIII::B3_ADDR
(byte) MOS4569_VICIII::B4PIX
(byte) MOS4569_VICIII::B4_ADDR
(byte) MOS4569_VICIII::B5PIX
(byte) MOS4569_VICIII::B5_ADDR
(byte) MOS4569_VICIII::B6PIX
(byte) MOS4569_VICIII::B6_ADDR
(byte) MOS4569_VICIII::B7PIX
(byte) MOS4569_VICIII::B7_ADDR
(byte) MOS4569_VICIII::BG_COLOR
(byte) MOS4569_VICIII::BG_COLOR1
(byte) MOS4569_VICIII::BG_COLOR2
(byte) MOS4569_VICIII::BG_COLOR3
(byte) MOS4569_VICIII::BORDER_COLOR
(byte) MOS4569_VICIII::BPCOMP
(byte) MOS4569_VICIII::BPX
(byte) MOS4569_VICIII::BPY
(byte) MOS4569_VICIII::CONTROL1
(byte) MOS4569_VICIII::CONTROL2
(byte) MOS4569_VICIII::CONTROLA
(byte) MOS4569_VICIII::CONTROLB
(byte) MOS4569_VICIII::HPOS
(byte) MOS4569_VICIII::IRQ_ENABLE
(byte) MOS4569_VICIII::IRQ_STATUS
(byte) MOS4569_VICIII::KEY
(byte) MOS4569_VICIII::LIGHTPEN_X
(byte) MOS4569_VICIII::LIGHTPEN_Y
(byte) MOS4569_VICIII::MEMORY
(byte) MOS4569_VICIII::RASTER
(byte) MOS4569_VICIII::SPRITE0_COLOR
(byte) MOS4569_VICIII::SPRITE0_X
(byte) MOS4569_VICIII::SPRITE0_Y
(byte) MOS4569_VICIII::SPRITE1_COLOR
(byte) MOS4569_VICIII::SPRITE1_X
(byte) MOS4569_VICIII::SPRITE1_Y
(byte) MOS4569_VICIII::SPRITE2_COLOR
(byte) MOS4569_VICIII::SPRITE2_X
(byte) MOS4569_VICIII::SPRITE2_Y
(byte) MOS4569_VICIII::SPRITE3_COLOR
(byte) MOS4569_VICIII::SPRITE3_X
(byte) MOS4569_VICIII::SPRITE3_Y
(byte) MOS4569_VICIII::SPRITE4_COLOR
(byte) MOS4569_VICIII::SPRITE4_X
(byte) MOS4569_VICIII::SPRITE4_Y
(byte) MOS4569_VICIII::SPRITE5_COLOR
(byte) MOS4569_VICIII::SPRITE5_X
(byte) MOS4569_VICIII::SPRITE5_Y
(byte) MOS4569_VICIII::SPRITE6_COLOR
(byte) MOS4569_VICIII::SPRITE6_X
(byte) MOS4569_VICIII::SPRITE6_Y
(byte) MOS4569_VICIII::SPRITE7_COLOR
(byte) MOS4569_VICIII::SPRITE7_X
(byte) MOS4569_VICIII::SPRITE7_Y
(byte) MOS4569_VICIII::SPRITES_BG_COLLISION
(byte) MOS4569_VICIII::SPRITES_COLLISION
(byte) MOS4569_VICIII::SPRITES_ENABLE
(byte) MOS4569_VICIII::SPRITES_EXPAND_X
(byte) MOS4569_VICIII::SPRITES_EXPAND_Y
(byte) MOS4569_VICIII::SPRITES_MC
(byte) MOS4569_VICIII::SPRITES_MCOLOR1
(byte) MOS4569_VICIII::SPRITES_MCOLOR2
(byte) MOS4569_VICIII::SPRITES_PRIORITY
(byte) MOS4569_VICIII::SPRITES_XMSB
(byte) MOS4569_VICIII::UNUSED
(byte) MOS4569_VICIII::VPOS
(byte) MOS6526_CIA::INTERRUPT
(byte) MOS6526_CIA::PORT_A
(byte) MOS6526_CIA::PORT_A_DDR
(byte) MOS6526_CIA::PORT_B
(byte) MOS6526_CIA::PORT_B_DDR
(byte) MOS6526_CIA::SERIAL_DATA
(word) MOS6526_CIA::TIMER_A
(byte) MOS6526_CIA::TIMER_A_CONTROL
(word) MOS6526_CIA::TIMER_B
(byte) MOS6526_CIA::TIMER_B_CONTROL
(byte) MOS6526_CIA::TOD_10THS
(byte) MOS6526_CIA::TOD_HOURS
(byte) MOS6526_CIA::TOD_MIN
(byte) MOS6526_CIA::TOD_SEC
(byte) MOS6569_VICII::BG_COLOR
(byte) MOS6569_VICII::BG_COLOR1
(byte) MOS6569_VICII::BG_COLOR2
(byte) MOS6569_VICII::BG_COLOR3
(byte) MOS6569_VICII::BORDER_COLOR
(byte) MOS6569_VICII::CONTROL1
(byte) MOS6569_VICII::CONTROL2
(byte) MOS6569_VICII::IRQ_ENABLE
(byte) MOS6569_VICII::IRQ_STATUS
(byte) MOS6569_VICII::LIGHTPEN_X
(byte) MOS6569_VICII::LIGHTPEN_Y
(byte) MOS6569_VICII::MEMORY
(byte) MOS6569_VICII::RASTER
(byte) MOS6569_VICII::SPRITE0_COLOR
(byte) MOS6569_VICII::SPRITE0_X
(byte) MOS6569_VICII::SPRITE0_Y
(byte) MOS6569_VICII::SPRITE1_COLOR
(byte) MOS6569_VICII::SPRITE1_X
(byte) MOS6569_VICII::SPRITE1_Y
(byte) MOS6569_VICII::SPRITE2_COLOR
(byte) MOS6569_VICII::SPRITE2_X
(byte) MOS6569_VICII::SPRITE2_Y
(byte) MOS6569_VICII::SPRITE3_COLOR
(byte) MOS6569_VICII::SPRITE3_X
(byte) MOS6569_VICII::SPRITE3_Y
(byte) MOS6569_VICII::SPRITE4_COLOR
(byte) MOS6569_VICII::SPRITE4_X
(byte) MOS6569_VICII::SPRITE4_Y
(byte) MOS6569_VICII::SPRITE5_COLOR
(byte) MOS6569_VICII::SPRITE5_X
(byte) MOS6569_VICII::SPRITE5_Y
(byte) MOS6569_VICII::SPRITE6_COLOR
(byte) MOS6569_VICII::SPRITE6_X
(byte) MOS6569_VICII::SPRITE6_Y
(byte) MOS6569_VICII::SPRITE7_COLOR
(byte) MOS6569_VICII::SPRITE7_X
(byte) MOS6569_VICII::SPRITE7_Y
(byte) MOS6569_VICII::SPRITES_BG_COLLISION
(byte) MOS6569_VICII::SPRITES_COLLISION
(byte) MOS6569_VICII::SPRITES_ENABLE
(byte) MOS6569_VICII::SPRITES_EXPAND_X
(byte) MOS6569_VICII::SPRITES_EXPAND_Y
(byte) MOS6569_VICII::SPRITES_MC
(byte) MOS6569_VICII::SPRITES_MCOLOR1
(byte) MOS6569_VICII::SPRITES_MCOLOR2
(byte) MOS6569_VICII::SPRITES_PRIORITY
(byte) MOS6569_VICII::SPRITES_XMSB
(byte) MOS6581_SID::CH1_ATTACK_DECAY
(byte) MOS6581_SID::CH1_CONTROL
(word) MOS6581_SID::CH1_FREQ
(word) MOS6581_SID::CH1_PULSE_WIDTH
(byte) MOS6581_SID::CH1_SUSTAIN_RELEASE
(byte) MOS6581_SID::CH2_ATTACK_DECAY
(byte) MOS6581_SID::CH2_CONTROL
(word) MOS6581_SID::CH2_FREQ
(word) MOS6581_SID::CH2_PULSE_WIDTH
(byte) MOS6581_SID::CH2_SUSTAIN_RELEASE
(byte) MOS6581_SID::CH3_ATTACK_DECAY
(byte) MOS6581_SID::CH3_CONTROL
(byte) MOS6581_SID::CH3_ENV
(word) MOS6581_SID::CH3_FREQ
(byte) MOS6581_SID::CH3_OSC
(word) MOS6581_SID::CH3_PULSE_WIDTH
(byte) MOS6581_SID::CH3_SUSTAIN_RELEASE
(byte) MOS6581_SID::FILTER_CUTOFF_HIGH
(byte) MOS6581_SID::FILTER_CUTOFF_LOW
(byte) MOS6581_SID::FILTER_SETUP
(byte) MOS6581_SID::POT_X
(byte) MOS6581_SID::POT_Y
(byte) MOS6581_SID::VOLUME_FILTER_MODE
(const byte*) MUSIC[] = kickasm {{ .const music = LoadSid("Cybernoid_II_4000.sid")
.fill music.size, music.getData(i)
}}
(const nomodify byte*) MUSIC_END = (byte*) 20992
(const byte) OFFSET_STRUCT_MEGA65_VICIV_CONTROLB = (byte) $31
(const byte) OFFSET_STRUCT_MEGA65_VICIV_CONTROLC = (byte) $54
(const byte) OFFSET_STRUCT_MEGA65_VICIV_SIDBDRWD_LO = (byte) $5c
(const byte) OFFSET_STRUCT_MOS4569_VICIII_KEY = (byte) $2f
(const byte) OFFSET_STRUCT_MOS6526_CIA_INTERRUPT = (byte) $d
(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR = (byte) $20
(const byte) OFFSET_STRUCT_MOS6569_VICII_CONTROL1 = (byte) $11
(const byte) OFFSET_STRUCT_MOS6569_VICII_IRQ_ENABLE = (byte) $1a
(const byte) OFFSET_STRUCT_MOS6569_VICII_IRQ_STATUS = (byte) $19
(const byte) OFFSET_STRUCT_MOS6569_VICII_RASTER = (byte) $12
(const nomodify byte*) PROCPORT = (byte*) 1
(const nomodify byte*) PROCPORT_DDR = (byte*) 0
(const nomodify byte) PROCPORT_DDR_MEMORY_MASK = (byte) 7
(const nomodify byte) PROCPORT_RAM_IO = (byte) 5
(const nomodify struct MOS6569_VICII*) VICII = (struct MOS6569_VICII*) 53248
(const nomodify struct MOS4569_VICIII*) VICIII = (struct MOS4569_VICIII*) 53248
(const nomodify struct MEGA65_VICIV*) VICIV = (struct MEGA65_VICIV*) 53248
interrupt(HARDWARE_STACK)(void()) irq()
(label) irq::@1
(label) irq::@2
(label) irq::@3
(label) irq::@4
(label) irq::@return
(byte) irq::raster
(byte) irq::raster#0 reg byte a 6.5
(void()) main()
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@6
(label) main::@7
(label) main::@8
(byte*) main::dst
(byte*) main::dst#1 dst zp[2]:2 11.0
(byte*) main::dst#2 dst zp[2]:2 14.666666666666666
(byte) main::i
(byte) main::i#1 reg byte y 202.0
(byte) main::i#2 reg byte y 168.33333333333331
(byte) main::mem_destroy_i
(byte) main::mem_destroy_i#1 reg byte x 22.4
(byte) main::mem_destroy_i#2 reg byte x 67.0
(byte*) main::src
(byte*) main::src#1 src zp[2]:4 22.0
(byte*) main::src#2 src zp[2]:4 8.25
(void()) memoryRemap((byte) memoryRemap::remapBlocks , (word) memoryRemap::lowerPageOffset , (word) memoryRemap::upperPageOffset)
(byte~) memoryRemap::$0 reg byte a 202.0
(byte~) memoryRemap::$1 zp[1]:10 67.33333333333333
(byte~) memoryRemap::$2 reg byte a 202.0
(byte~) memoryRemap::$3 reg byte a 202.0
(byte~) memoryRemap::$4 reg byte a 202.0
(byte~) memoryRemap::$5 reg byte a 202.0
(byte~) memoryRemap::$6 zp[1]:11 67.33333333333333
(byte~) memoryRemap::$7 reg byte a 202.0
(byte~) memoryRemap::$8 reg byte a 202.0
(byte~) memoryRemap::$9 reg byte a 202.0
(label) memoryRemap::@return
(const byte*) memoryRemap::aVal = (byte*) 252
(word) memoryRemap::lowerPageOffset
(word) memoryRemap::lowerPageOffset#4 lowerPageOffset zp[2]:6 50.5
(byte) memoryRemap::remapBlocks
(byte) memoryRemap::remapBlocks#4 reg byte z 20.2
(word) memoryRemap::upperPageOffset
(word) memoryRemap::upperPageOffset#4 upperPageOffset zp[2]:8 18.363636363636363
(const byte*) memoryRemap::xVal = (byte*) 253
(const byte*) memoryRemap::yVal = (byte*) 254
(const byte*) memoryRemap::zVal = (byte*) 255
(void()) memoryRemapBlock((byte) memoryRemapBlock::blockPage , (word) memoryRemapBlock::memoryPage)
(label) memoryRemapBlock::@return
(byte) memoryRemapBlock::block
(const byte) memoryRemapBlock::block#0 block = (byte) $40>>(byte) 5
(byte) memoryRemapBlock::blockBits
(const byte) memoryRemapBlock::blockBits#0 blockBits = (byte) 1<<(const byte) memoryRemapBlock::block#0
(byte) memoryRemapBlock::blockPage
(word) memoryRemapBlock::memoryPage
(word) memoryRemapBlock::pageOffset
(const word) memoryRemapBlock::pageOffset#0 pageOffset = (word) $100-(byte) $40
(const void()*) musicInit = (void()*)(const byte*) MUSIC
(const void()*) musicPlay = (void()*)(const byte*) MUSIC+(byte) 3
(const byte*) upperCodeData[] = kickasm {{ .segmentout [segments="Banked"]
}}
zp[2]:2 [ main::dst#2 main::dst#1 ]
zp[2]:4 [ main::src#2 main::src#1 ]
reg byte x [ main::mem_destroy_i#2 main::mem_destroy_i#1 ]
reg byte y [ main::i#2 main::i#1 ]
zp[2]:6 [ memoryRemap::lowerPageOffset#4 ]
reg byte z [ memoryRemap::remapBlocks#4 ]
zp[2]:8 [ memoryRemap::upperPageOffset#4 ]
reg byte a [ irq::raster#0 ]
reg byte a [ memoryRemap::$0 ]
zp[1]:10 [ memoryRemap::$1 ]
reg byte a [ memoryRemap::$2 ]
reg byte a [ memoryRemap::$3 ]
reg byte a [ memoryRemap::$4 ]
reg byte a [ memoryRemap::$5 ]
zp[1]:11 [ memoryRemap::$6 ]
reg byte a [ memoryRemap::$7 ]
reg byte a [ memoryRemap::$8 ]
reg byte a [ memoryRemap::$9 ]

View File

@ -1,6 +1,9 @@
Fixing struct type size struct F018_DMAGIC to 17
Fixing struct type size struct printf_buffer_number to 12
Fixing struct type size struct printf_buffer_number to 12
Fixing struct type SIZE_OF struct F018_DMAGIC to 17
Fixing struct type SIZE_OF struct printf_buffer_number to 12
Fixing struct type SIZE_OF struct F018_DMAGIC to 17
Fixing struct type SIZE_OF struct printf_buffer_number to 12
Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx
Inlined call call __init
@ -308,6 +311,31 @@ SYMBOL TABLE SSA
(const nomodify byte) CONIO_TEXTCOLOR_DEFAULT = (const nomodify byte) LIGHT_BLUE
(const nomodify byte) CRAM2K = (byte) 1
(const nomodify byte*) DEFAULT_SCREEN = (byte*)(number) $800
(byte) DMA_LIST_F018A::command
(word) DMA_LIST_F018A::count
(byte*) DMA_LIST_F018A::dest
(byte) DMA_LIST_F018A::dest_bank
(word) DMA_LIST_F018A::modulo
(byte*) DMA_LIST_F018A::src
(byte) DMA_LIST_F018A::src_bank
(byte) DMA_LIST_F018B::command
(word) DMA_LIST_F018B::count
(byte*) DMA_LIST_F018B::dest
(byte) DMA_LIST_F018B::dest_bank
(word) DMA_LIST_F018B::modulo
(byte*) DMA_LIST_F018B::src
(byte) DMA_LIST_F018B::src_bank
(byte) DMA_LIST_F018B::sub_command
(byte) F018_DMAGIC::ADDRBANK
(byte) F018_DMAGIC::ADDRLSB
(byte) F018_DMAGIC::ADDRLSBTRIG
(byte) F018_DMAGIC::ADDRMB
(byte) F018_DMAGIC::ADDRMSB
(byte) F018_DMAGIC::EN018B
(byte) F018_DMAGIC::ETRIG
(byte) F018_DMAGIC::MISC
(const byte*) F018_DMAGIC::UNUSED1[(number) 8] = { fill( 8, 0) }
(byte) F018_DMAGIC::UNUSED2
(const nomodify to_volatile byte*) IO_BANK = (byte*)(number) $d030
(const nomodify to_volatile byte*) IO_KEY = (byte*)(number) $d02f
(const nomodify byte) LIGHT_BLUE = (byte) $e
@ -1285,6 +1313,30 @@ memset::@3: scope:[memset] from memset::@2
VARIABLE REGISTER WEIGHTS
(byte) DMA_LIST_F018A::command
(word) DMA_LIST_F018A::count
(byte*) DMA_LIST_F018A::dest
(byte) DMA_LIST_F018A::dest_bank
(word) DMA_LIST_F018A::modulo
(byte*) DMA_LIST_F018A::src
(byte) DMA_LIST_F018A::src_bank
(byte) DMA_LIST_F018B::command
(word) DMA_LIST_F018B::count
(byte*) DMA_LIST_F018B::dest
(byte) DMA_LIST_F018B::dest_bank
(word) DMA_LIST_F018B::modulo
(byte*) DMA_LIST_F018B::src
(byte) DMA_LIST_F018B::src_bank
(byte) DMA_LIST_F018B::sub_command
(byte) F018_DMAGIC::ADDRBANK
(byte) F018_DMAGIC::ADDRLSB
(byte) F018_DMAGIC::ADDRLSBTRIG
(byte) F018_DMAGIC::ADDRMB
(byte) F018_DMAGIC::ADDRMSB
(byte) F018_DMAGIC::EN018B
(byte) F018_DMAGIC::ETRIG
(byte) F018_DMAGIC::MISC
(byte) F018_DMAGIC::UNUSED2
(byte) MEGA65_VICIV::ALPHADELAY
(byte) MEGA65_VICIV::B0PIX
(byte) MEGA65_VICIV::B0_ADDR
@ -2233,6 +2285,9 @@ Uplift Scope [MOS6569_VICII]
Uplift Scope [MOS6581_SID]
Uplift Scope [MOS4569_VICIII]
Uplift Scope [MEGA65_VICIV]
Uplift Scope [F018_DMAGIC]
Uplift Scope [DMA_LIST_F018A]
Uplift Scope [DMA_LIST_F018B]
Uplift Scope [cputln]
Uplift Scope [cscroll]
Uplift Scope [conio_mega65_init]
@ -2253,6 +2308,9 @@ Uplifting [MOS6569_VICII] best 10120 combination
Uplifting [MOS6581_SID] best 10120 combination
Uplifting [MOS4569_VICIII] best 10120 combination
Uplifting [MEGA65_VICIV] best 10120 combination
Uplifting [F018_DMAGIC] best 10120 combination
Uplifting [DMA_LIST_F018A] best 10120 combination
Uplifting [DMA_LIST_F018B] best 10120 combination
Uplifting [cputln] best 10120 combination
Uplifting [cscroll] best 10120 combination
Uplifting [conio_mega65_init] best 10120 combination
@ -2802,6 +2860,31 @@ FINAL SYMBOL TABLE
(const nomodify byte*) COLORRAM = (byte*) 55296
(const nomodify byte) CRAM2K = (byte) 1
(const nomodify byte*) DEFAULT_SCREEN = (byte*) 2048
(byte) DMA_LIST_F018A::command
(word) DMA_LIST_F018A::count
(byte*) DMA_LIST_F018A::dest
(byte) DMA_LIST_F018A::dest_bank
(word) DMA_LIST_F018A::modulo
(byte*) DMA_LIST_F018A::src
(byte) DMA_LIST_F018A::src_bank
(byte) DMA_LIST_F018B::command
(word) DMA_LIST_F018B::count
(byte*) DMA_LIST_F018B::dest
(byte) DMA_LIST_F018B::dest_bank
(word) DMA_LIST_F018B::modulo
(byte*) DMA_LIST_F018B::src
(byte) DMA_LIST_F018B::src_bank
(byte) DMA_LIST_F018B::sub_command
(byte) F018_DMAGIC::ADDRBANK
(byte) F018_DMAGIC::ADDRLSB
(byte) F018_DMAGIC::ADDRLSBTRIG
(byte) F018_DMAGIC::ADDRMB
(byte) F018_DMAGIC::ADDRMSB
(byte) F018_DMAGIC::EN018B
(byte) F018_DMAGIC::ETRIG
(byte) F018_DMAGIC::MISC
(const byte*) F018_DMAGIC::UNUSED1[(number) 8] = { fill( 8, 0) }
(byte) F018_DMAGIC::UNUSED2
(const nomodify to_volatile byte*) IO_BANK = (byte*) 53296
(const nomodify to_volatile byte*) IO_KEY = (byte*) 53295
(const nomodify byte) LIGHT_BLUE = (byte) $e

View File

@ -1,6 +1,31 @@
(const nomodify byte*) COLORRAM = (byte*) 55296
(const nomodify byte) CRAM2K = (byte) 1
(const nomodify byte*) DEFAULT_SCREEN = (byte*) 2048
(byte) DMA_LIST_F018A::command
(word) DMA_LIST_F018A::count
(byte*) DMA_LIST_F018A::dest
(byte) DMA_LIST_F018A::dest_bank
(word) DMA_LIST_F018A::modulo
(byte*) DMA_LIST_F018A::src
(byte) DMA_LIST_F018A::src_bank
(byte) DMA_LIST_F018B::command
(word) DMA_LIST_F018B::count
(byte*) DMA_LIST_F018B::dest
(byte) DMA_LIST_F018B::dest_bank
(word) DMA_LIST_F018B::modulo
(byte*) DMA_LIST_F018B::src
(byte) DMA_LIST_F018B::src_bank
(byte) DMA_LIST_F018B::sub_command
(byte) F018_DMAGIC::ADDRBANK
(byte) F018_DMAGIC::ADDRLSB
(byte) F018_DMAGIC::ADDRLSBTRIG
(byte) F018_DMAGIC::ADDRMB
(byte) F018_DMAGIC::ADDRMSB
(byte) F018_DMAGIC::EN018B
(byte) F018_DMAGIC::ETRIG
(byte) F018_DMAGIC::MISC
(const byte*) F018_DMAGIC::UNUSED1[(number) 8] = { fill( 8, 0) }
(byte) F018_DMAGIC::UNUSED2
(const nomodify to_volatile byte*) IO_BANK = (byte*) 53296
(const nomodify to_volatile byte*) IO_KEY = (byte*) 53295
(const nomodify byte) LIGHT_BLUE = (byte) $e

View File

@ -0,0 +1,361 @@
// Test the MAP instruction for remapping memory
// See section 2.3.4 in http://www.zimmers.net/cbmpics/cbm/c65/c65manual.txt for a description of the CPU memory remapper of the C65.
// See Appendix G in https://mega.scryptos.com/sharefolder-link/MEGA/MEGA65+filehost/Docs/MEGA65-Book_draft.pdf for a description of the CPU memory remapper of the MEGA65.
// MEGA65 Registers and Constants
// The MOS 6526 Complex Interface Adapter (CIA)
// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf
.cpu _45gs02
// MEGA65 platform PRG executable starting in MEGA65 mode.
.file [name="memorymap-test.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$2001]
.segmentdef Code [start=$2017]
.segmentdef Data [startAfter="Code"]
.segment Basic
.byte $0a, $20, $0a, $00, $fe, $02, $20, $30, $00 // 10 BANK 0
.byte $15, $20, $14, $00, $9e, $20 // 20 SYS
.text toIntString(main) // NNNN
.byte $00, $00, $00 //
// Bit representing 8K block #2 of the 64K addressable memory ($4000-$5fff)
.const MEMORYBLOCK_4000 = 4
// Bit representing 8K block #4 of the 64K addressable memory ($8000-$9fff)
.const MEMORYBLOCK_8000 = $10
// Default address of screen character matrix
.label DEFAULT_SCREEN = $800
.segment Code
main: {
.label BLOCK_4000 = $4000
.label BLOCK_8000 = $8000
// memoryRemapBlock(0x40, 0x100)
// Remap [$4000-$5fff] to point to [$10000-$11fff]
ldx #$40
jsr memoryRemapBlock
// BLOCK_4000[0] = '-'
// Put '-', '*' into $10000
lda #'-'
sta BLOCK_4000
// BLOCK_4000[1] = '*'
lda #'*'
sta BLOCK_4000+1
// memoryRemapBlock(0x80, 0x100)
// Remap [$8000-$9fff] to point to [$10000-$11fff]
ldx #$80
jsr memoryRemapBlock
// BLOCK_8000[2] = '-'
// Put '-', '*' into $10002
lda #'-'
sta BLOCK_8000+2
// BLOCK_8000[3] = '*'
lda #'*'
sta BLOCK_8000+3
// memoryRemap(MEMORYBLOCK_4000|MEMORYBLOCK_8000, 0x0c0, 0x080)
// Remap [$4000-$5fff] and [$8000-$9fff] to both point to [$10000-$11fff] (notice usage of page offsets)
lda #<$80
sta.z memoryRemap.upperPageOffset
lda #>$80
sta.z memoryRemap.upperPageOffset+1
ldz #MEMORYBLOCK_4000|MEMORYBLOCK_8000
lda #<$c0
sta.z memoryRemap.lowerPageOffset
lda #>$c0
sta.z memoryRemap.lowerPageOffset+1
jsr memoryRemap
// BLOCK_8000[4] = BLOCK_4000[2]
// Put '-', '*' into $10004 in a convoluted way
lda BLOCK_4000+2
sta BLOCK_8000+4
// BLOCK_4000[5] = BLOCK_8000[1]
lda BLOCK_8000+1
sta BLOCK_4000+5
ldx #0
// copy the resulting values onto the screen
__b1:
// for(char i=0;i<6;i++)
cpx #6
bcc __b2
// memoryRemap256M(MEMORYBLOCK_4000, 0xff800-0x00040, 0)
// Remap [$4000-$5fff] to both point to [$ff80000-$ff81fff] COLORAM! (notice usage of page offsets)
ldz #MEMORYBLOCK_4000
lda #<$ff800-$40
sta.z memoryRemap256M.lowerPageOffset
lda #>$ff800-$40
sta.z memoryRemap256M.lowerPageOffset+1
lda #<$ff800-$40>>$10
sta.z memoryRemap256M.lowerPageOffset+2
lda #>$ff800-$40>>$10
sta.z memoryRemap256M.lowerPageOffset+3
jsr memoryRemap256M
ldx #0
// Put colors in the upper screen line
__b4:
// for( char i=0; i<16; i++)
cpx #$10
bcc __b5
// memoryRemap256M(0, 0, 0)
// Remap [$4000-$5fff] back to normal memory!
ldz #0
lda #0
sta.z memoryRemap256M.lowerPageOffset
sta.z memoryRemap256M.lowerPageOffset+1
sta.z memoryRemap256M.lowerPageOffset+2
sta.z memoryRemap256M.lowerPageOffset+3
jsr memoryRemap256M
// }
rts
__b5:
// 0x40+i
txa
clc
adc #$40
// BLOCK_4000[i] = 0x40+i
sta BLOCK_4000,x
// for( char i=0; i<16; i++)
inx
jmp __b4
__b2:
// (DEFAULT_SCREEN+80-6)[i] = BLOCK_4000[i]
lda BLOCK_4000,x
sta DEFAULT_SCREEN+$50-6,x
// for(char i=0;i<6;i++)
inx
jmp __b1
}
// Remap a single 8K memory block in the 64K address space of the 6502 to point somewhere else in the first 1MB memory space of the MEGA65.
// All the other 8K memory blocks will not be mapped and will point to their own address in the lowest 64K of the MEGA65 memory.
// blockPage: Page address of the 8K memory block to remap (ie. the block that is remapped is $100 * the passed page address.)
// memoryPage: Page address of the memory that the block should point to in the 1MB memory space of the MEGA65.
// Ie. the memory that will be pointed to is $100 * the passed page address. Only the lower 12bits of the passed value is used.
// memoryRemapBlock(byte register(X) blockPage)
memoryRemapBlock: {
.label pageOffset = $d
// pageOffset = memoryPage-blockPage
stx.z $ff
lda #<$100
sec
sbc.z $ff
sta.z pageOffset
lda #>$100
sbc #0
sta.z pageOffset+1
// block = blockPage / $20
txa
lsr
lsr
lsr
lsr
lsr
// blockBits = 1<<block
tay
lda #1
cpy #0
beq !e+
!:
asl
dey
bne !-
!e:
// memoryRemap(blockBits, pageOffset, pageOffset)
taz
lda.z pageOffset
sta.z memoryRemap.upperPageOffset
lda.z pageOffset+1
sta.z memoryRemap.upperPageOffset+1
jsr memoryRemap
// }
rts
}
// Remap some of the eight 8K memory blocks in the 64K address space of the 6502 to point somewhere else in the first 1MB memory space of the MEGA65.
// After the remapping the CPU will access the mapped memory whenever it uses instructions that access a remapped block.
// See section 2.3.4 in http://www.zimmers.net/cbmpics/cbm/c65/c65manual.txt for a description of the CPU memory remapper of the C65.
// remapBlocks: Indicates which 8K blocks of the 6502 address space to remap. Each bit represents one 8K block
// - bit 0 Memory block $0000-$1fff. Use constant MEMORYBLOCK_0000.
// - bit 1 Memory block $2000-$3fff. Use constant MEMORYBLOCK_2000.
// - bit 2 Memory block $4000-$5fff. Use constant MEMORYBLOCK_4000.
// - bit 3 Memory block $6000-$7fff. Use constant MEMORYBLOCK_6000.
// - bit 4 Memory block $8000-$9fff. Use constant MEMORYBLOCK_8000.
// - bit 5 Memory block $a000-$bfff. Use constant MEMORYBLOCK_A000.
// - bit 6 Memory block $c000-$dfff. Use constant MEMORYBLOCK_C000.
// - bit 7 Memory block $e000-$ffff. Use constant MEMORYBLOCK_E000.
// lowerPageOffset: Offset that will be added to any remapped blocks in the lower 32K of memory (block 0-3).
// The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 12bits of the passed value is used.
// - If block 0 ($0000-$1fff) is remapped it will point to lowerPageOffset*$100.
// - If block 1 ($2000-$3fff) is remapped it will point to lowerPageOffset*$100 + $2000.
// - If block 2 ($4000-$5fff) is remapped it will point to lowerPageOffset*$100 + $4000.
// - If block 3 ($6000-$7fff) is remapped it will point to lowerPageOffset*$100 + $6000.
// upperPageOffset: Offset that will be added to any remapped blocks in the upper 32K of memory (block 4-7).
// The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 12bits of the passed value is used.
// - If block 4 ($8000-$9fff) is remapped it will point to upperPageOffset*$100 + $8000
// - If block 5 ($a000-$bfff) is remapped it will point to upperPageOffset*$100 + $a000.
// - If block 6 ($c000-$dfff) is remapped it will point to upperPageOffset*$100 + $c000.
// - If block 7 ($e000-$ffff) is remapped it will point to upperPageOffset*$100 + $e000.
// memoryRemap(byte register(Z) remapBlocks, word zp($d) lowerPageOffset, word zp(2) upperPageOffset)
memoryRemap: {
.label aVal = $fc
.label xVal = $fd
.label yVal = $fe
.label zVal = $ff
.label __1 = $f
.label __6 = 8
.label lowerPageOffset = $d
.label upperPageOffset = 2
// <lowerPageOffset
lda.z lowerPageOffset
// *aVal = <lowerPageOffset
sta aVal
// remapBlocks << 4
tza
asl
asl
asl
asl
sta.z __1
// >lowerPageOffset
lda.z lowerPageOffset+1
// >lowerPageOffset & 0xf
and #$f
// (remapBlocks << 4) | (>lowerPageOffset & 0xf)
ora.z __1
// *xVal = (remapBlocks << 4) | (>lowerPageOffset & 0xf)
sta xVal
// <upperPageOffset
lda.z upperPageOffset
// *yVal = <upperPageOffset
sta yVal
// remapBlocks & 0xf0
tza
and #$f0
sta.z __6
// >upperPageOffset
lda.z upperPageOffset+1
// >upperPageOffset & 0xf
and #$f
// (remapBlocks & 0xf0) | (>upperPageOffset & 0xf)
ora.z __6
// *zVal = (remapBlocks & 0xf0) | (>upperPageOffset & 0xf)
sta zVal
// asm
lda aVal
ldx xVal
ldy yVal
ldz zVal
map
eom
// }
rts
}
// Remap some of the eight 8K memory blocks in the 64K address space of the 6502 to point somewhere else in the entire 256MB memory space of the MEGA65.
// After the remapping the CPU will access the mapped memory whenever it uses instructions that access a remapped block.
// See section 2.3.4 in http://www.zimmers.net/cbmpics/cbm/c65/c65manual.txt for a description of the CPU memory remapper of the C65.
// See Appendix G in file:///Users/jespergravgaard/Downloads/MEGA65-Book_draft%20(5).pdf for a description of the CPU memory remapper of the MEGA65.
// remapBlocks: Indicates which 8K blocks of the 6502 address space to remap. Each bit represents one 8K block
// - bit 0 Memory block $0000-$1fff. Use constant MEMORYBLOCK_0000.
// - bit 1 Memory block $2000-$3fff. Use constant MEMORYBLOCK_2000.
// - bit 2 Memory block $4000-$5fff. Use constant MEMORYBLOCK_4000.
// - bit 3 Memory block $6000-$7fff. Use constant MEMORYBLOCK_6000.
// - bit 4 Memory block $8000-$9fff. Use constant MEMORYBLOCK_8000.
// - bit 5 Memory block $a000-$bfff. Use constant MEMORYBLOCK_A000.
// - bit 6 Memory block $c000-$dfff. Use constant MEMORYBLOCK_C000.
// - bit 7 Memory block $e000-$ffff. Use constant MEMORYBLOCK_E000.
// lowerPageOffset: Offset that will be added to any remapped blocks in the lower 32K of memory (block 0-3).
// The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 20bits of the passed value is used.
// - If block 0 ($0000-$1fff) is remapped it will point to lowerPageOffset*$100.
// - If block 1 ($2000-$3fff) is remapped it will point to lowerPageOffset*$100 + $2000.
// - If block 2 ($4000-$5fff) is remapped it will point to lowerPageOffset*$100 + $4000.
// - If block 3 ($6000-$7fff) is remapped it will point to lowerPageOffset*$100 + $6000.
// upperPageOffset: Offset that will be added to any remapped blocks in the upper 32K of memory (block 4-7).
// The offset is a page offset (meaning it is multiplied by 0x100). Only the lower 20bits of the passed value is used.
// - If block 4 ($8000-$9fff) is remapped it will point to upperPageOffset*$100 + $8000
// - If block 5 ($a000-$bfff) is remapped it will point to upperPageOffset*$100 + $a000.
// - If block 6 ($c000-$dfff) is remapped it will point to upperPageOffset*$100 + $c000.
// - If block 7 ($e000-$ffff) is remapped it will point to upperPageOffset*$100 + $e000.
// memoryRemap256M(byte register(Z) remapBlocks, dword zp(4) lowerPageOffset)
memoryRemap256M: {
.label lMb = $fa
.label uMb = $fb
.label aVal = $fc
.label xVal = $fd
.label yVal = $fe
.label zVal = $ff
.label __0 = 9
.label __6 = $f
.label __7 = $d
.label lowerPageOffset = 4
// lowerPageOffset>>4
lda.z lowerPageOffset+3
lsr
sta.z __0+3
lda.z lowerPageOffset+2
ror
sta.z __0+2
lda.z lowerPageOffset+1
ror
sta.z __0+1
lda.z lowerPageOffset
ror
sta.z __0
lsr.z __0+3
ror.z __0+2
ror.z __0+1
ror.z __0
lsr.z __0+3
ror.z __0+2
ror.z __0+1
ror.z __0
lsr.z __0+3
ror.z __0+2
ror.z __0+1
ror.z __0
// >((unsigned int)(lowerPageOffset>>4))
lda.z __0+1
// *lMb = >((unsigned int)(lowerPageOffset>>4))
sta lMb
// *uMb = >((unsigned int)(upperPageOffset>>4))
lda #0
sta uMb
// <lowerPageOffset
lda.z lowerPageOffset
sta.z __7
lda.z lowerPageOffset+1
sta.z __7+1
// < <lowerPageOffset
lda.z __7
// *aVal = < <lowerPageOffset
sta aVal
// remapBlocks << 4
tza
asl
asl
asl
asl
sta.z __6
// > <lowerPageOffset
lda.z __7+1
// > <lowerPageOffset & 0xf
and #$f
// (remapBlocks << 4) | (> <lowerPageOffset & 0xf)
ora.z __6
// *xVal = (remapBlocks << 4) | (> <lowerPageOffset & 0xf)
sta xVal
// *yVal = < <upperPageOffset
lda #0
sta yVal
// (remapBlocks & 0xf0) | (> <upperPageOffset & 0xf)
tza
and #$f0
// *zVal = (remapBlocks & 0xf0) | (> <upperPageOffset & 0xf)
sta zVal
// asm
lda lMb
ldx #$f
ldy uMb
ldz #0
map
lda aVal
ldx xVal
ldy yVal
ldz zVal
map
eom
// }
rts
}

View File

@ -0,0 +1,113 @@
(void()) main()
main: scope:[main] from
[0] phi()
[1] call memoryRemapBlock
to:main::@7
main::@7: scope:[main] from main
[2] *((const byte*) main::BLOCK_4000) ← (byte) '-'
[3] *((const byte*) main::BLOCK_4000+(byte) 1) ← (byte) '*'
[4] call memoryRemapBlock
to:main::@8
main::@8: scope:[main] from main::@7
[5] *((const byte*) main::BLOCK_8000+(byte) 2) ← (byte) '-'
[6] *((const byte*) main::BLOCK_8000+(byte) 3) ← (byte) '*'
[7] call memoryRemap
to:main::@9
main::@9: scope:[main] from main::@8
[8] *((const byte*) main::BLOCK_8000+(byte) 4) ← *((const byte*) main::BLOCK_4000+(byte) 2)
[9] *((const byte*) main::BLOCK_4000+(byte) 5) ← *((const byte*) main::BLOCK_8000+(byte) 1)
to:main::@1
main::@1: scope:[main] from main::@2 main::@9
[10] (byte) main::i#2 ← phi( main::@2/(byte) main::i#1 main::@9/(byte) 0 )
[11] if((byte) main::i#2<(byte) 6) goto main::@2
to:main::@3
main::@3: scope:[main] from main::@1
[12] phi()
[13] call memoryRemap256M
to:main::@4
main::@4: scope:[main] from main::@3 main::@5
[14] (byte) main::i1#2 ← phi( main::@3/(byte) 0 main::@5/(byte) main::i1#1 )
[15] if((byte) main::i1#2<(byte) $10) goto main::@5
to:main::@6
main::@6: scope:[main] from main::@4
[16] phi()
[17] call memoryRemap256M
to:main::@return
main::@return: scope:[main] from main::@6
[18] return
to:@return
main::@5: scope:[main] from main::@4
[19] (byte~) main::$7 ← (byte) $40 + (byte) main::i1#2
[20] *((const byte*) main::BLOCK_4000 + (byte) main::i1#2) ← (byte~) main::$7
[21] (byte) main::i1#1 ← ++ (byte) main::i1#2
to:main::@4
main::@2: scope:[main] from main::@1
[22] *((const nomodify byte*) DEFAULT_SCREEN+(byte) $50-(byte) 6 + (byte) main::i#2) ← *((const byte*) main::BLOCK_4000 + (byte) main::i#2)
[23] (byte) main::i#1 ← ++ (byte) main::i#2
to:main::@1
(void()) memoryRemapBlock((byte) memoryRemapBlock::blockPage , (word) memoryRemapBlock::memoryPage)
memoryRemapBlock: scope:[memoryRemapBlock] from main main::@7
[24] (byte) memoryRemapBlock::blockPage#2 ← phi( main/(byte) $40 main::@7/(byte) $80 )
[25] (word) memoryRemapBlock::pageOffset#0 ← (word) $100 - (byte) memoryRemapBlock::blockPage#2
[26] (byte) memoryRemapBlock::block#0 ← (byte) memoryRemapBlock::blockPage#2 >> (byte) 5
[27] (byte) memoryRemapBlock::blockBits#0 ← (byte) 1 << (byte) memoryRemapBlock::block#0
[28] (byte) memoryRemap::remapBlocks#0 ← (byte) memoryRemapBlock::blockBits#0
[29] (word) memoryRemap::lowerPageOffset#0 ← (word) memoryRemapBlock::pageOffset#0
[30] (word) memoryRemap::upperPageOffset#0 ← (word) memoryRemapBlock::pageOffset#0
[31] call memoryRemap
to:memoryRemapBlock::@return
memoryRemapBlock::@return: scope:[memoryRemapBlock] from memoryRemapBlock
[32] return
to:@return
(void()) memoryRemap((byte) memoryRemap::remapBlocks , (word) memoryRemap::lowerPageOffset , (word) memoryRemap::upperPageOffset)
memoryRemap: scope:[memoryRemap] from main::@8 memoryRemapBlock
[33] (word) memoryRemap::upperPageOffset#2 ← phi( main::@8/(byte) $80 memoryRemapBlock/(word) memoryRemap::upperPageOffset#0 )
[33] (byte) memoryRemap::remapBlocks#2 ← phi( main::@8/(const nomodify byte) MEMORYBLOCK_4000|(const nomodify byte) MEMORYBLOCK_8000 memoryRemapBlock/(byte) memoryRemap::remapBlocks#0 )
[33] (word) memoryRemap::lowerPageOffset#2 ← phi( main::@8/(byte) $c0 memoryRemapBlock/(word) memoryRemap::lowerPageOffset#0 )
[34] (byte~) memoryRemap::$0 ← < (word) memoryRemap::lowerPageOffset#2
[35] *((const byte*) memoryRemap::aVal) ← (byte~) memoryRemap::$0
[36] (byte~) memoryRemap::$1 ← (byte) memoryRemap::remapBlocks#2 << (byte) 4
[37] (byte~) memoryRemap::$2 ← > (word) memoryRemap::lowerPageOffset#2
[38] (byte~) memoryRemap::$3 ← (byte~) memoryRemap::$2 & (byte) $f
[39] (byte~) memoryRemap::$4 ← (byte~) memoryRemap::$1 | (byte~) memoryRemap::$3
[40] *((const byte*) memoryRemap::xVal) ← (byte~) memoryRemap::$4
[41] (byte~) memoryRemap::$5 ← < (word) memoryRemap::upperPageOffset#2
[42] *((const byte*) memoryRemap::yVal) ← (byte~) memoryRemap::$5
[43] (byte~) memoryRemap::$6 ← (byte) memoryRemap::remapBlocks#2 & (byte) $f0
[44] (byte~) memoryRemap::$7 ← > (word) memoryRemap::upperPageOffset#2
[45] (byte~) memoryRemap::$8 ← (byte~) memoryRemap::$7 & (byte) $f
[46] (byte~) memoryRemap::$9 ← (byte~) memoryRemap::$6 | (byte~) memoryRemap::$8
[47] *((const byte*) memoryRemap::zVal) ← (byte~) memoryRemap::$9
asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
to:memoryRemap::@return
memoryRemap::@return: scope:[memoryRemap] from memoryRemap
[49] return
to:@return
(void()) memoryRemap256M((byte) memoryRemap256M::remapBlocks , (dword) memoryRemap256M::lowerPageOffset , (dword) memoryRemap256M::upperPageOffset)
memoryRemap256M: scope:[memoryRemap256M] from main::@3 main::@6
[50] (byte) memoryRemap256M::remapBlocks#2 ← phi( main::@3/(const nomodify byte) MEMORYBLOCK_4000 main::@6/(byte) 0 )
[50] (dword) memoryRemap256M::lowerPageOffset#2 ← phi( main::@3/(dword)(number) $ff800-(number) $40 main::@6/(byte) 0 )
[51] (dword~) memoryRemap256M::$0 ← (dword) memoryRemap256M::lowerPageOffset#2 >> (byte) 4
[52] (byte~) memoryRemap256M::$1 ← > (word)(dword~) memoryRemap256M::$0
[53] *((const byte*) memoryRemap256M::lMb) ← (byte~) memoryRemap256M::$1
[54] *((const byte*) memoryRemap256M::uMb) ← (byte) 0
[55] (word~) memoryRemap256M::$7 ← < (dword) memoryRemap256M::lowerPageOffset#2
[56] (byte~) memoryRemap256M::$5 ← < (word~) memoryRemap256M::$7
[57] *((const byte*) memoryRemap256M::aVal) ← (byte~) memoryRemap256M::$5
[58] (byte~) memoryRemap256M::$6 ← (byte) memoryRemap256M::remapBlocks#2 << (byte) 4
[59] (byte~) memoryRemap256M::$8 ← > (word~) memoryRemap256M::$7
[60] (byte~) memoryRemap256M::$9 ← (byte~) memoryRemap256M::$8 & (byte) $f
[61] (byte~) memoryRemap256M::$10 ← (byte~) memoryRemap256M::$6 | (byte~) memoryRemap256M::$9
[62] *((const byte*) memoryRemap256M::xVal) ← (byte~) memoryRemap256M::$10
[63] *((const byte*) memoryRemap256M::yVal) ← (byte) 0
[64] (byte~) memoryRemap256M::$17 ← (byte) memoryRemap256M::remapBlocks#2 & (byte) $f0
[65] *((const byte*) memoryRemap256M::zVal) ← (byte~) memoryRemap256M::$17
asm { ldalMb ldx#$0f ldyuMb ldz#$00 map ldaaVal ldxxVal ldyyVal ldzzVal map eom }
to:memoryRemap256M::@return
memoryRemap256M::@return: scope:[memoryRemap256M] from memoryRemap256M
[67] return
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,419 @@
(const nomodify byte*) DEFAULT_SCREEN = (byte*) 2048
(byte) DMA_LIST_F018A::command
(word) DMA_LIST_F018A::count
(byte*) DMA_LIST_F018A::dest
(byte) DMA_LIST_F018A::dest_bank
(word) DMA_LIST_F018A::modulo
(byte*) DMA_LIST_F018A::src
(byte) DMA_LIST_F018A::src_bank
(byte) DMA_LIST_F018B::command
(word) DMA_LIST_F018B::count
(byte*) DMA_LIST_F018B::dest
(byte) DMA_LIST_F018B::dest_bank
(word) DMA_LIST_F018B::modulo
(byte*) DMA_LIST_F018B::src
(byte) DMA_LIST_F018B::src_bank
(byte) DMA_LIST_F018B::sub_command
(byte) F018_DMAGIC::ADDRBANK
(byte) F018_DMAGIC::ADDRLSB
(byte) F018_DMAGIC::ADDRLSBTRIG
(byte) F018_DMAGIC::ADDRMB
(byte) F018_DMAGIC::ADDRMSB
(byte) F018_DMAGIC::EN018B
(byte) F018_DMAGIC::ETRIG
(byte) F018_DMAGIC::MISC
(const byte*) F018_DMAGIC::UNUSED1[(number) 8] = { fill( 8, 0) }
(byte) F018_DMAGIC::UNUSED2
(byte) MEGA65_VICIV::ALPHADELAY
(byte) MEGA65_VICIV::B0PIX
(byte) MEGA65_VICIV::B0_ADDR
(byte) MEGA65_VICIV::B1PIX
(byte) MEGA65_VICIV::B1_ADDR
(byte) MEGA65_VICIV::B2PIX
(byte) MEGA65_VICIV::B2_ADDR
(byte) MEGA65_VICIV::B3PIX
(byte) MEGA65_VICIV::B3_ADDR
(byte) MEGA65_VICIV::B4PIX
(byte) MEGA65_VICIV::B4_ADDR
(byte) MEGA65_VICIV::B5PIX
(byte) MEGA65_VICIV::B5_ADDR
(byte) MEGA65_VICIV::B6PIX
(byte) MEGA65_VICIV::B6_ADDR
(byte) MEGA65_VICIV::B7PIX
(byte) MEGA65_VICIV::B7_ADDR
(byte) MEGA65_VICIV::BBDRPOS_HI
(byte) MEGA65_VICIV::BBDRPOS_LO
(byte) MEGA65_VICIV::BG_COLOR
(byte) MEGA65_VICIV::BG_COLOR1
(byte) MEGA65_VICIV::BG_COLOR2
(byte) MEGA65_VICIV::BG_COLOR3
(byte) MEGA65_VICIV::BORDER_COLOR
(byte) MEGA65_VICIV::BP16ENS
(byte) MEGA65_VICIV::BPCOMP
(byte) MEGA65_VICIV::BPX
(byte) MEGA65_VICIV::BPY
(byte) MEGA65_VICIV::CHARPTR_HILO
(byte) MEGA65_VICIV::CHARPTR_LOHI
(byte) MEGA65_VICIV::CHARPTR_LOLO
(byte) MEGA65_VICIV::CHARSTEP_HI
(byte) MEGA65_VICIV::CHARSTEP_LO
(byte) MEGA65_VICIV::CHRCOUNT
(byte) MEGA65_VICIV::CHRXSCL
(byte) MEGA65_VICIV::CHRYSCL
(byte) MEGA65_VICIV::COLPTR_HI
(byte) MEGA65_VICIV::COLPTR_LO
(byte) MEGA65_VICIV::CONTROL1
(byte) MEGA65_VICIV::CONTROL2
(byte) MEGA65_VICIV::CONTROLA
(byte) MEGA65_VICIV::CONTROLB
(byte) MEGA65_VICIV::CONTROLC
(byte) MEGA65_VICIV::DEBUG1
(byte) MEGA65_VICIV::DEBUGX
(byte) MEGA65_VICIV::DEBUGXY
(byte) MEGA65_VICIV::DEBUGY
(byte) MEGA65_VICIV::FNRASTER_HI
(byte) MEGA65_VICIV::FNRASTER_LO
(byte) MEGA65_VICIV::HPOS
(byte) MEGA65_VICIV::IRQ_ENABLE
(byte) MEGA65_VICIV::IRQ_STATUS
(byte) MEGA65_VICIV::KEY
(byte) MEGA65_VICIV::LIGHTPEN_X
(byte) MEGA65_VICIV::LIGHTPEN_Y
(byte) MEGA65_VICIV::MEMORY
(byte) MEGA65_VICIV::PALSEL
(byte) MEGA65_VICIV::RASLINE0
(byte) MEGA65_VICIV::RASTER
(byte) MEGA65_VICIV::ROWCOUNT
(byte) MEGA65_VICIV::RSTCMP
(byte) MEGA65_VICIV::RSTCOMP
(byte) MEGA65_VICIV::SBPDEBUG
(byte) MEGA65_VICIV::SCRNPTR_HIHI
(byte) MEGA65_VICIV::SCRNPTR_HILO
(byte) MEGA65_VICIV::SCRNPTR_LOHI
(byte) MEGA65_VICIV::SCRNPTR_LOLO
(byte) MEGA65_VICIV::SIDBDRWD_HI
(byte) MEGA65_VICIV::SIDBDRWD_LO
(byte) MEGA65_VICIV::SPR16EN
(byte) MEGA65_VICIV::SPRALPHAVAL
(byte) MEGA65_VICIV::SPRENALPHA
(byte) MEGA65_VICIV::SPRENV400
(byte) MEGA65_VICIV::SPRHGHT
(byte) MEGA65_VICIV::SPRHGTEN
(byte) MEGA65_VICIV::SPRITE0_COLOR
(byte) MEGA65_VICIV::SPRITE0_X
(byte) MEGA65_VICIV::SPRITE0_Y
(byte) MEGA65_VICIV::SPRITE1_COLOR
(byte) MEGA65_VICIV::SPRITE1_X
(byte) MEGA65_VICIV::SPRITE1_Y
(byte) MEGA65_VICIV::SPRITE2_COLOR
(byte) MEGA65_VICIV::SPRITE2_X
(byte) MEGA65_VICIV::SPRITE2_Y
(byte) MEGA65_VICIV::SPRITE3_COLOR
(byte) MEGA65_VICIV::SPRITE3_X
(byte) MEGA65_VICIV::SPRITE3_Y
(byte) MEGA65_VICIV::SPRITE4_COLOR
(byte) MEGA65_VICIV::SPRITE4_X
(byte) MEGA65_VICIV::SPRITE4_Y
(byte) MEGA65_VICIV::SPRITE5_COLOR
(byte) MEGA65_VICIV::SPRITE5_X
(byte) MEGA65_VICIV::SPRITE5_Y
(byte) MEGA65_VICIV::SPRITE6_COLOR
(byte) MEGA65_VICIV::SPRITE6_X
(byte) MEGA65_VICIV::SPRITE6_Y
(byte) MEGA65_VICIV::SPRITE7_COLOR
(byte) MEGA65_VICIV::SPRITE7_X
(byte) MEGA65_VICIV::SPRITE7_Y
(byte) MEGA65_VICIV::SPRITES_BG_COLLISION
(byte) MEGA65_VICIV::SPRITES_COLLISION
(byte) MEGA65_VICIV::SPRITES_ENABLE
(byte) MEGA65_VICIV::SPRITES_EXPAND_X
(byte) MEGA65_VICIV::SPRITES_EXPAND_Y
(byte) MEGA65_VICIV::SPRITES_MC
(byte) MEGA65_VICIV::SPRITES_MCOLOR1
(byte) MEGA65_VICIV::SPRITES_MCOLOR2
(byte) MEGA65_VICIV::SPRITES_PRIORITY
(byte) MEGA65_VICIV::SPRITES_XMSB
(byte) MEGA65_VICIV::SPRPTRADR_HILO
(byte) MEGA65_VICIV::SPRPTRADR_LOHI
(byte) MEGA65_VICIV::SPRPTRADR_LOLO
(byte) MEGA65_VICIV::SPRX64EN
(byte) MEGA65_VICIV::SPRXSMSBS
(byte) MEGA65_VICIV::SPRYSMSBSM
(byte) MEGA65_VICIV::SRPYMSBS
(byte) MEGA65_VICIV::SYNCPOL
(byte) MEGA65_VICIV::TBDRPOS_HI
(byte) MEGA65_VICIV::TBDRPOS_LO
(byte) MEGA65_VICIV::TEXTXPOS_HI
(byte) MEGA65_VICIV::TEXTXPOS_LO
(byte) MEGA65_VICIV::TEXTYPOS_HI
(byte) MEGA65_VICIV::TEXTYPOS_LO
(byte) MEGA65_VICIV::UNUSED
(byte) MEGA65_VICIV::VPOS
(byte) MEGA65_VICIV::VSYNDEL
(byte) MEGA65_VICIV::XPOS_HI
(byte) MEGA65_VICIV::XPOS_LO
(const nomodify byte) MEMORYBLOCK_4000 = (byte) 4
(const nomodify byte) MEMORYBLOCK_8000 = (byte) $10
(byte) MOS4569_VICIII::B0PIX
(byte) MOS4569_VICIII::B0_ADDR
(byte) MOS4569_VICIII::B1PIX
(byte) MOS4569_VICIII::B1_ADDR
(byte) MOS4569_VICIII::B2PIX
(byte) MOS4569_VICIII::B2_ADDR
(byte) MOS4569_VICIII::B3PIX
(byte) MOS4569_VICIII::B3_ADDR
(byte) MOS4569_VICIII::B4PIX
(byte) MOS4569_VICIII::B4_ADDR
(byte) MOS4569_VICIII::B5PIX
(byte) MOS4569_VICIII::B5_ADDR
(byte) MOS4569_VICIII::B6PIX
(byte) MOS4569_VICIII::B6_ADDR
(byte) MOS4569_VICIII::B7PIX
(byte) MOS4569_VICIII::B7_ADDR
(byte) MOS4569_VICIII::BG_COLOR
(byte) MOS4569_VICIII::BG_COLOR1
(byte) MOS4569_VICIII::BG_COLOR2
(byte) MOS4569_VICIII::BG_COLOR3
(byte) MOS4569_VICIII::BORDER_COLOR
(byte) MOS4569_VICIII::BPCOMP
(byte) MOS4569_VICIII::BPX
(byte) MOS4569_VICIII::BPY
(byte) MOS4569_VICIII::CONTROL1
(byte) MOS4569_VICIII::CONTROL2
(byte) MOS4569_VICIII::CONTROLA
(byte) MOS4569_VICIII::CONTROLB
(byte) MOS4569_VICIII::HPOS
(byte) MOS4569_VICIII::IRQ_ENABLE
(byte) MOS4569_VICIII::IRQ_STATUS
(byte) MOS4569_VICIII::KEY
(byte) MOS4569_VICIII::LIGHTPEN_X
(byte) MOS4569_VICIII::LIGHTPEN_Y
(byte) MOS4569_VICIII::MEMORY
(byte) MOS4569_VICIII::RASTER
(byte) MOS4569_VICIII::SPRITE0_COLOR
(byte) MOS4569_VICIII::SPRITE0_X
(byte) MOS4569_VICIII::SPRITE0_Y
(byte) MOS4569_VICIII::SPRITE1_COLOR
(byte) MOS4569_VICIII::SPRITE1_X
(byte) MOS4569_VICIII::SPRITE1_Y
(byte) MOS4569_VICIII::SPRITE2_COLOR
(byte) MOS4569_VICIII::SPRITE2_X
(byte) MOS4569_VICIII::SPRITE2_Y
(byte) MOS4569_VICIII::SPRITE3_COLOR
(byte) MOS4569_VICIII::SPRITE3_X
(byte) MOS4569_VICIII::SPRITE3_Y
(byte) MOS4569_VICIII::SPRITE4_COLOR
(byte) MOS4569_VICIII::SPRITE4_X
(byte) MOS4569_VICIII::SPRITE4_Y
(byte) MOS4569_VICIII::SPRITE5_COLOR
(byte) MOS4569_VICIII::SPRITE5_X
(byte) MOS4569_VICIII::SPRITE5_Y
(byte) MOS4569_VICIII::SPRITE6_COLOR
(byte) MOS4569_VICIII::SPRITE6_X
(byte) MOS4569_VICIII::SPRITE6_Y
(byte) MOS4569_VICIII::SPRITE7_COLOR
(byte) MOS4569_VICIII::SPRITE7_X
(byte) MOS4569_VICIII::SPRITE7_Y
(byte) MOS4569_VICIII::SPRITES_BG_COLLISION
(byte) MOS4569_VICIII::SPRITES_COLLISION
(byte) MOS4569_VICIII::SPRITES_ENABLE
(byte) MOS4569_VICIII::SPRITES_EXPAND_X
(byte) MOS4569_VICIII::SPRITES_EXPAND_Y
(byte) MOS4569_VICIII::SPRITES_MC
(byte) MOS4569_VICIII::SPRITES_MCOLOR1
(byte) MOS4569_VICIII::SPRITES_MCOLOR2
(byte) MOS4569_VICIII::SPRITES_PRIORITY
(byte) MOS4569_VICIII::SPRITES_XMSB
(byte) MOS4569_VICIII::UNUSED
(byte) MOS4569_VICIII::VPOS
(byte) MOS6526_CIA::INTERRUPT
(byte) MOS6526_CIA::PORT_A
(byte) MOS6526_CIA::PORT_A_DDR
(byte) MOS6526_CIA::PORT_B
(byte) MOS6526_CIA::PORT_B_DDR
(byte) MOS6526_CIA::SERIAL_DATA
(word) MOS6526_CIA::TIMER_A
(byte) MOS6526_CIA::TIMER_A_CONTROL
(word) MOS6526_CIA::TIMER_B
(byte) MOS6526_CIA::TIMER_B_CONTROL
(byte) MOS6526_CIA::TOD_10THS
(byte) MOS6526_CIA::TOD_HOURS
(byte) MOS6526_CIA::TOD_MIN
(byte) MOS6526_CIA::TOD_SEC
(byte) MOS6569_VICII::BG_COLOR
(byte) MOS6569_VICII::BG_COLOR1
(byte) MOS6569_VICII::BG_COLOR2
(byte) MOS6569_VICII::BG_COLOR3
(byte) MOS6569_VICII::BORDER_COLOR
(byte) MOS6569_VICII::CONTROL1
(byte) MOS6569_VICII::CONTROL2
(byte) MOS6569_VICII::IRQ_ENABLE
(byte) MOS6569_VICII::IRQ_STATUS
(byte) MOS6569_VICII::LIGHTPEN_X
(byte) MOS6569_VICII::LIGHTPEN_Y
(byte) MOS6569_VICII::MEMORY
(byte) MOS6569_VICII::RASTER
(byte) MOS6569_VICII::SPRITE0_COLOR
(byte) MOS6569_VICII::SPRITE0_X
(byte) MOS6569_VICII::SPRITE0_Y
(byte) MOS6569_VICII::SPRITE1_COLOR
(byte) MOS6569_VICII::SPRITE1_X
(byte) MOS6569_VICII::SPRITE1_Y
(byte) MOS6569_VICII::SPRITE2_COLOR
(byte) MOS6569_VICII::SPRITE2_X
(byte) MOS6569_VICII::SPRITE2_Y
(byte) MOS6569_VICII::SPRITE3_COLOR
(byte) MOS6569_VICII::SPRITE3_X
(byte) MOS6569_VICII::SPRITE3_Y
(byte) MOS6569_VICII::SPRITE4_COLOR
(byte) MOS6569_VICII::SPRITE4_X
(byte) MOS6569_VICII::SPRITE4_Y
(byte) MOS6569_VICII::SPRITE5_COLOR
(byte) MOS6569_VICII::SPRITE5_X
(byte) MOS6569_VICII::SPRITE5_Y
(byte) MOS6569_VICII::SPRITE6_COLOR
(byte) MOS6569_VICII::SPRITE6_X
(byte) MOS6569_VICII::SPRITE6_Y
(byte) MOS6569_VICII::SPRITE7_COLOR
(byte) MOS6569_VICII::SPRITE7_X
(byte) MOS6569_VICII::SPRITE7_Y
(byte) MOS6569_VICII::SPRITES_BG_COLLISION
(byte) MOS6569_VICII::SPRITES_COLLISION
(byte) MOS6569_VICII::SPRITES_ENABLE
(byte) MOS6569_VICII::SPRITES_EXPAND_X
(byte) MOS6569_VICII::SPRITES_EXPAND_Y
(byte) MOS6569_VICII::SPRITES_MC
(byte) MOS6569_VICII::SPRITES_MCOLOR1
(byte) MOS6569_VICII::SPRITES_MCOLOR2
(byte) MOS6569_VICII::SPRITES_PRIORITY
(byte) MOS6569_VICII::SPRITES_XMSB
(byte) MOS6581_SID::CH1_ATTACK_DECAY
(byte) MOS6581_SID::CH1_CONTROL
(word) MOS6581_SID::CH1_FREQ
(word) MOS6581_SID::CH1_PULSE_WIDTH
(byte) MOS6581_SID::CH1_SUSTAIN_RELEASE
(byte) MOS6581_SID::CH2_ATTACK_DECAY
(byte) MOS6581_SID::CH2_CONTROL
(word) MOS6581_SID::CH2_FREQ
(word) MOS6581_SID::CH2_PULSE_WIDTH
(byte) MOS6581_SID::CH2_SUSTAIN_RELEASE
(byte) MOS6581_SID::CH3_ATTACK_DECAY
(byte) MOS6581_SID::CH3_CONTROL
(byte) MOS6581_SID::CH3_ENV
(word) MOS6581_SID::CH3_FREQ
(byte) MOS6581_SID::CH3_OSC
(word) MOS6581_SID::CH3_PULSE_WIDTH
(byte) MOS6581_SID::CH3_SUSTAIN_RELEASE
(byte) MOS6581_SID::FILTER_CUTOFF_HIGH
(byte) MOS6581_SID::FILTER_CUTOFF_LOW
(byte) MOS6581_SID::FILTER_SETUP
(byte) MOS6581_SID::POT_X
(byte) MOS6581_SID::POT_Y
(byte) MOS6581_SID::VOLUME_FILTER_MODE
(void()) main()
(byte~) main::$7 reg byte a 22.0
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@6
(label) main::@7
(label) main::@8
(label) main::@9
(label) main::@return
(const byte*) main::BLOCK_4000 = (byte*) 16384
(const byte*) main::BLOCK_8000 = (byte*) 32768
(byte) main::i
(byte) main::i#1 reg byte x 22.0
(byte) main::i#2 reg byte x 18.333333333333332
(byte) main::i1
(byte) main::i1#1 reg byte x 22.0
(byte) main::i1#2 reg byte x 13.75
(void()) memoryRemap((byte) memoryRemap::remapBlocks , (word) memoryRemap::lowerPageOffset , (word) memoryRemap::upperPageOffset)
(byte~) memoryRemap::$0 reg byte a 202.0
(byte~) memoryRemap::$1 zp[1]:15 67.33333333333333
(byte~) memoryRemap::$2 reg byte a 202.0
(byte~) memoryRemap::$3 reg byte a 202.0
(byte~) memoryRemap::$4 reg byte a 202.0
(byte~) memoryRemap::$5 reg byte a 202.0
(byte~) memoryRemap::$6 zp[1]:8 67.33333333333333
(byte~) memoryRemap::$7 reg byte a 202.0
(byte~) memoryRemap::$8 reg byte a 202.0
(byte~) memoryRemap::$9 reg byte a 202.0
(label) memoryRemap::@return
(const byte*) memoryRemap::aVal = (byte*) 252
(word) memoryRemap::lowerPageOffset
(word) memoryRemap::lowerPageOffset#0 lowerPageOffset zp[2]:13 11.0
(word) memoryRemap::lowerPageOffset#2 lowerPageOffset zp[2]:13 53.25
(byte) memoryRemap::remapBlocks
(byte) memoryRemap::remapBlocks#0 reg byte z 7.333333333333333
(byte) memoryRemap::remapBlocks#2 reg byte z 21.299999999999997
(word) memoryRemap::upperPageOffset
(word) memoryRemap::upperPageOffset#0 upperPageOffset zp[2]:2 22.0
(word) memoryRemap::upperPageOffset#2 upperPageOffset zp[2]:2 19.363636363636363
(const byte*) memoryRemap::xVal = (byte*) 253
(const byte*) memoryRemap::yVal = (byte*) 254
(const byte*) memoryRemap::zVal = (byte*) 255
(void()) memoryRemap256M((byte) memoryRemap256M::remapBlocks , (dword) memoryRemap256M::lowerPageOffset , (dword) memoryRemap256M::upperPageOffset)
(dword~) memoryRemap256M::$0 zp[4]:9 11.0
(byte~) memoryRemap256M::$1 reg byte a 22.0
(byte~) memoryRemap256M::$10 reg byte a 22.0
(byte~) memoryRemap256M::$17 reg byte a 22.0
(byte~) memoryRemap256M::$5 reg byte a 22.0
(byte~) memoryRemap256M::$6 zp[1]:15 7.333333333333333
(word~) memoryRemap256M::$7 zp[2]:13 8.25
(byte~) memoryRemap256M::$8 reg byte a 22.0
(byte~) memoryRemap256M::$9 reg byte a 22.0
(label) memoryRemap256M::@return
(const byte*) memoryRemap256M::aVal = (byte*) 252
(const byte*) memoryRemap256M::lMb = (byte*) 250
(dword) memoryRemap256M::lowerPageOffset
(dword) memoryRemap256M::lowerPageOffset#2 lowerPageOffset zp[4]:4 4.4
(byte) memoryRemap256M::remapBlocks
(byte) memoryRemap256M::remapBlocks#2 reg byte z 1.5714285714285714
(const byte*) memoryRemap256M::uMb = (byte*) 251
(dword) memoryRemap256M::upperPageOffset
(const byte*) memoryRemap256M::xVal = (byte*) 253
(const byte*) memoryRemap256M::yVal = (byte*) 254
(const byte*) memoryRemap256M::zVal = (byte*) 255
(void()) memoryRemapBlock((byte) memoryRemapBlock::blockPage , (word) memoryRemapBlock::memoryPage)
(label) memoryRemapBlock::@return
(byte) memoryRemapBlock::block
(byte) memoryRemapBlock::block#0 reg byte a 22.0
(byte) memoryRemapBlock::blockBits
(byte) memoryRemapBlock::blockBits#0 reg byte a 22.0
(byte) memoryRemapBlock::blockPage
(byte) memoryRemapBlock::blockPage#2 reg byte x 11.0
(word) memoryRemapBlock::memoryPage
(word) memoryRemapBlock::pageOffset
(word) memoryRemapBlock::pageOffset#0 pageOffset zp[2]:13 6.6000000000000005
reg byte x [ main::i#2 main::i#1 ]
reg byte x [ main::i1#2 main::i1#1 ]
reg byte x [ memoryRemapBlock::blockPage#2 ]
reg byte z [ memoryRemap::remapBlocks#2 memoryRemap::remapBlocks#0 ]
zp[2]:2 [ memoryRemap::upperPageOffset#2 memoryRemap::upperPageOffset#0 ]
zp[4]:4 [ memoryRemap256M::lowerPageOffset#2 ]
reg byte z [ memoryRemap256M::remapBlocks#2 ]
reg byte a [ main::$7 ]
reg byte a [ memoryRemapBlock::block#0 ]
reg byte a [ memoryRemapBlock::blockBits#0 ]
reg byte a [ memoryRemap::$0 ]
reg byte a [ memoryRemap::$2 ]
reg byte a [ memoryRemap::$3 ]
reg byte a [ memoryRemap::$4 ]
reg byte a [ memoryRemap::$5 ]
zp[1]:8 [ memoryRemap::$6 ]
reg byte a [ memoryRemap::$7 ]
reg byte a [ memoryRemap::$8 ]
reg byte a [ memoryRemap::$9 ]
zp[4]:9 [ memoryRemap256M::$0 ]
reg byte a [ memoryRemap256M::$1 ]
zp[2]:13 [ memoryRemap256M::$7 memoryRemap::lowerPageOffset#2 memoryRemap::lowerPageOffset#0 memoryRemapBlock::pageOffset#0 ]
reg byte a [ memoryRemap256M::$5 ]
zp[1]:15 [ memoryRemap256M::$6 memoryRemap::$1 ]
reg byte a [ memoryRemap256M::$8 ]
reg byte a [ memoryRemap256M::$9 ]
reg byte a [ memoryRemap256M::$10 ]
reg byte a [ memoryRemap256M::$17 ]

View File

@ -1,7 +1,10 @@
// Raster65 Demo Implementation in C
// Based on RASTER65 assembler demo made by DEFT in 2015
// Raster65 Demo re-implementation in C by Jesper Gravgaard
// Based on RASTER65 assembler demo made in 2015 and updated in 2020 by DEFT
// https://mega.scryptos.com/sharefolder/MEGA/MEGA65+filehost
// https://www.forum64.de/index.php?thread/104591-xemu-vic-iv-implementation-update/&postID=1560511#post1560511
// MEGA65 Registers and Constants
// The MOS 6526 Complex Interface Adapter (CIA)
// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf
.cpu _45gs02
// MEGA65 platform executable starting in C64 mode.
.file [name="raster65.prg", type="prg", segments="Program"]
@ -64,14 +67,14 @@
.label VICIII = $d000
// The VIC IV
.label VICIV = $d000
// Color Ram
.label COLORRAM = $d800
// Palette RED
.label PALETTE_RED = $d100
// Palette GREEN
.label PALETTE_GREEN = $d200
// Palette BLUE
.label PALETTE_BLUE = $d300
// Color Ram
.label COLORRAM = $d800
// Default address of screen character matrix
.label DEFAULT_SCREEN = $400
// The CIA#1: keyboard matrix, joystick #1/#2
@ -215,7 +218,7 @@ irq: {
ldy #0
lda (scroll_ptr),y
inw.z scroll_ptr
// if(nxt==0)
// if(nxt == 0)
cmp #0
bne __b39
// scroll_ptr = SCROLL_TEXT

View File

@ -9,6 +9,9 @@ Resolved forward reference GREET_COUNT to (const nomodify byte) GREET_COUNT
Resolved forward reference PAL_GREEN to (const byte*) PAL_GREEN
Resolved forward reference GREETING to (const byte*) GREETING
Resolved forward reference SCROLL_TEXT to (const byte*) SCROLL_TEXT
Fixing struct type size struct F018_DMAGIC to 17
Fixing struct type SIZE_OF struct F018_DMAGIC to 17
Fixing struct type SIZE_OF struct F018_DMAGIC to 17
Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx
Inlined call call __init
@ -444,6 +447,31 @@ SYMBOL TABLE SSA
(const nomodify byte) CIA_INTERRUPT_CLEAR = (byte) $7f
(const nomodify byte*) COLORRAM = (byte*)(number) $d800
(const nomodify byte*) DEFAULT_SCREEN = (byte*)(number) $400
(byte) DMA_LIST_F018A::command
(word) DMA_LIST_F018A::count
(byte*) DMA_LIST_F018A::dest
(byte) DMA_LIST_F018A::dest_bank
(word) DMA_LIST_F018A::modulo
(byte*) DMA_LIST_F018A::src
(byte) DMA_LIST_F018A::src_bank
(byte) DMA_LIST_F018B::command
(word) DMA_LIST_F018B::count
(byte*) DMA_LIST_F018B::dest
(byte) DMA_LIST_F018B::dest_bank
(word) DMA_LIST_F018B::modulo
(byte*) DMA_LIST_F018B::src
(byte) DMA_LIST_F018B::src_bank
(byte) DMA_LIST_F018B::sub_command
(byte) F018_DMAGIC::ADDRBANK
(byte) F018_DMAGIC::ADDRLSB
(byte) F018_DMAGIC::ADDRLSBTRIG
(byte) F018_DMAGIC::ADDRMB
(byte) F018_DMAGIC::ADDRMSB
(byte) F018_DMAGIC::EN018B
(byte) F018_DMAGIC::ETRIG
(byte) F018_DMAGIC::MISC
(const byte*) F018_DMAGIC::UNUSED1[(number) 8] = { fill( 8, 0) }
(byte) F018_DMAGIC::UNUSED2
(const byte*) GREETING[] = (byte*) " DOUBLEFLASH ADTBM SY2002 TAYGER SERIOUSLY LIBI IN PARADIZE LGB BLUEWAYSW SAUSAGE BIT SHIFTER INDIOCOLIFA GRUMPYNINJA 0-LIMITS CHEVERON DR. COMMODORE "
(const nomodify byte) GREET_COUNT = (byte) $f
(const nomodify byte) GREET_ROW = (byte) $14
@ -1181,10 +1209,10 @@ Simplifying constant pointer cast (byte*) 1
Simplifying constant pointer cast (struct MOS6569_VICII*) 53248
Simplifying constant pointer cast (struct MOS4569_VICIII*) 53248
Simplifying constant pointer cast (struct MEGA65_VICIV*) 53248
Simplifying constant pointer cast (byte*) 55296
Simplifying constant pointer cast (byte*) 53504
Simplifying constant pointer cast (byte*) 53760
Simplifying constant pointer cast (byte*) 54016
Simplifying constant pointer cast (byte*) 55296
Simplifying constant pointer cast (byte*) 1024
Simplifying constant pointer cast (struct MOS6526_CIA*) 56320
Simplifying constant pointer cast (void()**) 65534
@ -1902,6 +1930,30 @@ memset::@2: scope:[memset] from memset::@1
VARIABLE REGISTER WEIGHTS
(byte) DMA_LIST_F018A::command
(word) DMA_LIST_F018A::count
(byte*) DMA_LIST_F018A::dest
(byte) DMA_LIST_F018A::dest_bank
(word) DMA_LIST_F018A::modulo
(byte*) DMA_LIST_F018A::src
(byte) DMA_LIST_F018A::src_bank
(byte) DMA_LIST_F018B::command
(word) DMA_LIST_F018B::count
(byte*) DMA_LIST_F018B::dest
(byte) DMA_LIST_F018B::dest_bank
(word) DMA_LIST_F018B::modulo
(byte*) DMA_LIST_F018B::src
(byte) DMA_LIST_F018B::src_bank
(byte) DMA_LIST_F018B::sub_command
(byte) F018_DMAGIC::ADDRBANK
(byte) F018_DMAGIC::ADDRLSB
(byte) F018_DMAGIC::ADDRLSBTRIG
(byte) F018_DMAGIC::ADDRMB
(byte) F018_DMAGIC::ADDRMSB
(byte) F018_DMAGIC::EN018B
(byte) F018_DMAGIC::ETRIG
(byte) F018_DMAGIC::MISC
(byte) F018_DMAGIC::UNUSED2
(byte) MEGA65_VICIV::ALPHADELAY
(byte) MEGA65_VICIV::B0PIX
(byte) MEGA65_VICIV::B0_ADDR
@ -2398,10 +2450,13 @@ Allocated zp[1]:38 [ irq::raster#0 ]
INITIAL ASM
Target platform is mega65_c64 / MEGA45GS02
// File Comments
// Raster65 Demo Implementation in C
// Based on RASTER65 assembler demo made by DEFT in 2015
// Raster65 Demo re-implementation in C by Jesper Gravgaard
// Based on RASTER65 assembler demo made in 2015 and updated in 2020 by DEFT
// https://mega.scryptos.com/sharefolder/MEGA/MEGA65+filehost
// https://www.forum64.de/index.php?thread/104591-xemu-vic-iv-implementation-update/&postID=1560511#post1560511
// MEGA65 Registers and Constants
// The MOS 6526 Complex Interface Adapter (CIA)
// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf
// Upstart
.cpu _45gs02
// MEGA65 platform executable starting in C64 mode.
@ -2466,14 +2521,14 @@ Target platform is mega65_c64 / MEGA45GS02
.label VICIII = $d000
// The VIC IV
.label VICIV = $d000
// Color Ram
.label COLORRAM = $d800
// Palette RED
.label PALETTE_RED = $d100
// Palette GREEN
.label PALETTE_GREEN = $d200
// Palette BLUE
.label PALETTE_BLUE = $d300
// Color Ram
.label COLORRAM = $d800
// Default address of screen character matrix
.label DEFAULT_SCREEN = $400
// The CIA#1: keyboard matrix, joystick #1/#2
@ -3533,6 +3588,9 @@ Uplift Scope [MOS6569_VICII]
Uplift Scope [MOS6581_SID]
Uplift Scope [MOS4569_VICIII]
Uplift Scope [MEGA65_VICIV]
Uplift Scope [F018_DMAGIC]
Uplift Scope [DMA_LIST_F018A]
Uplift Scope [DMA_LIST_F018B]
Uplift Scope [__start]
Uplifting [memset] best 18980 combination zp[2]:21 [ memset::dst#2 memset::dst#1 ]
@ -3543,6 +3601,9 @@ Uplifting [MOS6569_VICII] best 18560 combination
Uplifting [MOS6581_SID] best 18560 combination
Uplifting [MOS4569_VICIII] best 18560 combination
Uplifting [MEGA65_VICIV] best 18560 combination
Uplifting [F018_DMAGIC] best 18560 combination
Uplifting [DMA_LIST_F018A] best 18560 combination
Uplifting [DMA_LIST_F018B] best 18560 combination
Uplifting [__start] best 18560 combination
Attempting to uplift remaining variables inzp[1]:16 [ irq::barcol#4 irq::barcol#3 irq::barcol#0 irq::barcol#1 irq::barcol#2 ]
Uplifting [irq] best 17340 combination reg byte z [ irq::barcol#4 irq::barcol#3 irq::barcol#0 irq::barcol#1 irq::barcol#2 ]
@ -3615,10 +3676,13 @@ Allocated (was zp[1]:28) zp[1]:11 [ greet_idx ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Raster65 Demo Implementation in C
// Based on RASTER65 assembler demo made by DEFT in 2015
// Raster65 Demo re-implementation in C by Jesper Gravgaard
// Based on RASTER65 assembler demo made in 2015 and updated in 2020 by DEFT
// https://mega.scryptos.com/sharefolder/MEGA/MEGA65+filehost
// https://www.forum64.de/index.php?thread/104591-xemu-vic-iv-implementation-update/&postID=1560511#post1560511
// MEGA65 Registers and Constants
// The MOS 6526 Complex Interface Adapter (CIA)
// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf
// Upstart
.cpu _45gs02
// MEGA65 platform executable starting in C64 mode.
@ -3683,14 +3747,14 @@ ASSEMBLER BEFORE OPTIMIZATION
.label VICIII = $d000
// The VIC IV
.label VICIV = $d000
// Color Ram
.label COLORRAM = $d800
// Palette RED
.label PALETTE_RED = $d100
// Palette GREEN
.label PALETTE_GREEN = $d200
// Palette BLUE
.label PALETTE_BLUE = $d300
// Color Ram
.label COLORRAM = $d800
// Default address of screen character matrix
.label DEFAULT_SCREEN = $400
// The CIA#1: keyboard matrix, joystick #1/#2
@ -4580,15 +4644,40 @@ Removing instruction jmp __b5
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction ldy #0
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Fixing long branch [135] bne __b2 to beq
Fixing long branch [145] bcc __b17 to bcs
Fixing long branch [152] bne __b19 to beq
Fixing long branch [138] bne __b2 to beq
Fixing long branch [148] bcc __b17 to bcs
Fixing long branch [155] bne __b19 to beq
FINAL SYMBOL TABLE
(const nomodify struct MOS6526_CIA*) CIA1 = (struct MOS6526_CIA*) 56320
(const nomodify byte) CIA_INTERRUPT_CLEAR = (byte) $7f
(const nomodify byte*) COLORRAM = (byte*) 55296
(const nomodify byte*) DEFAULT_SCREEN = (byte*) 1024
(byte) DMA_LIST_F018A::command
(word) DMA_LIST_F018A::count
(byte*) DMA_LIST_F018A::dest
(byte) DMA_LIST_F018A::dest_bank
(word) DMA_LIST_F018A::modulo
(byte*) DMA_LIST_F018A::src
(byte) DMA_LIST_F018A::src_bank
(byte) DMA_LIST_F018B::command
(word) DMA_LIST_F018B::count
(byte*) DMA_LIST_F018B::dest
(byte) DMA_LIST_F018B::dest_bank
(word) DMA_LIST_F018B::modulo
(byte*) DMA_LIST_F018B::src
(byte) DMA_LIST_F018B::src_bank
(byte) DMA_LIST_F018B::sub_command
(byte) F018_DMAGIC::ADDRBANK
(byte) F018_DMAGIC::ADDRLSB
(byte) F018_DMAGIC::ADDRLSBTRIG
(byte) F018_DMAGIC::ADDRMB
(byte) F018_DMAGIC::ADDRMSB
(byte) F018_DMAGIC::EN018B
(byte) F018_DMAGIC::ETRIG
(byte) F018_DMAGIC::MISC
(const byte*) F018_DMAGIC::UNUSED1[(number) 8] = { fill( 8, 0) }
(byte) F018_DMAGIC::UNUSED2
(const byte*) GREETING[] = (byte*) " DOUBLEFLASH ADTBM SY2002 TAYGER SERIOUSLY LIBI IN PARADIZE LGB BLUEWAYSW SAUSAGE BIT SHIFTER INDIOCOLIFA GRUMPYNINJA 0-LIMITS CHEVERON DR. COMMODORE "
(const nomodify byte) GREET_COUNT = (byte) $f
(const nomodify byte) GREET_ROW = (byte) $14
@ -5121,10 +5210,13 @@ FINAL ASSEMBLER
Score: 9963
// File Comments
// Raster65 Demo Implementation in C
// Based on RASTER65 assembler demo made by DEFT in 2015
// Raster65 Demo re-implementation in C by Jesper Gravgaard
// Based on RASTER65 assembler demo made in 2015 and updated in 2020 by DEFT
// https://mega.scryptos.com/sharefolder/MEGA/MEGA65+filehost
// https://www.forum64.de/index.php?thread/104591-xemu-vic-iv-implementation-update/&postID=1560511#post1560511
// MEGA65 Registers and Constants
// The MOS 6526 Complex Interface Adapter (CIA)
// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf
// Upstart
.cpu _45gs02
// MEGA65 platform executable starting in C64 mode.
@ -5189,14 +5281,14 @@ Score: 9963
.label VICIII = $d000
// The VIC IV
.label VICIV = $d000
// Color Ram
.label COLORRAM = $d800
// Palette RED
.label PALETTE_RED = $d100
// Palette GREEN
.label PALETTE_GREEN = $d200
// Palette BLUE
.label PALETTE_BLUE = $d300
// Color Ram
.label COLORRAM = $d800
// Default address of screen character matrix
.label DEFAULT_SCREEN = $400
// The CIA#1: keyboard matrix, joystick #1/#2
@ -5406,7 +5498,7 @@ irq: {
lda (scroll_ptr),y
// [36] (volatile byte*) scroll_ptr ← ++ (volatile byte*) scroll_ptr -- pbuz1=_inc_pbuz1
inw.z scroll_ptr
// if(nxt==0)
// if(nxt == 0)
// [37] if((byte) irq::nxt#0!=(byte) 0) goto irq::@39 -- vbuaa_neq_0_then_la1
cmp #0
bne __b39

View File

@ -2,6 +2,31 @@
(const nomodify byte) CIA_INTERRUPT_CLEAR = (byte) $7f
(const nomodify byte*) COLORRAM = (byte*) 55296
(const nomodify byte*) DEFAULT_SCREEN = (byte*) 1024
(byte) DMA_LIST_F018A::command
(word) DMA_LIST_F018A::count
(byte*) DMA_LIST_F018A::dest
(byte) DMA_LIST_F018A::dest_bank
(word) DMA_LIST_F018A::modulo
(byte*) DMA_LIST_F018A::src
(byte) DMA_LIST_F018A::src_bank
(byte) DMA_LIST_F018B::command
(word) DMA_LIST_F018B::count
(byte*) DMA_LIST_F018B::dest
(byte) DMA_LIST_F018B::dest_bank
(word) DMA_LIST_F018B::modulo
(byte*) DMA_LIST_F018B::src
(byte) DMA_LIST_F018B::src_bank
(byte) DMA_LIST_F018B::sub_command
(byte) F018_DMAGIC::ADDRBANK
(byte) F018_DMAGIC::ADDRLSB
(byte) F018_DMAGIC::ADDRLSBTRIG
(byte) F018_DMAGIC::ADDRMB
(byte) F018_DMAGIC::ADDRMSB
(byte) F018_DMAGIC::EN018B
(byte) F018_DMAGIC::ETRIG
(byte) F018_DMAGIC::MISC
(const byte*) F018_DMAGIC::UNUSED1[(number) 8] = { fill( 8, 0) }
(byte) F018_DMAGIC::UNUSED2
(const byte*) GREETING[] = (byte*) " DOUBLEFLASH ADTBM SY2002 TAYGER SERIOUSLY LIBI IN PARADIZE LGB BLUEWAYSW SAUSAGE BIT SHIFTER INDIOCOLIFA GRUMPYNINJA 0-LIMITS CHEVERON DR. COMMODORE "
(const nomodify byte) GREET_COUNT = (byte) $f
(const nomodify byte) GREET_ROW = (byte) $14

View File

@ -1,4 +1,7 @@
// Hello World for MEGA 65 - putting chars directly to the screen
// Test a few VIC 3/4 features
// MEGA65 Registers and Constants
// The MOS 6526 Complex Interface Adapter (CIA)
// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf
.cpu _45gs02
// MEGA65 platform PRG executable starting in MEGA65 mode.
.file [name="test-vic4.prg", type="prg", segments="Program"]
@ -13,10 +16,14 @@
.byte $00, $00, $00 //
// Map 2nd KB of colour RAM $DC00-$DFFF (hiding CIA's)
.const CRAM2K = 1
.const OFFSET_STRUCT_MOS6569_VICII_RASTER = $12
.const OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR = $20
// I/O Personality selection
.label IO_KEY = $d02f
// C65 Banking Register
.label IO_BANK = $d030
// The VIC-II MOS 6567/6569
.label VICII = $d000
.label SCREEN = $800
.label COLORS = $d800
.segment Code
@ -74,8 +81,11 @@ main: {
cmp #<COLORS+$7d0
bcc __b4
!:
// }
rts
__b5:
// VICII->BORDER_COLOR = VICII->RASTER
lda VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER
sta VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR
jmp __b5
__b4:
// <col
lda.z col

View File

@ -13,10 +13,10 @@ main::@1: scope:[main] from main main::@2
main::@3: scope:[main] from main::@1 main::@4
[6] (byte*) main::col#2 ← phi( main::@1/(const nomodify byte*) COLORS main::@4/(byte*) main::col#1 )
[7] if((byte*) main::col#2<(const nomodify byte*) COLORS+(word) $7d0) goto main::@4
to:main::@return
main::@return: scope:[main] from main::@3
[8] return
to:@return
to:main::@5
main::@5: scope:[main] from main::@3 main::@5
[8] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) ← *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_RASTER)
to:main::@5
main::@4: scope:[main] from main::@3
[9] (byte~) main::$2 ← < (byte*) main::col#2
[10] *((byte*) main::col#2) ← (byte~) main::$2

View File

@ -1,3 +1,6 @@
Fixing struct type size struct F018_DMAGIC to 17
Fixing struct type SIZE_OF struct F018_DMAGIC to 17
Fixing struct type SIZE_OF struct F018_DMAGIC to 17
Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx
CONTROL FLOW GRAPH SSA
@ -27,14 +30,17 @@ main::@4: scope:[main] from main::@3 main::@5
(byte*) main::col#2 ← phi( main::@3/(byte*) main::col#0 main::@5/(byte*) main::col#1 )
(bool~) main::$1 ← (byte*) main::col#2 < (const nomodify byte*) COLORS+(number) $7d0
if((bool~) main::$1) goto main::@5
to:main::@return
to:main::@6
main::@5: scope:[main] from main::@4
(byte*) main::col#3 ← phi( main::@4/(byte*) main::col#2 )
(byte~) main::$2 ← < (byte*) main::col#3
*((byte*) main::col#3) ← (byte~) main::$2
(byte*) main::col#1 ← ++ (byte*) main::col#3
to:main::@4
main::@return: scope:[main] from main::@4
main::@6: scope:[main] from main::@4 main::@6
*((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) ← *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_RASTER)
to:main::@6
main::@return: scope:[main] from
return
to:@return
@ -51,6 +57,31 @@ __start::@return: scope:[__start] from __start::@1
SYMBOL TABLE SSA
(const nomodify byte*) COLORS = (byte*)(number) $d800
(const nomodify byte) CRAM2K = (byte) 1
(byte) DMA_LIST_F018A::command
(word) DMA_LIST_F018A::count
(byte*) DMA_LIST_F018A::dest
(byte) DMA_LIST_F018A::dest_bank
(word) DMA_LIST_F018A::modulo
(byte*) DMA_LIST_F018A::src
(byte) DMA_LIST_F018A::src_bank
(byte) DMA_LIST_F018B::command
(word) DMA_LIST_F018B::count
(byte*) DMA_LIST_F018B::dest
(byte) DMA_LIST_F018B::dest_bank
(word) DMA_LIST_F018B::modulo
(byte*) DMA_LIST_F018B::src
(byte) DMA_LIST_F018B::src_bank
(byte) DMA_LIST_F018B::sub_command
(byte) F018_DMAGIC::ADDRBANK
(byte) F018_DMAGIC::ADDRLSB
(byte) F018_DMAGIC::ADDRLSBTRIG
(byte) F018_DMAGIC::ADDRMB
(byte) F018_DMAGIC::ADDRMSB
(byte) F018_DMAGIC::EN018B
(byte) F018_DMAGIC::ETRIG
(byte) F018_DMAGIC::MISC
(const byte*) F018_DMAGIC::UNUSED1[(number) 8] = { fill( 8, 0) }
(byte) F018_DMAGIC::UNUSED2
(const nomodify to_volatile byte*) IO_BANK = (byte*)(number) $d030
(const nomodify to_volatile byte*) IO_KEY = (byte*)(number) $d02f
(byte) MEGA65_VICIV::ALPHADELAY
@ -337,7 +368,10 @@ SYMBOL TABLE SSA
(byte) MOS6581_SID::POT_X
(byte) MOS6581_SID::POT_Y
(byte) MOS6581_SID::VOLUME_FILTER_MODE
(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR = (byte) $20
(const byte) OFFSET_STRUCT_MOS6569_VICII_RASTER = (byte) $12
(const nomodify byte*) SCREEN = (byte*)(number) $800
(const nomodify struct MOS6569_VICII*) VICII = (struct MOS6569_VICII*)(number) $d000
(void()) __start()
(label) __start::@1
(label) __start::@return
@ -350,6 +384,7 @@ SYMBOL TABLE SSA
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@6
(label) main::@return
(byte*) main::col
(byte*) main::col#0
@ -372,6 +407,7 @@ Inlining cast *((const nomodify to_volatile byte*) IO_KEY) ← (unumber)(number)
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (byte*) 53295
Simplifying constant pointer cast (byte*) 53296
Simplifying constant pointer cast (struct MOS6569_VICII*) 53248
Simplifying constant pointer cast (byte*) 2048
Simplifying constant pointer cast (byte*) 55296
Simplifying constant integer cast $47
@ -393,6 +429,8 @@ Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte*) main::sc#0 = SCREEN
Constant (const byte*) main::col#0 = COLORS
Successful SSA optimization Pass2ConstantIdentification
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Removing unused procedure __start
Removing unused procedure block __start
Removing unused procedure block __start::@1
@ -413,6 +451,7 @@ Coalesced down to 2 phi equivalence classes
Culled Empty Block (label) main::@3
Renumbering block main::@4 to main::@3
Renumbering block main::@5 to main::@4
Renumbering block main::@6 to main::@5
FINAL CONTROL FLOW GRAPH
@ -430,10 +469,10 @@ main::@1: scope:[main] from main main::@2
main::@3: scope:[main] from main::@1 main::@4
[6] (byte*) main::col#2 ← phi( main::@1/(const nomodify byte*) COLORS main::@4/(byte*) main::col#1 )
[7] if((byte*) main::col#2<(const nomodify byte*) COLORS+(word) $7d0) goto main::@4
to:main::@return
main::@return: scope:[main] from main::@3
[8] return
to:@return
to:main::@5
main::@5: scope:[main] from main::@3 main::@5
[8] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) ← *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_RASTER)
to:main::@5
main::@4: scope:[main] from main::@3
[9] (byte~) main::$2 ← < (byte*) main::col#2
[10] *((byte*) main::col#2) ← (byte~) main::$2
@ -446,6 +485,30 @@ main::@2: scope:[main] from main::@1
VARIABLE REGISTER WEIGHTS
(byte) DMA_LIST_F018A::command
(word) DMA_LIST_F018A::count
(byte*) DMA_LIST_F018A::dest
(byte) DMA_LIST_F018A::dest_bank
(word) DMA_LIST_F018A::modulo
(byte*) DMA_LIST_F018A::src
(byte) DMA_LIST_F018A::src_bank
(byte) DMA_LIST_F018B::command
(word) DMA_LIST_F018B::count
(byte*) DMA_LIST_F018B::dest
(byte) DMA_LIST_F018B::dest_bank
(word) DMA_LIST_F018B::modulo
(byte*) DMA_LIST_F018B::src
(byte) DMA_LIST_F018B::src_bank
(byte) DMA_LIST_F018B::sub_command
(byte) F018_DMAGIC::ADDRBANK
(byte) F018_DMAGIC::ADDRLSB
(byte) F018_DMAGIC::ADDRLSBTRIG
(byte) F018_DMAGIC::ADDRMB
(byte) F018_DMAGIC::ADDRMSB
(byte) F018_DMAGIC::EN018B
(byte) F018_DMAGIC::ETRIG
(byte) F018_DMAGIC::MISC
(byte) F018_DMAGIC::UNUSED2
(byte) MEGA65_VICIV::ALPHADELAY
(byte) MEGA65_VICIV::B0PIX
(byte) MEGA65_VICIV::B0_ADDR
@ -754,7 +817,10 @@ Allocated zp[1]:6 [ main::$2 ]
INITIAL ASM
Target platform is mega65 / MEGA45GS02
// File Comments
// Hello World for MEGA 65 - putting chars directly to the screen
// Test a few VIC 3/4 features
// MEGA65 Registers and Constants
// The MOS 6526 Complex Interface Adapter (CIA)
// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf
// Upstart
.cpu _45gs02
// MEGA65 platform PRG executable starting in MEGA65 mode.
@ -771,10 +837,14 @@ Target platform is mega65 / MEGA45GS02
// Global Constants & labels
// Map 2nd KB of colour RAM $DC00-$DFFF (hiding CIA's)
.const CRAM2K = 1
.const OFFSET_STRUCT_MOS6569_VICII_RASTER = $12
.const OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR = $20
// I/O Personality selection
.label IO_KEY = $d02f
// C65 Banking Register
.label IO_BANK = $d030
// The VIC-II MOS 6567/6569
.label VICII = $d000
.label SCREEN = $800
.label COLORS = $d800
.segment Code
@ -844,11 +914,13 @@ main: {
cmp #<COLORS+$7d0
bcc __b4
!:
jmp __breturn
// main::@return
__breturn:
// [8] return
rts
jmp __b5
// main::@5
__b5:
// [8] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) ← *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_RASTER) -- _deref_pbuc1=_deref_pbuc2
lda VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER
sta VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR
jmp __b5
// main::@4
__b4:
// [9] (byte~) main::$2 ← < (byte*) main::col#2 -- vbuz1=_lo_pbuz2
@ -886,6 +958,7 @@ Statement [2] *((const nomodify to_volatile byte*) IO_KEY) ← (byte) $53 [ ] (
Statement [3] *((const nomodify to_volatile byte*) IO_BANK) ← *((const nomodify to_volatile byte*) IO_BANK) | (const nomodify byte) CRAM2K [ ] ( [ ] { } ) always clobbers reg byte a
Statement [5] if((byte*) main::sc#2<(const nomodify byte*) SCREEN+(word) $7d0) goto main::@2 [ main::sc#2 ] ( [ main::sc#2 ] { } ) always clobbers reg byte a
Statement [7] if((byte*) main::col#2<(const nomodify byte*) COLORS+(word) $7d0) goto main::@4 [ main::col#2 ] ( [ main::col#2 ] { } ) always clobbers reg byte a
Statement [8] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) ← *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_RASTER) [ ] ( [ ] { } ) always clobbers reg byte a
Statement [10] *((byte*) main::col#2) ← (byte~) main::$2 [ main::col#2 ] ( [ main::col#2 ] { } ) always clobbers reg byte y
Statement [12] *((byte*) main::sc#2) ← (byte) '*' [ main::sc#2 ] ( [ main::sc#2 ] { } ) always clobbers reg byte a reg byte y
Potential registers zp[2]:2 [ main::sc#2 main::sc#1 ] : zp[2]:2 ,
@ -899,19 +972,28 @@ Uplift Scope [MOS6569_VICII]
Uplift Scope [MOS6581_SID]
Uplift Scope [MOS4569_VICIII]
Uplift Scope [MEGA65_VICIV]
Uplift Scope [F018_DMAGIC]
Uplift Scope [DMA_LIST_F018A]
Uplift Scope [DMA_LIST_F018B]
Uplift Scope []
Uplifting [main] best 1050 combination zp[2]:2 [ main::sc#2 main::sc#1 ] zp[2]:4 [ main::col#2 main::col#1 ] reg byte a [ main::$2 ]
Uplifting [MOS6526_CIA] best 1050 combination
Uplifting [MOS6569_VICII] best 1050 combination
Uplifting [MOS6581_SID] best 1050 combination
Uplifting [MOS4569_VICIII] best 1050 combination
Uplifting [MEGA65_VICIV] best 1050 combination
Uplifting [] best 1050 combination
Uplifting [main] best 1154 combination zp[2]:2 [ main::sc#2 main::sc#1 ] zp[2]:4 [ main::col#2 main::col#1 ] reg byte a [ main::$2 ]
Uplifting [MOS6526_CIA] best 1154 combination
Uplifting [MOS6569_VICII] best 1154 combination
Uplifting [MOS6581_SID] best 1154 combination
Uplifting [MOS4569_VICIII] best 1154 combination
Uplifting [MEGA65_VICIV] best 1154 combination
Uplifting [F018_DMAGIC] best 1154 combination
Uplifting [DMA_LIST_F018A] best 1154 combination
Uplifting [DMA_LIST_F018B] best 1154 combination
Uplifting [] best 1154 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Hello World for MEGA 65 - putting chars directly to the screen
// Test a few VIC 3/4 features
// MEGA65 Registers and Constants
// The MOS 6526 Complex Interface Adapter (CIA)
// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf
// Upstart
.cpu _45gs02
// MEGA65 platform PRG executable starting in MEGA65 mode.
@ -928,10 +1010,14 @@ ASSEMBLER BEFORE OPTIMIZATION
// Global Constants & labels
// Map 2nd KB of colour RAM $DC00-$DFFF (hiding CIA's)
.const CRAM2K = 1
.const OFFSET_STRUCT_MOS6569_VICII_RASTER = $12
.const OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR = $20
// I/O Personality selection
.label IO_KEY = $d02f
// C65 Banking Register
.label IO_BANK = $d030
// The VIC-II MOS 6567/6569
.label VICII = $d000
.label SCREEN = $800
.label COLORS = $d800
.segment Code
@ -1000,11 +1086,13 @@ main: {
cmp #<COLORS+$7d0
bcc __b4
!:
jmp __breturn
// main::@return
__breturn:
// [8] return
rts
jmp __b5
// main::@5
__b5:
// [8] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) ← *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_RASTER) -- _deref_pbuc1=_deref_pbuc2
lda VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER
sta VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR
jmp __b5
// main::@4
__b4:
// [9] (byte~) main::$2 ← < (byte*) main::col#2 -- vbuaa=_lo_pbuz1
@ -1036,11 +1124,10 @@ main: {
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __b3
Removing instruction jmp __breturn
Removing instruction jmp __b5
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __b1_from_main:
Removing instruction __b3_from___b1:
Removing instruction __breturn:
Removing instruction __b3_from___b4:
Removing instruction __b1_from___b2:
Succesful ASM optimization Pass5UnusedLabelElimination
@ -1048,6 +1135,31 @@ Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
(const nomodify byte*) COLORS = (byte*) 55296
(const nomodify byte) CRAM2K = (byte) 1
(byte) DMA_LIST_F018A::command
(word) DMA_LIST_F018A::count
(byte*) DMA_LIST_F018A::dest
(byte) DMA_LIST_F018A::dest_bank
(word) DMA_LIST_F018A::modulo
(byte*) DMA_LIST_F018A::src
(byte) DMA_LIST_F018A::src_bank
(byte) DMA_LIST_F018B::command
(word) DMA_LIST_F018B::count
(byte*) DMA_LIST_F018B::dest
(byte) DMA_LIST_F018B::dest_bank
(word) DMA_LIST_F018B::modulo
(byte*) DMA_LIST_F018B::src
(byte) DMA_LIST_F018B::src_bank
(byte) DMA_LIST_F018B::sub_command
(byte) F018_DMAGIC::ADDRBANK
(byte) F018_DMAGIC::ADDRLSB
(byte) F018_DMAGIC::ADDRLSBTRIG
(byte) F018_DMAGIC::ADDRMB
(byte) F018_DMAGIC::ADDRMSB
(byte) F018_DMAGIC::EN018B
(byte) F018_DMAGIC::ETRIG
(byte) F018_DMAGIC::MISC
(const byte*) F018_DMAGIC::UNUSED1[(number) 8] = { fill( 8, 0) }
(byte) F018_DMAGIC::UNUSED2
(const nomodify to_volatile byte*) IO_BANK = (byte*) 53296
(const nomodify to_volatile byte*) IO_KEY = (byte*) 53295
(byte) MEGA65_VICIV::ALPHADELAY
@ -1334,14 +1446,17 @@ FINAL SYMBOL TABLE
(byte) MOS6581_SID::POT_X
(byte) MOS6581_SID::POT_Y
(byte) MOS6581_SID::VOLUME_FILTER_MODE
(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR = (byte) $20
(const byte) OFFSET_STRUCT_MOS6569_VICII_RASTER = (byte) $12
(const nomodify byte*) SCREEN = (byte*) 2048
(const nomodify struct MOS6569_VICII*) VICII = (struct MOS6569_VICII*) 53248
(void()) main()
(byte~) main::$2 reg byte a 22.0
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@return
(label) main::@5
(byte*) main::col
(byte*) main::col#1 col zp[2]:4 22.0
(byte*) main::col#2 col zp[2]:4 13.75
@ -1355,10 +1470,13 @@ reg byte a [ main::$2 ]
FINAL ASSEMBLER
Score: 960
Score: 1064
// File Comments
// Hello World for MEGA 65 - putting chars directly to the screen
// Test a few VIC 3/4 features
// MEGA65 Registers and Constants
// The MOS 6526 Complex Interface Adapter (CIA)
// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf
// Upstart
.cpu _45gs02
// MEGA65 platform PRG executable starting in MEGA65 mode.
@ -1375,10 +1493,14 @@ Score: 960
// Global Constants & labels
// Map 2nd KB of colour RAM $DC00-$DFFF (hiding CIA's)
.const CRAM2K = 1
.const OFFSET_STRUCT_MOS6569_VICII_RASTER = $12
.const OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR = $20
// I/O Personality selection
.label IO_KEY = $d02f
// C65 Banking Register
.label IO_BANK = $d030
// The VIC-II MOS 6567/6569
.label VICII = $d000
.label SCREEN = $800
.label COLORS = $d800
.segment Code
@ -1449,10 +1571,13 @@ main: {
cmp #<COLORS+$7d0
bcc __b4
!:
// main::@return
// }
// [8] return
rts
// main::@5
__b5:
// VICII->BORDER_COLOR = VICII->RASTER
// [8] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR) ← *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_RASTER) -- _deref_pbuc1=_deref_pbuc2
lda VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER
sta VICII+OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR
jmp __b5
// main::@4
__b4:
// <col

View File

@ -1,5 +1,30 @@
(const nomodify byte*) COLORS = (byte*) 55296
(const nomodify byte) CRAM2K = (byte) 1
(byte) DMA_LIST_F018A::command
(word) DMA_LIST_F018A::count
(byte*) DMA_LIST_F018A::dest
(byte) DMA_LIST_F018A::dest_bank
(word) DMA_LIST_F018A::modulo
(byte*) DMA_LIST_F018A::src
(byte) DMA_LIST_F018A::src_bank
(byte) DMA_LIST_F018B::command
(word) DMA_LIST_F018B::count
(byte*) DMA_LIST_F018B::dest
(byte) DMA_LIST_F018B::dest_bank
(word) DMA_LIST_F018B::modulo
(byte*) DMA_LIST_F018B::src
(byte) DMA_LIST_F018B::src_bank
(byte) DMA_LIST_F018B::sub_command
(byte) F018_DMAGIC::ADDRBANK
(byte) F018_DMAGIC::ADDRLSB
(byte) F018_DMAGIC::ADDRLSBTRIG
(byte) F018_DMAGIC::ADDRMB
(byte) F018_DMAGIC::ADDRMSB
(byte) F018_DMAGIC::EN018B
(byte) F018_DMAGIC::ETRIG
(byte) F018_DMAGIC::MISC
(const byte*) F018_DMAGIC::UNUSED1[(number) 8] = { fill( 8, 0) }
(byte) F018_DMAGIC::UNUSED2
(const nomodify to_volatile byte*) IO_BANK = (byte*) 53296
(const nomodify to_volatile byte*) IO_KEY = (byte*) 53295
(byte) MEGA65_VICIV::ALPHADELAY
@ -286,14 +311,17 @@
(byte) MOS6581_SID::POT_X
(byte) MOS6581_SID::POT_Y
(byte) MOS6581_SID::VOLUME_FILTER_MODE
(const byte) OFFSET_STRUCT_MOS6569_VICII_BORDER_COLOR = (byte) $20
(const byte) OFFSET_STRUCT_MOS6569_VICII_RASTER = (byte) $12
(const nomodify byte*) SCREEN = (byte*) 2048
(const nomodify struct MOS6569_VICII*) VICII = (struct MOS6569_VICII*) 53248
(void()) main()
(byte~) main::$2 reg byte a 22.0
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@return
(label) main::@5
(byte*) main::col
(byte*) main::col#1 col zp[2]:4 22.0
(byte*) main::col#2 col zp[2]:4 13.75