Compare commits

...

38 Commits

Author SHA1 Message Date
tudnai 6a20b9d070 Immediate value should be 8 bit 2020-05-07 13:21:43 -07:00
tudnai ae427f9926 Fixed 4 line Text screen position in Mixed mode 2020-05-07 13:20:46 -07:00
tudnai 6cd257850e Disk adjustment magic numbers lifted out as variables so it will be easier to remember them and adjust them 2020-05-06 20:49:15 -07:00
tudnai 3cb987a0d7 Removed dead code 2020-05-06 20:24:22 -07:00
tudnai 1afaaf164d Removed breakpoint settings from project 2020-05-06 20:08:01 -07:00
tudnai d2a37ca1d2 Adjusted Disk properties to work with the new instruction clock counter 2020-05-06 20:07:09 -07:00
tudnai a91e8239ae Speed bumped to 1244MHz!
Fixed CPU initialization
2020-05-06 16:07:19 -07:00
tudnai d03524e771 Link time optimization 2020-05-06 10:12:04 -07:00
tudnai cb5339e01f - Optimized Text Rendering
- Optimized HiRes screen hiding
2020-05-06 09:56:21 -07:00
tudnai 803ce37b0a - Startup speed is set by ColdReset, so it will work always
- HiRes screen is being cleared when switched back to text mode
- Turned off Debug app for Release mode
2020-05-05 23:03:36 -07:00
tudnai 2eead2f4ad - Speed improvements
- Keyboard Up
- HiRes optimized (battery save) refresh / Refresh by blocks that modified
2020-05-05 08:35:57 -07:00
tudnai 092c40a7cb Optimized color management 2020-05-04 13:54:04 -07:00
tudnai 7b4771d236 Optimizing HiRes screen updates - do not refresh HiRes when it is in TextMode 2020-05-04 13:53:36 -07:00
tudnai 3f4968624e Slight speed improvements 2020-05-04 13:52:52 -07:00
tudnai 1c4cdf7399 Simplifying reset + Cleanup code 2020-05-02 22:39:54 -07:00
tudnai 361726b0a4 Interrupt handling outside of the instruction loop 2020-05-02 22:35:59 -07:00
tudnai bae447ad32 - Fixed disk acceleration algorithm
- Some tiny speed optimizations
2020-05-02 22:04:22 -07:00
tudnai 12dc2f1d2b - Removed some dead code
- Disk accelerator reset moved to a function
- Some tiny speed optimizations
2020-05-02 21:26:24 -07:00
tudnai 291dd59b31 Limit increased to allow sheer power 2020-05-02 21:07:02 -07:00
tudnai 97e8fb5230 Code Cleaning 2020-05-02 21:06:34 -07:00
tudnai dab96d6a28 Fixed Text Page switching 2020-05-02 10:36:21 -07:00
tudnai 60017f1c82 Milestone! GHz reached! & Removing large files 2020-05-01 23:35:17 -07:00
tudnai c2a74d4511 Shadow memory direct access for all instructions & flags promoted to uint8_t instead of bitfield 2020-05-01 21:52:51 -07:00
tudnai 38fc6367b2 Not sure why it got removed 2020-05-01 20:16:41 -07:00
tudnai 0db174cdc7 Merge branch 'speedbump' 2020-05-01 20:13:01 -07:00
tudnai b64fe9e1a7 added schemas 2020-05-01 20:12:01 -07:00
tudnai cc76b018b0 Merge branch 'speedbump' 2020-05-01 19:54:40 -07:00
tudnai 242c4339e1 Removing log files 2020-05-01 19:49:31 -07:00
tudnai e00583823d Page Table removed 2020-05-01 19:33:14 -07:00
tudnai 650f169f3a Getting rid of Page Table 2020-05-01 19:24:09 -07:00
tudnai 8c7fcc437a Rendering running independently on the main thread 2020-05-01 19:10:44 -07:00
tudnai 4c006f5323 Shadow memory kinda works 2020-05-01 18:56:30 -07:00
tudnai db68ac0bac Started to come alive 2020-05-01 14:43:41 -07:00
tudnai c163f80bd7 Further steps to implement Shadow Memory 2020-04-30 19:33:59 -07:00
tudnai bc56d23bd2 Bugfixes merged from Master 2020-04-30 12:01:35 -07:00
tudnai 92442e6491 Merge branch 'master'
Conflicts:
	src/cpu/6502.c
	src/dev/mem/mmio.h
2020-04-30 11:49:52 -07:00
tudnai a70937b321 First steps for the Shadow Memory implementation 2020-04-29 19:58:03 -07:00
tudnai 53f81555ea - Removed 16K LC RAM -- using 64K AUX to emulate it
- Removed 12K ROM -- using 16K ROM to emulate it
2020-04-29 16:18:27 -07:00
70 changed files with 1963397 additions and 818 deletions

BIN
.Apple_II_ROM.s.swp Normal file

Binary file not shown.

BIN
.disksectorload.log.swo Normal file

Binary file not shown.

187
1 Normal file
View File

@ -0,0 +1,187 @@
#!/usr/bin/perl
my $state = 'begin';
my $trk = 0;
my $sec = 0;
my @sectorData = ();
my $reLDA_C08C = qr/LDA\s+\$C08C,X\t0x([8-9A-Fa-f][0-9A-Fa-f])/;
my $reLDY_C08C = qr/LDY\s+\$C08C,X\t0x([0-9A-Fa-f]{2})\t0x([0-9A-Fa-f]{2})\t0x([8-9A-Fa-f][0-9A-F])/;
my $reSTA_0300 = qr/STA\s+\$0300,Y\t0x([0-9A-F]{2})\t0x([0-9A-F]{2})\t0x([0-9A-F]{2})/;
my $reSTA_26Y = qr/STA\s+\(\$26\),Y\t0x([0-9A-F]{2})\t0x([0-9A-F]{2})\t0x([0-9A-F]{2})/;
sub hexdump {
my ($arr) = @_;
for($i = 0; $i < scalar(@{$arr}); $i++) {
if ( $i % 16 == 0 ) {
printf("\n%04X: ", $i);
}
printf("%02X ", @{$arr}[$i]);
}
print "\n";
}
while (<>) {
chomp;
s/[\n\r]+//;
print;
{ # for the redo to avoid print input twice
if ( $state eq 'begin' ) {
if ( /LDA\s+\$C08C,X\t0xD5/ ) {
print "\t marker D5";
$state = 'loaded_D5';
}
}
elsif ( $state eq 'loaded_D5' ) {
if ( /LDA\s+\$C08C,X\t0xAA/ ) {
print "\t marker AA";
$state = 'loaded_AA';
}
elsif ( /$reLDA_C08C/ ) {
$state = 'begin';
redo;
}
}
elsif ( $state eq 'loaded_AA' ) {
if ( /LDA\s+\$C08C,X\t0x96/ ) {
print "\t marker 96";
$state = 'loaded_96';
print "\t; sector marker";
}
elsif ( /$reLDA_C08C/ ) {
$state = 'begin';
redo;
}
}
elsif ( $state eq 'loaded_96' ) {
if ( /$reLDA_C08C/ ) {
print "\t marker v1";
$state = 'loaded_v1';
}
}
elsif ( $state eq 'loaded_v1' ) {
if ( /$reLDA_C08C/ ) {
print "\t marker v2";
$state = 'loaded_v2';
}
}
elsif ( $state eq 'loaded_v2' ) {
if ( /$reLDA_C08C/ ) {
print "\t marker t1:$1";
$trk = hex($1) << 1;
$trk |= 1;
$state = 'loaded_t1';
}
}
elsif ( $state eq 'loaded_t1' ) {
if ( /$reLDA_C08C/ ) {
print "\t marker t2:$1";
$trk &= hex($1);
print "\t; trk:$trk";
$state = 'loaded_t2';
}
}
elsif ( $state eq 'loaded_t2' ) {
if ( /$reLDA_C08C/ ) {
print "\t marker s1:$1";
$sec = hex($1) << 1;
$sec |= 1;
$state = 'loaded_s1';
}
}
elsif ( $state eq 'loaded_s1' ) {
if ( /$reLDA_C08C/ ) {
print "\t marker s2:$1";
$sec &= hex($1);
print "\t; sec:$sec";
$state = 'loaded_s2';
}
}
elsif ( $state eq 'loaded_s2' ) {
if ( /LDA\s+\$C08C,X\t0xD5/ ) {
print "\t marker D5";
$state = 'waitingfor_AA';
}
elsif ( /EOR\s+#\$D5/ ) {
$state = 'begin';
redo;
}
}
elsif ( $state eq 'waitingfor_AA' ) {
if ( /LDA\s+\$C08C,X\t0xAA/ ) {
print "\t marker AA 2";
$state = 'waitingfor_AD';
}
elsif ( /$reLDA_C08C/ ) {
$state = 'begin';
redo;
}
}
elsif ( $state eq 'waitingfor_AD' ) {
if ( /LDA\s+\$C08C,X\t0xAD/ ) {
print "\t marker AD";
$state = 'loaded_AD';
print "\t; sector data marker";
}
elsif ( /EOR\s+#\$D5/ ) {
$state = 'begin';
redo;
}
}
elsif ( $state eq 'loaded_AD' ) {
if ( /$reLDY_C08C/ ) {
print "\t byte read: $3 (t:$trk s:$sec)";
}
elsif ( /$reSTA_0300/ ) {
printf( "\t byte to mem: \$%04X:$1\n", 0x300 + hex($3) );
}
elsif ( /$reSTA_26Y/ ) {
my $y = hex($3);
printf( "\t byte to mem ind: (\$26)+\$%02X:$1\n", $y );
if ($y >= 255) {
$state = 'sector_decode';
}
}
}
elsif ( $state eq 'sector_decode' ) {
if ( /$reSTA_26Y/ ) {
$i = hex($1);
$y = hex($3);
printf( "\t byte to mem ind: (\$26)+\$%02X:$1\n", $y );
$sectorData[$y] = $i;
if ($y >= 255) {
$state = 'sector_decode';
print "\nHEXDUMP track: $trk sector: $sec\n";
hexdump(\@sectorData);
}
}
elsif ( /$reLDA_C08C/ ) {
$state = 'begin';
redo;
}
}
} # for the redo to avoid print input twice
print "\n";
}

BIN
6502_functional_test.bin Normal file

Binary file not shown.

14360
6502_functional_test.lst Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1249,6 +1249,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
LLVM_LTO = YES_THIN;
OTHER_CFLAGS = (
"-D_NO_DISASSEMBLER",
"-D_NO_INTERRUPT_CHECK_PER_STEP",

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array/>
</plist>

View File

@ -0,0 +1,493 @@
<?xml version="1.0" encoding="UTF-8"?>
<VariablesViewState
version = "1.0">
<ContextStates>
<ContextState
contextName = "AND:6502_instr_logic.h">
</ContextState>
<ContextState
contextName = "set_flags_V:common.h">
<PersistentStrings>
<PersistentString
value = "test">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "read_rom:6502.c">
<PersistentStrings>
<PersistentString
value = "Apple2_64K_AUX + 0xC600">
</PersistentString>
<PersistentString
value = "Apple2_64K_RAM + 0xC600">
</PersistentString>
<PersistentString
value = "(void*)rom">
</PersistentString>
<PersistentString
value = "strlen(fullPath)">
</PersistentString>
<PersistentString
value = "(void*)Apple2_64K_RAM">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "rel_addr:Apple2_mmio.h">
</ContextState>
<ContextState
contextName = "addr_ind_Y:Apple2_mmio.h">
</ContextState>
<ContextState
contextName = "m6502_ColdReset:6502.c">
<PersistentStrings>
<PersistentString
value = "m6502">
</PersistentString>
<PersistentString
value = "RAM_PG_RD_TBL">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "set_flags_NZC:common.h">
<PersistentStrings>
<PersistentString
value = "(unsigned)0xFF">
</PersistentString>
<PersistentString
value = "(unsigned)test ">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "mach_msg_trap:(null)">
<PersistentStrings>
<PersistentString
value = "RAM">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "ViewController.viewDidLoad():ViewController.swift">
<PersistentStrings>
<PersistentString
value = "y">
</PersistentString>
<PersistentString
value = "textLines">
</PersistentString>
<PersistentString
value = "hires.frame">
</PersistentString>
<PersistentString
value = "view">
</PersistentString>
<PersistentString
value = "hires.layer">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "ViewController.Reset(_:):ViewController.swift">
<PersistentStrings>
<PersistentString
value = "m6502.pc">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "ORA:6502_instr_logic.h">
</ContextState>
<ContextState
contextName = "BRA:6502_instr_branch.h">
<PersistentStrings>
<PersistentString
value = "">
</PersistentString>
<PersistentString
value = "RAM[0x346f]">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "HiRes.initMetal():HiRes.swift">
<PersistentStrings>
<PersistentString
value = "mtlBufferB">
</PersistentString>
<PersistentString
value = "addFunction">
</PersistentString>
<PersistentString
value = "device">
</PersistentString>
<PersistentString
value = "mtlBufferA">
</PersistentString>
<PersistentString
value = "mtlBufferC">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "set_flags_NZCV:common.h">
<PersistentStrings>
<PersistentString
value = "m6502">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "memread8:Apple2_mmio.h">
</ContextState>
<ContextState
contextName = "textPageSelect:mmio.h">
<PersistentStrings>
<PersistentString
value = "AUX[0x22]">
</PersistentString>
<PersistentString
value = "RAM[0x22]">
</PersistentString>
<PersistentString
value = "MEMcfg">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "ioRead:Apple2_mmio.h">
<PersistentStrings>
<PersistentString
value = "clkelpased">
</PersistentString>
<PersistentString
value = "clklast">
</PersistentString>
<PersistentString
value = "m6502.clktime">
</PersistentString>
<PersistentString
value = "phase.current">
</PersistentString>
<PersistentString
value = "phase.last">
</PersistentString>
<PersistentString
value = "woz_trks[track].phase[woz_track_offset]">
</PersistentString>
<PersistentString
value = "RAM[0xC010]">
</PersistentString>
<PersistentString
value = "WOZread">
</PersistentString>
<PersistentString
value = "m6502">
</PersistentString>
<PersistentString
value = "phaseTransition[phase.current][phase.last]">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "CPY:6502_instr_compare_test.h">
<PersistentStrings>
<PersistentString
value = "m6502.Y">
</PersistentString>
<PersistentString
value = "(int)m6502.Y - imm">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "LSRA:6502_instr_shift_rotate.h">
<PersistentStrings>
<PersistentString
value = "m6502.A">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "STR:6502_instr_load_store.h">
<PersistentStrings>
<PersistentString
value = "m6502">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "PLA:6502_instr_stack.h">
</ContextState>
<ContextState
contextName = "BNE:6502_instr_branch.h">
</ContextState>
<ContextState
contextName = "PUSH:6502_instr_stack.h">
</ContextState>
<ContextState
contextName = "ViewController.Update():ViewController.swift">
<PersistentStrings>
<PersistentString
value = "y * (textCols + lineEndChars) + x ">
</PersistentString>
<PersistentString
value = "textCols">
</PersistentString>
<PersistentString
value = "textLines * (textCols+1) + textCols">
</PersistentString>
<PersistentString
value = "textLines">
</PersistentString>
<PersistentString
value = "txtArr">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "ViewController.createHiRes():ViewController.swift">
<PersistentStrings>
<PersistentString
value = "container.frame">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "HiRes.draw(_:):HiRes.swift">
<PersistentStrings>
<PersistentString
value = "(blockH7 | ( block &amp; bitMask ))">
</PersistentString>
<PersistentString
value = "ctx?.data">
</PersistentString>
<PersistentString
value = "ctx?.width">
</PersistentString>
<PersistentString
value = "ctx?.bitmapInfo">
</PersistentString>
<PersistentString
value = "ctx?.bytesPerRow">
</PersistentString>
<PersistentString
value = "blockView.needsDisplay">
</PersistentString>
<PersistentString
value = "HiResLineAddrTbl">
</PersistentString>
<PersistentString
value = "HiRes.blockCols">
</PersistentString>
<PersistentString
value = "shadowScreen">
</PersistentString>
<PersistentString
value = "ctx?.height">
</PersistentString>
<PersistentString
value = "linAddr">
</PersistentString>
<PersistentString
value = "ctx?.bitsPerComponent">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "ioRead:mmio.h">
<PersistentStrings>
<PersistentString
value = "m6502.PC">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "ViewController.currentContext.getter:ViewController.swift">
<PersistentStrings>
<PersistentString
value = "NSGraphicsContext.current">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "AppDelegate.Disk1_Selected(_:):AppDelegate.swift">
<PersistentStrings>
<PersistentString
value = "sender.identifier!.rawValue">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "m6502_Run:6502.c">
<PersistentStrings>
<PersistentString
value = "m6502">
</PersistentString>
<PersistentString
value = "Apple2_64K_AUX + 0x3600">
</PersistentString>
<PersistentString
value = "Apple2_64K_RAM + 0x3600">
</PersistentString>
<PersistentString
value = "(void*)Apple2_64K_RAM">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "set_flags_NZ:common.h">
</ContextState>
<ContextState
contextName = "CMP:6502_instr_compare_test.h">
</ContextState>
<ContextState
contextName = "POP:6502_instr_stack.h">
</ContextState>
<ContextState
contextName = "LDA:6502_instr_load_store.h">
</ContextState>
<ContextState
contextName = "m6502_step:6502.c">
<PersistentStrings>
<PersistentString
value = "m6502">
</PersistentString>
<PersistentString
value = "bp1">
</PersistentString>
<PersistentString
value = "m6502.PC">
</PersistentString>
<PersistentString
value = "RAM">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "HiRes.initHiResLineAddresses():HiRes.swift">
<PersistentStrings>
<PersistentString
value = "HiResLineAddrTbl">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "specialized closure #1 in ViewController.Update():ViewController.swift">
<PersistentStrings>
<PersistentString
value = "self.HiRes.frame">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "JMP:6502_instr_call_ret_jump.h">
</ContextState>
<ContextState
contextName = "STA:6502_instr_load_store.h">
</ContextState>
<ContextState
contextName = "addr_abs:mmio.h">
<PersistentStrings>
<PersistentString
value = "cache">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "m6502_Step:6502.c">
<PersistentStrings>
<PersistentString
value = "m6502.dbgLevel.trace">
</PersistentString>
<PersistentString
value = "RAM[0x51]">
</PersistentString>
<PersistentString
value = "disassembly">
</PersistentString>
<PersistentString
value = "RAM">
</PersistentString>
<PersistentString
value = "RAM[0x50]">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "ADC:6502_instr_arithmetic.h">
</ContextState>
<ContextState
contextName = "m6502_run:6502.c">
<PersistentStrings>
<PersistentString
value = "RAM[0x70]">
</PersistentString>
<PersistentString
value = "RAM[0x74]">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "HiRes.compute():HiRes.swift">
<PersistentStrings>
<PersistentString
value = "UnsafeRawBufferPointer(result)">
</PersistentString>
<PersistentString
value = "result[2]">
</PersistentString>
<PersistentString
value = "computePipelineState.maxTotalThreadsPerThreadgroup">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "init:6502.c">
</ContextState>
<ContextState
contextName = "read_woz:6502.c">
<PersistentStrings>
<PersistentString
value = "r">
</PersistentString>
<PersistentString
value = "foffs + woz_chunk_header.size">
</PersistentString>
<PersistentString
value = "woz_chunk_header.size">
</PersistentString>
<PersistentString
value = "sizeof(woz_chunk_header_t)">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "dest_ind_Y:Apple2_mmio.h">
<PersistentStrings>
<PersistentString
value = "disassembly">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "ViewController.setCPUClockSpeed(freq:):ViewController.swift">
<PersistentStrings>
<PersistentString
value = "MHz_6502">
</PersistentString>
<PersistentString
value = "mhz">
</PersistentString>
<PersistentString
value = "fps">
</PersistentString>
<PersistentString
value = "clk_6502_per_frm">
</PersistentString>
</PersistentStrings>
</ContextState>
</ContextStates>
</VariablesViewState>

View File

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32BFFB5622EACC630003B53F"
BuildableName = "A2Mac.app"
BlueprintName = "A2Mac"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32BFFB5622EACC630003B53F"
BuildableName = "A2Mac.app"
BlueprintName = "A2Mac"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32BFFB6822EACC660003B53F"
BuildableName = "A2MacTests.xctest"
BlueprintName = "A2MacTests"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32BFFB7322EACC660003B53F"
BuildableName = "A2MacUITests.xctest"
BlueprintName = "A2MacUITests"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32BFFB5622EACC630003B53F"
BuildableName = "A2Mac.app"
BlueprintName = "A2Mac"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32BFFB5622EACC630003B53F"
BuildableName = "A2Mac.app"
BlueprintName = "A2Mac"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "325EB63F23FBBACF00C6B4A4"
BuildableName = "A2iOS.app"
BlueprintName = "A2iOS"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "325EB65423FBBAD100C6B4A4"
BuildableName = "A2iOSTests.xctest"
BlueprintName = "A2iOSTests"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "325EB65F23FBBAD100C6B4A4"
BuildableName = "A2iOSUITests.xctest"
BlueprintName = "A2iOSUITests"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "325EB63F23FBBACF00C6B4A4"
BuildableName = "A2iOS.app"
BlueprintName = "A2iOS"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "325EB63F23FBBACF00C6B4A4"
BuildableName = "A2iOS.app"
BlueprintName = "A2iOS"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32BFFB5622EACC630003B53F"
BuildableName = "A2Mac.app"
BlueprintName = "A2Mac"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32BFFB5622EACC630003B53F"
BuildableName = "A2Mac.app"
BlueprintName = "A2Mac"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32BFFB6822EACC660003B53F"
BuildableName = "A2MacTests.xctest"
BlueprintName = "A2MacTests"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32BFFB7322EACC660003B53F"
BuildableName = "A2MacUITests.xctest"
BlueprintName = "A2MacUITests"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32BFFB5622EACC630003B53F"
BuildableName = "A2Mac.app"
BlueprintName = "A2Mac"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Debug"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32BFFB5622EACC630003B53F"
BuildableName = "A2Mac.app"
BlueprintName = "A2Mac"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32BFFB5622EACC630003B53F"
BuildableName = "A2Mac.app"
BlueprintName = "A2Mac"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32C4531B2331FED90000EBA1"
BuildableName = "Functiontest.app"
BlueprintName = "Functiontest"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32BFFB6822EACC660003B53F"
BuildableName = "A2MacTests.xctest"
BlueprintName = "A2MacTests"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32BFFB7322EACC660003B53F"
BuildableName = "A2MacUITests.xctest"
BlueprintName = "A2MacUITests"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32C4531B2331FED90000EBA1"
BuildableName = "Functiontest.app"
BlueprintName = "Functiontest"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32BFFB5622EACC630003B53F"
BuildableName = "A2Mac.app"
BlueprintName = "A2Mac"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "NO"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32C453092331F7220000EBA1"
BuildableName = "Speedtest.app"
BlueprintName = "Speedtest"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32C453092331F7220000EBA1"
BuildableName = "Speedtest.app"
BlueprintName = "Speedtest"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32C453092331F7220000EBA1"
BuildableName = "Speedtest.app"
BlueprintName = "Speedtest"
ReferencedContainer = "container:A2Mac.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -14,17 +14,17 @@
<key>orderHint</key>
<integer>4</integer>
</dict>
<key>Debug.xcscheme</key>
<key>Debug.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
</dict>
<key>Function Test.xcscheme</key>
<key>Function Test.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>2</integer>
</dict>
<key>Speedtest.xcscheme</key>
<key>Speedtest.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>3</integer>

View File

@ -25,9 +25,9 @@ class HiRes: NSView {
static let blockWidth = PixelWidth / blockCols
static let blockHeight = PixelHeight / blockRows
let HiResBuffer1 = UnsafeRawBufferPointer(start: RAM + Page1Addr, count: PageSize * 2)
let HiResBuffer2 = UnsafeRawBufferPointer(start: RAM + Page2Addr, count: PageSize * 2)
var HiResBufferPointer = UnsafeRawBufferPointer(start: RAM + Page1Addr, count: PageSize * 2)
let HiResBuffer1 = UnsafeRawBufferPointer(start: MEM + Page1Addr, count: PageSize * 2)
let HiResBuffer2 = UnsafeRawBufferPointer(start: MEM + Page2Addr, count: PageSize * 2)
var HiResBufferPointer = UnsafeRawBufferPointer(start: MEM + Page1Addr, count: PageSize * 2)
let HiResRawPointer = UnsafeRawPointer(RAM + Page1Addr)
@ -129,12 +129,19 @@ class HiRes: NSView {
}
}
}
func clearScreen() {
HiRes.context?.clear( CGRect(x: 0, y: 0, width: frame.width, height: frame.height) )
needsDisplay = true
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
initHiResLineAddresses()
clearScreen()
// currentContext?.setShouldAntialias(false)
// currentContext?.interpolationQuality = CGInterpolationQuality.none
@ -392,7 +399,8 @@ class HiRes: NSView {
#if HIRESLOW || HIRESLOWCOLOR
static let ScreenBitmapSize = (PixelWidth * PixelHeight * 4)
static let context = createBitmapContext(pixelsWide: PixelWidth, PixelHeight)
static let pixels = UnsafeMutableRawBufferPointer(start: context?.data, count: ScreenBitmapSize) // UnsafeMutablePointer<CUnsignedChar>.allocate(capacity: byteCount)
static let pixels = UnsafeMutableRawBufferPointer(start: context?.data, count: ScreenBitmapSize)
static var typedPointer = pixels.bindMemory(to: UInt32.self)
#endif
let R = 2
@ -473,29 +481,26 @@ class HiRes: NSView {
#elseif HIRESLOWCOLOR
let color_black : UInt32 = 0x00000000;
let color_white : UInt32 = 0xFFFFFFFF;
let color_purple : UInt32 = 0xFFBB11EE;
let color_green : UInt32 = 0xFF0BA212;
let color_blue : UInt32 = 0xFF1166EE;
let color_orange : UInt32 = 0xFFEE2211;
func hiresColorPixel ( pixelAddr : Int, pixel : Int, prev : Int ) {
let colorAddr = pixelAddr / 4
switch ( pixel ) {
case 0x00: // black
HiRes.pixels[pixelAddr + R] = 0x00;
HiRes.pixels[pixelAddr + G] = 0x00;
HiRes.pixels[pixelAddr + B] = 0x00;
HiRes.pixels[pixelAddr + A] = 0x00;
HiRes.pixels[pixelAddr + 4 + R] = 0x00;
HiRes.pixels[pixelAddr + 4 + G] = 0x00;
HiRes.pixels[pixelAddr + 4 + B] = 0x00;
HiRes.pixels[pixelAddr + 4 + A] = 0x00;
case 0x01: // purple (bits are in reverse!)
HiRes.pixels[pixelAddr + R] = 0xBB;
HiRes.pixels[pixelAddr + G] = 0x11;
HiRes.pixels[pixelAddr + B] = 0xEE;
HiRes.pixels[pixelAddr + A] = 0xFF;
// HiRes.typedPointer[colorAddr] = color_black;
// HiRes.typedPointer[colorAddr + 1] = color_black;
break
HiRes.pixels[pixelAddr + 4 + R] = 0x00;
HiRes.pixels[pixelAddr + 4 + G] = 0x00;
HiRes.pixels[pixelAddr + 4 + B] = 0x00;
HiRes.pixels[pixelAddr + 4 + A] = 0x00;
case 0x01: // purple (bits are in reverse!)
HiRes.typedPointer[colorAddr] = color_purple;
// HiRes.typedPointer[colorAddr + 1] = color_black;
case 0x02: // green
if (prev == 0x02) ||
@ -504,131 +509,66 @@ class HiRes: NSView {
(prev == 0x00) || (prev == 0x04) ||
(prev == 0x04)
{
HiRes.pixels[pixelAddr + R] = 0x08;
HiRes.pixels[pixelAddr + G] = 0xA2;
HiRes.pixels[pixelAddr + B] = 0x12;
HiRes.pixels[pixelAddr + A] = 0xFF;
}
else {
HiRes.pixels[pixelAddr + R] = 0x00;
HiRes.pixels[pixelAddr + G] = 0x00;
HiRes.pixels[pixelAddr + B] = 0x00;
HiRes.pixels[pixelAddr + A] = 0x00;
HiRes.typedPointer[colorAddr] = color_green;
}
// else {
// HiRes.typedPointer[colorAddr] = color_black;
// }
// reducing color bleeding
if (prev == 0x01) ||
(prev == 0x05)
{
HiRes.pixels[pixelAddr + 4 + R] = 0x00;
HiRes.pixels[pixelAddr + 4 + G] = 0x00;
HiRes.pixels[pixelAddr + 4 + B] = 0x00;
HiRes.pixels[pixelAddr + 4 + A] = 0x00;
// HiRes.typedPointer[colorAddr + 1] = color_black;
}
else {
HiRes.pixels[pixelAddr + 4 + R] = 0x08;
HiRes.pixels[pixelAddr + 4 + G] = 0xA2;
HiRes.pixels[pixelAddr + 4 + B] = 0x12;
HiRes.pixels[pixelAddr + 4 + A] = 0xFF;
HiRes.typedPointer[colorAddr + 1] = color_green;
}
case 0x03: // white
HiRes.pixels[pixelAddr + R] = 0xFF;
HiRes.pixels[pixelAddr + G] = 0xFF;
HiRes.pixels[pixelAddr + B] = 0xFF;
HiRes.pixels[pixelAddr + A] = 0xFF;
HiRes.pixels[pixelAddr + 4 + R] = 0xFF;
HiRes.pixels[pixelAddr + 4 + G] = 0xFF;
HiRes.pixels[pixelAddr + 4 + B] = 0xFF;
HiRes.pixels[pixelAddr + 4 + A] = 0xFF;
HiRes.typedPointer[colorAddr] = color_white;
HiRes.typedPointer[colorAddr + 1] = color_white;
case 0x04: // black 2
HiRes.pixels[pixelAddr + R] = 0x00;
HiRes.pixels[pixelAddr + G] = 0x00;
HiRes.pixels[pixelAddr + B] = 0x00;
HiRes.pixels[pixelAddr + A] = 0x00;
HiRes.pixels[pixelAddr + 4 + R] = 0x00;
HiRes.pixels[pixelAddr + 4 + G] = 0x00;
HiRes.pixels[pixelAddr + 4 + B] = 0x00;
HiRes.pixels[pixelAddr + 4 + A] = 0x00;
// HiRes.typedPointer[colorAddr] = color_black;
// HiRes.typedPointer[colorAddr + 1] = color_black;
break
case 0x05: // blue
HiRes.pixels[pixelAddr + R] = 0x11;
HiRes.pixels[pixelAddr + G] = 0x66;
HiRes.pixels[pixelAddr + B] = 0xEE;
HiRes.pixels[pixelAddr + A] = 0xFF;
HiRes.typedPointer[colorAddr] = color_blue;
// HiRes.typedPointer[colorAddr + 1] = color_black;
HiRes.pixels[pixelAddr + 4 + R] = 0x00;
HiRes.pixels[pixelAddr + 4 + G] = 0x00;
HiRes.pixels[pixelAddr + 4 + B] = 0x00;
HiRes.pixels[pixelAddr + 4 + A] = 0x00;
case 0x06: // orange
// do we need to extend the color?
if (prev == 0x06) ||
(prev == 0x03) || (prev == 0x07)
{
HiRes.pixels[pixelAddr + R] = 0xEE;
HiRes.pixels[pixelAddr + G] = 0x22;
HiRes.pixels[pixelAddr + B] = 0x11;
HiRes.pixels[pixelAddr + A] = 0xFF;
HiRes.typedPointer[colorAddr] = color_orange;
}
else {
HiRes.pixels[pixelAddr + R] = 0x00;
HiRes.pixels[pixelAddr + G] = 0x00;
HiRes.pixels[pixelAddr + B] = 0x00;
HiRes.pixels[pixelAddr + A] = 0x00;
// HiRes.typedPointer[colorAddr] = color_black;
}
HiRes.pixels[pixelAddr + 4 + R] = 0xEE;
HiRes.pixels[pixelAddr + 4 + G] = 0x22;
HiRes.pixels[pixelAddr + 4 + B] = 0x11;
HiRes.pixels[pixelAddr + 4 + A] = 0xFF;
HiRes.typedPointer[colorAddr + 1] = color_orange;
case 0x07: // white 2
HiRes.pixels[pixelAddr + R] = 0xFF;
HiRes.pixels[pixelAddr + G] = 0xFF;
HiRes.pixels[pixelAddr + B] = 0xFF;
HiRes.pixels[pixelAddr + A] = 0xFF;
HiRes.pixels[pixelAddr + 4 + R] = 0xFF;
HiRes.pixels[pixelAddr + 4 + G] = 0xFF;
HiRes.pixels[pixelAddr + 4 + B] = 0xFF;
HiRes.pixels[pixelAddr + 4 + A] = 0xFF;
HiRes.typedPointer[colorAddr] = color_white;
HiRes.typedPointer[colorAddr + 1] = color_white;
default:
HiRes.pixels[pixelAddr + R] = 0x00;
HiRes.pixels[pixelAddr + G] = 0x00;
HiRes.pixels[pixelAddr + B] = 0x00;
HiRes.pixels[pixelAddr + A] = 0x00;
HiRes.pixels[pixelAddr + 4 + R] = 0x00;
HiRes.pixels[pixelAddr + 4 + G] = 0x00;
HiRes.pixels[pixelAddr + 4 + B] = 0x00;
HiRes.pixels[pixelAddr + 4 + A] = 0x00;
// HiRes.typedPointer[colorAddr] = color_black;
// HiRes.typedPointer[colorAddr + 1] = color_black;
break
}
// white adjustment
if ( (prev & 2) == 2 ) && ( (pixel & 1) == 1 ) {
HiRes.pixels[pixelAddr + R] = 0xFF;
HiRes.pixels[pixelAddr + G] = 0xFF;
HiRes.pixels[pixelAddr + B] = 0xFF;
HiRes.pixels[pixelAddr + A] = 0xFF;
HiRes.pixels[pixelAddr - 4 + R] = 0xFF;
HiRes.pixels[pixelAddr - 4 + G] = 0xFF;
HiRes.pixels[pixelAddr - 4 + B] = 0xFF;
HiRes.pixels[pixelAddr - 4 + A] = 0xFF;
HiRes.typedPointer[colorAddr] = color_white;
HiRes.typedPointer[colorAddr - 1] = color_white;
// TODO: Need better check if extra green was created
if (HiRes.pixels[pixelAddr - 8 + G] == 0xA2 ) {
HiRes.pixels[pixelAddr - 8 + R] = 0x00;
HiRes.pixels[pixelAddr - 8 + G] = 0x00;
HiRes.pixels[pixelAddr - 8 + B] = 0x00;
HiRes.pixels[pixelAddr - 8 + A] = 0x00;
HiRes.typedPointer[colorAddr - 2] = color_black;
}
}
@ -640,10 +580,7 @@ class HiRes: NSView {
) {
// was the previous purple pixel promoted to white or is it still purple?
if ( HiRes.pixels[pixelAddr - 8 + R] == 0xBB ) {
HiRes.pixels[pixelAddr - 4 + R] = 0xBB;
HiRes.pixels[pixelAddr - 4 + G] = 0x11;
HiRes.pixels[pixelAddr - 4 + B] = 0xEE;
HiRes.pixels[pixelAddr - 4 + A] = 0xFF;
HiRes.typedPointer[colorAddr - 1] = color_purple;
}
}
@ -652,24 +589,15 @@ class HiRes: NSView {
(pixel == 0x05) ||
(pixel == 0x03) || (pixel == 0x07)
) {
HiRes.pixels[pixelAddr - 4 + R] = 0x11;
HiRes.pixels[pixelAddr - 4 + G] = 0x66;
HiRes.pixels[pixelAddr - 4 + B] = 0xEE;
HiRes.pixels[pixelAddr - 4 + A] = 0xFF;
HiRes.typedPointer[colorAddr - 1] = color_blue;
}
}
override func draw(_ rect: CGRect) {
// print("HIRESSLOW\n")
// if was > 100 {
// return
// }
// was += 1
func Update() {
var height = HiRes.PixelHeight
// do not even render it...
if videoMode.text == 1 {
return
@ -685,17 +613,13 @@ class HiRes: NSView {
HiResBufferPointer = HiResBuffer1
}
}
var pixelAddr = 0
var minX = 9999
var minY = 9999
var maxX = 0
var maxY = 0
var x = 0
var y = 0
blockChanged = [Bool](repeating: false, count: HiRes.blockRows * HiRes.blockCols / 2)
HiRes.context?.clear( CGRect(x: 0, y: 0, width: frame.width, height: frame.height) )
for lineAddr in HiResLineAddrTbl {
@ -709,67 +633,80 @@ class HiRes: NSView {
var prev = 0
for blockHorIdx in 0 ..< HiRes.blockCols / 2 {
// print("blockVertIdx:", blockVertIdx, " blockHorIdx:", blockHorIdx)
let blockH = Int(HiResBufferPointer[ Int(lineAddr + blockHorIdx * 2) ])
let blockH7 = ( blockH >> 5 ) & 0x04
let blockL = Int(HiResBufferPointer[ Int(lineAddr + blockHorIdx * 2) + 1 ])
let blockL7 = ( blockL >> 5 ) & 0x04
let block = ( blockL << 7 ) | ( blockH & 0x7F ) & 0x3FFF
let block8 = ( blockL << 8 ) | blockH
let screenIdx = y * HiRes.blockCols + blockHorIdx
if ( shadowScreen[ screenIdx ] != block ) {
blockChanged[ blockVertIdx + blockHorIdx ] = true
}
else {
blockChanged[ blockVertIdx + blockHorIdx ] = false
}
shadowScreen[ screenIdx ] = block
for px in 0 ... 2 {
// let bitMask = 3 << ( px * 2 )
let pixel = blockH7 | ( (block >> (px * 2)) & 3 )
hiresColorPixel(pixelAddr: pixelAddr, pixel: pixel, prev: prev )
pixelAddr += 8
prev = pixel
// if ( minX > x ) { minX = x }
// if ( minY > y ) { minY = y }
// if ( maxX < x ) { maxX = x }
// if ( maxY < y ) { maxY = y }
//
// x += 2
}
let pixel = blockH7 | ( (block >> (3 * 2)) & 3 )
// get all changed blocks
blockChanged[ blockVertIdx + blockHorIdx ] = blockChanged[ blockVertIdx + blockHorIdx ] || shadowScreen[ screenIdx ] != block8
shadowScreen[ screenIdx ] = block8
for px in 0 ... 2 {
// let bitMask = 3 << ( px * 2 )
let pixel = blockH7 | ( (block >> (px * 2)) & 3 )
hiresColorPixel(pixelAddr: pixelAddr, pixel: pixel, prev: prev )
pixelAddr += 8
prev = pixel
for px in 4 ... 6 {
// let bitMask = 3 << ( px * 2 )
let pixel = blockL7 | ( (block >> (px * 2)) & 3 )
hiresColorPixel(pixelAddr: pixelAddr, pixel: pixel, prev: prev )
pixelAddr += 8
prev = pixel
// if ( minX > x ) { minX = x }
// if ( minY > y ) { minY = y }
// if ( maxX < x ) { maxX = x }
// if ( maxY < y ) { maxY = y }
//
// x += 2
}
}
// else {
// pixelAddr += 4 * 7
// x += 7
// }
// }
let pixel = blockH7 | ( (block >> (3 * 2)) & 3 )
hiresColorPixel(pixelAddr: pixelAddr, pixel: pixel, prev: prev )
pixelAddr += 8
prev = pixel
for px in 4 ... 6 {
// let bitMask = 3 << ( px * 2 )
let pixel = blockL7 | ( (block >> (px * 2)) & 3 )
hiresColorPixel(pixelAddr: pixelAddr, pixel: pixel, prev: prev )
pixelAddr += 8
prev = pixel
}
}
y += 1
x = 0
}
// refresh changed block only
let blockScreenWidth = Int(frame.width) / HiRes.blockCols * 2
let blockScreenHeigth = Int(frame.height) / HiRes.blockRows
for blockVertIdx in 0 ..< HiRes.blockRows {
for blockHorIdx in 0 ..< HiRes.blockCols / 2 {
if blockChanged[ blockVertIdx * HiRes.blockCols / 2 + blockHorIdx ] {
// refresh the entire screen
let boundingBox = CGRect(
x: blockHorIdx * blockScreenWidth - 2,
y: Int(frame.height) - blockVertIdx * blockScreenHeigth - blockScreenHeigth - 2,
width: blockScreenWidth + 4,
height: blockScreenHeigth + 4)
self.setNeedsDisplay( boundingBox )
}
}
}
// needsDisplay = true // refresh the entire screen
}
override func draw(_ rect: CGRect) {
// print("HIRESSLOW\n")
// if was > 100 {
// return
// }
// was += 1
// HiRes.context?.setShouldAntialias(true)
// HiRes.context?.interpolationQuality = CGInterpolationQuality.low
@ -790,7 +727,7 @@ class HiRes: NSView {
// refresh the entire screen
let boundingBox = CGRect(x: 0, y: 0, width: frame.width, height: frame.height)
currentContext!.draw (image, in: boundingBox)
currentContext!.draw(image, in: boundingBox)
}
#elseif HIRESDRAWCOLOR

View File

@ -131,16 +131,17 @@ class ViewController: NSViewController {
}
@IBAction func Reset(_ sender: Any) {
// let resetPointer = UnsafeRawBufferPointer(start: &RAM + 0x3F2, count: 2)
// let ral = UInt16(resetPointer[0])
// let rah = UInt16(resetPointer[1])
// let resetAddr = rah << 8 + ral
//
// let hex = String(resetAddr, radix: 16, uppercase: true)
// print("reset to:\(hex)\n")
// m6502.pc = resetAddr
// m6502.interrupt = SOFTRESET;
m6502.interrupt = SOFTRESET;
// let saved_frm_set = clk_6502_per_frm_set;
// clk_6502_per_frm_set = 0
// clk_6502_per_frm_max = 0
// // wait for 1 ms to allow the simulation to halt
// usleep(10000);
softReset()
// clk_6502_per_frm_set = saved_frm_set
}
@ -164,8 +165,8 @@ class ViewController: NSViewController {
// static let blockChar : Character = ""
// static var flashingSpace : Character = " "
let ramBufferPointer = UnsafeRawBufferPointer(start: RAM, count: 64 * 1024)
let textBufferPointer = UnsafeRawBufferPointer(start: RAM + textBaseAddr, count: textBufferSize * 2)
let ramBufferPointer = UnsafeRawBufferPointer(start: MEM, count: 64 * 1024)
let textBufferPointer = UnsafeRawBufferPointer(start: MEM + textBaseAddr, count: textBufferSize * 2)
let textAuxBufferPointer = UnsafeRawBufferPointer(start: AUX + textBaseAddr, count: textBufferSize)
static let textArraySize = textLines * (textCols + lineEndChars) + textCols * 2
@ -287,6 +288,10 @@ class ViewController: NSViewController {
}
var savedVideoMode = videoMode_t.init()
override func keyUp(with event: NSEvent) {
print("KBD Event")
// switch event.modifierFlags.intersection(.deviceIndependentFlagsMask) {
@ -331,6 +336,8 @@ class ViewController: NSViewController {
}
#endif
kbdUp()
}
// override func flagsChanged(with event: NSEvent) {
// switch event.modifierFlags.intersection(.deviceIndependentFlagsMask) {
@ -376,19 +383,22 @@ class ViewController: NSViewController {
var currentVideoMode = videoMode
var lastFrameTime = CACurrentMediaTime() as Double
var frameCounter : UInt = 0
var frameCounter : UInt32 = 0
var clkCounter : Double = 0
let fpsHalf = fps / 2
var halted = true;
func Update() {
clk_6502_per_frm_max = 0
// clk_6502_per_frm_max = 0
clkCounter += Double(clkfrm)
// we start a new frame from here, so CPU is running even while rendering
clkfrm = 0
frameCounter += 1
if ( frameCounter % UInt(fps) == 0 ) {
if ( frameCounter % fps == 0 ) {
let currentTime = CACurrentMediaTime() as Double
let elpasedTime = currentTime - lastFrameTime
lastFrameTime = currentTime
@ -403,7 +413,8 @@ class ViewController: NSViewController {
// return
frameCnt += 1
if ( frameCnt == fps / 2 ) {
if ( frameCnt == fpsHalf ) {
// flashingSpace = blockChar
ViewController.charConvTbl = ViewController.charConvTblFlashOn
}
@ -413,65 +424,74 @@ class ViewController: NSViewController {
frameCnt = 0
}
var txt : String = ""
var fromLines = 0
var toLines = textLines
// Rendering is happening in the main thread, which has two implications:
// 1. We can update UI elements
// 2. it is independent of the simulation, de that is running in the background thread while we are busy with rendering...
DispatchQueue.main.async {
var txt : String = ""
var fromLines = 0
var toLines = self.textLines
if videoMode.text == 0 {
if videoMode.mixed == 1 {
fromLines = toLines - 4
}
else {
toLines = 0
}
}
txtArr = txtClear
// render an empty space to eiminate displaying text portion of the screen covered by graphics
for y in 0 ..< fromLines {
if videoMode.col80 == 0 {
txtArr[ y * (textCols + lineEndChars) + textCols ] = "\n"
}
else {
txtArr[ y * (textCols * 2 + lineEndChars) + textCols * 2] = "\n"
}
}
// render the rest of the text screen
for y in fromLines ..< toLines {
for x in 0 ..< textCols {
let byte = textBufferPointer[ textLineOfs[y] + x ]
let idx = Int(byte);
let chr = ViewController.charConvTbl[idx]
if videoMode.col80 == 0 {
txtArr[ y * (textCols + lineEndChars) + x ] = chr
if videoMode.text == 0 {
if videoMode.mixed == 1 {
fromLines = toLines - 4
}
else {
txtArr[ y * (textCols * 2 + lineEndChars) + x * 2 + 1] = chr
let byte = textAuxBufferPointer[ textLineOfs[y] + x ]
let idx = Int(byte);
let chr = ViewController.charConvTbl[idx]
txtArr[ y * (textCols * 2 + lineEndChars) + x * 2] = chr
toLines = 0
}
}
self.txtArr = self.txtClear
// render an empty space to eiminate displaying text portion of the screen covered by graphics
let charDisposition = videoMode.col80 == 0 ? 1 : 2
for y in 0 ..< fromLines {
self.txtArr[ y * (self.textCols * charDisposition + self.lineEndChars) + self.textCols * charDisposition] = "\n"
}
// 40 col
if videoMode.col80 == 0 {
txtArr[ y * (textCols + lineEndChars) + textCols ] = "\n"
// render the rest of the text screen
for y in fromLines ..< toLines {
for x in 0 ..< self.textCols {
let byte = self.textBufferPointer[ self.textLineOfs[y] + x ]
let idx = Int(byte);
let chr = ViewController.charConvTbl[idx]
self.txtArr[ y * (self.textCols + self.lineEndChars) + x ] = chr
}
self.txtArr[ y * (self.textCols + self.lineEndChars) + self.textCols ] = "\n"
}
}
// 80 col
else {
txtArr[ y * (textCols * 2 + lineEndChars) + textCols * 2] = "\n"
// render the rest of the text screen
for y in fromLines ..< toLines {
for x in 0 ..< self.textCols {
let byte = self.textBufferPointer[ self.textLineOfs[y] + x ]
let idx = Int(byte);
let chr = ViewController.charConvTbl[idx]
self.txtArr[ y * (self.textCols * 2 + self.lineEndChars) + x * 2 + 1] = chr
let byte2 = self.textAuxBufferPointer[ self.textLineOfs[y] + x ]
let idx2 = Int(byte2);
let chr2 = ViewController.charConvTbl[idx2]
self.txtArr[ y * (self.textCols * 2 + self.lineEndChars) + x * 2] = chr2
}
self.txtArr[ y * (self.textCols * 2 + self.lineEndChars) + self.textCols * 2] = "\n"
}
}
}
txt = String(txtArr)
DispatchQueue.main.async {
txt = String(self.txtArr)
if videoMode.col80 != self.currentVideoMode.col80 {
self.currentVideoMode.col80 = videoMode.col80
@ -510,8 +530,69 @@ class ViewController: NSViewController {
// }
// self.HiRes.setNeedsDisplay(self.HiRes.frame)
// self.hires.setNeedsDisplay( CGRect(x: 0, y: 191-50, width: 50, height: 50) )
self.hires.needsDisplay = true
// self.hires.setNeedsDisplay( CGRect(x: 0, y: 0, width: self.hires.frame.width, height: self.hires.frame.height) )
// self.hires.setNeedsDisplay( CGRect(x: 0, y: 100, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 100, y: 100, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 200, y: 100, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 300, y: 100, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 400, y: 100, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 800, y: 100, width: 50, height: 50) )
//
// self.hires.setNeedsDisplay( CGRect(x: 0, y: 200, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 100, y: 200, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 200, y: 200, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 300, y: 200, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 400, y: 200, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 500, y: 200, width: 50, height: 50) )
//
// self.hires.setNeedsDisplay( CGRect(x: 0, y: 300, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 100, y: 300, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 200, y: 300, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 300, y: 300, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 400, y: 300, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 500, y: 300, width: 50, height: 50) )
//
// self.hires.setNeedsDisplay( CGRect(x: 0, y: 400, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 100, y: 400, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 200, y: 400, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 300, y: 400, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 400, y: 400, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 500, y: 400, width: 50, height: 50) )
//
// self.hires.setNeedsDisplay( CGRect(x: 0, y: 500, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 100, y: 500, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 200, y: 500, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 300, y: 500, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 400, y: 500, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 500, y: 500, width: 50, height: 50) )
//
// self.hires.setNeedsDisplay( CGRect(x: 0, y: 600, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 100, y: 600, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 200, y: 600, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 300, y: 600, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 400, y: 600, width: 50, height: 50) )
// self.hires.setNeedsDisplay( CGRect(x: 500, y: 600, width: 50, height: 50) )
if self.savedVideoMode.text != videoMode.text {
self.savedVideoMode.text = videoMode.text
// self.hires.clearScreen()
if ( videoMode.text == 0 ) {
self.hires.isHidden = false
}
else {
self.hires.isHidden = true
}
}
// only refresh graphics view when needed (aka not in text mode)
if ( videoMode.text == 0 ) {
// self.hires.needsDisplay = true
self.hires.Update()
}
// }
#endif
}
@ -547,6 +628,8 @@ class ViewController: NSViewController {
// txtClear[ y * (textCols + lineEndChars) + textCols * 2 + 1 ] = "\n"
// }
hires.needsDisplay = true;
woz_loadFile( Bundle.main.resourcePath, "Apple DOS 3.3 January 1983.woz" )
@ -627,7 +710,7 @@ class ViewController: NSViewController {
@IBAction func speedSelected(_ sender: NSButton) {
if ( sender.title == "MAX" ) {
setCPUClockSpeed(freq: 1000)
setCPUClockSpeed(freq: 1280)
}
else if let freq = Double( sender.title ) {
setCPUClockSpeed(freq: freq)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>18F132</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>A2Mac</string>
<key>CFBundleIdentifier</key>
<string>com.gamealloy.A2Mac</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>A2Mac</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>10G8</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>18G74</string>
<key>DTSDKName</key>
<string>macosx10.14</string>
<key>DTXcode</key>
<string>1030</string>
<key>DTXcodeBuild</key>
<string>10G8</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.education</string>
<key>LSMinimumSystemVersion</key>
<string>10.14</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2019 GameAlloy. All rights reserved.</string>
<key>NSMainStoryboardFile</key>
<string>Main</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

Binary file not shown.

View File

@ -0,0 +1 @@
APPL????

Binary file not shown.

View File

@ -0,0 +1,307 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict>
<key>Resources/Base.lproj/Main.storyboardc/Info.plist</key>
<data>
6AoYrKQ3DrvTjTFOS28hS2LJZo0=
</data>
<key>Resources/Base.lproj/Main.storyboardc/MainMenu.nib</key>
<data>
AR1X5fdhmuYDefj1pzhWIprdtTg=
</data>
<key>Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib</key>
<data>
e02N0kNSyoLS58xvaeJNNvs5o7U=
</data>
<key>Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib</key>
<data>
bXljSC6cO28V+VsNqrUNOCq0GwU=
</data>
<key>Resources/apple.rom</key>
<data>
jFygw5AF37CJivLAmS95fMd1MMA=
</data>
</dict>
<key>files2</key>
<dict>
<key>Frameworks/libswiftAppKit.dylib</key>
<dict>
<key>cdhash</key>
<data>
EEZldB5IJ9RpHesgqMDMNL3mbE8=
</data>
<key>requirement</key>
<string>identifier "com.apple.dt.runtime.swiftAppKit" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Tamas Rudnai (Z7ST5Z9Q8J)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */</string>
</dict>
<key>Frameworks/libswiftCore.dylib</key>
<dict>
<key>cdhash</key>
<data>
yLZO5FT4glZCn+WK44wbb6G9MuQ=
</data>
<key>requirement</key>
<string>identifier "com.apple.dt.runtime.swiftCore" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Tamas Rudnai (Z7ST5Z9Q8J)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */</string>
</dict>
<key>Frameworks/libswiftCoreData.dylib</key>
<dict>
<key>cdhash</key>
<data>
5RXmxeqkT+Eom4gmjwpu/L4VWpo=
</data>
<key>requirement</key>
<string>identifier "com.apple.dt.runtime.swiftCoreData" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Tamas Rudnai (Z7ST5Z9Q8J)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */</string>
</dict>
<key>Frameworks/libswiftCoreFoundation.dylib</key>
<dict>
<key>cdhash</key>
<data>
15U42JsstUuAgvvPlduzuZRgb2Y=
</data>
<key>requirement</key>
<string>identifier "com.apple.dt.runtime.swiftCoreFoundation" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Tamas Rudnai (Z7ST5Z9Q8J)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */</string>
</dict>
<key>Frameworks/libswiftCoreGraphics.dylib</key>
<dict>
<key>cdhash</key>
<data>
rX6mvlo+rVwId+sxApdqWDj9tl0=
</data>
<key>requirement</key>
<string>identifier "com.apple.dt.runtime.swiftCoreGraphics" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Tamas Rudnai (Z7ST5Z9Q8J)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */</string>
</dict>
<key>Frameworks/libswiftCoreImage.dylib</key>
<dict>
<key>cdhash</key>
<data>
Jdi29Tbt0gd+miC6HeatrVrgb5U=
</data>
<key>requirement</key>
<string>identifier "com.apple.dt.runtime.swiftCoreImage" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Tamas Rudnai (Z7ST5Z9Q8J)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */</string>
</dict>
<key>Frameworks/libswiftDarwin.dylib</key>
<dict>
<key>cdhash</key>
<data>
XILe/3halVvWzNqo8KU+GSpLwbU=
</data>
<key>requirement</key>
<string>identifier "com.apple.dt.runtime.swiftDarwin" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Tamas Rudnai (Z7ST5Z9Q8J)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */</string>
</dict>
<key>Frameworks/libswiftDispatch.dylib</key>
<dict>
<key>cdhash</key>
<data>
8J6F/njpkZM4uUrc+qboMANq/RU=
</data>
<key>requirement</key>
<string>identifier "com.apple.dt.runtime.swiftDispatch" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Tamas Rudnai (Z7ST5Z9Q8J)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */</string>
</dict>
<key>Frameworks/libswiftFoundation.dylib</key>
<dict>
<key>cdhash</key>
<data>
6sdl5nbIOv8y2YGS458aTUoAv5Y=
</data>
<key>requirement</key>
<string>identifier "com.apple.dt.runtime.swiftFoundation" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Tamas Rudnai (Z7ST5Z9Q8J)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */</string>
</dict>
<key>Frameworks/libswiftIOKit.dylib</key>
<dict>
<key>cdhash</key>
<data>
WBdgAwVaVFf42xT5ycN+pvrwFXI=
</data>
<key>requirement</key>
<string>identifier "com.apple.dt.runtime.swiftIOKit" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Tamas Rudnai (Z7ST5Z9Q8J)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */</string>
</dict>
<key>Frameworks/libswiftMetal.dylib</key>
<dict>
<key>cdhash</key>
<data>
a6pBJtcpf+VB2xYUf9guYyXljsI=
</data>
<key>requirement</key>
<string>identifier "com.apple.dt.runtime.swiftMetal" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Tamas Rudnai (Z7ST5Z9Q8J)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */</string>
</dict>
<key>Frameworks/libswiftObjectiveC.dylib</key>
<dict>
<key>cdhash</key>
<data>
VP0qhJG8sUl15upzEOz9FL20HQI=
</data>
<key>requirement</key>
<string>identifier "com.apple.dt.runtime.swiftObjectiveC" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Tamas Rudnai (Z7ST5Z9Q8J)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */</string>
</dict>
<key>Frameworks/libswiftQuartzCore.dylib</key>
<dict>
<key>cdhash</key>
<data>
eSSvbBdEBb5qswjKznS971MYi2E=
</data>
<key>requirement</key>
<string>identifier "com.apple.dt.runtime.swiftQuartzCore" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Tamas Rudnai (Z7ST5Z9Q8J)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */</string>
</dict>
<key>Frameworks/libswiftXPC.dylib</key>
<dict>
<key>cdhash</key>
<data>
AI3dcMnYeote388+0kD9cxzrbMs=
</data>
<key>requirement</key>
<string>identifier "com.apple.dt.runtime.swiftXPC" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Tamas Rudnai (Z7ST5Z9Q8J)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */</string>
</dict>
<key>Frameworks/libswiftos.dylib</key>
<dict>
<key>cdhash</key>
<data>
Zx0Sx7JGoCoRsXhNGTGoqaSsqNM=
</data>
<key>requirement</key>
<string>identifier "com.apple.dt.runtime.swiftos" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Tamas Rudnai (Z7ST5Z9Q8J)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */</string>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/Info.plist</key>
<dict>
<key>hash2</key>
<data>
xwLd2dtY/GK5rjLbjhEc5yjMTxFoYQhVrr5WfTsPCFk=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/MainMenu.nib</key>
<dict>
<key>hash2</key>
<data>
Fs6qfQisRgsf4aocKfSKu7npHuUg1KjhjV95eh9lpKA=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib</key>
<dict>
<key>hash2</key>
<data>
U7BNL6kIHc9C61myhWj0Oek+pCAc+KtieZzYy/hXvYs=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib</key>
<dict>
<key>hash2</key>
<data>
V29XadPgSCRQGHvw6g+qEt1uqimZRlZDg1RRmDo9pus=
</data>
</dict>
<key>Resources/apple.rom</key>
<dict>
<key>hash2</key>
<data>
N4ugDIamTMpJztrKfejV01GYPrwpXZ0R4HUv6/w0Ykk=
</data>
</dict>
</dict>
<key>rules</key>
<dict>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>

View File

@ -0,0 +1,3 @@
import Cocoa
var str = "Hello, playground"

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='macos' executeOnSourceChanges='false'>
<timeline fileName='timeline.xctimeline'/>
</playground>

BIN
DISK_II_C600.ROM Normal file

Binary file not shown.

View File

View File

Binary file not shown.

BIN
apple.rom Normal file

Binary file not shown.

967392
disksectorload_5.log Normal file

File diff suppressed because it is too large Load Diff

967392
disksectorload_5.marked Normal file

File diff suppressed because it is too large Load Diff

125
disksectorload_vii.csv Normal file
View File

@ -0,0 +1,125 @@
100935 44567424 C65E: BD 8C C0 LDA $C08C,X 0x07 0x60 0x00 0x35 0xFE
100936 44567428 C661: 10 FB BPL $C65E 0x07 0x60 0x00 0x35 0xFE
100937 44567431 C65E: BD 8C C0 LDA $C08C,X 0x1F 0x60 0x00 0x35 0xFE
100938 44567435 C661: 10 FB BPL $C65E 0x1F 0x60 0x00 0x35 0xFE
100939 44567438 C65E: BD 8C C0 LDA $C08C,X 0x7F 0x60 0x00 0x35 0xFE
100940 44567442 C661: 10 FB BPL $C65E 0x7F 0x60 0x00 0x35 0xFE
100941 44567445 C65E: BD 8C C0 LDA $C08C,X 0xFF 0x60 0x00 0xB5 0xFE
100942 44567449 C661: 10 FB BPL $C65E 0xFF 0x60 0x00 0xB5 0xFE
100943 44567451 C663: 49 D5 EOR #$D5 0x2A 0x60 0x00 0x35 0xFE
100944 44567453 C665: D0 F7 BNE $C65E 0x2A 0x60 0x00 0x35 0xFE
100945 44567456 C65E: BD 8C C0 LDA $C08C,X 0xFF 0x60 0x00 0xB5 0xFE
100946 44567460 C661: 10 FB BPL $C65E 0xFF 0x60 0x00 0xB5 0xFE
100947 44567462 C663: 49 D5 EOR #$D5 0x2A 0x60 0x00 0x35 0xFE
100948 44567464 C665: D0 F7 BNE $C65E 0x2A 0x60 0x00 0x35 0xFE
100949 44567467 C65E: BD 8C C0 LDA $C08C,X 0x0D 0x60 0x00 0x35 0xFE
100950 44567471 C661: 10 FB BPL $C65E 0x0D 0x60 0x00 0x35 0xFE
100951 44567474 C65E: BD 8C C0 LDA $C08C,X 0x35 0x60 0x00 0x35 0xFE
100952 44567478 C661: 10 FB BPL $C65E 0x35 0x60 0x00 0x35 0xFE
100953 44567481 C65E: BD 8C C0 LDA $C08C,X 0x6A 0x60 0x00 0x35 0xFE
100954 44567485 C661: 10 FB BPL $C65E 0x6A 0x60 0x00 0x35 0xFE
100955 44567488 C65E: BD 8C C0 LDA $C08C,X 0xD5 0x60 0x00 0xB5 0xFE
100956 44567492 C661: 10 FB BPL $C65E 0xD5 0x60 0x00 0xB5 0xFE
100957 44567494 C663: 49 D5 EOR #$D5 0x00 0x60 0x00 0x37 0xFE
100958 44567496 C665: D0 F7 BNE $C65E 0x00 0x60 0x00 0x37 0xFE
100959 44567498 C667: BD 8C C0 LDA $C08C,X 0x0A 0x60 0x00 0x35 0xFE
100960 44567502 C66A: 10 FB BPL $C667 0x0A 0x60 0x00 0x35 0xFE
100961 44567505 C667: BD 8C C0 LDA $C08C,X 0x15 0x60 0x00 0x35 0xFE
100962 44567509 C66A: 10 FB BPL $C667 0x15 0x60 0x00 0x35 0xFE
100963 44567512 C667: BD 8C C0 LDA $C08C,X 0x55 0x60 0x00 0x35 0xFE
100964 44567516 C66A: 10 FB BPL $C667 0x55 0x60 0x00 0x35 0xFE
100965 44567519 C667: BD 8C C0 LDA $C08C,X 0xAA 0x60 0x00 0xB5 0xFE
100966 44567523 C66A: 10 FB BPL $C667 0xAA 0x60 0x00 0xB5 0xFE
100967 44567525 C66C: C9 AA CMP #$AA 0xAA 0x60 0x00 0x37 0xFE
100968 44567527 C66E: D0 F3 BNE $C663 0xAA 0x60 0x00 0x37 0xFE
100969 44567529 C670: EA NOP 0xAA 0x60 0x00 0x37 0xFE
100970 44567531 C671: BD 8C C0 LDA $C08C,X 0x0A 0x60 0x00 0x35 0xFE
100971 44567535 C674: 10 FB BPL $C671 0x0A 0x60 0x00 0x35 0xFE
100972 44567538 C671: BD 8C C0 LDA $C08C,X 0x2B 0x60 0x00 0x35 0xFE
100973 44567542 C674: 10 FB BPL $C671 0x2B 0x60 0x00 0x35 0xFE
100974 44567545 C671: BD 8C C0 LDA $C08C,X 0x56 0x60 0x00 0x35 0xFE
100975 44567549 C674: 10 FB BPL $C671 0x56 0x60 0x00 0x35 0xFE
100976 44567552 C671: BD 8C C0 LDA $C08C,X 0xAD 0x60 0x00 0xB5 0xFE
100977 44567556 C674: 10 FB BPL $C671 0xAD 0x60 0x00 0xB5 0xFE
100978 44567558 C676: C9 96 CMP #$96 0xAD 0x60 0x00 0x35 0xFE
100979 44567560 C678: F0 09 BEQ $C683 0xAD 0x60 0x00 0x35 0xFE
100980 44567562 C67A: 28 PLP 0xAD 0x60 0x00 0x37 0xFF
100981 44567566 C67B: 90 DF BCC $C65C 0xAD 0x60 0x00 0x37 0xFF
100982 44567568 C67D: 49 AD EOR #$AD 0x00 0x60 0x00 0x37 0xFF
100983 44567570 C67F: F0 25 BEQ $C6A6 0x00 0x60 0x00 0x37 0xFF
100984 44567573 C6A6: A0 56 LDY #$56 0x00 0x60 0x56 0x35 0xFF
100985 44567575 C6A8: 84 3C STY $3C 0x00 0x60 0x56 0x35 0xFF
100986 44567578 C6AA: BC 8C C0 LDY $C08C,X 0x00 0x60 0xB6 0xB5 0xFF
100987 44567582 C6AD: 10 FB BPL $C6AA 0x00 0x60 0xB6 0xB5 0xFF
100988 44567584 C6AF: 59 D6 02 EOR $02D6,Y 0x12 0x60 0xB6 0x35 0xFF
100989 44567589 C6B2: A4 3C LDY $3C 0x12 0x60 0x56 0x35 0xFF
100990 44567592 C6B4: 88 DEY 0x12 0x60 0x55 0x35 0xFF
100991 44567594 C6B5: 99 00 03 STA $0300,Y 0x12 0x60 0x55 0x35 0xFF
100992 44567599 C6B8: D0 EE BNE $C6A8 0x12 0x60 0x55 0x35 0xFF
100993 44567602 C6A8: 84 3C STY $3C 0x12 0x60 0x55 0x35 0xFF
100994 44567605 C6AA: BC 8C C0 LDY $C08C,X 0x12 0x60 0x36 0x35 0xFF
100995 44567609 C6AD: 10 FB BPL $C6AA 0x12 0x60 0x36 0x35 0xFF
100996 44567612 C6AA: BC 8C C0 LDY $C08C,X 0x12 0x60 0xDB 0xB5 0xFF
100997 44567616 C6AD: 10 FB BPL $C6AA 0x12 0x60 0xDB 0xB5 0xFF
100998 44567618 C6AF: 59 D6 02 EOR $02D6,Y 0x36 0x60 0xDB 0x35 0xFF
100999 44567623 C6B2: A4 3C LDY $3C 0x36 0x60 0x55 0x35 0xFF
101000 44567626 C6B4: 88 DEY 0x36 0x60 0x54 0x35 0xFF
101001 44567628 C6B5: 99 00 03 STA $0300,Y 0x36 0x60 0x54 0x35 0xFF
101002 44567633 C6B8: D0 EE BNE $C6A8 0x36 0x60 0x54 0x35 0xFF
101003 44567636 C6A8: 84 3C STY $3C 0x36 0x60 0x54 0x35 0xFF
101004 44567639 C6AA: BC 8C C0 LDY $C08C,X 0x36 0x60 0x6E 0x35 0xFF
101005 44567643 C6AD: 10 FB BPL $C6AA 0x36 0x60 0x6E 0x35 0xFF
101006 44567646 C6AA: BC 8C C0 LDY $C08C,X 0x36 0x60 0xDC 0xB5 0xFF
101007 44567650 C6AD: 10 FB BPL $C6AA 0x36 0x60 0xDC 0xB5 0xFF
101008 44567652 C6AF: 59 D6 02 EOR $02D6,Y 0x13 0x60 0xDC 0x35 0xFF
101009 44567657 C6B2: A4 3C LDY $3C 0x13 0x60 0x54 0x35 0xFF
101010 44567660 C6B4: 88 DEY 0x13 0x60 0x53 0x35 0xFF
101011 44567662 C6B5: 99 00 03 STA $0300,Y 0x13 0x60 0x53 0x35 0xFF
101012 44567667 C6B8: D0 EE BNE $C6A8 0x13 0x60 0x53 0x35 0xFF
101013 44567670 C6A8: 84 3C STY $3C 0x13 0x60 0x53 0x35 0xFF
101014 44567673 C6AA: BC 8C C0 LDY $C08C,X 0x13 0x60 0x7A 0x35 0xFF
101015 44567677 C6AD: 10 FB BPL $C6AA 0x13 0x60 0x7A 0x35 0xFF
101016 44567680 C6AA: BC 8C C0 LDY $C08C,X 0x13 0x60 0xF4 0xB5 0xFF
101017 44567684 C6AD: 10 FB BPL $C6AA 0x13 0x60 0xF4 0xB5 0xFF
101018 44567686 C6AF: 59 D6 02 EOR $02D6,Y 0x26 0x60 0xF4 0x35 0xFF
101019 44567691 C6B2: A4 3C LDY $3C 0x26 0x60 0x53 0x35 0xFF
101020 44567694 C6B4: 88 DEY 0x26 0x60 0x52 0x35 0xFF
101021 44567696 C6B5: 99 00 03 STA $0300,Y 0x26 0x60 0x52 0x35 0xFF
101022 44567701 C6B8: D0 EE BNE $C6A8 0x26 0x60 0x52 0x35 0xFF
101023 44567704 C6A8: 84 3C STY $3C 0x26 0x60 0x52 0x35 0xFF
101024 44567707 C6AA: BC 8C C0 LDY $C08C,X 0x26 0x60 0xF3 0xB5 0xFF
101025 44567711 C6AD: 10 FB BPL $C6AA 0x26 0x60 0xF3 0xB5 0xFF
101026 44567713 C6AF: 59 D6 02 EOR $02D6,Y 0x12 0x60 0xF3 0x35 0xFF
101027 44567718 C6B2: A4 3C LDY $3C 0x12 0x60 0x52 0x35 0xFF
101028 44567721 C6B4: 88 DEY 0x12 0x60 0x51 0x35 0xFF
101029 44567723 C6B5: 99 00 03 STA $0300,Y 0x12 0x60 0x51 0x35 0xFF
101030 44567728 C6B8: D0 EE BNE $C6A8 0x12 0x60 0x51 0x35 0xFF
101031 44567731 C6A8: 84 3C STY $3C 0x12 0x60 0x51 0x35 0xFF
101032 44567734 C6AA: BC 8C C0 LDY $C08C,X 0x12 0x60 0x5D 0x35 0xFF
101033 44567738 C6AD: 10 FB BPL $C6AA 0x12 0x60 0x5D 0x35 0xFF
101034 44567741 C6AA: BC 8C C0 LDY $C08C,X 0x12 0x60 0xBB 0xB5 0xFF
101035 44567745 C6AD: 10 FB BPL $C6AA 0x12 0x60 0xBB 0xB5 0xFF
101036 44567747 C6AF: 59 D6 02 EOR $02D6,Y 0x04 0x60 0xBB 0x35 0xFF
101037 44567752 C6B2: A4 3C LDY $3C 0x04 0x60 0x51 0x35 0xFF
101038 44567755 C6B4: 88 DEY 0x04 0x60 0x50 0x35 0xFF
101039 44567757 C6B5: 99 00 03 STA $0300,Y 0x04 0x60 0x50 0x35 0xFF
101040 44567762 C6B8: D0 EE BNE $C6A8 0x04 0x60 0x50 0x35 0xFF
101041 44567765 C6A8: 84 3C STY $3C 0x04 0x60 0x50 0x35 0xFF
101042 44567768 C6AA: BC 8C C0 LDY $C08C,X 0x04 0x60 0x5E 0x35 0xFF
101043 44567772 C6AD: 10 FB BPL $C6AA 0x04 0x60 0x5E 0x35 0xFF
101044 44567775 C6AA: BC 8C C0 LDY $C08C,X 0x04 0x60 0xBD 0xB5 0xFF
101045 44567779 C6AD: 10 FB BPL $C6AA 0x04 0x60 0xBD 0xB5 0xFF
101046 44567781 C6AF: 59 D6 02 EOR $02D6,Y 0x1C 0x60 0xBD 0x35 0xFF
101047 44567786 C6B2: A4 3C LDY $3C 0x1C 0x60 0x50 0x35 0xFF
101048 44567789 C6B4: 88 DEY 0x1C 0x60 0x4F 0x35 0xFF
101049 44567791 C6B5: 99 00 03 STA $0300,Y 0x1C 0x60 0x4F 0x35 0xFF
101050 44567796 C6B8: D0 EE BNE $C6A8 0x1C 0x60 0x4F 0x35 0xFF
101051 44567799 C6A8: 84 3C STY $3C 0x1C 0x60 0x4F 0x35 0xFF
101052 44567802 C6AA: BC 8C C0 LDY $C08C,X 0x1C 0x60 0xCF 0xB5 0xFF
101053 44567806 C6AD: 10 FB BPL $C6AA 0x1C 0x60 0xCF 0xB5 0xFF
101054 44567808 C6AF: 59 D6 02 EOR $02D6,Y 0x02 0x60 0xCF 0x35 0xFF
101055 44567813 C6B2: A4 3C LDY $3C 0x02 0x60 0x4F 0x35 0xFF
101056 44567816 C6B4: 88 DEY 0x02 0x60 0x4E 0x35 0xFF
101057 44567818 C6B5: 99 00 03 STA $0300,Y 0x02 0x60 0x4E 0x35 0xFF
101058 44567823 C6B8: D0 EE BNE $C6A8 0x02 0x60 0x4E 0x35 0xFF
101059 44567826 C6A8: 84 3C STY $3C 0x02 0x60 0x4E 0x35 0xFF
1 100935 44567424 C65E: BD 8C C0 LDA $C08C,X 0x07 0x60 0x00 0x35 0xFE
2 100936 44567428 C661: 10 FB BPL $C65E 0x07 0x60 0x00 0x35 0xFE
3 100937 44567431 C65E: BD 8C C0 LDA $C08C,X 0x1F 0x60 0x00 0x35 0xFE
4 100938 44567435 C661: 10 FB BPL $C65E 0x1F 0x60 0x00 0x35 0xFE
5 100939 44567438 C65E: BD 8C C0 LDA $C08C,X 0x7F 0x60 0x00 0x35 0xFE
6 100940 44567442 C661: 10 FB BPL $C65E 0x7F 0x60 0x00 0x35 0xFE
7 100941 44567445 C65E: BD 8C C0 LDA $C08C,X 0xFF 0x60 0x00 0xB5 0xFE
8 100942 44567449 C661: 10 FB BPL $C65E 0xFF 0x60 0x00 0xB5 0xFE
9 100943 44567451 C663: 49 D5 EOR #$D5 0x2A 0x60 0x00 0x35 0xFE
10 100944 44567453 C665: D0 F7 BNE $C65E 0x2A 0x60 0x00 0x35 0xFE
11 100945 44567456 C65E: BD 8C C0 LDA $C08C,X 0xFF 0x60 0x00 0xB5 0xFE
12 100946 44567460 C661: 10 FB BPL $C65E 0xFF 0x60 0x00 0xB5 0xFE
13 100947 44567462 C663: 49 D5 EOR #$D5 0x2A 0x60 0x00 0x35 0xFE
14 100948 44567464 C665: D0 F7 BNE $C65E 0x2A 0x60 0x00 0x35 0xFE
15 100949 44567467 C65E: BD 8C C0 LDA $C08C,X 0x0D 0x60 0x00 0x35 0xFE
16 100950 44567471 C661: 10 FB BPL $C65E 0x0D 0x60 0x00 0x35 0xFE
17 100951 44567474 C65E: BD 8C C0 LDA $C08C,X 0x35 0x60 0x00 0x35 0xFE
18 100952 44567478 C661: 10 FB BPL $C65E 0x35 0x60 0x00 0x35 0xFE
19 100953 44567481 C65E: BD 8C C0 LDA $C08C,X 0x6A 0x60 0x00 0x35 0xFE
20 100954 44567485 C661: 10 FB BPL $C65E 0x6A 0x60 0x00 0x35 0xFE
21 100955 44567488 C65E: BD 8C C0 LDA $C08C,X 0xD5 0x60 0x00 0xB5 0xFE
22 100956 44567492 C661: 10 FB BPL $C65E 0xD5 0x60 0x00 0xB5 0xFE
23 100957 44567494 C663: 49 D5 EOR #$D5 0x00 0x60 0x00 0x37 0xFE
24 100958 44567496 C665: D0 F7 BNE $C65E 0x00 0x60 0x00 0x37 0xFE
25 100959 44567498 C667: BD 8C C0 LDA $C08C,X 0x0A 0x60 0x00 0x35 0xFE
26 100960 44567502 C66A: 10 FB BPL $C667 0x0A 0x60 0x00 0x35 0xFE
27 100961 44567505 C667: BD 8C C0 LDA $C08C,X 0x15 0x60 0x00 0x35 0xFE
28 100962 44567509 C66A: 10 FB BPL $C667 0x15 0x60 0x00 0x35 0xFE
29 100963 44567512 C667: BD 8C C0 LDA $C08C,X 0x55 0x60 0x00 0x35 0xFE
30 100964 44567516 C66A: 10 FB BPL $C667 0x55 0x60 0x00 0x35 0xFE
31 100965 44567519 C667: BD 8C C0 LDA $C08C,X 0xAA 0x60 0x00 0xB5 0xFE
32 100966 44567523 C66A: 10 FB BPL $C667 0xAA 0x60 0x00 0xB5 0xFE
33 100967 44567525 C66C: C9 AA CMP #$AA 0xAA 0x60 0x00 0x37 0xFE
34 100968 44567527 C66E: D0 F3 BNE $C663 0xAA 0x60 0x00 0x37 0xFE
35 100969 44567529 C670: EA NOP 0xAA 0x60 0x00 0x37 0xFE
36 100970 44567531 C671: BD 8C C0 LDA $C08C,X 0x0A 0x60 0x00 0x35 0xFE
37 100971 44567535 C674: 10 FB BPL $C671 0x0A 0x60 0x00 0x35 0xFE
38 100972 44567538 C671: BD 8C C0 LDA $C08C,X 0x2B 0x60 0x00 0x35 0xFE
39 100973 44567542 C674: 10 FB BPL $C671 0x2B 0x60 0x00 0x35 0xFE
40 100974 44567545 C671: BD 8C C0 LDA $C08C,X 0x56 0x60 0x00 0x35 0xFE
41 100975 44567549 C674: 10 FB BPL $C671 0x56 0x60 0x00 0x35 0xFE
42 100976 44567552 C671: BD 8C C0 LDA $C08C,X 0xAD 0x60 0x00 0xB5 0xFE
43 100977 44567556 C674: 10 FB BPL $C671 0xAD 0x60 0x00 0xB5 0xFE
44 100978 44567558 C676: C9 96 CMP #$96 0xAD 0x60 0x00 0x35 0xFE
45 100979 44567560 C678: F0 09 BEQ $C683 0xAD 0x60 0x00 0x35 0xFE
46 100980 44567562 C67A: 28 PLP 0xAD 0x60 0x00 0x37 0xFF
47 100981 44567566 C67B: 90 DF BCC $C65C 0xAD 0x60 0x00 0x37 0xFF
48 100982 44567568 C67D: 49 AD EOR #$AD 0x00 0x60 0x00 0x37 0xFF
49 100983 44567570 C67F: F0 25 BEQ $C6A6 0x00 0x60 0x00 0x37 0xFF
50 100984 44567573 C6A6: A0 56 LDY #$56 0x00 0x60 0x56 0x35 0xFF
51 100985 44567575 C6A8: 84 3C STY $3C 0x00 0x60 0x56 0x35 0xFF
52 100986 44567578 C6AA: BC 8C C0 LDY $C08C,X 0x00 0x60 0xB6 0xB5 0xFF
53 100987 44567582 C6AD: 10 FB BPL $C6AA 0x00 0x60 0xB6 0xB5 0xFF
54 100988 44567584 C6AF: 59 D6 02 EOR $02D6,Y 0x12 0x60 0xB6 0x35 0xFF
55 100989 44567589 C6B2: A4 3C LDY $3C 0x12 0x60 0x56 0x35 0xFF
56 100990 44567592 C6B4: 88 DEY 0x12 0x60 0x55 0x35 0xFF
57 100991 44567594 C6B5: 99 00 03 STA $0300,Y 0x12 0x60 0x55 0x35 0xFF
58 100992 44567599 C6B8: D0 EE BNE $C6A8 0x12 0x60 0x55 0x35 0xFF
59 100993 44567602 C6A8: 84 3C STY $3C 0x12 0x60 0x55 0x35 0xFF
60 100994 44567605 C6AA: BC 8C C0 LDY $C08C,X 0x12 0x60 0x36 0x35 0xFF
61 100995 44567609 C6AD: 10 FB BPL $C6AA 0x12 0x60 0x36 0x35 0xFF
62 100996 44567612 C6AA: BC 8C C0 LDY $C08C,X 0x12 0x60 0xDB 0xB5 0xFF
63 100997 44567616 C6AD: 10 FB BPL $C6AA 0x12 0x60 0xDB 0xB5 0xFF
64 100998 44567618 C6AF: 59 D6 02 EOR $02D6,Y 0x36 0x60 0xDB 0x35 0xFF
65 100999 44567623 C6B2: A4 3C LDY $3C 0x36 0x60 0x55 0x35 0xFF
66 101000 44567626 C6B4: 88 DEY 0x36 0x60 0x54 0x35 0xFF
67 101001 44567628 C6B5: 99 00 03 STA $0300,Y 0x36 0x60 0x54 0x35 0xFF
68 101002 44567633 C6B8: D0 EE BNE $C6A8 0x36 0x60 0x54 0x35 0xFF
69 101003 44567636 C6A8: 84 3C STY $3C 0x36 0x60 0x54 0x35 0xFF
70 101004 44567639 C6AA: BC 8C C0 LDY $C08C,X 0x36 0x60 0x6E 0x35 0xFF
71 101005 44567643 C6AD: 10 FB BPL $C6AA 0x36 0x60 0x6E 0x35 0xFF
72 101006 44567646 C6AA: BC 8C C0 LDY $C08C,X 0x36 0x60 0xDC 0xB5 0xFF
73 101007 44567650 C6AD: 10 FB BPL $C6AA 0x36 0x60 0xDC 0xB5 0xFF
74 101008 44567652 C6AF: 59 D6 02 EOR $02D6,Y 0x13 0x60 0xDC 0x35 0xFF
75 101009 44567657 C6B2: A4 3C LDY $3C 0x13 0x60 0x54 0x35 0xFF
76 101010 44567660 C6B4: 88 DEY 0x13 0x60 0x53 0x35 0xFF
77 101011 44567662 C6B5: 99 00 03 STA $0300,Y 0x13 0x60 0x53 0x35 0xFF
78 101012 44567667 C6B8: D0 EE BNE $C6A8 0x13 0x60 0x53 0x35 0xFF
79 101013 44567670 C6A8: 84 3C STY $3C 0x13 0x60 0x53 0x35 0xFF
80 101014 44567673 C6AA: BC 8C C0 LDY $C08C,X 0x13 0x60 0x7A 0x35 0xFF
81 101015 44567677 C6AD: 10 FB BPL $C6AA 0x13 0x60 0x7A 0x35 0xFF
82 101016 44567680 C6AA: BC 8C C0 LDY $C08C,X 0x13 0x60 0xF4 0xB5 0xFF
83 101017 44567684 C6AD: 10 FB BPL $C6AA 0x13 0x60 0xF4 0xB5 0xFF
84 101018 44567686 C6AF: 59 D6 02 EOR $02D6,Y 0x26 0x60 0xF4 0x35 0xFF
85 101019 44567691 C6B2: A4 3C LDY $3C 0x26 0x60 0x53 0x35 0xFF
86 101020 44567694 C6B4: 88 DEY 0x26 0x60 0x52 0x35 0xFF
87 101021 44567696 C6B5: 99 00 03 STA $0300,Y 0x26 0x60 0x52 0x35 0xFF
88 101022 44567701 C6B8: D0 EE BNE $C6A8 0x26 0x60 0x52 0x35 0xFF
89 101023 44567704 C6A8: 84 3C STY $3C 0x26 0x60 0x52 0x35 0xFF
90 101024 44567707 C6AA: BC 8C C0 LDY $C08C,X 0x26 0x60 0xF3 0xB5 0xFF
91 101025 44567711 C6AD: 10 FB BPL $C6AA 0x26 0x60 0xF3 0xB5 0xFF
92 101026 44567713 C6AF: 59 D6 02 EOR $02D6,Y 0x12 0x60 0xF3 0x35 0xFF
93 101027 44567718 C6B2: A4 3C LDY $3C 0x12 0x60 0x52 0x35 0xFF
94 101028 44567721 C6B4: 88 DEY 0x12 0x60 0x51 0x35 0xFF
95 101029 44567723 C6B5: 99 00 03 STA $0300,Y 0x12 0x60 0x51 0x35 0xFF
96 101030 44567728 C6B8: D0 EE BNE $C6A8 0x12 0x60 0x51 0x35 0xFF
97 101031 44567731 C6A8: 84 3C STY $3C 0x12 0x60 0x51 0x35 0xFF
98 101032 44567734 C6AA: BC 8C C0 LDY $C08C,X 0x12 0x60 0x5D 0x35 0xFF
99 101033 44567738 C6AD: 10 FB BPL $C6AA 0x12 0x60 0x5D 0x35 0xFF
100 101034 44567741 C6AA: BC 8C C0 LDY $C08C,X 0x12 0x60 0xBB 0xB5 0xFF
101 101035 44567745 C6AD: 10 FB BPL $C6AA 0x12 0x60 0xBB 0xB5 0xFF
102 101036 44567747 C6AF: 59 D6 02 EOR $02D6,Y 0x04 0x60 0xBB 0x35 0xFF
103 101037 44567752 C6B2: A4 3C LDY $3C 0x04 0x60 0x51 0x35 0xFF
104 101038 44567755 C6B4: 88 DEY 0x04 0x60 0x50 0x35 0xFF
105 101039 44567757 C6B5: 99 00 03 STA $0300,Y 0x04 0x60 0x50 0x35 0xFF
106 101040 44567762 C6B8: D0 EE BNE $C6A8 0x04 0x60 0x50 0x35 0xFF
107 101041 44567765 C6A8: 84 3C STY $3C 0x04 0x60 0x50 0x35 0xFF
108 101042 44567768 C6AA: BC 8C C0 LDY $C08C,X 0x04 0x60 0x5E 0x35 0xFF
109 101043 44567772 C6AD: 10 FB BPL $C6AA 0x04 0x60 0x5E 0x35 0xFF
110 101044 44567775 C6AA: BC 8C C0 LDY $C08C,X 0x04 0x60 0xBD 0xB5 0xFF
111 101045 44567779 C6AD: 10 FB BPL $C6AA 0x04 0x60 0xBD 0xB5 0xFF
112 101046 44567781 C6AF: 59 D6 02 EOR $02D6,Y 0x1C 0x60 0xBD 0x35 0xFF
113 101047 44567786 C6B2: A4 3C LDY $3C 0x1C 0x60 0x50 0x35 0xFF
114 101048 44567789 C6B4: 88 DEY 0x1C 0x60 0x4F 0x35 0xFF
115 101049 44567791 C6B5: 99 00 03 STA $0300,Y 0x1C 0x60 0x4F 0x35 0xFF
116 101050 44567796 C6B8: D0 EE BNE $C6A8 0x1C 0x60 0x4F 0x35 0xFF
117 101051 44567799 C6A8: 84 3C STY $3C 0x1C 0x60 0x4F 0x35 0xFF
118 101052 44567802 C6AA: BC 8C C0 LDY $C08C,X 0x1C 0x60 0xCF 0xB5 0xFF
119 101053 44567806 C6AD: 10 FB BPL $C6AA 0x1C 0x60 0xCF 0xB5 0xFF
120 101054 44567808 C6AF: 59 D6 02 EOR $02D6,Y 0x02 0x60 0xCF 0x35 0xFF
121 101055 44567813 C6B2: A4 3C LDY $3C 0x02 0x60 0x4F 0x35 0xFF
122 101056 44567816 C6B4: 88 DEY 0x02 0x60 0x4E 0x35 0xFF
123 101057 44567818 C6B5: 99 00 03 STA $0300,Y 0x02 0x60 0x4E 0x35 0xFF
124 101058 44567823 C6B8: D0 EE BNE $C6A8 0x02 0x60 0x4E 0x35 0xFF
125 101059 44567826 C6A8: 84 3C STY $3C 0x02 0x60 0x4E 0x35 0xFF

93
logfltr.pl Executable file
View File

@ -0,0 +1,93 @@
#!/usr/bin/perl
my $addr = "";
my $status = 0;
my @buf = ();
my $max = 5000;
while(<>) {
if ($status == 0) {
if (/([0-9A-F]{4}):( [0-9A-F]{2}){3}\s*LDA \$C08C,X/) {
# print("DEBUG: 0 LDA\n");
$status = 1;
push(@buf, $_);
$addr = $1;
}
else {
# print("DEBUG: 0 no LDA\n");
print;
}
}
elsif ($status == 1) {
if (/BPL \$$addr/) {
# print("DEBUG: 1 BPL\n");
$status = 2;
push(@buf, $_);
}
else {
# print("DEBUG: 1 no BPL\n");
$status = 0;
print @buf;
@buf = ();
print;
}
}
elsif ($status == 2) {
if (/EOR #\$D5/) {
# print("DEBUG: 2 EOR\n");
$status = 3;
push(@buf, $_);
}
else {
# print("DEBUG: 2 no EOR\n");
$status = 0;
print @buf;
@buf = ();
print;
}
}
elsif ($status == 3) {
if (/BNE \$$addr/) {
# print("DEBUG: 3 BNE\n");
$status = 4;
push(@buf, $_);
}
else {
# print("DEBUG: 3 no BNE\n");
$status = 0;
print @buf;
@buf = ();
print;
}
}
elsif ($status == 4) {
if (/$addr:( [0-9A-F]{2}){3}\s*LDA \$C08C,X/) {
# print("DEBUG: 4 LDA\n");
$status = 1;
@buf = ();
push(@buf, $_);
}
else {
# print("DEBUG: 4 no LDA\n");
$status = 0;
print @buf, "\n";
@buf = ();
print;
}
}
else {
# print("DEBUG: else\n");
$status = 0;
print @buf;
@buf = ();
print;
}
# if( -- $max <= 0 ) {
# last;
# }
}

View File

@ -35,7 +35,7 @@ unsigned long long int inst_cnt = 0;
//const unsigned int fps = 30;
const unsigned long long default_MHz_6502 = 1.023 * M; // 2 * M; // 4 * M; // 8 * M; // 16 * M; // 128 * M; // 256 * M; // 512 * M;
const unsigned long long startup_MHz_6502 = 25 * M;
const unsigned long long startup_MHz_6502 = 32 * M;
unsigned long long MHz_6502 = default_MHz_6502;
unsigned long long clk_6502_per_frm = startup_MHz_6502 / fps;
unsigned long long clk_6502_per_frm_set = default_MHz_6502 / fps;
@ -57,7 +57,15 @@ m6502_t m6502 = {
0, // X
0, // Y
0, // SR
0, // C
0, // Z
0, // I
0, // D
0, // B
0, // res
0, // V
0, // N
0, // PC
0, // SP
@ -81,12 +89,6 @@ disassembly_t disassembly;
#include "../util/disassembler.h"
#include "../dev/mem/mmio.h"
uint16_t videoShadow [0x1000];
uint32_t videoMem [0x2000];
uint32_t * videoMemPtr = videoMem;
uint16_t HiResLineAddrTbl [0x2000];
INLINE void set_flags_N( const uint8_t test ) {
m6502.N = BITTEST(test, 7);
@ -124,62 +126,12 @@ INLINE void set_flags_NZC( const int16_t test ) {
set_flags_C(test);
}
//INLINE void set_flags_NZCV( int test ) {
// set_flags_NZC(test);
// set_flags_V(test);
//}
void initHiResLineAddresses() {
uint16_t i = 0;
for ( uint16_t x = 0; x <= 0x50; x+= 0x28 ) {
for ( uint16_t y = 0; y <= 0x380; y += 0x80 ) {
for ( uint16_t z = 0; z <= 0x1C00; z += 0x400) {
HiResLineAddrTbl[i++] = x + y + z;
}
}
}
}
typedef struct {
uint8_t L;
uint8_t H;
} bytes_t;
void hires_Update () {
// lines
int videoMemIndex = 0;
for( int y = 0; y < 192; y++ ) {
// 16 bit blocks of columns
for ( int x = 0; x < 20; x++ ) {
// odd
bytes_t block = * (bytes_t*)(& RAM[ HiResLineAddrTbl[y * 20] + x * 2 ]);
for ( uint8_t bit = 0; bit < 7; bit++ ) {
uint8_t bitMask = 1 << bit;
if (block.L & bitMask) {
videoMem[videoMemIndex++] = 0x7F12A208;
}
else { // 28CD41
videoMem[videoMemIndex++] = 0x00000000;
}
}
// even
for ( uint8_t bit = 0; bit < 7; bit++ ) {
uint8_t bitMask = 1 << bit;
if (block.H & bitMask) {
videoMem[videoMemIndex++] = 0x7F12A208;
}
else { // 28CD41
videoMem[videoMemIndex++] = 0x00000000;
}
}
}
}
}
/**
Instruction Implementations
@ -187,8 +139,37 @@ void hires_Update () {
This idea is that "INLINE" would work only if it is
located in the same source file -- hence the include...
**/
#include "6502_instructions.h"
INLINE flags_t getFlags() {
flags_t f = {
m6502.C != 0, // Carry Flag
m6502.Z != 0, // Zero Flag
m6502.I != 0, // Interrupt Flag
m6502.D != 0, // Decimal Flag
m6502.B != 0, // B Flag
m6502.res != 0, // reserved -- should be always 1
m6502.V != 0, // Overflow Flag ???
m6502.N != 0, // Negative Flag
};
return f;
}
INLINE void setFlags( uint8_t byte ) {
flags_t flags = { .SR = byte };
m6502.C = flags.C; // Carry Flag
m6502.Z = flags.Z; // Zero Flag
m6502.I = flags.I; // Interrupt Flag
m6502.D = flags.D; // Decimal Flag
m6502.B = flags.B; // B Flag
m6502.res = flags.res; // reserved -- should be always 1
m6502.V = flags.V; // Overflow Flag ???
m6502.N = flags.N; // Negative Flag
}
#include "6502_instructions.h"
INLINE int m6502_Step() {
@ -426,7 +407,7 @@ INLINE int m6502_Step() {
// case 0x03: // SLO* (undocumented)
// case 0x04: // NOP* (undocumented)
case 0x05: ORA( src_zp() ); return 3; // ORA zpg
case 0x06: ASL( dest_zp() ); return 5; // ASL zpg
case 0x06: ASL( addr_zp() ); return 5; // ASL zpg
// case 0x07: // SLO* (undocumented)
case 0x08: PHP(); return 3; // PHP
case 0x09: ORA( imm() ); return 2; // ORA imm
@ -434,15 +415,15 @@ INLINE int m6502_Step() {
// case 0x0B: // ANC** (undocumented)
// case 0x0C: // NOP* (undocumented)
case 0x0D: ORA( src_abs() ); return 4; // ORA abs
case 0x0E: ASL( dest_abs() ); return 6; // ASL abs
case 0x0E: ASL( addr_abs() ); return 6; // ASL abs
// case 0x0F: // SLO* (undocumented)
case 0x10: BPL( rel_addr() ); return 2; // BPL rel
case 0x10: BPL( rel_addr() ); return 3; // BPL rel
case 0x11: ORA( src_ind_Y() ); return 5; // ORA ind,Y
// case 0x12: // t jams
// case 0x13: // SLO* (undocumented)
// case 0x14: // NOP* (undocumented)
case 0x15: ORA( src_zp_X() ); return 4; // ORA zpg,X
case 0x16: ASL( dest_zp_X() ); return 6; // ASL zpg,X
case 0x16: ASL( addr_zp_X() ); return 6; // ASL zpg,X
// case 0x17: // SLO* (undocumented)
case 0x18: CLC(); return 2; // CLC
case 0x19: ORA( src_abs_Y() ); return 4; // ORA abs,Y
@ -450,7 +431,7 @@ INLINE int m6502_Step() {
// case 0x1B: // SLO* (undocumented)
// case 0x1C: // NOP* (undocumented)
case 0x1D: ORA( src_abs_X() ); return 4; // ORA abs,X
case 0x1E: ASL( dest_abs_X() ); return 7; // ASL abs,X
case 0x1E: ASL( addr_abs_X() ); return 7; // ASL abs,X
// case 0x1F: // SLO* (undocumented)
case 0x20: JSR( abs_addr() ); return 6; // JSR abs
case 0x21: AND( src_X_ind() ); return 6; // AND X,ind
@ -458,7 +439,7 @@ INLINE int m6502_Step() {
// case 0x23: RLA izx 8
case 0x24: BIT( src_zp() ); return 3; // BIT zpg
case 0x25: AND( src_zp() ); return 3; // AND zpg
case 0x26: ROL( dest_zp() ); return 5; // ROL zpg
case 0x26: ROL( addr_zp() ); return 5; // ROL zpg
// case 0x27: RLA zp 5
case 0x28: PLP(); return 4; // PLP
case 0x29: AND( imm() ); return 2; // AND imm
@ -466,15 +447,15 @@ INLINE int m6502_Step() {
// case 0x2B: ANC imm 2
case 0x2C: BIT( src_abs() ); return 4; // BIT abs
case 0x2D: AND( src_abs() ); return 4; // AND abs
case 0x2E: ROL( dest_abs() ); return 6; // ROL abs
case 0x2E: ROL( addr_abs() ); return 6; // ROL abs
// case 0x2F: RLA abs 6
case 0x30: BMI( rel_addr() ); return 2; // BMI rel
case 0x30: BMI( rel_addr() ); return 3; // BMI rel
case 0x31: AND( src_ind_Y() ); return 5; // AND ind,Y
// case 0x32: KIL
// case 0x33: RLA izy 8
// case 0x34: NOP zpx 4
case 0x35: AND( src_zp_X() ); return 4; // AND zpg,X
case 0x36: ROL( dest_zp_X() ); return 6; // ROL zpg,X
case 0x36: ROL( addr_zp_X() ); return 6; // ROL zpg,X
// case 0x37: RLA zpx 6
case 0x38: SEC(); return 2; // SEC
case 0x39: AND( src_abs_Y() ); return 4; // AND abs,Y
@ -482,7 +463,7 @@ INLINE int m6502_Step() {
// case 0x3B: RLA aby 7
// case 0x3C: NOP abx 4
case 0x3D: AND( src_abs_X() ); return 4; // AND abs,X
case 0x3E: ROL( dest_abs_X() ); return 7; // ROL abs,X
case 0x3E: ROL( addr_abs_X() ); return 7; // ROL abs,X
// case 0x3F: RLA abx 7
case 0x40: RTI(); return 6; // RTI
case 0x41: EOR( src_X_ind() ); return 6; // EOR X,ind
@ -490,7 +471,7 @@ INLINE int m6502_Step() {
// case 0x43: SRE izx 8
// case 0x44: NOP zp 3
case 0x45: EOR( src_zp() ); return 3; // EOR zpg
case 0x46: LSR( dest_zp() ); return 5; // LSR zpg
case 0x46: LSR( addr_zp() ); return 5; // LSR zpg
// case 0x47: SRE zp 5
case 0x48: PHA(); return 3; // PHA
case 0x49: EOR( imm() ); return 2; // EOR imm
@ -498,15 +479,15 @@ INLINE int m6502_Step() {
// case 0x4B: ALR imm 2
case 0x4C: JMP( abs_addr() ); return 3; // JMP abs
case 0x4D: EOR( src_abs() ); return 4; // EOR abs
case 0x4E: LSR( dest_abs() ); return 6; // LSR abs
case 0x4E: LSR( addr_abs() ); return 6; // LSR abs
// case 0x4F: SRE abs 6
case 0x50: BVC( rel_addr() ); return 2; // BVC rel
case 0x50: BVC( rel_addr() ); return 3; // BVC rel
case 0x51: EOR( src_ind_Y() ); return 5; // EOR ind,Y
// case 0x52: KIL
// case 0x53: SRE izy 8
// case 0x54: NOP zpx 4
case 0x55: EOR( src_zp_X() ); return 4; // AND zpg,X
case 0x56: LSR( dest_zp_X() ); return 6; // LSR zpg,X
case 0x56: LSR( addr_zp_X() ); return 6; // LSR zpg,X
// case 0x57: SRE zpx 6
case 0x58: CLI(); return 2; // CLI
case 0x59: EOR( src_abs_Y() ); return 4; // EOR abs,Y
@ -514,7 +495,7 @@ INLINE int m6502_Step() {
// case 0x5B: SRE aby 7
// case 0x5C: NOP abx 4
case 0x5D: EOR( src_abs_X() ); return 4; // EOR abs,X
case 0x5E: LSR( dest_abs_X() ); return 7; // LSR abs,X
case 0x5E: LSR( addr_abs_X() ); return 7; // LSR abs,X
// case 0x5F: SRE abx 7
case 0x60: RTS(); return 6; // RTS
case 0x61: ADC( src_X_ind() ); return 6; // ADC X,ind
@ -522,7 +503,7 @@ INLINE int m6502_Step() {
// case 0x63: RRA izx 8
// case 0x64: NOP zp 3
case 0x65: ADC( src_zp() ); return 3; // ADC zpg
case 0x66: ROR( dest_zp() ); return 5; // ROR zpg
case 0x66: ROR( addr_zp() ); return 5; // ROR zpg
// case 0x67: RRA zp 5
case 0x68: PLA(); break; // PLA
case 0x69: ADC( imm() ); return 2; // ADC imm
@ -530,15 +511,15 @@ INLINE int m6502_Step() {
// case 0x6B: ARR imm 2
case 0x6C: JMP( ind_addr() ); return 5; // JMP ind
case 0x6D: ADC( src_abs() ); return 4; // ADC abs
case 0x6E: ROR( dest_abs() ); return 6; // ROR abs
case 0x6E: ROR( addr_abs() ); return 6; // ROR abs
// case 0x6F: RRA abs 6
case 0x70: BVS( rel_addr() ); return 2; // BVS rel
case 0x70: BVS( rel_addr() ); return 3; // BVS rel
case 0x71: ADC( src_ind_Y() ); return 5; // ADC ind,Y
// case 0x72:
// case 0x73:
// case 0x74:
case 0x75: ADC( src_zp_X() ); return 4; // ADC zpg,X
case 0x76: ROR( dest_zp_X() ); return 6; // ROR zpg,X
case 0x76: ROR( addr_zp_X() ); return 6; // ROR zpg,X
// case 0x77:
case 0x78: SEI(); return 2; // SEI
case 0x79: ADC( src_abs_Y() ); return 4; // ADC abs,Y
@ -546,7 +527,7 @@ INLINE int m6502_Step() {
// case 0x7B:
// case 0x7C:
case 0x7D: ADC( src_abs_X() ); return 4; // ADC abs,X
case 0x7E: ROR( dest_abs_X() ); return 7; // ROR abs,X
case 0x7E: ROR( addr_abs_X() ); return 7; // ROR abs,X
// case 0x7F:
// case 0x80:
case 0x81: STA( addr_X_ind() ) ; return 6; // STA X,ind
@ -564,7 +545,7 @@ INLINE int m6502_Step() {
case 0x8D: STA( addr_abs() ); return 4; // STA abs
case 0x8E: STX( addr_abs() ); return 4; // STX abs
// case 0x8F:
case 0x90: BCC( rel_addr() ); return 2; // BCC rel
case 0x90: BCC( rel_addr() ); return 3; // BCC rel
case 0x91: STA( addr_ind_Y() ); return 6; // STA ind,Y
// case 0x92:
// case 0x93:
@ -596,7 +577,7 @@ INLINE int m6502_Step() {
case 0xAD: LDA( src_abs() ); return 4; // LDA abs
case 0xAE: LDX( src_abs() ); return 4; // LDX abs
// case 0xAF:
case 0xB0: BCS( rel_addr() ); return 2; // BCS rel
case 0xB0: BCS( rel_addr() ); return 3; // BCS rel
case 0xB1: LDA( src_ind_Y() ); return 5; // LDA ind,Y
// case 0xB2:
// case 0xB3:
@ -618,7 +599,7 @@ INLINE int m6502_Step() {
// case 0xC3:
case 0xC4: CPY( src_zp() ); return 3; // CPY zpg
case 0xC5: CMP( src_zp() ); return 3; // CMP zpg
case 0xC6: DEC( dest_zp() ); return 5; // DEC zpg
case 0xC6: DEC( addr_zp() ); return 5; // DEC zpg
// case 0xC7:
case 0xC8: INY(); return 2; // INY
case 0xC9: CMP( imm() ); return 2; // CMP imm
@ -626,15 +607,15 @@ INLINE int m6502_Step() {
// case 0xCB:
case 0xCC: CPY( src_abs() ); return 4; // CPY abs
case 0xCD: CMP( src_abs() ); return 4; // CMP abs
case 0xCE: DEC( dest_abs() ); return 6; // DEC abs
case 0xCE: DEC( addr_abs() ); return 6; // DEC abs
// case 0xCF:
case 0xD0: BNE( rel_addr() ); return 2; // BNE rel
case 0xD0: BNE( rel_addr() ); return 3; // BNE rel
case 0xD1: CMP( src_ind_Y() ); return 5; // CMP ind,Y
// case 0xD2:
// case 0xD3:
// case 0xD4:
case 0xD5: CMP( src_zp_X() ); return 4; // CMP zpg,X
case 0xD6: DEC( dest_zp_X() ); return 6; // DEC zpg,X
case 0xD6: DEC( addr_zp_X() ); return 6; // DEC zpg,X
// case 0xD7:
case 0xD8: CLD(); return 2; // CLD
case 0xD9: CMP( src_abs_Y() ); return 4; // CMP abs,Y
@ -642,7 +623,7 @@ INLINE int m6502_Step() {
// case 0xDB:
// case 0xDC:
case 0xDD: CMP( src_abs_X() ); return 4; // CMP abs,X
case 0xDE: DEC( dest_abs_X() ); return 7; // DEC abs,X
case 0xDE: DEC( addr_abs_X() ); return 7; // DEC abs,X
// case 0xDF:
case 0xE0: CPX( imm() ); return 2; // CPX imm
case 0xE1: SBC( src_X_ind() ) ; return 6; // SBC (X,ind)
@ -650,7 +631,7 @@ INLINE int m6502_Step() {
// case 0xE3:
case 0xE4: CPX( src_zp() ); return 3; // CPX zpg
case 0xE5: SBC( src_zp() ); return 3; // SBC zpg
case 0xE6: INC( dest_zp() ); return 5; // INC zpg
case 0xE6: INC( addr_zp() ); return 5; // INC zpg
// case 0xE7:
case 0xE8: INX(); return 2; // INX
case 0xE9: SBC( imm() ); return 2; // SBC imm
@ -658,15 +639,15 @@ INLINE int m6502_Step() {
// case 0xEB:
case 0xEC: CPX( src_abs() ); return 4; // CPX abs
case 0xED: SBC( src_abs() ); return 4; // SBC abs
case 0xEE: INC( dest_abs() ); return 6; // INC abs
case 0xEE: INC( addr_abs() ); return 6; // INC abs
// case 0xEF:
case 0xF0: BEQ( rel_addr() ); return 2; // BEQ rel
case 0xF0: BEQ( rel_addr() ); return 3; // BEQ rel
case 0xF1: SBC( src_ind_Y() ); return 5; // SBC ind,Y
// case 0xF2:
// case 0xF3:
// case 0xF4:
case 0xF5: SBC( src_zp_X() ); return 4; // SBC zpg,X
case 0xF6: INC( dest_zp_X() ); return 6; // INC zpg,X
case 0xF6: INC( addr_zp_X() ); return 6; // INC zpg,X
// case 0xF7:
case 0xF8: SED(); return 2; // SED
case 0xF9: SBC( src_abs_Y() ); return 4; // SBC abs,Y
@ -674,7 +655,7 @@ INLINE int m6502_Step() {
// case 0xFB:
// case 0xFC:
case 0xFD: SBC( src_abs_X() ); return 4; // SBC abs,X
case 0xFE: INC( dest_abs_X() ); return 7; // INC abs,X
case 0xFE: INC( addr_abs_X() ); return 7; // INC abs,X
// case 0xFF:
default:
@ -699,6 +680,36 @@ unsigned long long epoch = 0;
unsigned int clkfrm = 0;
void interrupt_IRQ() {
m6502.PC = memread16(IRQ_VECTOR);
// TODO: PUSH things onto stack?
}
void interrupt_NMI() {
m6502.PC = memread16(NMI_VECTOR);
// TODO: PUSH things onto stack?
}
void hardReset() {
m6502.PC = memread16(RESET_VECTOR);
// make sure it will be a cold reset...
memwrite(0x3F4, 0);
m6502.SP = 0xFF;
// N V - B D I Z C
// 0 0 1 0 0 1 0 1
setFlags(0x25);
}
void softReset() {
// m6502.PC = memread16(SOFTRESET_VECTOR);
m6502.PC = memread16( RESET_VECTOR );
m6502.SP = 0xFF;
// N V - B D I Z C
// 0 0 1 0 0 1 0 1
setFlags(0x25);
}
void m6502_Run() {
static unsigned int clk = 0;
@ -713,9 +724,10 @@ void m6502_Run() {
#ifdef SPEEDTEST
for ( inst_cnt = 0; inst_cnt < iterations ; inst_cnt++ )
#elif defined( CLK_WAIT )
for ( clkfrm = 0; clkfrm < clk_6502_per_frm_max ; clkfrm += clk )
// we clear the clkfrm from ViewController Update()
for ( ; clkfrm < clk_6502_per_frm_max ; clkfrm += clk )
#else
// for ( ; m6502.pc ; )
// this is for max speed only -- WARNING! It works only if simulation runs in a completely different thread from the Update()
for ( ; ; )
#endif
{
@ -728,35 +740,19 @@ void m6502_Run() {
return;
case IRQ:
m6502.PC = memread16(IRQ_VECTOR);
// TODO: PUSH things onto stack?
interrupt_IRQ();
break;
case NMI:
m6502.PC = memread16(NMI_VECTOR);
// TODO: PUSH things onto stack?
interrupt_NMI();
break;
case HARDRESET:
m6502.PC = memread16(RESET_VECTOR);
// make sure it will be a cold reset...
memwrite(0x3F4, 0);
m6502.SP = 0xFF;
// N V - B D I Z C
// 0 0 1 0 0 1 0 1
m6502.SR = 0x25;
hardReset();
break;
case SOFTRESET:
// m6502.PC = memread16(SOFTRESET_VECTOR);
m6502.PC = memread16( RESET_VECTOR );
m6502.SP = 0xFF;
// N V - B D I Z C
// 0 0 1 0 0 1 0 1
m6502.SR = 0x25;
softReset();
break;
default:
@ -767,48 +763,8 @@ void m6502_Run() {
}
#endif // INTERRUPT_CHECK_PER_STEP
// dbgPrintf("%llu %04X: ", clktime, m6502.PC);
m6502.clktime +=
clk = m6502_Step();
m6502.clktime += ( clk = m6502_Step() );
printDisassembly( outdev );
// dbgPrintf2("A:%02X X:%02X Y:%02X SP:%02X %c%c%c%c%c%c%c%c\n\n",
// m6502.A,
// m6502.X,
// m6502.Y,
// m6502.SP,
// m6502.N ? 'N' : 'n',
// m6502.V ? 'V' : 'v',
// m6502.res ? 'R' : 'r',
// m6502.B ? 'B' : 'b',
// m6502.D ? 'D' : 'd',
// m6502.I ? 'I' : 'i',
// m6502.Z ? 'Z' : 'z',
// m6502.C ? 'C' : 'c'
// );
#ifdef CLK_WAIT
// ee += tick_6502_per_sec * clk;
// ee /= 2;
// dd += rdtsc() - epoch - elpased;
// dd /= 2;
// get the new time in ticks needed to simulate exact 6502 clock
// elpased = tick_6502_per_sec * clktime;
// query time + wait
// TODO: We should use nanosleep
// usleep(1); // this is good enough for debugging
// nanosleep(&tim, NULL);
// printf(" tps:%llu s:%llu t:%llu d:%llu e:%llu n:%llu\n", tick_6502_per_sec, s, t, t - s, e, e - (t - s));
// tight loop gives us the most precise wait time
// while ( rdtsc() - epoch < elpased ) {}
#endif
}
if( diskAccelerator_count ) {
@ -819,15 +775,6 @@ void m6502_Run() {
}
}
// clock_t end = clock();
// double execution_time = ((double) (end - start)) / CLOCKS_PER_SEC;
// unsigned long long e = rdtsc();
// unsigned long long t = e - epoch;
// double execution_time = (double)t / tick_per_sec;
//
// mips = inst_cnt / (execution_time * M);
// mhz = clktime / (execution_time * M);
}
void read_rom( const char * bundlePath, const char * filename, uint8_t * rom, const uint16_t addr ) {
@ -886,28 +833,14 @@ void rom_loadFile( const char * bundlePath, const char * filename ) {
else if ( flen == 16 * KB ) {
read_rom( bundlePath, filename, Apple2_16K_ROM, 0);
memcpy(Apple2_12K_ROM + 0x0000, Apple2_16K_ROM + 0x1000, sizeof(Apple2_12K_ROM));
// memcpy(Apple2_64K_RAM + 0xC000, Apple2_16K_ROM, 0x1000);
// SWITCH_CX_ROM( RAM_PG_RD_TBL, 0xC0, Apple2_16K_ROM, 0x00);
memcpy(Apple2_64K_MEM + 0xC000, Apple2_16K_ROM, 16 * KB);
}
else if ( flen == 12 * KB ) {
read_rom( bundlePath, filename, Apple2_12K_ROM, 0);
// memcpy(Apple2_64K_RAM + 0xD000, Apple2_12K_ROM, sizeof(Apple2_12K_ROM));
read_rom( bundlePath, filename, Apple2_16K_ROM, 0x1000);
memcpy(Apple2_64K_MEM + 0xD000, Apple2_16K_ROM + 0x1000, 12 * KB);
}
// read_rom( bundlePath, "Apple2Plus.rom", Apple2_12K_ROM, 0);
// read_rom( bundlePath, "Apple2e.rom", Apple2_16K_ROM, 0);
// read_rom( bundlePath, "Apple2e_Enhanced.rom", Apple2_16K_ROM, 0);
// read_rom( "/Users/trudnai/Library/Containers/com.gamealloy.A2Mac/Data/", "Apple2Plus.rom", Apple2_12K_ROM, 0);
// read_rom("/Users/trudnai/Library/Containers/com.gamealloy.A2Mac/Data/Apple2Plus.rom", Apple2_12K_ROM, 0);
// memcpy(Apple2_64K_RAM + 0xD000, Apple2_12K_ROM, sizeof(Apple2_12K_ROM));
// memcpy(Apple2_12K_ROM + 0x0000, Apple2_16K_ROM + 0x1000, sizeof(Apple2_12K_ROM));
// memcpy(Apple2_64K_RAM + 0xC000, Apple2_16K_ROM, sizeof(Apple2_16K_ROM));
}
@ -916,7 +849,9 @@ void m6502_ColdReset( const char * bundlePath, const char * romFileName ) {
mhz = (double)MHz_6502 / M;
unsigned long long saved_frm_set = clk_6502_per_frm_set;
clk_6502_per_frm_max = clk_6502_per_frm_set = 0;
clk_6502_per_frm =
clk_6502_per_frm_max =
clk_6502_per_frm_set = 0;
// wait 100ms to be sure simulation has been halted
usleep(100000);
@ -957,7 +892,9 @@ void m6502_ColdReset( const char * bundlePath, const char * romFileName ) {
// Disk ][ ROM in Slot 6
read_rom( bundlePath, "DISK_II_C600.ROM", Apple2_64K_RAM, 0xC600);
// read_rom( "/Users/trudnai/Library/Containers/com.gamealloy.A2Mac/Data/", "DISK_II_C600.ROM", Apple2_64K_RAM, 0xC600);
memcpy(Apple2_64K_MEM + 0xC600, Apple2_64K_RAM + 0xC600, 0x100);
// read_rom( "/Users/trudnai/Library/Containers/com.gamealloy.A2Mac/Data/", "DISK_II_C600.ROM", Apple2_64K_MEM, 0xC600);
m6502.A = m6502.X = m6502.Y = 0xFF;
// reset vector
@ -965,7 +902,7 @@ void m6502_ColdReset( const char * bundlePath, const char * romFileName ) {
// N V - B D I Z C
// 0 0 1 0 0 1 0 0
m6502.SR = 0x24;
setFlags(0x24);
m6502.IF = 0;
@ -1078,8 +1015,9 @@ void m6502_ColdReset( const char * bundlePath, const char * romFileName ) {
// memcpy( RAM + 0x1000, counter_fast, sizeof(counter));
// m6502.PC = 0x1000;
clk_6502_per_frm_set = saved_frm_set;
clk_6502_per_frm_set = saved_frm_set;
clk_6502_per_frm = startup_MHz_6502 / fps;
diskAccelerator_count = 15;
}

View File

@ -42,6 +42,22 @@ typedef struct debugLevel_s {
} debugLevel_t;
typedef union flags_u {
struct {
uint8_t C:1; // Carry Flag
uint8_t Z:1; // Zero Flag
uint8_t I:1; // Interrupt Flag
uint8_t D:1; // Decimal Flag
uint8_t B:1; // B Flag
uint8_t res:1; // reserved -- should be always 1
uint8_t V:1; // Overflow Flag ???
uint8_t N:1; // Negative Flag
};
uint8_t SR;
} flags_t;
typedef struct m6502_s {
uint8_t A; // Accumulator
uint8_t X; // X index register
@ -54,19 +70,17 @@ typedef struct m6502_s {
// uint8_t aaa:3;
// };
// };
union {
uint8_t SR; // Status Register
struct {
uint8_t C:1; // Carry Flag
uint8_t Z:1; // Zero Flag
uint8_t I:1; // Interrupt Flag
uint8_t D:1; // Decimal Flag
uint8_t B:1; // B Flag
uint8_t res:1; // reserved -- should be always 1
uint8_t V:1; // Overflow Flag ???
uint8_t N:1; // Negative Flag
};
struct { // no bitfield faster processing
uint8_t C; // Carry Flag
uint8_t Z; // Zero Flag
uint8_t I; // Interrupt Flag
uint8_t D; // Decimal Flag
uint8_t B; // B Flag
uint8_t res; // reserved -- should be always 1
uint8_t V; // Overflow Flag ???
uint8_t N; // Negative Flag
};
uint16_t PC; // Program Counter
uint8_t SP; // Stack Pointer ( stack addr = 0x01 + sp )
@ -129,10 +143,10 @@ extern MEMcfg_t MEMcfg;
extern m6502_t m6502;
extern uint8_t * const AUX; // Pointer to the auxiliary memory so we can use this from Swift
extern uint8_t * const RAM;
//extern uint8_t * AUX_VID_RAM;
extern uint8_t * const MEM; // Pointer to the Shadow Memory Map so we can use this from Swift//extern uint8_t * AUX_VID_RAM;
extern uint32_t * videoMemPtr;
extern void hires_Update(void);
//extern void hires_Update(void);
extern double mips;
extern double mhz;
@ -145,8 +159,13 @@ extern void tst6502(void);
extern void m6502_ColdReset( const char * bundlePath, const char * romFilePath );
extern void m6502_Run(void);
extern void kbdInput ( uint8_t code );
extern void kbdUp ();
extern void setIO ( uint16_t ioaddr, uint8_t val );
extern void interrupt_IRQ(void);
extern void interrupt_NMI(void);
extern void hardReset(void);
extern void softReset(void);
#endif /* __6502_H__ */

View File

@ -36,27 +36,18 @@ INLINE void ADC( uint8_t src ) {
uint16_t tmp;
// V = C7 != C6
m6502.V = ((m6502.A & 0x7F) + (src & 0x7F) + m6502.C) > 0x7F;
m6502.V = ((m6502.A & 0x7F) + (src & 0x7F) + (m6502.C != 0)) > 0x7F;
if ( m6502.D ) {
if ( (tmp = (m6502.A & 0x0F) + (src & 0x0F) + m6502.C) > 0x09 ) {
if ( (tmp = (m6502.A & 0x0F) + (src & 0x0F) + (m6502.C != 0)) > 0x09 ) {
tmp += 0x06;
}
if ( (tmp += (m6502.A & 0xF0) + (src & 0xF0)) > 0x99 ) {
tmp += 0x60;
}
// tmp = m6502.A + src + m6502.C;
//
// if ( (tmp & 0x0F) > 0x09 ) {
// tmp += 0x06;
// }
// if ( tmp > 0x99 ) {
// tmp += 0x60;
// }
}
else {
tmp = (uint16_t)m6502.A + src + m6502.C;
tmp = (uint16_t)m6502.A + src + (m6502.C != 0);
}
set_flags_NZ( m6502.A = tmp );

View File

@ -10,12 +10,12 @@
#define __6502_INSTR_BRANCH_H__
INLINE void BRA( int8_t reladdr ) {
uint8_t pg = m6502.PC >> 8;
m6502.PC += reladdr;
#ifdef CLK_ABSOLUTE_PRECISE
uint8_t pg = m6502.PC >> 8;
m6502.clktime += m6502.PC >> 8 == pg ? 1 : 2;
#else
m6502.clktime++;
// m6502.clktime++;
#endif
#ifdef DEBUG
if ( reladdr == -2 ) {
@ -38,7 +38,7 @@ INLINE void BRA( int8_t reladdr ) {
INLINE void BCC( int8_t reladdr ) {
dbgPrintf("BCC ");
disPrintf(disassembly.inst, "BCC");
if ( m6502.C == 0 ) {
if ( ! m6502.C ) {
BRA( reladdr );
}
else {
@ -59,7 +59,7 @@ INLINE void BCC( int8_t reladdr ) {
INLINE void BCS( int8_t reladdr ) {
dbgPrintf("BCS ");
disPrintf(disassembly.inst, "BCS");
if ( m6502.C == 1 ) {
if ( m6502.C ) {
BRA( reladdr );
}
else {
@ -80,7 +80,7 @@ INLINE void BCS( int8_t reladdr ) {
INLINE void BNE( int8_t reladdr ) {
dbgPrintf("BNE ");
disPrintf(disassembly.inst, "BNE");
if ( m6502.Z == 0 ) {
if ( ! m6502.Z ) {
BRA( reladdr );
}
else {
@ -101,7 +101,7 @@ INLINE void BNE( int8_t reladdr ) {
INLINE void BEQ( int8_t reladdr ) {
dbgPrintf("BEQ ");
disPrintf(disassembly.inst, "BEQ");
if ( m6502.Z == 1 ) {
if ( m6502.Z ) {
BRA( reladdr );
}
else {
@ -122,7 +122,7 @@ INLINE void BEQ( int8_t reladdr ) {
INLINE void BPL( int8_t reladdr ) {
dbgPrintf("BPL ");
disPrintf(disassembly.inst, "BPL");
if ( m6502.N == 0 ) {
if ( ! m6502.N ) {
BRA( reladdr );
}
else {
@ -143,7 +143,7 @@ INLINE void BPL( int8_t reladdr ) {
INLINE void BMI( int8_t reladdr ) {
dbgPrintf("BMI ");
disPrintf(disassembly.inst, "BMI");
if ( m6502.N == 1 ) {
if ( m6502.N ) {
BRA( reladdr );
}
else {
@ -164,7 +164,7 @@ INLINE void BMI( int8_t reladdr ) {
INLINE void BVC( int8_t reladdr ) {
dbgPrintf("BVC ");
disPrintf(disassembly.inst, "BVC");
if ( m6502.V == 0 ) {
if ( ! m6502.V ) {
BRA( reladdr );
}
else {
@ -185,7 +185,7 @@ INLINE void BVC( int8_t reladdr ) {
INLINE void BVS( int8_t reladdr ) {
dbgPrintf("BVS ");
disPrintf(disassembly.inst, "BVS");
if ( m6502.V == 1 ) {
if ( m6502.V ) {
BRA( reladdr );
}
else {

View File

@ -86,7 +86,7 @@ INLINE void RTS() {
INLINE void RTI() {
dbgPrintf("RTI ");
disPrintf(disassembly.inst, "RTI");
m6502.SR = POP();
setFlags( POP() );
// m6502.I = 0;
m6502.PC = POP_addr();
}

View File

@ -23,11 +23,11 @@
absolute INC oper EE 3 6
absolute,X INC oper,X FE 3 7
**/
INLINE void INC( uint8_t * dst ) {
dbgPrintf("INC %02X -> ", *dst);
INLINE void INC( uint16_t addr ) {
dbgPrintf("INC %02X -> ", WRLOMEM[addr]);
disPrintf(disassembly.inst, "INC");
set_flags_NZ( ++(*dst) );
dbgPrintf("%02X ", *dst);
set_flags_NZ( ++(WRLOMEM[addr]) );
dbgPrintf("%02X ", WRLOMEM[addr]);
}
/**
@ -77,11 +77,11 @@ INLINE void INY() {
absolute DEC oper CE 3 3
absolute,X DEC oper,X DE 3 7
**/
INLINE void DEC( uint8_t * dst ) {
dbgPrintf("DEC %02X -> ", *dst);
INLINE void DEC( uint16_t addr ) {
dbgPrintf("DEC %02X -> ", WRLOMEM[addr]);
disPrintf(disassembly.inst, "DEC");
set_flags_NZ( --(*dst) );
dbgPrintf("%02X ", *dst);
set_flags_NZ( --(WRLOMEM[addr]) );
dbgPrintf("%02X ", WRLOMEM[addr]);
}
/**

View File

@ -92,15 +92,7 @@ char * charConv =
**/
INLINE void STR( uint16_t addr, uint8_t src ) {
dbgPrintf("STR [%04X], %02X ", addr, src );
// I/O or ROM or RAM EXP
if ( ( addr >= 0xC000 ) && ( addr < 0xC100 ) ) {
return ioWrite( addr, src );
}
// DO NOT MAKE IT NICER! faster this way!
*(RAM_PG_WR_TBL[ addr >> 8 ] + (addr & 0xFF)) = src;
// RAM[addr] = src;
memwrite(addr, src);
}
/**

View File

@ -26,7 +26,7 @@ INLINE int BRK() {
PUSH_addr(m6502.PC +1); // PC +2, however, fetch already incremented it by 1
// B flag should be set before pushing flags onto the stack
m6502.B = 1;
PUSH(m6502.SR);
PUSH( getFlags().SR );
m6502.I = 1;
m6502.PC = memread16(IRQ_VECTOR);

View File

@ -24,16 +24,16 @@
absolute ASL oper 0E 3 6
absolute,X ASL oper,X 1E 3 7
**/
INLINE void ASL( uint8_t * dst ) {
INLINE void ASL( uint16_t addr ) {
dbgPrintf("ASL ");
disPrintf(disassembly.inst, "ASL");
m6502.C = *dst >> 7;
set_flags_NZ( *dst <<= 1 );
m6502.C = WRLOMEM[addr] & 0x80;
set_flags_NZ( WRLOMEM[addr] <<= 1 );
}
INLINE void ASLA() {
dbgPrintf("ASL ");
disPrintf(disassembly.inst, "ASL");
m6502.C = m6502.A >> 7;
m6502.C = m6502.A & 0x80;
set_flags_NZ( m6502.A <<= 1 );
}
@ -51,11 +51,11 @@ INLINE void ASLA() {
absolute LSR oper 4E 3 6
absolute,X LSR oper,X 5E 3 7
**/
INLINE void LSR( uint8_t * dst ) {
INLINE void LSR( uint16_t addr ) {
dbgPrintf("LSR ");
disPrintf(disassembly.inst, "LSR");
m6502.C = *dst & 1;
set_flags_NZ( *dst >>= 1 );
m6502.C = WRLOMEM[addr] & 1;
set_flags_NZ( WRLOMEM[addr] >>= 1 );
}
INLINE void LSRA() {
dbgPrintf("LSR ");
@ -78,19 +78,19 @@ INLINE void LSRA() {
absolute ROL oper 2E 3 6
absolute,X ROL oper,X 3E 3 7
**/
INLINE void ROL( uint8_t * dst ) {
INLINE void ROL( uint16_t addr ) {
dbgPrintf("ROL ");
disPrintf(disassembly.inst, "ROL");
uint8_t C = m6502.C;
m6502.C = *dst >> 7;
*dst <<= 1;
set_flags_NZ( *dst |= C );
uint8_t C = m6502.C != 0;
m6502.C = WRLOMEM[addr] & 0x80;
WRLOMEM[addr] <<= 1;
set_flags_NZ( WRLOMEM[addr] |= C );
}
INLINE void ROLA() {
dbgPrintf("ROL ");
disPrintf(disassembly.inst, "ROL");
uint8_t C = m6502.C;
m6502.C = m6502.A >> 7;
uint8_t C = m6502.C != 0;
m6502.C = m6502.A & 0x80;
m6502.A <<= 1;
set_flags_NZ( m6502.A |= C );
}
@ -109,21 +109,21 @@ INLINE void ROLA() {
absolute ROR oper 6E 3 6
absolute,X ROR oper,X 7E 3 7
**/
INLINE void ROR( uint8_t * dst ) {
INLINE void ROR( uint16_t addr ) {
dbgPrintf("ROR ");
disPrintf(disassembly.inst, "ROR");
uint8_t C = m6502.C << 7;
m6502.C = *dst & 1;
*dst >>= 1;
set_flags_NZ( *dst |= C );
uint8_t C = m6502.C != 0;
m6502.C = WRLOMEM[addr] & 1;
WRLOMEM[addr] >>= 1;
set_flags_NZ( WRLOMEM[addr] |= C << 7 );
}
INLINE void RORA() {
dbgPrintf("ROR ");
disPrintf(disassembly.inst, "ROR");
uint8_t C = m6502.C << 7;
uint8_t C = m6502.C != 0;
m6502.C = m6502.A & 1;
m6502.A >>= 1;
set_flags_NZ( m6502.A |= C );
set_flags_NZ( m6502.A |= C << 7);
}

View File

@ -13,14 +13,12 @@ static const uint16_t stack_base_addr = 0x100;
INLINE void PUSH( uint8_t src ) {
// RAM[ stack_base_addr | m6502.SP-- ] = src;
// DO NOT MAKE IT NICER! faster this way!
*( RAM_PG_WR_TBL[ stack_base_addr >> 8 ] + m6502.SP-- ) = src;
WRLOMEM[ stack_base_addr | m6502.SP-- ] = src;
}
INLINE uint8_t POP() {
// return RAM[ stack_base_addr | ++m6502.SP ];
return *( RAM_PG_WR_TBL[ stack_base_addr >> 8 ] + ++m6502.SP );
return Apple2_64K_MEM[ stack_base_addr | ++m6502.SP ];
}
@ -80,7 +78,7 @@ INLINE void PLA() {
INLINE void PHP() {
dbgPrintf("PHP %02X ", m6502.SR);
disPrintf(disassembly.inst, "PHP");
PUSH( m6502.SR ); // res and B flag should be set
PUSH( getFlags().SR ); // res and B flag should be set
}
/**
@ -94,7 +92,7 @@ INLINE void PHP() {
implied PLP 28 1 4
**/
INLINE void PLP() {
m6502.SR = POP() | 0x30; // res and B flag should be set
setFlags(POP() | 0x30); // res and B flag should be set
dbgPrintf("PLP %02X ", m6502.SR);
disPrintf(disassembly.inst, "PLP");
}

View File

@ -17,9 +17,9 @@ disk_t disk = {
0, // clk_since_last_read
};
const int diskAccelerator_frames = 5;
int diskAccelerator_count = 10;
int diskAccelerator_speed = 25; // less than actual CPU speed means no acceleration
const int diskAccelerator_frames = 2;
int diskAccelerator_count = 15;
int diskAccelerator_speed = 25 * M / fps; // less than actual CPU speed means no acceleration
//const unsigned long long clk_6502_per_frm_diskAccelerator = 25 * M / fps; // disk acceleration bumps up CPU clock to 25 MHz
//const unsigned long long clk_diskAcceleratorTimeout = 1000ULL;
@ -45,6 +45,13 @@ const int position_to_direction[8][8] = {
};
void disk_accelerator_speedup() {
if ( diskAccelerator_speed >= clk_6502_per_frm ) {
clk_6502_per_frm = diskAccelerator_speed; // clk_6502_per_frm_diskAccelerator;
diskAccelerator_count = diskAccelerator_frames;
}
}
void disk_phase() {
int position = magnet_to_Poistion[disk.phase.magnet];
@ -64,12 +71,7 @@ void disk_phase() {
// printf(", p:%d d:%d l:%d: ph:%u trk:%u)", position, direction, lastPosition, phase.count, woz_tmap.phase[phase.count]);
disk.clk_last_access = m6502.clktime;
if ( diskAccelerator_speed > clk_6502_per_frm ) {
// clk_6502_per_frm = clk_6502_per_frm_diskAccelerator;
clk_6502_per_frm = diskAccelerator_speed * M / fps; // clk_6502_per_frm_diskAccelerator;
diskAccelerator_count = diskAccelerator_frames;
}
disk_accelerator_speedup();
}
else {
// invalid magnet config
@ -82,11 +84,8 @@ void disk_phase() {
uint8_t disk_read() {
dbgPrintf("io_DISK_READ (S%u)\n", 6);
disk.clk_last_access = m6502.clktime;
if ( diskAccelerator_speed > 2 ) {
clk_6502_per_frm = diskAccelerator_speed * M / fps; // clk_6502_per_frm_diskAccelerator;
diskAccelerator_count = diskAccelerator_frames;
}
disk_accelerator_speedup();
return woz_read();
}

View File

@ -254,12 +254,15 @@ uint8_t woz_read() {
clkelpased = m6502.clktime - m6502.clklast;
m6502.clklast = m6502.clktime;
const int clkBeforeAdjusting = 250;
const int magicShiftOffset = 90;
uint16_t usedBytes = woz_trks[track].bytes_used < WOZ_TRACK_BYTE_COUNT ? woz_trks[track].bytes_used : WOZ_TRACK_BYTE_COUNT;
if ( usedBytes ) {
if ( clkelpased > 100 ) {
if ( clkelpased > clkBeforeAdjusting ) {
// printf("NEED SYNC : %llu\n", clkelpased);
bitOffset = (clkelpased >> 2) & 7;
trackOffset += ((clkelpased >> 5) +100) % usedBytes;
trackOffset += ((clkelpased >> 5) + magicShiftOffset) % usedBytes;
WOZread.data = woz_trks[track].data[trackOffset];
}

View File

@ -27,17 +27,25 @@ typedef union address16_u {
videoMode_t videoMode = { 1 }; // 40 col text, page 1
uint8_t Apple2_Dummy_Page[ 1 * PG ]; // Dummy Page for discarding data
uint8_t Apple2_Dummy_RAM[ 4 * KB ]; // Dummy RAM for discarding data
uint8_t Apple2_12K_ROM[ 12 * KB ] = {0}; // ROM D0, D8, E0, E8, F0, F8
uint8_t Apple2_16K_ROM[ 16 * KB ] = {0}; // ROM C0, C8, D0, D8, E0, E8, F0, F8
uint8_t Apple2_16K_RAM[ 16 * KB ] = {0}; // 16K Memory Expansion Card
uint8_t Apple2_64K_AUX[ 64 * KB ] = {0}; // 64K Expansion Memory
uint8_t Apple2_64K_RAM[ 64 * KB ] = {0}; // Main Memory
uint8_t Apple2_Dummy_Page[ 1 * PG ]; // Dummy Page to discard data
uint8_t Apple2_Dummy_RAM[ 64 * KB ]; // Dummy RAM to discard data
uint8_t Apple2_16K_ROM[ 16 * KB ] = {0}; // ROM C0, C8, D0, D8, E0, E8, F0, F8
uint8_t Apple2_64K_AUX[ 64 * KB ] = {0}; // 64K Expansion Memory
uint8_t Apple2_64K_RAM[ 64 * KB ] = {0}; // Main Memory
uint8_t Apple2_64K_MEM[ 64 * KB ] = {0}; // Shadow Copy of Memory (or current memory content)
//uint8_t * AUX_VID_RAM = Apple2_VID_AUX; // Pointer to Auxiliary Video Memory
uint8_t * const AUX = Apple2_64K_AUX; // Pointer to the Auxiliary Memory so we can use this from Swift
uint8_t * const RAM = Apple2_64K_RAM; // Pointer to the Main Memory so we can use this from Swift
uint8_t * const MEM = Apple2_64K_MEM; // Pointer to the Shadow Memory Map so we can use this from Swift
uint8_t * const RDLOMEM = Apple2_64K_MEM; // Pointer to the Shadow Memory Map so we can use this from Swift
uint8_t * const WRLOMEM = Apple2_64K_MEM; // Pointer to the Shadow Memory Map so we can use this from Swift
uint8_t * const RDHIMEM = Apple2_64K_MEM; // Pointer to the Shadow Memory Map so we can use this from Swift
uint8_t * const WRHIMEM = Apple2_Dummy_RAM; // Pointer to the Shadow Memory Map so we can use this from Swift
//uint8_t * AUX_VID_RAM = Apple2_VID_AUX; // Pointer to Auxiliary Video Memory
uint8_t * const AUX = Apple2_64K_AUX; // Pointer to the auxiliary memory so we can use this from Swift
uint8_t * const RAM = Apple2_64K_RAM; // Pointer to the main memory so we can use this from Swift
#define DEF_RAM_PAGE(mem,pg) \
@ -180,72 +188,6 @@ uint8_t * const RAM = Apple2_64K_RAM; // Pointer to the main memory
NULL, \
NULL
uint8_t * RAM_PG_RD_TBL[256] = {
// 48K main memory
DEF_RAM_PAGE16( Apple2_64K_RAM, 0x00),
DEF_RAM_PAGE16( Apple2_64K_RAM, 0x10),
DEF_RAM_PAGE16( Apple2_64K_RAM, 0x20),
DEF_RAM_PAGE16( Apple2_64K_RAM, 0x30),
DEF_RAM_PAGE16( Apple2_64K_RAM, 0x40),
DEF_RAM_PAGE16( Apple2_64K_RAM, 0x50),
DEF_RAM_PAGE16( Apple2_64K_RAM, 0x60),
DEF_RAM_PAGE16( Apple2_64K_RAM, 0x70),
DEF_RAM_PAGE16( Apple2_64K_RAM, 0x80),
DEF_RAM_PAGE16( Apple2_64K_RAM, 0x90),
DEF_RAM_PAGE16( Apple2_64K_RAM, 0xA0),
DEF_RAM_PAGE16( Apple2_64K_RAM, 0xB0),
// I/O Addresses
DEF_RAM_PAGE16( Apple2_64K_RAM, 0xC0),
// Reading from the ROM
DEF_RAM_PAGE16( Apple2_12K_ROM, 0x00), // D0
DEF_RAM_PAGE16( Apple2_12K_ROM, 0x10), // E0
DEF_RAM_PAGE16( Apple2_12K_ROM, 0x20) // F0
};
uint8_t * RAM_PG_WR_TBL[256] = {
// 48K main memory
DEF_RAM_PAGE16( Apple2_64K_RAM, 0x00),
DEF_RAM_PAGE16( Apple2_64K_RAM, 0x10),
DEF_RAM_PAGE16( Apple2_64K_RAM, 0x20),
DEF_RAM_PAGE16( Apple2_64K_RAM, 0x30),
DEF_RAM_PAGE16( Apple2_64K_RAM, 0x40),
DEF_RAM_PAGE16( Apple2_64K_RAM, 0x50),
DEF_RAM_PAGE16( Apple2_64K_RAM, 0x60),
DEF_RAM_PAGE16( Apple2_64K_RAM, 0x70),
DEF_RAM_PAGE16( Apple2_64K_RAM, 0x80),
DEF_RAM_PAGE16( Apple2_64K_RAM, 0x90),
DEF_RAM_PAGE16( Apple2_64K_RAM, 0xA0),
DEF_RAM_PAGE16( Apple2_64K_RAM, 0xB0),
// I/O Addresses
// DEF_RAM_DUMMY16,
DEF_RAM_PAGE16( Apple2_64K_RAM, 0xC0),
// DEF_RAM_PAGE(Apple2_64K_RAM, 0xC0),
// // SLOT ROM is non-writeable
// DEF_RAM_PAGE(Apple2_Dummy_Page, 0), // 01
// DEF_RAM_PAGE(Apple2_Dummy_Page, 0), // 02
// DEF_RAM_PAGE(Apple2_Dummy_Page, 0), // 03
// DEF_RAM_PAGE(Apple2_Dummy_Page, 0), // 04
// DEF_RAM_PAGE(Apple2_Dummy_Page, 0), // 05
// DEF_RAM_PAGE(Apple2_Dummy_Page, 0), // 06
// DEF_RAM_PAGE(Apple2_Dummy_Page, 0), // 07
// DEF_RAM_PAGE(Apple2_Dummy_Page, 0), // 08
// DEF_RAM_PAGE(Apple2_Dummy_Page, 0), // 09
// DEF_RAM_PAGE(Apple2_Dummy_Page, 0), // 0A
// DEF_RAM_PAGE(Apple2_Dummy_Page, 0), // 0B
// DEF_RAM_PAGE(Apple2_Dummy_Page, 0), // 0C
// DEF_RAM_PAGE(Apple2_Dummy_Page, 0), // 0D
// DEF_RAM_PAGE(Apple2_Dummy_Page, 0), // 0E
// DEF_RAM_PAGE(Apple2_Dummy_Page, 0), // 0F
// NO Writing to the ROM
DEF_RAM_DUMMY16,
DEF_RAM_DUMMY16,
DEF_RAM_DUMMY16,
};
enum slot {
SLOT0 = 0x00,
@ -354,46 +296,8 @@ enum mmio {
void resetMemory() {
// 48K main memory
SWITCH_RAM_PAGE16( RAM_PG_RD_TBL, 0x00, Apple2_64K_RAM, 0x00)
SWITCH_RAM_PAGE16( RAM_PG_RD_TBL, 0x10, Apple2_64K_RAM, 0x10)
SWITCH_RAM_PAGE16( RAM_PG_RD_TBL, 0x20, Apple2_64K_RAM, 0x20)
SWITCH_RAM_PAGE16( RAM_PG_RD_TBL, 0x30, Apple2_64K_RAM, 0x30)
SWITCH_RAM_PAGE16( RAM_PG_RD_TBL, 0x40, Apple2_64K_RAM, 0x40)
SWITCH_RAM_PAGE16( RAM_PG_RD_TBL, 0x50, Apple2_64K_RAM, 0x50)
SWITCH_RAM_PAGE16( RAM_PG_RD_TBL, 0x60, Apple2_64K_RAM, 0x60)
SWITCH_RAM_PAGE16( RAM_PG_RD_TBL, 0x70, Apple2_64K_RAM, 0x70)
SWITCH_RAM_PAGE16( RAM_PG_RD_TBL, 0x80, Apple2_64K_RAM, 0x80)
SWITCH_RAM_PAGE16( RAM_PG_RD_TBL, 0x90, Apple2_64K_RAM, 0x90)
SWITCH_RAM_PAGE16( RAM_PG_RD_TBL, 0xA0, Apple2_64K_RAM, 0xA0)
SWITCH_RAM_PAGE16( RAM_PG_RD_TBL, 0xB0, Apple2_64K_RAM, 0xB0)
// I/O Addresses
SWITCH_RAM_PAGE16( RAM_PG_RD_TBL, 0xC0, Apple2_64K_RAM, 0xC0)
// Reading from the ROM
SWITCH_RAM_PAGE16( RAM_PG_RD_TBL, 0xD0, Apple2_12K_ROM, 0x00) // D0
SWITCH_RAM_PAGE16( RAM_PG_RD_TBL, 0xE0, Apple2_12K_ROM, 0x10) // E0
SWITCH_RAM_PAGE16( RAM_PG_RD_TBL, 0xF0, Apple2_12K_ROM, 0x20) // F0
// 48K main memory
SWITCH_RAM_PAGE16( RAM_PG_WR_TBL, 0x00, Apple2_64K_RAM, 0x00)
SWITCH_RAM_PAGE16( RAM_PG_WR_TBL, 0x10, Apple2_64K_RAM, 0x10)
SWITCH_RAM_PAGE16( RAM_PG_WR_TBL, 0x20, Apple2_64K_RAM, 0x20)
SWITCH_RAM_PAGE16( RAM_PG_WR_TBL, 0x30, Apple2_64K_RAM, 0x30)
SWITCH_RAM_PAGE16( RAM_PG_WR_TBL, 0x40, Apple2_64K_RAM, 0x40)
SWITCH_RAM_PAGE16( RAM_PG_WR_TBL, 0x50, Apple2_64K_RAM, 0x50)
SWITCH_RAM_PAGE16( RAM_PG_WR_TBL, 0x60, Apple2_64K_RAM, 0x60)
SWITCH_RAM_PAGE16( RAM_PG_WR_TBL, 0x70, Apple2_64K_RAM, 0x70)
SWITCH_RAM_PAGE16( RAM_PG_WR_TBL, 0x80, Apple2_64K_RAM, 0x80)
SWITCH_RAM_PAGE16( RAM_PG_WR_TBL, 0x90, Apple2_64K_RAM, 0x90)
SWITCH_RAM_PAGE16( RAM_PG_WR_TBL, 0xA0, Apple2_64K_RAM, 0xA0)
SWITCH_RAM_PAGE16( RAM_PG_WR_TBL, 0xB0, Apple2_64K_RAM, 0xB0)
// I/O Addresses
SWITCH_RAM_PAGE16( RAM_PG_WR_TBL, 0xC0, Apple2_64K_RAM, 0xC0)
// NO Writing to the ROM
SWITCH_RAM_PAGE16( RAM_PG_WR_TBL, 0xD0, Apple2_Dummy_RAM, 0 );
SWITCH_RAM_PAGE16( RAM_PG_WR_TBL, 0xE0, Apple2_Dummy_RAM, 0 );
SWITCH_RAM_PAGE16( RAM_PG_WR_TBL, 0xF0, Apple2_Dummy_RAM, 0 );
// Reset memory configuration
MEMcfg.RAM_16K = 0;
MEMcfg.RAM_128K = 1;
MEMcfg.RD_RAM = 0;
@ -404,9 +308,8 @@ void resetMemory() {
MEMcfg.RD_AUX_MEM = 0;
MEMcfg.WR_AUX_MEM = 0;
MEMcfg.int_Cx_ROM = 0;
MEMcfg.slot_C3_ROM = 0;
MEMcfg.ALT_ZP = 0;
MEMcfg.RD_AUX_MEM = 0;
MEMcfg.WR_AUX_MEM = 0;
MEMcfg.txt_page_2 = 0;
@ -414,72 +317,110 @@ void resetMemory() {
memset( Apple2_64K_AUX, 0, sizeof(Apple2_64K_AUX) );
// 64K Main Memory Area
memset( Apple2_64K_RAM, 0, sizeof(Apple2_64K_RAM) );
// 16K Memory Expansion
memset( Apple2_16K_RAM, 0, sizeof(Apple2_16K_RAM) );
memset( Apple2_64K_MEM, 0, sizeof(Apple2_64K_MEM) );
// I/O area should be 0 -- just in case we decide to init RAM with a different pattern...
memset( Apple2_64K_RAM + 0xC000, 0, 0x1000 );
}
static uint8_t page2 = 0;
static uint8_t * activePage = Apple2_64K_RAM + 0x400;
void textPageSelect() {
uint8_t * shadow = Apple2_64K_MEM + 0x400;
if ( page2 != MEMcfg.txt_page_2 ) {
page2 = MEMcfg.txt_page_2;
static uint8_t * newPage = NULL;
if ( MEMcfg.is_80STORE && MEMcfg.txt_page_2 ) {
newPage = Apple2_64K_AUX + 0x400;
}
else {
newPage = Apple2_64K_RAM + 0x400;
}
if ( activePage != newPage ) {
if ( activePage ) {
// save the content of Shadow Memory
memcpy(activePage, shadow, 0x400);
}
// load the content of Video Page 2
memcpy(shadow, newPage, 0x400);
activePage = newPage;
}
}
}
void textPageSelect() {
if ( MEMcfg.is_80STORE && MEMcfg.txt_page_2 ) {
SWITCH_VIDEO_RAM( RAM_PG_RD_TBL, 0x04, Apple2_64K_AUX, 0x04)
SWITCH_VIDEO_RAM( RAM_PG_WR_TBL, 0x04, Apple2_64K_AUX, 0x04)
}
else {
SWITCH_VIDEO_RAM( RAM_PG_RD_TBL, 0x04, Apple2_64K_RAM, 0x04)
SWITCH_VIDEO_RAM( RAM_PG_WR_TBL, 0x04, Apple2_64K_RAM, 0x04)
}
}
void auxMemorySelect() {
uint8_t * shadow = Apple2_64K_MEM + 0x200;
uint8_t * memory;
if ( MEMcfg.is_80STORE ) {
if ( MEMcfg.RD_AUX_MEM ) {
SWITCH_AUX_MEM( RAM_PG_RD_TBL, Apple2_64K_AUX );
memory = Apple2_64K_AUX + 0x200;
// save the content of Shadow Memory
memcpy(Apple2_64K_RAM + 0x200, shadow, 0xA00);
// load the content of Aux Memory
memcpy(Apple2_64K_MEM + 0x200, Apple2_64K_AUX, 0xA00);
}
else {
SWITCH_AUX_MEM( RAM_PG_RD_TBL, Apple2_64K_RAM );
memory = Apple2_64K_RAM + 0x200;
// save the content of Shadow Memory
memcpy(Apple2_64K_AUX + 0x200, shadow, 0xA00);
// load the content of Int Memory
memcpy(Apple2_64K_MEM + 0x200, Apple2_64K_RAM, 0xA00);
}
if ( MEMcfg.WR_AUX_MEM ) {
SWITCH_AUX_MEM( RAM_PG_WR_TBL, Apple2_64K_AUX );
// TODO: set write table for AUX
}
else {
SWITCH_AUX_MEM( RAM_PG_WR_TBL, Apple2_64K_RAM );
// TODO: set write table for RAM
}
}
else {
SWITCH_AUX_MEM( RAM_PG_RD_TBL, Apple2_64K_RAM );
SWITCH_AUX_MEM( RAM_PG_WR_TBL, Apple2_64K_RAM );
// TODO: set read table for RAM
}
// load new content to shadow memory
memcpy(shadow, memory, 0xA00);
}
INLINE uint8_t ioRead( uint16_t addr ) {
// if (outdev) fprintf(outdev, "ioRead:%04X\n", addr);
// printf("ioRead:%04X (PC:%04X)\n", addr, m6502.PC);
uint8_t currentMagnet = 0;
switch (addr) {
case io_KBD:
switch ( (uint8_t)addr ) {
case (uint8_t)io_KBD:
// if ( RAM[io_KBD] > 0x7F ) printf("io_KBD:%04X\n", addr);
return RAM[io_KBD];
return Apple2_64K_RAM[io_KBD];
case io_KBDSTRB:
case (uint8_t)io_KBDSTRB:
// TODO: This is very slow!
// printf("io_KBDSTRB\n");
return RAM[io_KBD] &= 0x7F;
Apple2_64K_RAM[io_KBD] &= 0x7F;
return Apple2_64K_RAM[io_KBDSTRB];
case io_SPKR:
case (uint8_t)io_SPKR:
// TODO: This is very slow!
// printf("io_KBDSTRB\n");
//ViewController_spk_up_play();
return RAM[io_SPKR];
return Apple2_64K_RAM[io_SPKR];
// case io_VID_CLR80VID:
// videoMode.col80 = 0;
@ -489,144 +430,146 @@ INLINE uint8_t ioRead( uint16_t addr ) {
// videoMode.col80 = 1;
// break;
//
case io_VID_RDTEXT:
case (uint8_t)io_VID_RDTEXT:
return videoMode.text << 7;
case io_VID_ALTCHAR:
case (uint8_t)io_VID_ALTCHAR:
return videoMode.altChr << 7;
case io_VID_RD80VID:
case (uint8_t)io_VID_RD80VID:
return videoMode.col80 << 7;
case io_TAPEIN:
case (uint8_t)io_TAPEIN:
return MEMcfg.txt_page_2 << 7;
case io_RDCXROM:
case (uint8_t)io_RDCXROM:
return MEMcfg.int_Cx_ROM << 7;
case io_RDALTZP:
case (uint8_t)io_RDALTZP:
return MEMcfg.ALT_ZP << 7;
case io_RDC3ROM:
case (uint8_t)io_RDC3ROM:
return MEMcfg.slot_C3_ROM << 7;
case io_RD80STORE:
case (uint8_t)io_RD80STORE:
return MEMcfg.is_80STORE << 7;
case io_VID_TXTPAGE1:
case (uint8_t)io_VID_TXTPAGE1:
// printf("io_VID_TXTPAGE1\n");
MEMcfg.txt_page_2 = 0;
textPageSelect();
break;
case io_VID_TXTPAGE2:
case (uint8_t)io_VID_TXTPAGE2:
// printf("io_VID_TXTPAGE2\n");
MEMcfg.txt_page_2 = 1;
textPageSelect();
break;
case io_VID_Text_OFF:
case (uint8_t)io_VID_Text_OFF:
videoMode.text = 0;
break;
case io_VID_Text_ON:
case (uint8_t)io_VID_Text_ON:
videoMode.text = 1;
break;
case io_VID_Mixed_OFF:
case (uint8_t)io_VID_Mixed_OFF:
videoMode.mixed = 0;
break;
case io_VID_Mixed_ON:
case (uint8_t)io_VID_Mixed_ON:
videoMode.mixed = 1;
break;
case io_VID_Hires_OFF:
case (uint8_t)io_VID_Hires_OFF:
videoMode.hires = 0;
break;
case io_VID_Hires_ON:
case (uint8_t)io_VID_Hires_ON:
videoMode.hires = 1;
break;
case io_PDL0:
case io_PDL1:
case io_PDL2:
case io_PDL3:
case (uint8_t)io_PDL0:
case (uint8_t)io_PDL1:
case (uint8_t)io_PDL2:
case (uint8_t)io_PDL3:
// if ( RAM[addr] > 127 ) {
// RAM[addr]--;
// }
return RAM[addr];
return Apple2_64K_RAM[addr];
case io_MEM_RDRAM_NOWR_2:
case io_MEM_RDROM_WRAM_2:
case io_MEM_RDROM_NOWR_2:
case io_MEM_RDRAM_WRAM_2:
case io_MEM_RDRAM_NOWR_1:
case io_MEM_RDROM_WRAM_1:
case io_MEM_RDROM_NOWR_1:
case io_MEM_RDRAM_WRAM_1:
case (uint8_t)io_MEM_RDRAM_NOWR_2:
case (uint8_t)io_MEM_RDROM_WRAM_2:
case (uint8_t)io_MEM_RDROM_NOWR_2:
case (uint8_t)io_MEM_RDRAM_WRAM_2:
case (uint8_t)io_MEM_RDRAM_NOWR_1:
case (uint8_t)io_MEM_RDROM_WRAM_1:
case (uint8_t)io_MEM_RDROM_NOWR_1:
case (uint8_t)io_MEM_RDRAM_WRAM_1:
if ( MEMcfg.RAM_16K || MEMcfg.RAM_128K ) {
uint8_t * RAM_BANK = Apple2_16K_RAM;
uint8_t * RAM_BANK = Apple2_64K_AUX + 0xC000;
// RAM Bank 1 or 2?
switch (addr) {
case io_MEM_RDRAM_NOWR_2:
case io_MEM_RDROM_WRAM_2:
case io_MEM_RDROM_NOWR_2:
case io_MEM_RDRAM_WRAM_2:
switch ((uint8_t)addr) {
case (uint8_t)io_MEM_RDRAM_NOWR_2:
case (uint8_t)io_MEM_RDROM_WRAM_2:
case (uint8_t)io_MEM_RDROM_NOWR_2:
case (uint8_t)io_MEM_RDRAM_WRAM_2:
MEMcfg.RAM_BANK_2 = 1;
RAM_BANK = Apple2_16K_RAM + 0x30;
RAM_BANK = Apple2_64K_AUX + 0xD000;
break;
default:
MEMcfg.RAM_BANK_2 = 0;
RAM_BANK = Apple2_16K_RAM;
RAM_BANK = Apple2_64K_AUX + 0xC000;
break;
}
// is RAM to read or ROM?
switch (addr) {
case io_MEM_RDRAM_NOWR_2:
case io_MEM_RDRAM_WRAM_2:
case io_MEM_RDRAM_NOWR_1:
case io_MEM_RDRAM_WRAM_1:
switch ((uint8_t)addr) {
case (uint8_t)io_MEM_RDRAM_NOWR_2:
case (uint8_t)io_MEM_RDRAM_WRAM_2:
case (uint8_t)io_MEM_RDRAM_NOWR_1:
case (uint8_t)io_MEM_RDRAM_WRAM_1:
MEMcfg.RD_RAM = 1;
uint8_t * shadow = Apple2_64K_MEM + 0xD000;
// save the content of Shadow Memory
memcpy(Apple2_64K_RAM + 0xD000, shadow, 0x3000);
// load the content of Aux Memory
memcpy(Apple2_64K_MEM + 0xD000, Apple2_64K_AUX, 0x3000);
// set the RAM extension to read on the upper memory area
SWITCH_RAM_PAGE16( RAM_PG_RD_TBL, 0xD0, RAM_BANK, 0x00 );
SWITCH_RAM_PAGE16( RAM_PG_RD_TBL, 0xE0, Apple2_16K_RAM, 0x10 );
SWITCH_RAM_PAGE16( RAM_PG_RD_TBL, 0xF0, Apple2_16K_RAM, 0x20 );
break;
default:
MEMcfg.RD_RAM = 0;
shadow = Apple2_64K_MEM + 0xD000;
// save the content of Shadow Memory
memcpy(Apple2_64K_AUX + 0xD000, shadow, 0x3000);
// load the content of ROM Memory
memcpy(Apple2_64K_MEM + 0xD000, Apple2_16K_ROM + 0x1000, 0x3000);
// set the ROM to read on the upper memory area
SWITCH_RAM_PAGE16( RAM_PG_RD_TBL, 0xD0, Apple2_12K_ROM, 0x00 );
SWITCH_RAM_PAGE16( RAM_PG_RD_TBL, 0xE0, Apple2_12K_ROM, 0x10 );
SWITCH_RAM_PAGE16( RAM_PG_RD_TBL, 0xF0, Apple2_12K_ROM, 0x20 );
break;
}
// is RAM Writeable?
switch (addr) {
case io_MEM_RDROM_WRAM_2:
case io_MEM_RDRAM_WRAM_2:
case io_MEM_RDROM_WRAM_1:
case io_MEM_RDRAM_WRAM_1:
switch ((uint8_t)addr) {
case (uint8_t)io_MEM_RDROM_WRAM_2:
case (uint8_t)io_MEM_RDRAM_WRAM_2:
case (uint8_t)io_MEM_RDROM_WRAM_1:
case (uint8_t)io_MEM_RDRAM_WRAM_1:
MEMcfg.WR_RAM = 1;
// set the RAM extension to read from the upper memory area
SWITCH_RAM_PAGE16( RAM_PG_WR_TBL, 0xD0, RAM_BANK, 0x00 );
SWITCH_RAM_PAGE16( RAM_PG_WR_TBL, 0xE0, Apple2_16K_RAM, 0x10 );
SWITCH_RAM_PAGE16( RAM_PG_WR_TBL, 0xF0, Apple2_16K_RAM, 0x20 );
break;
default:
MEMcfg.WR_RAM = 0;
// set the ROM to read on the upper memory area
SWITCH_RAM_PAGE16( RAM_PG_WR_TBL, 0xD0, Apple2_Dummy_RAM, 0 );
SWITCH_RAM_PAGE16( RAM_PG_WR_TBL, 0xE0, Apple2_Dummy_RAM, 0 );
SWITCH_RAM_PAGE16( RAM_PG_WR_TBL, 0xF0, Apple2_Dummy_RAM, 0 );
break;
}
@ -634,10 +577,10 @@ INLINE uint8_t ioRead( uint16_t addr ) {
break;
// TODO: Make code "card insertable to slot" / aka slot independent and dynamically add/remove
case io_DISK_PHASE0_OFF + SLOT6:
case io_DISK_PHASE1_OFF + SLOT6:
case io_DISK_PHASE2_OFF + SLOT6:
case io_DISK_PHASE3_OFF + SLOT6:
case (uint8_t)io_DISK_PHASE0_OFF + SLOT6:
case (uint8_t)io_DISK_PHASE1_OFF + SLOT6:
case (uint8_t)io_DISK_PHASE2_OFF + SLOT6:
case (uint8_t)io_DISK_PHASE3_OFF + SLOT6:
currentMagnet = (addr - io_DISK_PHASE0_OFF - SLOT6) / 2;
disk.phase.magnet &= ~(1 << currentMagnet);
printf("io_DISK_PHASE%u_OFF (S%u, ps:%X) ", currentMagnet, 6, disk.phase.magnet);
@ -645,10 +588,10 @@ INLINE uint8_t ioRead( uint16_t addr ) {
disk_phase();
return 0;
case io_DISK_PHASE0_ON + SLOT6:
case io_DISK_PHASE1_ON + SLOT6:
case io_DISK_PHASE2_ON + SLOT6:
case io_DISK_PHASE3_ON + SLOT6: {
case (uint8_t)io_DISK_PHASE0_ON + SLOT6:
case (uint8_t)io_DISK_PHASE1_ON + SLOT6:
case (uint8_t)io_DISK_PHASE2_ON + SLOT6:
case (uint8_t)io_DISK_PHASE3_ON + SLOT6: {
currentMagnet = (addr - io_DISK_PHASE0_ON - SLOT6) / 2;
disk.phase.magnet |= 1 << currentMagnet;
printf("io_DISK_PHASE%u_ON (S%u, ps:%X) ", currentMagnet, 6, disk.phase.magnet);
@ -657,35 +600,35 @@ INLINE uint8_t ioRead( uint16_t addr ) {
return 0;
}
case io_DISK_POWER_OFF + SLOT6:
case (uint8_t)io_DISK_POWER_OFF + SLOT6:
dbgPrintf2("io_DISK_POWER_OFF (S%u)\n", 6);
return 0;
case io_DISK_POWER_ON + SLOT6:
case (uint8_t)io_DISK_POWER_ON + SLOT6:
dbgPrintf2("io_DISK_POWER_ON (S%u)\n", 6);
return 0;
case io_DISK_SELECT_1 + SLOT6:
case (uint8_t)io_DISK_SELECT_1 + SLOT6:
dbgPrintf2("io_DISK_SELECT_1 (S%u)\n", 6);
return 0;
case io_DISK_SELECT_2 + SLOT6:
case (uint8_t)io_DISK_SELECT_2 + SLOT6:
dbgPrintf2("io_DISK_SELECT_2 (S%u)\n", 6);
return 0;
case io_DISK_READ + SLOT6:
case (uint8_t)io_DISK_READ + SLOT6:
return disk_read();
case io_DISK_WRITE + SLOT6:
case (uint8_t)io_DISK_WRITE + SLOT6:
dbgPrintf2("io_DISK_WRITE (S%u)\n", 6);
return 0;
case io_DISK_CLEAR + SLOT6:
case (uint8_t)io_DISK_CLEAR + SLOT6:
dbgPrintf2("io_DISK_CLEAR (S%u)\n", 6);
return 0;
case io_DISK_SHIFT + SLOT6:
case (uint8_t)io_DISK_SHIFT + SLOT6:
dbgPrintf2("io_DISK_SHIFT (S%u)\n", 6);
return 0;
@ -696,12 +639,12 @@ INLINE uint8_t ioRead( uint16_t addr ) {
break;
}
return RAM[addr];
return Apple2_64K_RAM[addr];
}
// TODO:
void setIO ( uint16_t ioaddr, uint8_t val ) {
RAM[ioaddr] = val;
Apple2_64K_RAM[ioaddr] = val;
}
@ -731,11 +674,18 @@ void kbdInput ( uint8_t code ) {
}
void kbdUp () {
RAM[io_KBDSTRB] &= 0x7F;
}
INLINE void ioWrite( uint16_t addr, uint8_t val ) {
// if (outdev) fprintf(outdev, "ioWrite:%04X (A:%02X)\n", addr, m6502.A);
switch (addr) {
case io_KBDSTRB:
RAM[io_KBD] &= 0x7F;
Apple2_64K_RAM[io_KBD] &= 0x7F;
break;
case io_RDMAINRAM:
@ -764,38 +714,36 @@ INLINE void ioWrite( uint16_t addr, uint8_t val ) {
case io_SETSTDZP:
MEMcfg.ALT_ZP = 0;
SWITCH_STACK_ZP(RAM_PG_RD_TBL, Apple2_64K_RAM);
SWITCH_STACK_ZP(RAM_PG_WR_TBL, Apple2_64K_RAM);
// TODO: set zero page table to RAM
break;
case io_SETALTZP:
MEMcfg.ALT_ZP = 1;
SWITCH_STACK_ZP(RAM_PG_RD_TBL, Apple2_64K_AUX);
SWITCH_STACK_ZP(RAM_PG_WR_TBL, Apple2_64K_AUX);
// TODO: set zero page table to AUX
break;
case io_SETSLOTCXROM:
// printf("io_SETSLOTCXROM\n");
MEMcfg.int_Cx_ROM = 0;
SWITCH_CX_ROM( RAM_PG_RD_TBL, 0xC0, Apple2_64K_RAM, 0xC0);
// TODO: set Cx00 ROM area table to SLOT
break;
case io_SETINTCXROM:
// printf("io_SETINTCXROM\n");
MEMcfg.int_Cx_ROM = 1;
SWITCH_CX_ROM( RAM_PG_RD_TBL, 0xC0, Apple2_16K_ROM, 0x00);
// TODO: set Cx00 ROM area table to INT
break;
case io_SETSLOTC3ROM:
// printf("io_SETSLOTC3ROM\n");
MEMcfg.slot_C3_ROM = 1;
SWITCH_ROM_PAGE( RAM_PG_RD_TBL, 0xC3, Apple2_64K_RAM, 0xC3);
// TODO: set C300 ROM area table to SLOT
break;
case io_SETINTC3ROM:
// printf("io_SETINTC3ROM\n");
MEMcfg.slot_C3_ROM = 0;
SWITCH_ROM_PAGE( RAM_PG_RD_TBL, 0xC3, Apple2_16K_ROM, 0x03);
// TODO: set C300 ROM area table to INT
break;
case io_VID_CLR80VID:
@ -852,24 +800,51 @@ INLINE void ioWrite( uint16_t addr, uint8_t val ) {
/**
Naive implementation of RAM read from address
**/
INLINE uint8_t memread8_low( uint16_t addr ) {
return Apple2_64K_MEM[addr];
}
INLINE uint8_t memread8_high( uint16_t addr ) {
return RDHIMEM[addr];
}
INLINE uint8_t memread8( uint16_t addr ) {
return * ( RAM_PG_RD_TBL[addr >> 8] + (addr & 0xFF) );
// return RAM[addr];
if (addr >= 0xC000) {
return memread8_high(addr);
}
return memread8_low(addr);
}
/**
Naive implementation of RAM read from address
**/
INLINE uint16_t memread16_low( uint16_t addr ) {
return * (uint16_t*) ( Apple2_64K_MEM + addr );
}
INLINE uint16_t memread16_high( uint16_t addr ) {
return * (uint16_t*) ( RDHIMEM + addr );
}
INLINE uint16_t memread16( uint16_t addr ) {
return * (uint16_t*) ( RAM_PG_RD_TBL[addr >> 8] + (addr & 0xFF) );
// return * (uint16_t*) (RAM + addr);
// if (addr >= 0xC000) {
// return memread16_high(addr);
// }
return memread16_low(addr);
}
INLINE uint8_t memread( uint16_t addr ) {
if ( (addr >= 0xC000) && (addr <= 0xC0FF) ) {
return ioRead(addr);
if (addr >= 0xC000) {
if (addr < 0xC100) {
return ioRead(addr);
}
// return memread8_paged(addr);
return memread8_high(addr);
}
return memread8(addr);
// return memread8_paged(addr);
return memread8_low(addr);
// return memread8(addr);
}
/**
@ -891,19 +866,27 @@ INLINE uint8_t memread( uint16_t addr ) {
/**
Naive implementation of RAM write to address
**/
static void memwrite( uint16_t addr, uint8_t byte ) {
// if ( addr >= 0xD000 ) {
// // ROM
// return;
// }
// if ( addr >= 0xC000 ) {
// return mmioWrite(addr);
// }
//
RAM[ addr ] = byte;
}
INLINE void memwrite8_low( uint16_t addr, uint8_t data ) {
WRLOMEM[addr] = data;
}
INLINE void memwrite8_high( uint16_t addr, uint8_t data ) {
WRHIMEM[addr] = data;
}
INLINE void memwrite( uint16_t addr, uint8_t data ) {
if (addr >= 0xC000) {
if (addr < 0xC100) {
ioWrite(addr, data);
}
else {
memwrite8_high(addr, data);
}
}
else {
memwrite8_low(addr, data);
}
}
/**
Fetching 1 byte from memory address pc (program counter)
@ -916,7 +899,7 @@ INLINE uint8_t fetch() {
m6502.clktime++;
}
#endif
return memread( m6502.PC++ );
return memread8_low( m6502.PC++ );
}
/**
@ -936,6 +919,12 @@ INLINE uint16_t fetch16() {
return word;
}
INLINE uint8_t * dest( uint8_t * mem, uint16_t addr ) {
return mem + addr;
}
/**
abs .... absolute OPC $LLHH,X
operand is address; effective address is address incremented by X with carry **
@ -949,8 +938,7 @@ INLINE uint8_t src_abs() {
return memread( addr_abs() );
}
INLINE uint8_t * dest_abs() {
uint16_t addr = addr_abs();
return ( RAM_PG_WR_TBL[addr >> 8] + (addr & 0xFF) );
return WRLOMEM + addr_abs();
}
@ -981,8 +969,7 @@ INLINE uint8_t src_abs_X() {
return memread( addr_abs_X() );
}
INLINE uint8_t * dest_abs_X() {
uint16_t addr = addr_abs_X();
return ( RAM_PG_WR_TBL[addr >> 8] + (addr & 0xFF) );
return WRLOMEM + addr_abs_X();
}
@ -999,11 +986,10 @@ INLINE uint8_t src_abs_Y() {
return memread(addr_abs_Y());
}
INLINE uint8_t * dest_abs_Y() {
uint16_t addr = addr_abs_Y();
return ( RAM_PG_WR_TBL[addr >> 8] + (addr & 0xFF) );
return WRLOMEM + addr_abs_Y();
}
INLINE uint16_t imm() {
INLINE uint8_t imm() {
disPrintf(disassembly.oper, "#$%02X", memread8(m6502.PC))
return fetch();
}
@ -1019,11 +1005,10 @@ INLINE uint8_t addr_zp() {
return fetch();
}
INLINE uint8_t src_zp() {
return memread8(addr_zp());
return memread8_low(addr_zp());
}
INLINE uint8_t * dest_zp() {
uint16_t addr = addr_zp();
return ( RAM_PG_WR_TBL[addr >> 8] + (addr & 0xFF) );
return WRLOMEM + addr_zp();
}
/**
@ -1051,8 +1036,7 @@ INLINE uint8_t src_X_ind() {
return memread( addr_X_ind() );
}
INLINE uint8_t * dest_X_ind() {
uint16_t addr = addr_X_ind();
return ( RAM_PG_WR_TBL[addr >> 8] + (addr & 0xFF) );
return WRLOMEM + addr_X_ind();
}
/**
@ -1071,8 +1055,7 @@ INLINE uint8_t src_ind_Y() {
return memread( addr_ind_Y() );
}
INLINE uint8_t * dest_ind_Y() {
uint16_t addr = addr_ind_Y();
return ( RAM_PG_WR_TBL[addr >> 8] + (addr & 0xFF) );
return WRLOMEM + addr_ind_Y();
}
/**
@ -1085,11 +1068,10 @@ INLINE uint8_t addr_zp_X() {
return fetch() + m6502.X;
}
INLINE uint8_t src_zp_X() {
return memread8(addr_zp_X());
return memread8_low(addr_zp_X());
}
INLINE uint8_t * dest_zp_X() {
uint16_t addr = addr_zp_X();
return ( RAM_PG_WR_TBL[addr >> 8] + (addr & 0xFF) );
return WRLOMEM + addr_zp_X();
}
/**
@ -1102,11 +1084,10 @@ INLINE uint8_t addr_zp_Y() {
return fetch() + m6502.Y;
}
INLINE uint8_t src_zp_Y() {
return memread8(addr_zp_Y());
return memread8_low(addr_zp_Y());
}
INLINE uint8_t * dest_zp_Y() {
uint16_t addr = addr_zp_Y();
return ( RAM_PG_WR_TBL[addr >> 8] + (addr & 0xFF) );
return WRLOMEM + addr_zp_Y();
}

View File

@ -58,9 +58,9 @@ union {
} bits_t;
#define BITTEST(n,x) ((bits_t)(n)).b##x
//#define BITTEST(n,x) ( (n) >> (x) )
//#define BITTEST(n,x) ( (n) & (1 << (x)) )
//#define BITTEST(n,x) ((bits_t)(n)).b##x
//#define BITTEST(n,x) (( (n) >> (x) ) & 1)
#define BITTEST(n,x) ( (n) & (1 << (x)) )
extern FILE * outdev;

View File

@ -50,6 +50,22 @@ unsigned long long discnt = 0;
} \
}
INLINE flags_t getFlags2() {
flags_t f = {
m6502.C != 0, // Carry Flag
m6502.Z != 0, // Zero Flag
m6502.I != 0, // Interrupt Flag
m6502.D != 0, // Decimal Flag
m6502.B != 0, // B Flag
m6502.res != 0, // reserved -- should be always 1
m6502.V != 0, // Overflow Flag ???
m6502.N != 0, // Negative Flag
};
return f;
}
INLINE void printDisassembly( FILE * f ) {
if ( m6502.dbgLevel.trace && f ) {
// fprintf( f, "%s: %-14s%-6s%-14s%-16s A:%02X X:%02X Y:%02X S:%02X P:%02X (%c%c%c%c%c%c%c%c)\n",
@ -83,7 +99,8 @@ INLINE void printDisassembly( FILE * f ) {
m6502.A,
m6502.X,
m6502.Y,
m6502.SR,
0,
//getFlags2(),
m6502.SP,
disassembly.comment
);

200
ssasa Normal file
View File

@ -0,0 +1,200 @@
DEBUG: 0 no LDA
Line Cycle Disassembly A X Y P S
DEBUG: 0 no LDA
5 44223738 C65E: BD 8C C0 LDA $C08C,X 0xF3 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
6 44223742 C661: 10 FB BPL $C65E 0xF3 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
7 44223744 C663: 49 D5 EOR #$D5 0x26 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
8 44223746 C665: D0 F7 BNE $C65E 0x26 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
15 44223770 C65E: BD 8C C0 LDA $C08C,X 0xCE 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
16 44223774 C661: 10 FB BPL $C65E 0xCE 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
17 44223776 C663: 49 D5 EOR #$D5 0x1B 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
18 44223778 C665: D0 F7 BNE $C65E 0x1B 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
25 44223802 C65E: BD 8C C0 LDA $C08C,X 0xE5 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
26 44223806 C661: 10 FB BPL $C65E 0xE5 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
27 44223808 C663: 49 D5 EOR #$D5 0x30 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
28 44223810 C665: D0 F7 BNE $C65E 0x30 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
35 44223834 C65E: BD 8C C0 LDA $C08C,X 0xF4 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
36 44223838 C661: 10 FB BPL $C65E 0xF4 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
37 44223840 C663: 49 D5 EOR #$D5 0x21 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
38 44223842 C665: D0 F7 BNE $C65E 0x21 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
45 44223866 C65E: BD 8C C0 LDA $C08C,X 0xCD 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
46 44223870 C661: 10 FB BPL $C65E 0xCD 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
47 44223872 C663: 49 D5 EOR #$D5 0x18 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
48 44223874 C665: D0 F7 BNE $C65E 0x18 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
55 44223898 C65E: BD 8C C0 LDA $C08C,X 0xBE 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
56 44223902 C661: 10 FB BPL $C65E 0xBE 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
57 44223904 C663: 49 D5 EOR #$D5 0x6B 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
58 44223906 C665: D0 F7 BNE $C65E 0x6B 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
65 44223930 C65E: BD 8C C0 LDA $C08C,X 0xFF 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
66 44223934 C661: 10 FB BPL $C65E 0xFF 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
67 44223936 C663: 49 D5 EOR #$D5 0x2A 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
68 44223938 C665: D0 F7 BNE $C65E 0x2A 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
75 44223962 C65E: BD 8C C0 LDA $C08C,X 0xE7 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
76 44223966 C661: 10 FB BPL $C65E 0xE7 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
77 44223968 C663: 49 D5 EOR #$D5 0x32 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
78 44223970 C665: D0 F7 BNE $C65E 0x32 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
85 44223994 C65E: BD 8C C0 LDA $C08C,X 0xCD 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
86 44223998 C661: 10 FB BPL $C65E 0xCD 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
87 44224000 C663: 49 D5 EOR #$D5 0x18 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
88 44224002 C665: D0 F7 BNE $C65E 0x18 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
95 44224026 C65E: BD 8C C0 LDA $C08C,X 0xBA 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
96 44224030 C661: 10 FB BPL $C65E 0xBA 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
97 44224032 C663: 49 D5 EOR #$D5 0x6F 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
98 44224034 C665: D0 F7 BNE $C65E 0x6F 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
105 44224058 C65E: BD 8C C0 LDA $C08C,X 0xB2 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
106 44224062 C661: 10 FB BPL $C65E 0xB2 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
107 44224064 C663: 49 D5 EOR #$D5 0x67 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
108 44224066 C665: D0 F7 BNE $C65E 0x67 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
115 44224090 C65E: BD 8C C0 LDA $C08C,X 0xA7 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
116 44224094 C661: 10 FB BPL $C65E 0xA7 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
117 44224096 C663: 49 D5 EOR #$D5 0x72 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
118 44224098 C665: D0 F7 BNE $C65E 0x72 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
125 44224122 C65E: BD 8C C0 LDA $C08C,X 0xFC 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
126 44224126 C661: 10 FB BPL $C65E 0xFC 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
127 44224128 C663: 49 D5 EOR #$D5 0x29 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
128 44224130 C665: D0 F7 BNE $C65E 0x29 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
135 44224154 C65E: BD 8C C0 LDA $C08C,X 0xF2 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
136 44224158 C661: 10 FB BPL $C65E 0xF2 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
137 44224160 C663: 49 D5 EOR #$D5 0x27 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
138 44224162 C665: D0 F7 BNE $C65E 0x27 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
145 44224186 C65E: BD 8C C0 LDA $C08C,X 0xE9 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
146 44224190 C661: 10 FB BPL $C65E 0xE9 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
147 44224192 C663: 49 D5 EOR #$D5 0x3C 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
148 44224194 C665: D0 F7 BNE $C65E 0x3C 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
155 44224218 C65E: BD 8C C0 LDA $C08C,X 0xFF 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
156 44224222 C661: 10 FB BPL $C65E 0xFF 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
157 44224224 C663: 49 D5 EOR #$D5 0x2A 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
158 44224226 C665: D0 F7 BNE $C65E 0x2A 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
165 44224250 C65E: BD 8C C0 LDA $C08C,X 0xCF 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
166 44224254 C661: 10 FB BPL $C65E 0xCF 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
167 44224256 C663: 49 D5 EOR #$D5 0x1A 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
168 44224258 C665: D0 F7 BNE $C65E 0x1A 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
175 44224282 C65E: BD 8C C0 LDA $C08C,X 0xA7 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
176 44224286 C661: 10 FB BPL $C65E 0xA7 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
177 44224288 C663: 49 D5 EOR #$D5 0x72 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
178 44224290 C665: D0 F7 BNE $C65E 0x72 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
185 44224314 C65E: BD 8C C0 LDA $C08C,X 0xDF 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
186 44224318 C661: 10 FB BPL $C65E 0xDF 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
187 44224320 C663: 49 D5 EOR #$D5 0x0A 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
188 44224322 C665: D0 F7 BNE $C65E 0x0A 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
195 44224346 C65E: BD 8C C0 LDA $C08C,X 0x9E 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
196 44224350 C661: 10 FB BPL $C65E 0x9E 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
197 44224352 C663: 49 D5 EOR #$D5 0x4B 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
198 44224354 C665: D0 F7 BNE $C65E 0x4B 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
205 44224378 C65E: BD 8C C0 LDA $C08C,X 0xE7 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
206 44224382 C661: 10 FB BPL $C65E 0xE7 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
207 44224384 C663: 49 D5 EOR #$D5 0x32 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
208 44224386 C665: D0 F7 BNE $C65E 0x32 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
215 44224410 C65E: BD 8C C0 LDA $C08C,X 0x9B 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
216 44224414 C661: 10 FB BPL $C65E 0x9B 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
217 44224416 C663: 49 D5 EOR #$D5 0x4E 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
218 44224418 C665: D0 F7 BNE $C65E 0x4E 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
225 44224442 C65E: BD 8C C0 LDA $C08C,X 0xBA 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
226 44224446 C661: 10 FB BPL $C65E 0xBA 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
227 44224448 C663: 49 D5 EOR #$D5 0x6F 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
228 44224450 C665: D0 F7 BNE $C65E 0x6F 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
235 44224474 C65E: BD 8C C0 LDA $C08C,X 0xFD 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
236 44224478 C661: 10 FB BPL $C65E 0xFD 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
237 44224480 C663: 49 D5 EOR #$D5 0x28 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
238 44224482 C665: D0 F7 BNE $C65E 0x28 0x60 0x00 0x34 0xFE
DEBUG: 0 no LDA
245 44224506 C65E: BD 8C C0 LDA $C08C,X 0xE7 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
246 44224510 C661: 10 FB BPL $C65E 0xE7 0x60 0x00 0xB4 0xFE
DEBUG: 0 no LDA
247 44224512 C663: 49 D5 EOR #$D5 0x32 0x60 0x00 0x34 0xFE