1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-26 12:49:21 +00:00

Updated reference manual. Added better MEGA65 DMA tests.

This commit is contained in:
jespergravgaard 2020-09-26 13:30:48 +02:00
parent 6e206d25a3
commit ce2dfe62b6
29 changed files with 7044 additions and 933 deletions

View File

@ -2247,3 +2247,44 @@ lda #<{c2}
sta {c1}
lda #>{c2}
sta {c1}+1
//FRAGMENT _deref_pbuc1=_inc__deref_pbuc1
inc {c1}
//FRAGMENT _deref_pbuc1_eq_vbuz1_then_la1
lda {c1}
cmp {z1}
beq {la1}
//FRAGMENT _deref_pbuc1=_dec__deref_pbuc1
dec {c1}
//FRAGMENT pbuc1_derefidx_vbuz1=_inc_pbuc1_derefidx_vbuz1
ldx {z1}
inc {c1},x
//FRAGMENT vwuz1=vwuc1
lda #<{c1}
sta {z1}
lda #>{c1}
sta {z1}+1
//FRAGMENT _deref_pbuc1_eq_vbuaa_then_la1
cmp {c1}
beq {la1}
//FRAGMENT pbuc1_derefidx_vbuaa=_inc_pbuc1_derefidx_vbuaa
tax
inc {c1},x
//FRAGMENT pbuc1_derefidx_vbuxx=_inc_pbuc1_derefidx_vbuxx
inc {c1},x
//FRAGMENT pbuc1_derefidx_vbuyy=_inc_pbuc1_derefidx_vbuyy
lda {c1},y
inc
sta {c1},y
//FRAGMENT pbuc1_derefidx_vbuzz=_inc_pbuc1_derefidx_vbuzz
tza
tax
inc {c1},x
//FRAGMENT _deref_pbuc1_eq_vbuxx_then_la1
cpx {c1}
beq {la1}
//FRAGMENT _deref_pbuc1_eq_vbuyy_then_la1
cpy {c1}
beq {la1}
//FRAGMENT _deref_pbuc1_eq_vbuzz_then_la1
cpz {c1}
beq {la1}

View File

@ -2,37 +2,28 @@
#include <mega65.h>
// Copy a memory block within the first 64K memory space using MEGA65 DMagic DMA
// Copies the values of num bytes from the location pointed to by source directly
// to the memory block pointed to by destination.
// The underlying type of the objects pointed to by both the source and destination pointers
// are irrelevant for this function; The result is a binary copy of the data.
void memcpy_dma(void* dest, void* src, unsigned int num) {
// Remember current F018 A/B mode
char dmaMode = DMA->EN018B;
// Set up command
memcpy_dma_command.count = num;
memcpy_dma_command.src = src;
memcpy_dma_command.dest = dest;
// Set F018B mode
DMA->EN018B = 1;
// Set address of DMA list
DMA->ADDRMB = 0;
DMA->ADDRBANK = 0;
DMA-> ADDRMSB = >&memcpy_dma_command;
// Trigger the DMA (without option lists)
DMA-> ADDRLSBTRIG = <&memcpy_dma_command;
// Re-enable F018A mode
DMA->EN018B = dmaMode;
}
// Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination.
// - dest The destination address (within the MB and bank)
// - src The source address (within the MB and bank)
// - num The number of bytes to copy
void memcpy_dma(void* dest, void* src, unsigned int num);
// DMA list entry for copying data
struct DMA_LIST_F018B memcpy_dma_command = {
DMA_COMMAND_COPY, // command
0, // count
0, // source
0, // source bank
0, // destination
0, // destination bank
0, // sub-command
0 // modulo-value
};
// Copy a memory block anywhere in first 4MB memory space using MEGA65 DMagic DMA
// Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination.
// - dest_bank The 64KB bank for the destination (0-63)
// - dest The destination address (within the MB and bank)
// - src_bank The 64KB bank for the source (0-63)
// - src The source address (within the MB and bank)
// - num The number of bytes to copy
void memcpy_dma4(char dest_bank, void* dest, char src_bank, void* src, unsigned int num);
// Copy a memory block anywhere in the entire 256MB memory space using MEGA65 DMagic DMA
// Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination.
// - dest_mb The MB value for the destination (0-255)
// - dest_bank The 64KB bank for the destination (0-15)
// - dest The destination address (within the MB and bank)
// - src_mb The MB value for the source (0-255)
// - src_bank The 64KB bank for the source (0-15)
// - src The source address (within the MB and bank)
// - num The number of bytes to copy
void memcpy_dma256(char dest_mb, char dest_bank, void* dest, char src_mb, char src_bank, void* src, unsigned int num);

View File

@ -55,7 +55,7 @@ struct DMA_LIST_F018A {
// 6 src direction
// 5 src modulo
// 4 src hold
// 0-3 address bank
// 0-3 address bank (which 64k bank is the address in)
char src_bank;
// Destination address
char* dest;
@ -65,7 +65,7 @@ struct DMA_LIST_F018A {
// 6 dest direction
// 5 dest modulo
// 4 dest hold
// 0-3 address bank
// 0-3 address bank (which 64k bank is the address in)
char dest_bank;
// Modulo value (unused)
unsigned int modulo;
@ -88,14 +88,14 @@ struct DMA_LIST_F018B {
// Source address bank
// bits
// 7 src I/O
// 0-6 dest address bank
// 0-6 dest address bank (which 64k bank is the address in)
char src_bank;
// Destination address
char* dest;
// Destination address bank
// bits
// 7 dest I/O
// 0-6 dest address bank
// 0-6 dest address bank (which 64k bank is the address in)
char dest_bank;
// Sub-command
// bits
@ -119,17 +119,30 @@ 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
const char DMA_OPTION_END = 0x00;
// $06 = Use $86 $xx transparency value (don't write source bytes to destination, if byte value matches $xx)
const char DMA_OPTION_TRANSPARENCY_ENABLE = 0x06;
// $07 = Disable $86 $xx transparency value.
const char DMA_OPTION_TRANSPARENCY_DISABLE = 0x07;
// $0A = Use F018A list format
const char DMA_OPTION_FORMAT_F018A = 0x0a;
// $0B = Use F018B list format
const char DMA_OPTION_FORMAT_F018B = 0x0a;
// $80 $xx = Set MB of source address
const char DMA_OPTION_SRC_MB = 0x80;
// $81 $xx = Set MB of destination address
const char DMA_OPTION_DEST_MB = 0x81;
// $82 $xx = Set source skip rate (/256ths of bytes)
const char DMA_OPTION_SRC_SKIPRATE_256TH = 0x82;
// $83 $xx = Set source skip rate (whole bytes)
const char DMA_OPTION_SRC_SKIPRATE = 0x83;
// $84 $xx = Set destination skip rate (/256ths of bytes)
const char DMA_OPTION_DEST_SKIPRATE_256TH = 0x84;
// $85 $xx = Set destination skip rate (whole bytes)
const char DMA_OPTION_DEST_SKIPRATE = 0x85;
// $86 $xx = Don't write to destination if byte value = $xx, and option $06 enabled
const char DMA_OPTION_TRANSPARENCY_VALUE = 0x86;

View File

@ -47,38 +47,14 @@ const unsigned char MEMORYBLOCK_E000 = 0b10000000;
// - 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
}
}
void memoryRemap(unsigned char remapBlocks, unsigned int lowerPageOffset, unsigned int upperPageOffset);
// 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);
}
void memoryRemapBlock(unsigned char blockPage, unsigned int memoryPage);
// 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.
@ -105,30 +81,4 @@ void memoryRemapBlock(unsigned char blockPage, unsigned int memoryPage) {
// - 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
}
}
void memoryRemap256M(unsigned char remapBlocks, unsigned long lowerPageOffset, unsigned long upperPageOffset);

View File

@ -0,0 +1,129 @@
// Functions for using the F018 DMA for very fast copying or filling of memory
#include <mega65-dma.h>
// Copy a memory block within the first 64K memory space using MEGA65 DMagic DMA
// Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination.
// - dest The destination address (within the MB and bank)
// - src The source address (within the MB and bank)
// - num The number of bytes to copy
void memcpy_dma(void* dest, void* src, unsigned int num) {
// Remember current F018 A/B mode
char dmaMode = DMA->EN018B;
// Set up command
memcpy_dma_command.count = num;
memcpy_dma_command.src = src;
memcpy_dma_command.dest = dest;
// Set F018B mode
DMA->EN018B = 1;
// Set address of DMA list
DMA->ADDRMB = 0;
DMA->ADDRBANK = 0;
DMA-> ADDRMSB = >&memcpy_dma_command;
// Trigger the DMA (without option lists)
DMA-> ADDRLSBTRIG = <&memcpy_dma_command;
// Re-enable F018A mode
DMA->EN018B = dmaMode;
}
// DMA list entry for copying data
struct DMA_LIST_F018B memcpy_dma_command = {
DMA_COMMAND_COPY, // command
0, // count
0, // source
0, // source bank
0, // destination
0, // destination bank
0, // sub-command
0 // modulo-value
};
// Copy a memory block anywhere in first 4MB memory space using MEGA65 DMagic DMA
// Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination.
// - dest_bank The 64KB bank for the destination (0-63)
// - dest The destination address (within the MB and bank)
// - src_bank The 64KB bank for the source (0-63)
// - src The source address (within the MB and bank)
// - num The number of bytes to copy
void memcpy_dma4(char dest_bank, void* dest, char src_bank, void* src, unsigned int num) {
// Remember current F018 A/B mode
char dmaMode = DMA->EN018B;
// Set up command
memcpy_dma_command4.count = num;
memcpy_dma_command4.src_bank = src_bank;
memcpy_dma_command4.src = src;
memcpy_dma_command4.dest_bank = dest_bank;
memcpy_dma_command4.dest = dest;
// Set F018B mode
DMA->EN018B = 1;
// Set address of DMA list
DMA->ADDRMB = 0;
DMA->ADDRBANK = 0;
DMA-> ADDRMSB = >&memcpy_dma_command4;
// Trigger the DMA (without option lists)
DMA-> ADDRLSBTRIG = <&memcpy_dma_command4;
// Re-enable F018A mode
DMA->EN018B = dmaMode;
}
// DMA list entry for copying data in the 1MB memory space
struct DMA_LIST_F018B memcpy_dma_command4 = {
DMA_COMMAND_COPY, // command
0, // count
0, // source
0, // source bank
0, // destination
0, // destination bank
0, // sub-command
0 // modulo-value
};
// Copy a memory block anywhere in the entire 256MB memory space using MEGA65 DMagic DMA
// Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination.
// - dest_mb The MB value for the destination (0-255)
// - dest_bank The 64KB bank for the destination (0-15)
// - dest The destination address (within the MB and bank)
// - src_mb The MB value for the source (0-255)
// - src_bank The 64KB bank for the source (0-15)
// - src The source address (within the MB and bank)
// - num The number of bytes to copy
void memcpy_dma256(char dest_mb, char dest_bank, void* dest, char src_mb, char src_bank, void* src, unsigned int num) {
// Remember current F018 A/B mode
char dmaMode = DMA->EN018B;
// Set up command
memcpy_dma_command256[1] = src_mb;
memcpy_dma_command256[3] = dest_mb;
struct DMA_LIST_F018B * f018b = (struct DMA_LIST_F018B *)(&memcpy_dma_command256[6]);
f018b->count = num;
f018b->src_bank = src_bank;
f018b->src = src;
f018b->dest_bank = dest_bank;
f018b->dest = dest;
// Set F018B mode
DMA->EN018B = 1;
// Set address of DMA list
DMA->ADDRMB = 0;
DMA->ADDRBANK = 0;
DMA-> ADDRMSB = >memcpy_dma_command256;
// Trigger the DMA (with option lists)
DMA-> ETRIG = <memcpy_dma_command256;
// Re-enable F018A mode
DMA->EN018B = dmaMode;
}
// DMA list entry with options for copying data in the 256MB memory space
// Contains DMA options options for setting MB followed by DMA_LIST_F018B struct.
char memcpy_dma_command256[] = {
DMA_OPTION_SRC_MB, 0x00, // Set MB of source address
DMA_OPTION_DEST_MB, 0x00, // Set MB of destination address
DMA_OPTION_FORMAT_F018B, // Use F018B list format
DMA_OPTION_END, // End of options
// struct DMA_LIST_F018B
DMA_COMMAND_COPY, // command
0, 0, // count
0, 0, // source
0, // source bank
0, 0, // destination
0, // destination bank
0, // sub-command
0, 0 // modulo-value
};

View File

@ -0,0 +1,118 @@
// 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
// 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

@ -237,6 +237,21 @@ 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 testMega65DmaTest4() throws IOException, URISyntaxException {
compileAndCompare("examples/mega65/dma-test4.c");
}
@Test
public void testMega65DmaTest3() throws IOException, URISyntaxException {
compileAndCompare("examples/mega65/dma-test3.c");
}
@Test
public void testMega65DmaTest2() throws IOException, URISyntaxException {
compileAndCompare("examples/mega65/dma-test2.c");

View File

@ -4,6 +4,7 @@
#pragma target(mega65)
#pragma link("mega65_banked.ld")
#include <mega65.h>
#include <mega65-dma.h>
void main() {
// Stop IRQ's
@ -22,12 +23,13 @@ void main() {
// open sideborder
VICIV->SIDBDRWD_LO = 1;
// Transfer banked code/data to upper memory ($10000)
memcpy_dma4(1, 0x0000, 0, upperCodeData, MUSIC_END-MUSIC);
// 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)
// Initialize SID
asm { lda #0 }
(*musicInit)();
// Reset memory mapping
memoryRemap(0,0,0);

View File

@ -1,4 +1,4 @@
// MEGA65 DMA test
// MEGA65 DMA test using F018 directly
// Appendix J in https://mega.scryptos.com/sharefolder-link/MEGA/MEGA65+filehost/Docs/MEGA65-Book_draft.pdf
#pragma target(mega65)
#include <mega65.h>

View File

@ -1,4 +1,4 @@
// MEGA65 DMA test
// MEGA65 DMA test using memcpy version
// Appendix J in https://mega.scryptos.com/sharefolder-link/MEGA/MEGA65+filehost/Docs/MEGA65-Book_draft.pdf
#pragma target(mega65)
#include <mega65-dma.h>

View File

@ -0,0 +1,11 @@
// MEGA65 DMA test using 4MB version
// Appendix J in https://mega.scryptos.com/sharefolder-link/MEGA/MEGA65+filehost/Docs/MEGA65-Book_draft.pdf
#pragma target(mega65)
#include <mega65-dma.h>
void main() {
// Map memory to BANK 0 : 0x00XXXX - giving access to I/O
memoryRemap(0,0,0);
// Move screen up using DMA
memcpy_dma4(0, DEFAULT_SCREEN, 0, DEFAULT_SCREEN+80, 24*80);
}

View File

@ -0,0 +1,11 @@
// MEGA65 DMA test using 256MB version
// Appendix J in https://mega.scryptos.com/sharefolder-link/MEGA/MEGA65+filehost/Docs/MEGA65-Book_draft.pdf
#pragma target(mega65)
#include <mega65-dma.h>
void main() {
// Map memory to BANK 0 : 0x00XXXX - giving access to I/O
memoryRemap(0,0,0);
// Move screen up using DMA
memcpy_dma256(0,0, DEFAULT_SCREEN, 0,0, DEFAULT_SCREEN+80, 24*80);
}

View File

@ -20,10 +20,21 @@
.const CIA_INTERRUPT_CLEAR = $7f
// Bits for the VICII IRQ Status/Enable Registers
.const IRQ_RASTER = 1
// DMA command copy
.const DMA_COMMAND_COPY = 0
// 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_F018_DMAGIC_EN018B = 3
.const OFFSET_STRUCT_DMA_LIST_F018B_COUNT = 1
.const OFFSET_STRUCT_DMA_LIST_F018B_SRC = 3
.const OFFSET_STRUCT_DMA_LIST_F018B_DEST = 6
.const OFFSET_STRUCT_F018_DMAGIC_ADDRMB = 4
.const OFFSET_STRUCT_F018_DMAGIC_ADDRBANK = 2
.const OFFSET_STRUCT_F018_DMAGIC_ADDRMSB = 1
.const OFFSET_STRUCT_DMA_LIST_F018B_SRC_BANK = 5
.const OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK = 8
.const OFFSET_STRUCT_MOS4569_VICIII_KEY = $2f
.const OFFSET_STRUCT_MEGA65_VICIV_CONTROLB = $31
.const OFFSET_STRUCT_MEGA65_VICIV_CONTROLC = $54
@ -44,6 +55,8 @@
.label VICIII = $d000
// The VIC IV
.label VICIV = $d000
// DMAgic F018 Controller
.label DMA = $d700
// Default address of screen character matrix
.label DEFAULT_SCREEN = $800
// The CIA#1: keyboard matrix, joystick #1/#2
@ -103,8 +116,6 @@ irq: {
rti
}
main: {
.label dst = 2
.label src = 4
// asm
// Stop IRQ's
sei
@ -144,30 +155,16 @@ main: {
// open sideborder
lda #1
sta VICIV+OFFSET_STRUCT_MEGA65_VICIV_SIDBDRWD_LO
// memcpy_dma4(1, 0x0000, 0, upperCodeData, MUSIC_END-MUSIC)
// Transfer banked code/data to upper memory ($10000)
jsr memcpy_dma4
// 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
!:
// asm
// Initialize SID
lda #0
// (*musicInit)()
// Initialize SID memory is still remapped)
jsr musicInit
// memoryRemap(0,0,0)
// Reset memory mapping
@ -205,33 +202,24 @@ main: {
// Enable IRQ
cli
ldx #0
__b4:
__b1:
// MUSIC[mem_destroy_i++]++;
inc MUSIC,x
inx
ldy #0
// Show unmapped MUSIC memory
__b5:
__b2:
// for(char i=0;i<240;i++)
cpy #$f0
bcc __b6
jmp __b4
__b6:
bcc __b3
jmp __b1
__b3:
// 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
jmp __b2
}
// 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.
@ -280,16 +268,16 @@ memoryRemapBlock: {
// - 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(byte register(Z) remapBlocks, word zp(2) lowerPageOffset, word zp(4) 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
.label __1 = 6
.label __6 = 7
.label lowerPageOffset = 2
.label upperPageOffset = 4
// <lowerPageOffset
lda.z lowerPageOffset
// *aVal = <lowerPageOffset
@ -335,11 +323,79 @@ memoryRemap: {
// }
rts
}
// Copy a memory block anywhere in first 4MB memory space using MEGA65 DMagic DMA
// Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination.
// - dest_bank The 64KB bank for the destination (0-63)
// - dest The destination address (within the MB and bank)
// - src_bank The 64KB bank for the source (0-63)
// - src The source address (within the MB and bank)
// - num The number of bytes to copy
memcpy_dma4: {
.const num = MUSIC_END-MUSIC
.const dest_bank = 1
.const src_bank = 0
.label dest = 0
.label src = upperCodeData
// dmaMode = DMA->EN018B
// Remember current F018 A/B mode
ldx DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B
// memcpy_dma_command4.count = num
// Set up command
lda #<num
sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_COUNT
lda #>num
sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_COUNT+1
// memcpy_dma_command4.src_bank = src_bank
lda #src_bank
sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_SRC_BANK
// memcpy_dma_command4.src = src
lda #<src
sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_SRC
lda #>src
sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_SRC+1
// memcpy_dma_command4.dest_bank = dest_bank
lda #dest_bank
sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK
// memcpy_dma_command4.dest = dest
lda #<dest
sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_DEST
lda #>dest
sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_DEST+1
// DMA->EN018B = 1
// Set F018B mode
lda #1
sta DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B
// DMA->ADDRMB = 0
// Set address of DMA list
lda #0
sta DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMB
// DMA->ADDRBANK = 0
sta DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRBANK
// DMA-> ADDRMSB = >&memcpy_dma_command4
lda #>memcpy_dma_command4
sta DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMSB
// DMA-> ADDRLSBTRIG = <&memcpy_dma_command4
// Trigger the DMA (without option lists)
lda #<memcpy_dma_command4
sta DMA
// DMA->EN018B = dmaMode
// Re-enable F018A mode
stx DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B
// }
rts
}
.segment Data
// Array containing the banked upper memory code/data to be transferred to upper memory before execution
// Array containing the banked upper memory code/data to be transferred to upper memory before execution
upperCodeData:
.segmentout [segments="Banked"]
// DMA list entry for copying data in the 1MB memory space
memcpy_dma_command4: .byte DMA_COMMAND_COPY
.word 0, 0
.byte 0
.word 0
.byte 0, 0
.word 0
.segment DataBanked
.pc = $4000 "MUSIC"
// SID tune at an absolute address

View File

@ -26,8 +26,8 @@ irq::@return: scope:[irq] from irq::@2
main: scope:[main] from
asm { sei }
[10] call memoryRemap
to:main::@7
main::@7: scope:[main] from main
to:main::@4
main::@4: 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
@ -35,74 +35,88 @@ main::@7: scope:[main] from main
[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
[18] call memcpy_dma4
to:main::@5
main::@5: scope:[main] from main::@4
[19] phi()
[20] call memoryRemapBlock
to:main::@6
main::@6: scope:[main] from main::@5
asm { lda#0 }
[22] call *((const void()*) musicInit)
[23] call memoryRemap
to:main::@7
main::@7: scope:[main] from main::@6
[24] *((byte*)(const nomodify struct MOS6526_CIA*) CIA1+(const byte) OFFSET_STRUCT_MOS6526_CIA_INTERRUPT) ← (const nomodify byte) CIA_INTERRUPT_CLEAR
[25] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_RASTER) ← (byte) $ff
[26] *((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
[27] *((byte*)(const nomodify struct MOS6569_VICII*) VICII+(const byte) OFFSET_STRUCT_MOS6569_VICII_IRQ_ENABLE) ← (const nomodify byte) IRQ_RASTER
[28] *((const nomodify void()**) HARDWARE_IRQ) ← &interrupt(HARDWARE_STACK)(void()) irq()
asm { cli }
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
[30] (byte) main::mem_destroy_i#2 ← phi( main::@2/(byte) main::mem_destroy_i#1 main::@7/(byte) 0 )
[31] *((const byte*) MUSIC + (byte) main::mem_destroy_i#2) ← ++ *((const byte*) MUSIC + (byte) main::mem_destroy_i#2)
[32] (byte) main::mem_destroy_i#1 ← ++ (byte) main::mem_destroy_i#2
to:main::@2
main::@2: scope:[main] from main::@1 main::@3
[33] (byte) main::i#2 ← phi( main::@1/(byte) 0 main::@3/(byte) main::i#1 )
[34] if((byte) main::i#2<(byte) $f0) goto main::@3
to:main::@1
main::@3: scope:[main] from main::@2
[35] *((const nomodify byte*) DEFAULT_SCREEN + (byte) main::i#2) ← *((const byte*) MUSIC + (byte) main::i#2)
[36] (byte) main::i#1 ← ++ (byte) main::i#2
to:main::@2
(void()) memoryRemapBlock((byte) memoryRemapBlock::blockPage , (word) memoryRemapBlock::memoryPage)
memoryRemapBlock: scope:[memoryRemapBlock] from irq main::@7
[39] phi()
[40] call memoryRemap
memoryRemapBlock: scope:[memoryRemapBlock] from irq main::@5
[37] phi()
[38] call memoryRemap
to:memoryRemapBlock::@return
memoryRemapBlock::@return: scope:[memoryRemapBlock] from memoryRemapBlock
[41] return
[39] 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
memoryRemap: scope:[memoryRemap] from irq::@3 main main::@6 memoryRemapBlock
[40] (word) memoryRemap::upperPageOffset#4 ← phi( irq::@3/(byte) 0 main/(byte) 0 main::@6/(byte) 0 memoryRemapBlock/(const word) memoryRemapBlock::pageOffset#0 )
[40] (byte) memoryRemap::remapBlocks#4 ← phi( irq::@3/(byte) 0 main/(byte) 0 main::@6/(byte) 0 memoryRemapBlock/(const byte) memoryRemapBlock::blockBits#0 )
[40] (word) memoryRemap::lowerPageOffset#4 ← phi( irq::@3/(byte) 0 main/(byte) 0 main::@6/(byte) 0 memoryRemapBlock/(const word) memoryRemapBlock::pageOffset#0 )
[41] (byte~) memoryRemap::$0 ← < (word) memoryRemap::lowerPageOffset#4
[42] *((const byte*) memoryRemap::aVal) ← (byte~) memoryRemap::$0
[43] (byte~) memoryRemap::$1 ← (byte) memoryRemap::remapBlocks#4 << (byte) 4
[44] (byte~) memoryRemap::$2 ← > (word) memoryRemap::lowerPageOffset#4
[45] (byte~) memoryRemap::$3 ← (byte~) memoryRemap::$2 & (byte) $f
[46] (byte~) memoryRemap::$4 ← (byte~) memoryRemap::$1 | (byte~) memoryRemap::$3
[47] *((const byte*) memoryRemap::xVal) ← (byte~) memoryRemap::$4
[48] (byte~) memoryRemap::$5 ← < (word) memoryRemap::upperPageOffset#4
[49] *((const byte*) memoryRemap::yVal) ← (byte~) memoryRemap::$5
[50] (byte~) memoryRemap::$6 ← (byte) memoryRemap::remapBlocks#4 & (byte) $f0
[51] (byte~) memoryRemap::$7 ← > (word) memoryRemap::upperPageOffset#4
[52] (byte~) memoryRemap::$8 ← (byte~) memoryRemap::$7 & (byte) $f
[53] (byte~) memoryRemap::$9 ← (byte~) memoryRemap::$6 | (byte~) memoryRemap::$8
[54] *((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
[56] return
to:@return
(void()) memcpy_dma4((byte) memcpy_dma4::dest_bank , (void*) memcpy_dma4::dest , (byte) memcpy_dma4::src_bank , (void*) memcpy_dma4::src , (word) memcpy_dma4::num)
memcpy_dma4: scope:[memcpy_dma4] from main::@4
[57] (byte) memcpy_dma4::dmaMode#0 ← *((byte*)(const nomodify struct F018_DMAGIC*) DMA+(const byte) OFFSET_STRUCT_F018_DMAGIC_EN018B)
[58] *((word*)&(struct DMA_LIST_F018B) memcpy_dma_command4+(const byte) OFFSET_STRUCT_DMA_LIST_F018B_COUNT) ← (const word) memcpy_dma4::num#0
[59] *((byte*)&(struct DMA_LIST_F018B) memcpy_dma_command4+(const byte) OFFSET_STRUCT_DMA_LIST_F018B_SRC_BANK) ← (const byte) memcpy_dma4::src_bank#0
[60] *((byte**)&(struct DMA_LIST_F018B) memcpy_dma_command4+(const byte) OFFSET_STRUCT_DMA_LIST_F018B_SRC) ← (byte*)(const void*) memcpy_dma4::src#0
[61] *((byte*)&(struct DMA_LIST_F018B) memcpy_dma_command4+(const byte) OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK) ← (const byte) memcpy_dma4::dest_bank#0
[62] *((byte**)&(struct DMA_LIST_F018B) memcpy_dma_command4+(const byte) OFFSET_STRUCT_DMA_LIST_F018B_DEST) ← (byte*)(const void*) memcpy_dma4::dest#0
[63] *((byte*)(const nomodify struct F018_DMAGIC*) DMA+(const byte) OFFSET_STRUCT_F018_DMAGIC_EN018B) ← (byte) 1
[64] *((byte*)(const nomodify struct F018_DMAGIC*) DMA+(const byte) OFFSET_STRUCT_F018_DMAGIC_ADDRMB) ← (byte) 0
[65] *((byte*)(const nomodify struct F018_DMAGIC*) DMA+(const byte) OFFSET_STRUCT_F018_DMAGIC_ADDRBANK) ← (byte) 0
[66] *((byte*)(const nomodify struct F018_DMAGIC*) DMA+(const byte) OFFSET_STRUCT_F018_DMAGIC_ADDRMSB) ← >&(struct DMA_LIST_F018B) memcpy_dma_command4
[67] *((byte*)(const nomodify struct F018_DMAGIC*) DMA) ← <&(struct DMA_LIST_F018B) memcpy_dma_command4
[68] *((byte*)(const nomodify struct F018_DMAGIC*) DMA+(const byte) OFFSET_STRUCT_F018_DMAGIC_EN018B) ← (byte) memcpy_dma4::dmaMode#0
to:memcpy_dma4::@return
memcpy_dma4::@return: scope:[memcpy_dma4] from memcpy_dma4
[69] return
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,8 @@
(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
(const nomodify struct F018_DMAGIC*) DMA = (struct F018_DMAGIC*) 55040
(const nomodify byte) DMA_COMMAND_COPY = (byte) 0
(byte) DMA_LIST_F018A::command
(word) DMA_LIST_F018A::count
(byte*) DMA_LIST_F018A::dest
@ -316,6 +318,15 @@
.fill music.size, music.getData(i)
}}
(const nomodify byte*) MUSIC_END = (byte*) 20992
(const byte) OFFSET_STRUCT_DMA_LIST_F018B_COUNT = (byte) 1
(const byte) OFFSET_STRUCT_DMA_LIST_F018B_DEST = (byte) 6
(const byte) OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK = (byte) 8
(const byte) OFFSET_STRUCT_DMA_LIST_F018B_SRC = (byte) 3
(const byte) OFFSET_STRUCT_DMA_LIST_F018B_SRC_BANK = (byte) 5
(const byte) OFFSET_STRUCT_F018_DMAGIC_ADDRBANK = (byte) 2
(const byte) OFFSET_STRUCT_F018_DMAGIC_ADDRMB = (byte) 4
(const byte) OFFSET_STRUCT_F018_DMAGIC_ADDRMSB = (byte) 1
(const byte) OFFSET_STRUCT_F018_DMAGIC_EN018B = (byte) 3
(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
@ -349,38 +360,46 @@ interrupt(HARDWARE_STACK)(void()) irq()
(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()) memcpy_dma4((byte) memcpy_dma4::dest_bank , (void*) memcpy_dma4::dest , (byte) memcpy_dma4::src_bank , (void*) memcpy_dma4::src , (word) memcpy_dma4::num)
(label) memcpy_dma4::@return
(void*) memcpy_dma4::dest
(const void*) memcpy_dma4::dest#0 dest = (void*) 0
(byte) memcpy_dma4::dest_bank
(const byte) memcpy_dma4::dest_bank#0 dest_bank = (byte) 1
(byte) memcpy_dma4::dmaMode
(byte) memcpy_dma4::dmaMode#0 reg byte x 2.0
(word) memcpy_dma4::num
(const word) memcpy_dma4::num#0 num = (const nomodify byte*) MUSIC_END-(const byte*) MUSIC
(void*) memcpy_dma4::src
(const void*) memcpy_dma4::src#0 src = (void*)(const byte*) upperCodeData
(byte) memcpy_dma4::src_bank
(const byte) memcpy_dma4::src_bank#0 src_bank = (byte) 0
(struct DMA_LIST_F018B) memcpy_dma_command4 loadstore mem[12] = { command: (const nomodify byte) DMA_COMMAND_COPY, count: (word) 0, src: (byte*) 0, src_bank: (byte) 0, dest: (byte*) 0, dest_bank: (byte) 0, sub_command: (byte) 0, modulo: (word) 0 }
(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::$1 zp[1]:6 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::$6 zp[1]:7 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
(word) memoryRemap::lowerPageOffset#4 lowerPageOffset zp[2]:2 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
(word) memoryRemap::upperPageOffset#4 upperPageOffset zp[2]:4 18.363636363636363
(const byte*) memoryRemap::xVal = (byte*) 253
(const byte*) memoryRemap::yVal = (byte*) 254
(const byte*) memoryRemap::zVal = (byte*) 255
@ -399,21 +418,21 @@ interrupt(HARDWARE_STACK)(void()) irq()
(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 ]
zp[2]:2 [ memoryRemap::lowerPageOffset#4 ]
reg byte z [ memoryRemap::remapBlocks#4 ]
zp[2]:8 [ memoryRemap::upperPageOffset#4 ]
zp[2]:4 [ memoryRemap::upperPageOffset#4 ]
reg byte a [ irq::raster#0 ]
reg byte a [ memoryRemap::$0 ]
zp[1]:10 [ memoryRemap::$1 ]
zp[1]:6 [ 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 ]
zp[1]:7 [ memoryRemap::$6 ]
reg byte a [ memoryRemap::$7 ]
reg byte a [ memoryRemap::$8 ]
reg byte a [ memoryRemap::$9 ]
reg byte x [ memcpy_dma4::dmaMode#0 ]
mem[12] [ memcpy_dma_command4 ]

View File

@ -1,4 +1,4 @@
// MEGA65 DMA test
// MEGA65 DMA test using F018 directly
// Appendix J in https://mega.scryptos.com/sharefolder-link/MEGA/MEGA65+filehost/Docs/MEGA65-Book_draft.pdf
// MEGA65 Registers and Constants
// The MOS 6526 Complex Interface Adapter (CIA)

View File

@ -909,7 +909,7 @@ Allocated mem[12] [ DMA_SCREEN_UP ]
INITIAL ASM
Target platform is mega65 / MEGA45GS02
// File Comments
// MEGA65 DMA test
// MEGA65 DMA test using F018 directly
// Appendix J in https://mega.scryptos.com/sharefolder-link/MEGA/MEGA65+filehost/Docs/MEGA65-Book_draft.pdf
// MEGA65 Registers and Constants
// The MOS 6526 Complex Interface Adapter (CIA)
@ -1081,7 +1081,7 @@ Uplifting [] best 106 combination mem[12] [ DMA_SCREEN_UP ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// MEGA65 DMA test
// MEGA65 DMA test using F018 directly
// Appendix J in https://mega.scryptos.com/sharefolder-link/MEGA/MEGA65+filehost/Docs/MEGA65-Book_draft.pdf
// MEGA65 Registers and Constants
// The MOS 6526 Complex Interface Adapter (CIA)
@ -1565,7 +1565,7 @@ FINAL ASSEMBLER
Score: 89
// File Comments
// MEGA65 DMA test
// MEGA65 DMA test using F018 directly
// Appendix J in https://mega.scryptos.com/sharefolder-link/MEGA/MEGA65+filehost/Docs/MEGA65-Book_draft.pdf
// MEGA65 Registers and Constants
// The MOS 6526 Complex Interface Adapter (CIA)

View File

@ -1,4 +1,4 @@
// MEGA65 DMA test
// MEGA65 DMA test using memcpy version
// Appendix J in https://mega.scryptos.com/sharefolder-link/MEGA/MEGA65+filehost/Docs/MEGA65-Book_draft.pdf
// Functions for using the F018 DMA for very fast copying or filling of memory
// MEGA65 Registers and Constants
@ -89,10 +89,10 @@ memoryRemap: {
rts
}
// Copy a memory block within the first 64K memory space using MEGA65 DMagic DMA
// Copies the values of num bytes from the location pointed to by source directly
// to the memory block pointed to by destination.
// The underlying type of the objects pointed to by both the source and destination pointers
// are irrelevant for this function; The result is a binary copy of the data.
// Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination.
// - dest The destination address (within the MB and bank)
// - src The source address (within the MB and bank)
// - num The number of bytes to copy
memcpy_dma: {
.const num = $18*$50
.label dest = DEFAULT_SCREEN

View File

@ -3,12 +3,27 @@ Resolved forward reference memcpy_dma_command to (struct DMA_LIST_F018B) memcpy_
Resolved forward reference memcpy_dma_command to (struct DMA_LIST_F018B) memcpy_dma_command
Resolved forward reference memcpy_dma_command to (struct DMA_LIST_F018B) memcpy_dma_command
Resolved forward reference memcpy_dma_command to (struct DMA_LIST_F018B) memcpy_dma_command
Resolved forward reference memcpy_dma_command4 to (struct DMA_LIST_F018B) memcpy_dma_command4
Resolved forward reference memcpy_dma_command4 to (struct DMA_LIST_F018B) memcpy_dma_command4
Resolved forward reference memcpy_dma_command4 to (struct DMA_LIST_F018B) memcpy_dma_command4
Resolved forward reference memcpy_dma_command4 to (struct DMA_LIST_F018B) memcpy_dma_command4
Resolved forward reference memcpy_dma_command4 to (struct DMA_LIST_F018B) memcpy_dma_command4
Resolved forward reference memcpy_dma_command4 to (struct DMA_LIST_F018B) memcpy_dma_command4
Resolved forward reference memcpy_dma_command4 to (struct DMA_LIST_F018B) memcpy_dma_command4
Resolved forward reference memcpy_dma_command256 to (const byte*) memcpy_dma_command256
Resolved forward reference memcpy_dma_command256 to (const byte*) memcpy_dma_command256
Resolved forward reference memcpy_dma_command256 to (const byte*) memcpy_dma_command256
Resolved forward reference memcpy_dma_command256 to (const byte*) memcpy_dma_command256
Resolved forward reference memcpy_dma_command256 to (const byte*) memcpy_dma_command256
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
Setting struct to load/store in variable affected by address-of *((const nomodify struct F018_DMAGIC*) DMA).ADDRMSB ← >&(struct DMA_LIST_F018B) memcpy_dma_command
Setting struct to load/store in variable affected by address-of *((const nomodify struct F018_DMAGIC*) DMA).ADDRLSBTRIG ← <&(struct DMA_LIST_F018B) memcpy_dma_command
Setting struct to load/store in variable affected by address-of *((const nomodify struct F018_DMAGIC*) DMA).ADDRMSB ← >&(struct DMA_LIST_F018B) memcpy_dma_command4
Setting struct to load/store in variable affected by address-of *((const nomodify struct F018_DMAGIC*) DMA).ADDRLSBTRIG ← <&(struct DMA_LIST_F018B) memcpy_dma_command4
Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx
Eliminating unused variable with no statement (struct DMA_LIST_F018B) memcpy_dma_command4
CONTROL FLOW GRAPH SSA
@ -988,7 +1003,7 @@ Allocated mem[12] [ memcpy_dma_command ]
INITIAL ASM
Target platform is mega65 / MEGA45GS02
// File Comments
// MEGA65 DMA test
// MEGA65 DMA test using memcpy version
// Appendix J in https://mega.scryptos.com/sharefolder-link/MEGA/MEGA65+filehost/Docs/MEGA65-Book_draft.pdf
// Functions for using the F018 DMA for very fast copying or filling of memory
// MEGA65 Registers and Constants
@ -1098,10 +1113,10 @@ memoryRemap: {
}
// memcpy_dma
// Copy a memory block within the first 64K memory space using MEGA65 DMagic DMA
// Copies the values of num bytes from the location pointed to by source directly
// to the memory block pointed to by destination.
// The underlying type of the objects pointed to by both the source and destination pointers
// are irrelevant for this function; The result is a binary copy of the data.
// Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination.
// - dest The destination address (within the MB and bank)
// - src The source address (within the MB and bank)
// - num The number of bytes to copy
memcpy_dma: {
.const num = $18*$50
.label dest = DEFAULT_SCREEN
@ -1225,7 +1240,7 @@ Uplifting [] best 159 combination mem[12] [ memcpy_dma_command ]
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// MEGA65 DMA test
// MEGA65 DMA test using memcpy version
// Appendix J in https://mega.scryptos.com/sharefolder-link/MEGA/MEGA65+filehost/Docs/MEGA65-Book_draft.pdf
// Functions for using the F018 DMA for very fast copying or filling of memory
// MEGA65 Registers and Constants
@ -1335,10 +1350,10 @@ memoryRemap: {
}
// memcpy_dma
// Copy a memory block within the first 64K memory space using MEGA65 DMagic DMA
// Copies the values of num bytes from the location pointed to by source directly
// to the memory block pointed to by destination.
// The underlying type of the objects pointed to by both the source and destination pointers
// are irrelevant for this function; The result is a binary copy of the data.
// Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination.
// - dest The destination address (within the MB and bank)
// - src The source address (within the MB and bank)
// - num The number of bytes to copy
memcpy_dma: {
.const num = $18*$50
.label dest = DEFAULT_SCREEN
@ -1770,7 +1785,7 @@ FINAL ASSEMBLER
Score: 139
// File Comments
// MEGA65 DMA test
// MEGA65 DMA test using memcpy version
// Appendix J in https://mega.scryptos.com/sharefolder-link/MEGA/MEGA65+filehost/Docs/MEGA65-Book_draft.pdf
// Functions for using the F018 DMA for very fast copying or filling of memory
// MEGA65 Registers and Constants
@ -1879,10 +1894,10 @@ memoryRemap: {
}
// memcpy_dma
// Copy a memory block within the first 64K memory space using MEGA65 DMagic DMA
// Copies the values of num bytes from the location pointed to by source directly
// to the memory block pointed to by destination.
// The underlying type of the objects pointed to by both the source and destination pointers
// are irrelevant for this function; The result is a binary copy of the data.
// Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination.
// - dest The destination address (within the MB and bank)
// - src The source address (within the MB and bank)
// - num The number of bytes to copy
memcpy_dma: {
.const num = $18*$50
.label dest = DEFAULT_SCREEN

View File

@ -0,0 +1,161 @@
// MEGA65 DMA test using 4MB version
// Appendix J in https://mega.scryptos.com/sharefolder-link/MEGA/MEGA65+filehost/Docs/MEGA65-Book_draft.pdf
// Functions for using the F018 DMA for very fast copying or filling of memory
// 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="dma-test3.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 //
// DMA command copy
.const DMA_COMMAND_COPY = 0
.const OFFSET_STRUCT_F018_DMAGIC_EN018B = 3
.const OFFSET_STRUCT_DMA_LIST_F018B_COUNT = 1
.const OFFSET_STRUCT_DMA_LIST_F018B_SRC = 3
.const OFFSET_STRUCT_DMA_LIST_F018B_DEST = 6
.const OFFSET_STRUCT_F018_DMAGIC_ADDRMB = 4
.const OFFSET_STRUCT_F018_DMAGIC_ADDRBANK = 2
.const OFFSET_STRUCT_F018_DMAGIC_ADDRMSB = 1
.const OFFSET_STRUCT_DMA_LIST_F018B_SRC_BANK = 5
.const OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK = 8
// DMAgic F018 Controller
.label DMA = $d700
// Default address of screen character matrix
.label DEFAULT_SCREEN = $800
.segment Code
main: {
// memoryRemap(0,0,0)
// Map memory to BANK 0 : 0x00XXXX - giving access to I/O
jsr memoryRemap
// memcpy_dma4(0, DEFAULT_SCREEN, 0, DEFAULT_SCREEN+80, 24*80)
// Move screen up using DMA
jsr memcpy_dma4
// }
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: {
.label aVal = $fc
.label xVal = $fd
.label yVal = $fe
.label zVal = $ff
// *aVal = <lowerPageOffset
lda #0
sta aVal
// *xVal = (remapBlocks << 4) | (>lowerPageOffset & 0xf)
sta xVal
// *yVal = <upperPageOffset
sta yVal
// *zVal = (remapBlocks & 0xf0) | (>upperPageOffset & 0xf)
sta zVal
// asm
lda aVal
ldx xVal
ldy yVal
ldz zVal
map
eom
// }
rts
}
// Copy a memory block anywhere in first 4MB memory space using MEGA65 DMagic DMA
// Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination.
// - dest_bank The 64KB bank for the destination (0-63)
// - dest The destination address (within the MB and bank)
// - src_bank The 64KB bank for the source (0-63)
// - src The source address (within the MB and bank)
// - num The number of bytes to copy
memcpy_dma4: {
.const dest_bank = 0
.const src_bank = 0
.const num = $18*$50
.label dest = DEFAULT_SCREEN
.label src = DEFAULT_SCREEN+$50
// dmaMode = DMA->EN018B
// Remember current F018 A/B mode
ldx DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B
// memcpy_dma_command4.count = num
// Set up command
lda #<num
sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_COUNT
lda #>num
sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_COUNT+1
// memcpy_dma_command4.src_bank = src_bank
lda #src_bank
sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_SRC_BANK
// memcpy_dma_command4.src = src
lda #<src
sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_SRC
lda #>src
sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_SRC+1
// memcpy_dma_command4.dest_bank = dest_bank
lda #dest_bank
sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK
// memcpy_dma_command4.dest = dest
lda #<dest
sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_DEST
lda #>dest
sta memcpy_dma_command4+OFFSET_STRUCT_DMA_LIST_F018B_DEST+1
// DMA->EN018B = 1
// Set F018B mode
lda #1
sta DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B
// DMA->ADDRMB = 0
// Set address of DMA list
lda #0
sta DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMB
// DMA->ADDRBANK = 0
sta DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRBANK
// DMA-> ADDRMSB = >&memcpy_dma_command4
lda #>memcpy_dma_command4
sta DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMSB
// DMA-> ADDRLSBTRIG = <&memcpy_dma_command4
// Trigger the DMA (without option lists)
lda #<memcpy_dma_command4
sta DMA
// DMA->EN018B = dmaMode
// Re-enable F018A mode
stx DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B
// }
rts
}
.segment Data
// DMA list entry for copying data in the 1MB memory space
memcpy_dma_command4: .byte DMA_COMMAND_COPY
.word 0, 0
.byte 0
.word 0
.byte 0, 0
.word 0

View File

@ -0,0 +1,44 @@
(void()) main()
main: scope:[main] from
[0] phi()
[1] call memoryRemap
to:main::@1
main::@1: scope:[main] from main
[2] phi()
[3] call memcpy_dma4
to:main::@return
main::@return: scope:[main] from main::@1
[4] return
to:@return
(void()) memoryRemap((byte) memoryRemap::remapBlocks , (word) memoryRemap::lowerPageOffset , (word) memoryRemap::upperPageOffset)
memoryRemap: scope:[memoryRemap] from main
[5] *((const byte*) memoryRemap::aVal) ← (byte) 0
[6] *((const byte*) memoryRemap::xVal) ← (byte) 0
[7] *((const byte*) memoryRemap::yVal) ← (byte) 0
[8] *((const byte*) memoryRemap::zVal) ← (byte) 0
asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
to:memoryRemap::@return
memoryRemap::@return: scope:[memoryRemap] from memoryRemap
[10] return
to:@return
(void()) memcpy_dma4((byte) memcpy_dma4::dest_bank , (void*) memcpy_dma4::dest , (byte) memcpy_dma4::src_bank , (void*) memcpy_dma4::src , (word) memcpy_dma4::num)
memcpy_dma4: scope:[memcpy_dma4] from main::@1
[11] (byte) memcpy_dma4::dmaMode#0 ← *((byte*)(const nomodify struct F018_DMAGIC*) DMA+(const byte) OFFSET_STRUCT_F018_DMAGIC_EN018B)
[12] *((word*)&(struct DMA_LIST_F018B) memcpy_dma_command4+(const byte) OFFSET_STRUCT_DMA_LIST_F018B_COUNT) ← (const word) memcpy_dma4::num#0
[13] *((byte*)&(struct DMA_LIST_F018B) memcpy_dma_command4+(const byte) OFFSET_STRUCT_DMA_LIST_F018B_SRC_BANK) ← (const byte) memcpy_dma4::src_bank#0
[14] *((byte**)&(struct DMA_LIST_F018B) memcpy_dma_command4+(const byte) OFFSET_STRUCT_DMA_LIST_F018B_SRC) ← (byte*)(const void*) memcpy_dma4::src#0
[15] *((byte*)&(struct DMA_LIST_F018B) memcpy_dma_command4+(const byte) OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK) ← (const byte) memcpy_dma4::dest_bank#0
[16] *((byte**)&(struct DMA_LIST_F018B) memcpy_dma_command4+(const byte) OFFSET_STRUCT_DMA_LIST_F018B_DEST) ← (byte*)(const void*) memcpy_dma4::dest#0
[17] *((byte*)(const nomodify struct F018_DMAGIC*) DMA+(const byte) OFFSET_STRUCT_F018_DMAGIC_EN018B) ← (byte) 1
[18] *((byte*)(const nomodify struct F018_DMAGIC*) DMA+(const byte) OFFSET_STRUCT_F018_DMAGIC_ADDRMB) ← (byte) 0
[19] *((byte*)(const nomodify struct F018_DMAGIC*) DMA+(const byte) OFFSET_STRUCT_F018_DMAGIC_ADDRBANK) ← (byte) 0
[20] *((byte*)(const nomodify struct F018_DMAGIC*) DMA+(const byte) OFFSET_STRUCT_F018_DMAGIC_ADDRMSB) ← >&(struct DMA_LIST_F018B) memcpy_dma_command4
[21] *((byte*)(const nomodify struct F018_DMAGIC*) DMA) ← <&(struct DMA_LIST_F018B) memcpy_dma_command4
[22] *((byte*)(const nomodify struct F018_DMAGIC*) DMA+(const byte) OFFSET_STRUCT_F018_DMAGIC_EN018B) ← (byte) memcpy_dma4::dmaMode#0
to:memcpy_dma4::@return
memcpy_dma4::@return: scope:[memcpy_dma4] from memcpy_dma4
[23] return
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,351 @@
(const nomodify byte*) DEFAULT_SCREEN = (byte*) 2048
(const nomodify struct F018_DMAGIC*) DMA = (struct F018_DMAGIC*) 55040
(const nomodify byte) DMA_COMMAND_COPY = (byte) 0
(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
(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) OFFSET_STRUCT_DMA_LIST_F018B_COUNT = (byte) 1
(const byte) OFFSET_STRUCT_DMA_LIST_F018B_DEST = (byte) 6
(const byte) OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK = (byte) 8
(const byte) OFFSET_STRUCT_DMA_LIST_F018B_SRC = (byte) 3
(const byte) OFFSET_STRUCT_DMA_LIST_F018B_SRC_BANK = (byte) 5
(const byte) OFFSET_STRUCT_F018_DMAGIC_ADDRBANK = (byte) 2
(const byte) OFFSET_STRUCT_F018_DMAGIC_ADDRMB = (byte) 4
(const byte) OFFSET_STRUCT_F018_DMAGIC_ADDRMSB = (byte) 1
(const byte) OFFSET_STRUCT_F018_DMAGIC_EN018B = (byte) 3
(void()) main()
(label) main::@1
(label) main::@return
(void()) memcpy_dma4((byte) memcpy_dma4::dest_bank , (void*) memcpy_dma4::dest , (byte) memcpy_dma4::src_bank , (void*) memcpy_dma4::src , (word) memcpy_dma4::num)
(label) memcpy_dma4::@return
(void*) memcpy_dma4::dest
(const void*) memcpy_dma4::dest#0 dest = (void*)(const nomodify byte*) DEFAULT_SCREEN
(byte) memcpy_dma4::dest_bank
(const byte) memcpy_dma4::dest_bank#0 dest_bank = (byte) 0
(byte) memcpy_dma4::dmaMode
(byte) memcpy_dma4::dmaMode#0 reg byte x 2.0
(word) memcpy_dma4::num
(const word) memcpy_dma4::num#0 num = (word)(number) $18*(number) $50
(void*) memcpy_dma4::src
(const void*) memcpy_dma4::src#0 src = (void*)(const nomodify byte*) DEFAULT_SCREEN+(byte) $50
(byte) memcpy_dma4::src_bank
(const byte) memcpy_dma4::src_bank#0 src_bank = (byte) 0
(struct DMA_LIST_F018B) memcpy_dma_command4 loadstore mem[12] = { command: (const nomodify byte) DMA_COMMAND_COPY, count: (word) 0, src: (byte*) 0, src_bank: (byte) 0, dest: (byte*) 0, dest_bank: (byte) 0, sub_command: (byte) 0, modulo: (word) 0 }
(void()) memoryRemap((byte) memoryRemap::remapBlocks , (word) memoryRemap::lowerPageOffset , (word) memoryRemap::upperPageOffset)
(label) memoryRemap::@return
(const byte*) memoryRemap::aVal = (byte*) 252
(word) memoryRemap::lowerPageOffset
(byte) memoryRemap::remapBlocks
(word) memoryRemap::upperPageOffset
(const byte*) memoryRemap::xVal = (byte*) 253
(const byte*) memoryRemap::yVal = (byte*) 254
(const byte*) memoryRemap::zVal = (byte*) 255
reg byte x [ memcpy_dma4::dmaMode#0 ]
mem[12] [ memcpy_dma_command4 ]

View File

@ -0,0 +1,177 @@
// MEGA65 DMA test using 256MB version
// Appendix J in https://mega.scryptos.com/sharefolder-link/MEGA/MEGA65+filehost/Docs/MEGA65-Book_draft.pdf
// Functions for using the F018 DMA for very fast copying or filling of memory
// 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="dma-test4.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 //
// DMA command copy
.const DMA_COMMAND_COPY = 0
// $00 = End of options
.const DMA_OPTION_END = 0
// $0B = Use F018B list format
.const DMA_OPTION_FORMAT_F018B = $a
// $80 $xx = Set MB of source address
.const DMA_OPTION_SRC_MB = $80
// $81 $xx = Set MB of destination address
.const DMA_OPTION_DEST_MB = $81
.const OFFSET_STRUCT_F018_DMAGIC_EN018B = 3
.const OFFSET_STRUCT_DMA_LIST_F018B_COUNT = 1
.const OFFSET_STRUCT_DMA_LIST_F018B_SRC = 3
.const OFFSET_STRUCT_DMA_LIST_F018B_DEST = 6
.const OFFSET_STRUCT_F018_DMAGIC_ADDRMB = 4
.const OFFSET_STRUCT_F018_DMAGIC_ADDRBANK = 2
.const OFFSET_STRUCT_F018_DMAGIC_ADDRMSB = 1
.const OFFSET_STRUCT_DMA_LIST_F018B_SRC_BANK = 5
.const OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK = 8
.const OFFSET_STRUCT_F018_DMAGIC_ETRIG = 5
// DMAgic F018 Controller
.label DMA = $d700
// Default address of screen character matrix
.label DEFAULT_SCREEN = $800
.segment Code
main: {
// memoryRemap(0,0,0)
// Map memory to BANK 0 : 0x00XXXX - giving access to I/O
jsr memoryRemap
// memcpy_dma256(0,0, DEFAULT_SCREEN, 0,0, DEFAULT_SCREEN+80, 24*80)
// Move screen up using DMA
jsr memcpy_dma256
// }
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: {
.label aVal = $fc
.label xVal = $fd
.label yVal = $fe
.label zVal = $ff
// *aVal = <lowerPageOffset
lda #0
sta aVal
// *xVal = (remapBlocks << 4) | (>lowerPageOffset & 0xf)
sta xVal
// *yVal = <upperPageOffset
sta yVal
// *zVal = (remapBlocks & 0xf0) | (>upperPageOffset & 0xf)
sta zVal
// asm
lda aVal
ldx xVal
ldy yVal
ldz zVal
map
eom
// }
rts
}
// Copy a memory block anywhere in the entire 256MB memory space using MEGA65 DMagic DMA
// Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination.
// - dest_mb The MB value for the destination (0-255)
// - dest_bank The 64KB bank for the destination (0-15)
// - dest The destination address (within the MB and bank)
// - src_mb The MB value for the source (0-255)
// - src_bank The 64KB bank for the source (0-15)
// - src The source address (within the MB and bank)
// - num The number of bytes to copy
memcpy_dma256: {
.const dest_mb = 0
.const dest_bank = 0
.const src_mb = 0
.const src_bank = 0
.const num = $18*$50
.label dest = DEFAULT_SCREEN
.label src = DEFAULT_SCREEN+$50
.label f018b = memcpy_dma_command256+6
// dmaMode = DMA->EN018B
// Remember current F018 A/B mode
ldx DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B
// memcpy_dma_command256[1] = src_mb
// Set up command
lda #src_mb
sta memcpy_dma_command256+1
// memcpy_dma_command256[3] = dest_mb
lda #dest_mb
sta memcpy_dma_command256+3
// f018b->count = num
lda #<num
sta f018b+OFFSET_STRUCT_DMA_LIST_F018B_COUNT
lda #>num
sta f018b+OFFSET_STRUCT_DMA_LIST_F018B_COUNT+1
// f018b->src_bank = src_bank
lda #src_bank
sta f018b+OFFSET_STRUCT_DMA_LIST_F018B_SRC_BANK
// f018b->src = src
lda #<src
sta f018b+OFFSET_STRUCT_DMA_LIST_F018B_SRC
lda #>src
sta f018b+OFFSET_STRUCT_DMA_LIST_F018B_SRC+1
// f018b->dest_bank = dest_bank
lda #dest_bank
sta f018b+OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK
// f018b->dest = dest
lda #<dest
sta f018b+OFFSET_STRUCT_DMA_LIST_F018B_DEST
lda #>dest
sta f018b+OFFSET_STRUCT_DMA_LIST_F018B_DEST+1
// DMA->EN018B = 1
// Set F018B mode
lda #1
sta DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B
// DMA->ADDRMB = 0
// Set address of DMA list
lda #0
sta DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMB
// DMA->ADDRBANK = 0
sta DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRBANK
// DMA-> ADDRMSB = >memcpy_dma_command256
lda #>memcpy_dma_command256
sta DMA+OFFSET_STRUCT_F018_DMAGIC_ADDRMSB
// DMA-> ETRIG = <memcpy_dma_command256
// Trigger the DMA (with option lists)
lda #<memcpy_dma_command256
sta DMA+OFFSET_STRUCT_F018_DMAGIC_ETRIG
// DMA->EN018B = dmaMode
// Re-enable F018A mode
stx DMA+OFFSET_STRUCT_F018_DMAGIC_EN018B
// }
rts
}
.segment Data
// DMA list entry with options for copying data in the 256MB memory space
// Contains DMA options options for setting MB followed by DMA_LIST_F018B struct.
memcpy_dma_command256: .byte DMA_OPTION_SRC_MB, 0, DMA_OPTION_DEST_MB, 0, DMA_OPTION_FORMAT_F018B, DMA_OPTION_END, DMA_COMMAND_COPY, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

View File

@ -0,0 +1,46 @@
(void()) main()
main: scope:[main] from
[0] phi()
[1] call memoryRemap
to:main::@1
main::@1: scope:[main] from main
[2] phi()
[3] call memcpy_dma256
to:main::@return
main::@return: scope:[main] from main::@1
[4] return
to:@return
(void()) memoryRemap((byte) memoryRemap::remapBlocks , (word) memoryRemap::lowerPageOffset , (word) memoryRemap::upperPageOffset)
memoryRemap: scope:[memoryRemap] from main
[5] *((const byte*) memoryRemap::aVal) ← (byte) 0
[6] *((const byte*) memoryRemap::xVal) ← (byte) 0
[7] *((const byte*) memoryRemap::yVal) ← (byte) 0
[8] *((const byte*) memoryRemap::zVal) ← (byte) 0
asm { ldaaVal ldxxVal ldyyVal ldzzVal map eom }
to:memoryRemap::@return
memoryRemap::@return: scope:[memoryRemap] from memoryRemap
[10] return
to:@return
(void()) memcpy_dma256((byte) memcpy_dma256::dest_mb , (byte) memcpy_dma256::dest_bank , (void*) memcpy_dma256::dest , (byte) memcpy_dma256::src_mb , (byte) memcpy_dma256::src_bank , (void*) memcpy_dma256::src , (word) memcpy_dma256::num)
memcpy_dma256: scope:[memcpy_dma256] from main::@1
[11] (byte) memcpy_dma256::dmaMode#0 ← *((byte*)(const nomodify struct F018_DMAGIC*) DMA+(const byte) OFFSET_STRUCT_F018_DMAGIC_EN018B)
[12] *((const byte*) memcpy_dma_command256+(byte) 1) ← (const byte) memcpy_dma256::src_mb#0
[13] *((const byte*) memcpy_dma_command256+(byte) 3) ← (const byte) memcpy_dma256::dest_mb#0
[14] *((word*)(const struct DMA_LIST_F018B*) memcpy_dma256::f018b#0+(const byte) OFFSET_STRUCT_DMA_LIST_F018B_COUNT) ← (const word) memcpy_dma256::num#0
[15] *((byte*)(const struct DMA_LIST_F018B*) memcpy_dma256::f018b#0+(const byte) OFFSET_STRUCT_DMA_LIST_F018B_SRC_BANK) ← (const byte) memcpy_dma256::src_bank#0
[16] *((byte**)(const struct DMA_LIST_F018B*) memcpy_dma256::f018b#0+(const byte) OFFSET_STRUCT_DMA_LIST_F018B_SRC) ← (byte*)(const void*) memcpy_dma256::src#0
[17] *((byte*)(const struct DMA_LIST_F018B*) memcpy_dma256::f018b#0+(const byte) OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK) ← (const byte) memcpy_dma256::dest_bank#0
[18] *((byte**)(const struct DMA_LIST_F018B*) memcpy_dma256::f018b#0+(const byte) OFFSET_STRUCT_DMA_LIST_F018B_DEST) ← (byte*)(const void*) memcpy_dma256::dest#0
[19] *((byte*)(const nomodify struct F018_DMAGIC*) DMA+(const byte) OFFSET_STRUCT_F018_DMAGIC_EN018B) ← (byte) 1
[20] *((byte*)(const nomodify struct F018_DMAGIC*) DMA+(const byte) OFFSET_STRUCT_F018_DMAGIC_ADDRMB) ← (byte) 0
[21] *((byte*)(const nomodify struct F018_DMAGIC*) DMA+(const byte) OFFSET_STRUCT_F018_DMAGIC_ADDRBANK) ← (byte) 0
[22] *((byte*)(const nomodify struct F018_DMAGIC*) DMA+(const byte) OFFSET_STRUCT_F018_DMAGIC_ADDRMSB) ← >(const byte*) memcpy_dma_command256
[23] *((byte*)(const nomodify struct F018_DMAGIC*) DMA+(const byte) OFFSET_STRUCT_F018_DMAGIC_ETRIG) ← <(const byte*) memcpy_dma_command256
[24] *((byte*)(const nomodify struct F018_DMAGIC*) DMA+(const byte) OFFSET_STRUCT_F018_DMAGIC_EN018B) ← (byte) memcpy_dma256::dmaMode#0
to:memcpy_dma256::@return
memcpy_dma256::@return: scope:[memcpy_dma256] from memcpy_dma256
[25] return
to:@return

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,361 @@
(const nomodify byte*) DEFAULT_SCREEN = (byte*) 2048
(const nomodify struct F018_DMAGIC*) DMA = (struct F018_DMAGIC*) 55040
(const nomodify byte) DMA_COMMAND_COPY = (byte) 0
(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
(const nomodify byte) DMA_OPTION_DEST_MB = (byte) $81
(const nomodify byte) DMA_OPTION_END = (byte) 0
(const nomodify byte) DMA_OPTION_FORMAT_F018B = (byte) $a
(const nomodify byte) DMA_OPTION_SRC_MB = (byte) $80
(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
(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) OFFSET_STRUCT_DMA_LIST_F018B_COUNT = (byte) 1
(const byte) OFFSET_STRUCT_DMA_LIST_F018B_DEST = (byte) 6
(const byte) OFFSET_STRUCT_DMA_LIST_F018B_DEST_BANK = (byte) 8
(const byte) OFFSET_STRUCT_DMA_LIST_F018B_SRC = (byte) 3
(const byte) OFFSET_STRUCT_DMA_LIST_F018B_SRC_BANK = (byte) 5
(const byte) OFFSET_STRUCT_F018_DMAGIC_ADDRBANK = (byte) 2
(const byte) OFFSET_STRUCT_F018_DMAGIC_ADDRMB = (byte) 4
(const byte) OFFSET_STRUCT_F018_DMAGIC_ADDRMSB = (byte) 1
(const byte) OFFSET_STRUCT_F018_DMAGIC_EN018B = (byte) 3
(const byte) OFFSET_STRUCT_F018_DMAGIC_ETRIG = (byte) 5
(void()) main()
(label) main::@1
(label) main::@return
(void()) memcpy_dma256((byte) memcpy_dma256::dest_mb , (byte) memcpy_dma256::dest_bank , (void*) memcpy_dma256::dest , (byte) memcpy_dma256::src_mb , (byte) memcpy_dma256::src_bank , (void*) memcpy_dma256::src , (word) memcpy_dma256::num)
(label) memcpy_dma256::@return
(void*) memcpy_dma256::dest
(const void*) memcpy_dma256::dest#0 dest = (void*)(const nomodify byte*) DEFAULT_SCREEN
(byte) memcpy_dma256::dest_bank
(const byte) memcpy_dma256::dest_bank#0 dest_bank = (byte) 0
(byte) memcpy_dma256::dest_mb
(const byte) memcpy_dma256::dest_mb#0 dest_mb = (byte) 0
(byte) memcpy_dma256::dmaMode
(byte) memcpy_dma256::dmaMode#0 reg byte x 1.6923076923076923
(struct DMA_LIST_F018B*) memcpy_dma256::f018b
(const struct DMA_LIST_F018B*) memcpy_dma256::f018b#0 f018b = (struct DMA_LIST_F018B*)(const byte*) memcpy_dma_command256+(byte) 6
(word) memcpy_dma256::num
(const word) memcpy_dma256::num#0 num = (word)(number) $18*(number) $50
(void*) memcpy_dma256::src
(const void*) memcpy_dma256::src#0 src = (void*)(const nomodify byte*) DEFAULT_SCREEN+(byte) $50
(byte) memcpy_dma256::src_bank
(const byte) memcpy_dma256::src_bank#0 src_bank = (byte) 0
(byte) memcpy_dma256::src_mb
(const byte) memcpy_dma256::src_mb#0 src_mb = (byte) 0
(const byte*) memcpy_dma_command256[] = { (const nomodify byte) DMA_OPTION_SRC_MB, (byte) 0, (const nomodify byte) DMA_OPTION_DEST_MB, (byte) 0, (const nomodify byte) DMA_OPTION_FORMAT_F018B, (const nomodify byte) DMA_OPTION_END, (const nomodify byte) DMA_COMMAND_COPY, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0 }
(void()) memoryRemap((byte) memoryRemap::remapBlocks , (word) memoryRemap::lowerPageOffset , (word) memoryRemap::upperPageOffset)
(label) memoryRemap::@return
(const byte*) memoryRemap::aVal = (byte*) 252
(word) memoryRemap::lowerPageOffset
(byte) memoryRemap::remapBlocks
(word) memoryRemap::upperPageOffset
(const byte*) memoryRemap::xVal = (byte*) 253
(const byte*) memoryRemap::yVal = (byte*) 254
(const byte*) memoryRemap::zVal = (byte*) 255
reg byte x [ memcpy_dma256::dmaMode#0 ]