Changes for the switch from SubVersion to git

- Fixed line endings of all text files
- Set executable bit on m.bat
- Added basic .gitignore
This commit is contained in:
Simon Owen 2010-02-04 19:15:30 +00:00
parent 869c9a319f
commit 215b5758f5
8 changed files with 4647 additions and 4644 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
.*
!.gitignore
apple1emu.dsk

View File

@ -1,27 +1,27 @@
Apple 1 Emulator for SAM Coupe (v1.2)
-------------------------------------
See website for usage: http://simonowen.com/sam/apple1emu/
---
Version 1.2 (5/9/2008)
- Fixed BRK flags (clear D, set I, N/Z set from wrong EXX set)
- Fixed Esc repeat, broken in previous version
- Added Applesoft BASIC [Lite] and Lee Davidson's Enhanced BASIC
- Updated Ken Wessen's Krusader assembler to v1.3
- First byte of emulator at &c000 appears to be ROM (for Applesoft BASIC ROM)
- Terminal output now supports lower-case characters (for Enhanced BASIC)
Version 1.1 (27/8/2008)
- Improved 65C02 core for ~20% speed boost
- Fixed broken TRB, which was masking the wrong value
- BIT #imm no longer considers setting N flag
Version 1.0 (19/3/2007)
- Initial release
---
Simon Owen
simon@simonowen.com
Apple 1 Emulator for SAM Coupe (v1.2)
-------------------------------------
See website for usage: http://simonowen.com/sam/apple1emu/
---
Version 1.2 (5/9/2008)
- Fixed BRK flags (clear D, set I, N/Z set from wrong EXX set)
- Fixed Esc repeat, broken in previous version
- Added Applesoft BASIC [Lite] and Lee Davidson's Enhanced BASIC
- Updated Ken Wessen's Krusader assembler to v1.3
- First byte of emulator at &c000 appears to be ROM (for Applesoft BASIC ROM)
- Terminal output now supports lower-case characters (for Enhanced BASIC)
Version 1.1 (27/8/2008)
- Improved 65C02 core for ~20% speed boost
- Fixed broken TRB, which was masking the wrong value
- BIT #imm no longer considers setting N flag
Version 1.0 (19/3/2007)
- Initial release
---
Simon Owen
simon@simonowen.com

File diff suppressed because it is too large Load Diff

128
font.pl
View File

@ -1,64 +1,64 @@
#!/usr/bin/perl -w
#
# Convert PNG image to raw font binary for Apple 1 emulator
#
# Makes lots of assumptions about the input image!
use Compress::Zlib;
# Input image and output data file
my $input = 'font.png';
my $output = 'font.bin';
# Our characters are 6 pixels wide
$chrw = 6;
# Slurp the entire PNG image
open INPUT, "<$input" and binmode INPUT or die "$input: $!\n";
read INPUT, $data='', -s $input;
close INPUT;
# Find and extract the image dimensions
$data =~ /IHDR(.{8})/s;
($w,$h) = unpack "N2", $1;
# Extract and expand the compressed image data
($data) = $data =~ /IDAT(.*).{8}IEND/s;
$data = Compress::Zlib::uncompress($data);
# Remove the type byte from the start of each line
$w_2 = $w/2;
$data =~ s/.(.{$w_2})/$1/sg;
@data = ();
# Unpack the pixel nibbles
foreach (unpack "C*", $data) {
push @data, $_>>4, $_&1;
}
open OUTPUT, ">$output" and binmode OUTPUT or die "$output: $!\n";
# Process all characters
foreach $chr (0..$w/$chrw-1)
{
# Process the image line by line
foreach $y (0..$h-1)
{
# Locate the pixel data for the current character
my $x = $chr*$chrw + $w*$y;
my $b = 0;
# Pack the 1bpp data into a single byte
foreach (@data[$x..$x+$chrw-1]) {
$b = ($b << 1) | $_;
}
# Left-align within the byte and output it
print OUTPUT chr($b << (8-$chrw));
}
}
close OUTPUT;
#!/usr/bin/perl -w
#
# Convert PNG image to raw font binary for Apple 1 emulator
#
# Makes lots of assumptions about the input image!
use Compress::Zlib;
# Input image and output data file
my $input = 'font.png';
my $output = 'font.bin';
# Our characters are 6 pixels wide
$chrw = 6;
# Slurp the entire PNG image
open INPUT, "<$input" and binmode INPUT or die "$input: $!\n";
read INPUT, $data='', -s $input;
close INPUT;
# Find and extract the image dimensions
$data =~ /IHDR(.{8})/s;
($w,$h) = unpack "N2", $1;
# Extract and expand the compressed image data
($data) = $data =~ /IDAT(.*).{8}IEND/s;
$data = Compress::Zlib::uncompress($data);
# Remove the type byte from the start of each line
$w_2 = $w/2;
$data =~ s/.(.{$w_2})/$1/sg;
@data = ();
# Unpack the pixel nibbles
foreach (unpack "C*", $data) {
push @data, $_>>4, $_&1;
}
open OUTPUT, ">$output" and binmode OUTPUT or die "$output: $!\n";
# Process all characters
foreach $chr (0..$w/$chrw-1)
{
# Process the image line by line
foreach $y (0..$h-1)
{
# Locate the pixel data for the current character
my $x = $chr*$chrw + $w*$y;
my $b = 0;
# Pack the 1bpp data into a single byte
foreach (@data[$x..$x+$chrw-1]) {
$b = ($b << 1) | $_;
}
# Left-align within the byte and output it
print OUTPUT chr($b << (8-$chrw));
}
}
close OUTPUT;

4
m.bat Normal file → Executable file
View File

@ -1,2 +1,2 @@
pyz80.py -I samdos2 -s length apple1emu.asm
@if %errorlevel%==0 start apple1emu.dsk
pyz80.py -I samdos2 -s length apple1emu.asm
@if %errorlevel%==0 start apple1emu.dsk

View File

@ -1,258 +1,258 @@
; Opcode table positions (auto-generated by opdefs.pl)
op_00: equ &c000 ; +42
op_01: equ &c401 ; +18
op_02: equ &ca02 ; +3
op_03: equ &c103 ; +3
op_04: equ &c304 ; +14
op_05: equ &c205 ; +12
op_06: equ &c706 ; +13
op_07: equ &cb07 ; +9
op_08: equ &c108 ; +23
op_09: equ &ca09 ; +10
op_0a: equ &cc0a ; +7
op_0b: equ &c90b ; +3
op_0c: equ &c50c ; +16
op_0d: equ &c80d ; +13
op_0e: equ &c60e ; +14
op_0f: equ &c90f ; +13
op_10: equ &cd10 ; +8
op_11: equ &c211 ; +22
op_12: equ &c312 ; +20
op_13: equ &c413 ; +3
op_14: equ &ca14 ; +15
op_15: equ &cc15 ; +14
op_16: equ &cb16 ; +15
op_17: equ &ce17 ; +9
op_18: equ &cd18 ; +4
op_19: equ &c719 ; +17
op_1a: equ &c41a ; +4
op_1b: equ &cf1b ; +3
op_1c: equ &c61c ; +17
op_1d: equ &c81d ; +17
op_1e: equ &c41e ; +18
op_1f: equ &cd1f ; +13
op_20: equ &c920 ; +16
op_21: equ &c521 ; +18
op_22: equ &ce22 ; +3
op_23: equ &ca23 ; +3
op_24: equ &c124 ; +27
op_25: equ &cb25 ; +12
op_26: equ &ca26 ; +13
op_27: equ &c327 ; +9
op_28: equ &c228 ; +25
op_29: equ &cc29 ; +10
op_2a: equ &ce2a ; +7
op_2b: equ &c02b ; +3
op_2c: equ &cd2c ; +9
op_2d: equ &c62d ; +13
op_2e: equ &c02e ; +14
op_2f: equ &c72f ; +13
op_30: equ &c830 ; +8
op_31: equ &c331 ; +22
op_32: equ &c432 ; +20
op_33: equ &c933 ; +3
op_34: equ &c534 ; +10
op_35: equ &ca35 ; +14
op_36: equ &c936 ; +15
op_37: equ &cc37 ; +9
op_38: equ &cb38 ; +4
op_39: equ &c839 ; +17
op_3a: equ &c63a ; +4
op_3b: equ &cd3b ; +3
op_3c: equ &cb3c ; +13
op_3d: equ &c73d ; +17
op_3e: equ &c63e ; +18
op_3f: equ &c13f ; +13
op_40: equ &c040 ; +35
op_41: equ &c541 ; +18
op_42: equ &c242 ; +3
op_43: equ &cc43 ; +3
op_44: equ &ca44 ; +3
op_45: equ &c245 ; +12
op_46: equ &c446 ; +13
op_47: equ &ca47 ; +9
op_48: equ &cc48 ; +7
op_49: equ &cb49 ; +10
op_4a: equ &cd4a ; +7
op_4b: equ &c34b ; +3
op_4c: equ &ce4c ; +6
op_4d: equ &c94d ; +13
op_4e: equ &c34e ; +14
op_4f: equ &c84f ; +13
op_50: equ &ca50 ; +10
op_51: equ &c151 ; +22
op_52: equ &c252 ; +20
op_53: equ &c453 ; +3
op_54: equ &c554 ; +3
op_55: equ &c755 ; +14
op_56: equ &c656 ; +15
op_57: equ &cb57 ; +9
op_58: equ &cd58 ; +6
op_59: equ &c559 ; +17
op_5a: equ &cc5a ; +8
op_5b: equ &c95b ; +3
op_5c: equ &c85c ; +3
op_5d: equ &c45d ; +17
op_5e: equ &c35e ; +18
op_5f: equ &c95f ; +13
op_60: equ &ca60 ; +13
op_61: equ &c861 ; +14
op_62: equ &cc62 ; +3
op_63: equ &c063 ; +3
op_64: equ &cb64 ; +8
op_65: equ &cd65 ; +8
op_66: equ &c666 ; +13
op_67: equ &c767 ; +9
op_68: equ &cc68 ; +8
op_69: equ &c069 ; +27
op_6a: equ &ce6a ; +7
op_6b: equ &c16b ; +3
op_6c: equ &c56c ; +10
op_6d: equ &cb6d ; +9
op_6e: equ &c16e ; +14
op_6f: equ &c26f ; +13
op_70: equ &c970 ; +10
op_71: equ &c371 ; +18
op_72: equ &c472 ; +16
op_73: equ &c673 ; +3
op_74: equ &ca74 ; +10
op_75: equ &c775 ; +10
op_76: equ &c676 ; +15
op_77: equ &cc77 ; +9
op_78: equ &cd78 ; +6
op_79: equ &c879 ; +13
op_7a: equ &cb7a ; +9
op_7b: equ &ce7b ; +3
op_7c: equ &c57c ; +15
op_7d: equ &c97d ; +13
op_7e: equ &c27e ; +18
op_7f: equ &ca7f ; +13
op_80: equ &c180 ; +21
op_81: equ &c781 ; +14
op_82: equ &c482 ; +3
op_83: equ &cb83 ; +3
op_84: equ &c384 ; +10
op_85: equ &c485 ; +8
op_86: equ &c086 ; +10
op_87: equ &c887 ; +9
op_88: equ &cc88 ; +6
op_89: equ &cb89 ; +7
op_8a: equ &c98a ; +5
op_8b: equ &cd8b ; +3
op_8c: equ &c58c ; +12
op_8d: equ &c68d ; +10
op_8e: equ &c48e ; +12
op_8f: equ &c38f ; +13
op_90: equ &c990 ; +8
op_91: equ &c091 ; +19
op_92: equ &c292 ; +17
op_93: equ &c793 ; +3
op_94: equ &c894 ; +12
op_95: equ &c195 ; +10
op_96: equ &c796 ; +12
op_97: equ &ca97 ; +9
op_98: equ &c698 ; +5
op_99: equ &c599 ; +14
op_9a: equ &cb9a ; +7
op_9b: equ &cc9b ; +3
op_9c: equ &c99c ; +11
op_9d: equ &c49d ; +14
op_9e: equ &c39e ; +15
op_9f: equ &c69f ; +13
op_a0: equ &caa0 ; +7
op_a1: equ &c1a1 ; +15
op_a2: equ &c8a2 ; +7
op_a3: equ &c7a3 ; +3
op_a4: equ &c0a4 ; +10
op_a5: equ &c2a5 ; +9
op_a6: equ &c7a6 ; +10
op_a7: equ &c5a7 ; +9
op_a8: equ &caa8 ; +5
op_a9: equ &c8a9 ; +6
op_aa: equ &c9aa ; +5
op_ab: equ &cbab ; +3
op_ac: equ &c4ac ; +12
op_ad: equ &c6ad ; +11
op_ae: equ &c3ae ; +12
op_af: equ &c2af ; +13
op_b0: equ &c7b0 ; +8
op_b1: equ &c0b1 ; +20
op_b2: equ &c1b2 ; +18
op_b3: equ &c5b3 ; +3
op_b4: equ &c8b4 ; +12
op_b5: equ &c9b5 ; +11
op_b6: equ &c5b6 ; +12
op_b7: equ &cbb7 ; +9
op_b8: equ &c4b8 ; +6
op_b9: equ &c6b9 ; +15
op_ba: equ &ccba ; +8
op_bb: equ &cabb ; +3
op_bc: equ &c3bc ; +16
op_bd: equ &c7bd ; +15
op_be: equ &c4be ; +16
op_bf: equ &cabf ; +13
op_c0: equ &c9c0 ; +13
op_c1: equ &c2c1 ; +20
op_c2: equ &c8c2 ; +3
op_c3: equ &cbc3 ; +3
op_c4: equ &c5c4 ; +15
op_c5: equ &c8c5 ; +14
op_c6: equ &c0c6 ; +9
op_c7: equ &c1c7 ; +9
op_c8: equ &ccc8 ; +6
op_c9: equ &cbc9 ; +12
op_ca: equ &cdca ; +6
op_cb: equ &cecb ; +3
op_cc: equ &c3cc ; +16
op_cd: equ &c6cd ; +15
op_ce: equ &c9ce ; +11
op_cf: equ &c7cf ; +13
op_d0: equ &ccd0 ; +8
op_d1: equ &c0d1 ; +24
op_d2: equ &c1d2 ; +22
op_d3: equ &c5d3 ; +3
op_d4: equ &c8d4 ; +3
op_d5: equ &c4d5 ; +16
op_d6: equ &c5d6 ; +11
op_d7: equ &cad7 ; +9
op_d8: equ &c8d8 ; +13
op_d9: equ &c2d9 ; +19
op_da: equ &cbda ; +8
op_db: equ &c9db ; +4
op_dc: equ &c7dc ; +3
op_dd: equ &c3dd ; +19
op_de: equ &c6de ; +15
op_df: equ &c9df ; +13
op_e0: equ &cae0 ; +13
op_e1: equ &c7e1 ; +14
op_e2: equ &cce2 ; +3
op_e3: equ &cbe3 ; +3
op_e4: equ &c5e4 ; +15
op_e5: equ &c8e5 ; +8
op_e6: equ &cce6 ; +9
op_e7: equ &cbe7 ; +9
op_e8: equ &c1e8 ; +6
op_e9: equ &c0e9 ; +22
op_ea: equ &c4ea ; +2
op_eb: equ &cdeb ; +3
op_ec: equ &c4ec ; +16
op_ed: equ &c6ed ; +9
op_ee: equ &c8ee ; +11
op_ef: equ &c7ef ; +13
op_f0: equ &caf0 ; +8
op_f1: equ &c1f1 ; +18
op_f2: equ &c2f2 ; +16
op_f3: equ &c3f3 ; +3
op_f4: equ &c5f4 ; +3
op_f5: equ &c9f5 ; +10
op_f6: equ &c3f6 ; +11
op_f7: equ &cbf7 ; +9
op_f8: equ &c6f8 ; +14
op_f9: equ &c8f9 ; +13
op_fa: equ &cafa ; +9
op_fb: equ &c5fb ; +3
op_fc: equ &c4fc ; +3
op_fd: equ &c7fd ; +13
op_fe: equ &c5fe ; +15
op_ff: equ &c4ff ; +13
; Opcode table positions (auto-generated by opdefs.pl)
op_00: equ &c000 ; +42
op_01: equ &c401 ; +18
op_02: equ &ca02 ; +3
op_03: equ &c103 ; +3
op_04: equ &c304 ; +14
op_05: equ &c205 ; +12
op_06: equ &c706 ; +13
op_07: equ &cb07 ; +9
op_08: equ &c108 ; +23
op_09: equ &ca09 ; +10
op_0a: equ &cc0a ; +7
op_0b: equ &c90b ; +3
op_0c: equ &c50c ; +16
op_0d: equ &c80d ; +13
op_0e: equ &c60e ; +14
op_0f: equ &c90f ; +13
op_10: equ &cd10 ; +8
op_11: equ &c211 ; +22
op_12: equ &c312 ; +20
op_13: equ &c413 ; +3
op_14: equ &ca14 ; +15
op_15: equ &cc15 ; +14
op_16: equ &cb16 ; +15
op_17: equ &ce17 ; +9
op_18: equ &cd18 ; +4
op_19: equ &c719 ; +17
op_1a: equ &c41a ; +4
op_1b: equ &cf1b ; +3
op_1c: equ &c61c ; +17
op_1d: equ &c81d ; +17
op_1e: equ &c41e ; +18
op_1f: equ &cd1f ; +13
op_20: equ &c920 ; +16
op_21: equ &c521 ; +18
op_22: equ &ce22 ; +3
op_23: equ &ca23 ; +3
op_24: equ &c124 ; +27
op_25: equ &cb25 ; +12
op_26: equ &ca26 ; +13
op_27: equ &c327 ; +9
op_28: equ &c228 ; +25
op_29: equ &cc29 ; +10
op_2a: equ &ce2a ; +7
op_2b: equ &c02b ; +3
op_2c: equ &cd2c ; +9
op_2d: equ &c62d ; +13
op_2e: equ &c02e ; +14
op_2f: equ &c72f ; +13
op_30: equ &c830 ; +8
op_31: equ &c331 ; +22
op_32: equ &c432 ; +20
op_33: equ &c933 ; +3
op_34: equ &c534 ; +10
op_35: equ &ca35 ; +14
op_36: equ &c936 ; +15
op_37: equ &cc37 ; +9
op_38: equ &cb38 ; +4
op_39: equ &c839 ; +17
op_3a: equ &c63a ; +4
op_3b: equ &cd3b ; +3
op_3c: equ &cb3c ; +13
op_3d: equ &c73d ; +17
op_3e: equ &c63e ; +18
op_3f: equ &c13f ; +13
op_40: equ &c040 ; +35
op_41: equ &c541 ; +18
op_42: equ &c242 ; +3
op_43: equ &cc43 ; +3
op_44: equ &ca44 ; +3
op_45: equ &c245 ; +12
op_46: equ &c446 ; +13
op_47: equ &ca47 ; +9
op_48: equ &cc48 ; +7
op_49: equ &cb49 ; +10
op_4a: equ &cd4a ; +7
op_4b: equ &c34b ; +3
op_4c: equ &ce4c ; +6
op_4d: equ &c94d ; +13
op_4e: equ &c34e ; +14
op_4f: equ &c84f ; +13
op_50: equ &ca50 ; +10
op_51: equ &c151 ; +22
op_52: equ &c252 ; +20
op_53: equ &c453 ; +3
op_54: equ &c554 ; +3
op_55: equ &c755 ; +14
op_56: equ &c656 ; +15
op_57: equ &cb57 ; +9
op_58: equ &cd58 ; +6
op_59: equ &c559 ; +17
op_5a: equ &cc5a ; +8
op_5b: equ &c95b ; +3
op_5c: equ &c85c ; +3
op_5d: equ &c45d ; +17
op_5e: equ &c35e ; +18
op_5f: equ &c95f ; +13
op_60: equ &ca60 ; +13
op_61: equ &c861 ; +14
op_62: equ &cc62 ; +3
op_63: equ &c063 ; +3
op_64: equ &cb64 ; +8
op_65: equ &cd65 ; +8
op_66: equ &c666 ; +13
op_67: equ &c767 ; +9
op_68: equ &cc68 ; +8
op_69: equ &c069 ; +27
op_6a: equ &ce6a ; +7
op_6b: equ &c16b ; +3
op_6c: equ &c56c ; +10
op_6d: equ &cb6d ; +9
op_6e: equ &c16e ; +14
op_6f: equ &c26f ; +13
op_70: equ &c970 ; +10
op_71: equ &c371 ; +18
op_72: equ &c472 ; +16
op_73: equ &c673 ; +3
op_74: equ &ca74 ; +10
op_75: equ &c775 ; +10
op_76: equ &c676 ; +15
op_77: equ &cc77 ; +9
op_78: equ &cd78 ; +6
op_79: equ &c879 ; +13
op_7a: equ &cb7a ; +9
op_7b: equ &ce7b ; +3
op_7c: equ &c57c ; +15
op_7d: equ &c97d ; +13
op_7e: equ &c27e ; +18
op_7f: equ &ca7f ; +13
op_80: equ &c180 ; +21
op_81: equ &c781 ; +14
op_82: equ &c482 ; +3
op_83: equ &cb83 ; +3
op_84: equ &c384 ; +10
op_85: equ &c485 ; +8
op_86: equ &c086 ; +10
op_87: equ &c887 ; +9
op_88: equ &cc88 ; +6
op_89: equ &cb89 ; +7
op_8a: equ &c98a ; +5
op_8b: equ &cd8b ; +3
op_8c: equ &c58c ; +12
op_8d: equ &c68d ; +10
op_8e: equ &c48e ; +12
op_8f: equ &c38f ; +13
op_90: equ &c990 ; +8
op_91: equ &c091 ; +19
op_92: equ &c292 ; +17
op_93: equ &c793 ; +3
op_94: equ &c894 ; +12
op_95: equ &c195 ; +10
op_96: equ &c796 ; +12
op_97: equ &ca97 ; +9
op_98: equ &c698 ; +5
op_99: equ &c599 ; +14
op_9a: equ &cb9a ; +7
op_9b: equ &cc9b ; +3
op_9c: equ &c99c ; +11
op_9d: equ &c49d ; +14
op_9e: equ &c39e ; +15
op_9f: equ &c69f ; +13
op_a0: equ &caa0 ; +7
op_a1: equ &c1a1 ; +15
op_a2: equ &c8a2 ; +7
op_a3: equ &c7a3 ; +3
op_a4: equ &c0a4 ; +10
op_a5: equ &c2a5 ; +9
op_a6: equ &c7a6 ; +10
op_a7: equ &c5a7 ; +9
op_a8: equ &caa8 ; +5
op_a9: equ &c8a9 ; +6
op_aa: equ &c9aa ; +5
op_ab: equ &cbab ; +3
op_ac: equ &c4ac ; +12
op_ad: equ &c6ad ; +11
op_ae: equ &c3ae ; +12
op_af: equ &c2af ; +13
op_b0: equ &c7b0 ; +8
op_b1: equ &c0b1 ; +20
op_b2: equ &c1b2 ; +18
op_b3: equ &c5b3 ; +3
op_b4: equ &c8b4 ; +12
op_b5: equ &c9b5 ; +11
op_b6: equ &c5b6 ; +12
op_b7: equ &cbb7 ; +9
op_b8: equ &c4b8 ; +6
op_b9: equ &c6b9 ; +15
op_ba: equ &ccba ; +8
op_bb: equ &cabb ; +3
op_bc: equ &c3bc ; +16
op_bd: equ &c7bd ; +15
op_be: equ &c4be ; +16
op_bf: equ &cabf ; +13
op_c0: equ &c9c0 ; +13
op_c1: equ &c2c1 ; +20
op_c2: equ &c8c2 ; +3
op_c3: equ &cbc3 ; +3
op_c4: equ &c5c4 ; +15
op_c5: equ &c8c5 ; +14
op_c6: equ &c0c6 ; +9
op_c7: equ &c1c7 ; +9
op_c8: equ &ccc8 ; +6
op_c9: equ &cbc9 ; +12
op_ca: equ &cdca ; +6
op_cb: equ &cecb ; +3
op_cc: equ &c3cc ; +16
op_cd: equ &c6cd ; +15
op_ce: equ &c9ce ; +11
op_cf: equ &c7cf ; +13
op_d0: equ &ccd0 ; +8
op_d1: equ &c0d1 ; +24
op_d2: equ &c1d2 ; +22
op_d3: equ &c5d3 ; +3
op_d4: equ &c8d4 ; +3
op_d5: equ &c4d5 ; +16
op_d6: equ &c5d6 ; +11
op_d7: equ &cad7 ; +9
op_d8: equ &c8d8 ; +13
op_d9: equ &c2d9 ; +19
op_da: equ &cbda ; +8
op_db: equ &c9db ; +4
op_dc: equ &c7dc ; +3
op_dd: equ &c3dd ; +19
op_de: equ &c6de ; +15
op_df: equ &c9df ; +13
op_e0: equ &cae0 ; +13
op_e1: equ &c7e1 ; +14
op_e2: equ &cce2 ; +3
op_e3: equ &cbe3 ; +3
op_e4: equ &c5e4 ; +15
op_e5: equ &c8e5 ; +8
op_e6: equ &cce6 ; +9
op_e7: equ &cbe7 ; +9
op_e8: equ &c1e8 ; +6
op_e9: equ &c0e9 ; +22
op_ea: equ &c4ea ; +2
op_eb: equ &cdeb ; +3
op_ec: equ &c4ec ; +16
op_ed: equ &c6ed ; +9
op_ee: equ &c8ee ; +11
op_ef: equ &c7ef ; +13
op_f0: equ &caf0 ; +8
op_f1: equ &c1f1 ; +18
op_f2: equ &c2f2 ; +16
op_f3: equ &c3f3 ; +3
op_f4: equ &c5f4 ; +3
op_f5: equ &c9f5 ; +10
op_f6: equ &c3f6 ; +11
op_f7: equ &cbf7 ; +9
op_f8: equ &c6f8 ; +14
op_f9: equ &c8f9 ; +13
op_fa: equ &cafa ; +9
op_fb: equ &c5fb ; +3
op_fc: equ &c4fc ; +3
op_fd: equ &c7fd ; +13
op_fe: equ &c5fe ; +15
op_ff: equ &c4ff ; +13

170
opdefs.pl
View File

@ -1,85 +1,85 @@
#!/usr/bin/perl -w
#
# Calculates opcode addresses for the inline instruction decoding table
#
# Used by the Apple 1 emulator, available from:
#
# http://simonowen.com/sam/apple1emu/
$source = 'apple1emu.asm';
$codeend = 0xd000;
# Assemble, outputting the symbols containing opcode implementation lengths
$_ = `pyz80.py -s op_.*_len $source`;
# Create include file for definitions
my $outfile = 'opdefs.inc';
open(FILE, ">$outfile") or die "$!";
print FILE "; Opcode table positions (auto-generated by opdefs.pl)\n\n";
# Assembly failed?
if ($?)
{
# Create dummy offset list to allow lengths to be calculated
for (0..255) {
printf FILE "op_%02x: equ &%04x\n", $_, $codeend-0x1000;
}
print "Assembly error, creating dummy definitions!\n";
exit;
}
# Create hash from opcode to length
while (/OP_(..)_LEN': (\d+)/g) {
$len{hex $1} = $2;
}
# Position in order of size, largest first
@todo = reverse sort { $len{$a} <=> $len{$b} } keys %len;
my($size,$used) = (0,0);
OPCODE:
foreach $op (@todo)
{
MSB:
# Work up through MSB values until we find a space
for ($msb = 0 ; ; $msb++)
{
# Determine the extent of the opcode in the current MSB
my $start = ($msb << 8) | $op;
my $end = $start + $len{$op}-1;
# Check against what we've already positioned
foreach (keys %off)
{
# Determine extent of existing item
my $start2 = $off{$_};
my $end2 = $start2 + $len{$_}-1;
# Reject MSB if new position would overlap
next MSB unless ($start > $end2 || $end < $start2);
}
# Assign to the free spot we've found
$off{$op} = $start;
# Update size stats
$used += $len{$op};
if ($end > $size) { $size = $end; }
next OPCODE;
}
}
# Position base so code finishes at the required point
$base = $codeend - (($size + 0xff) & ~0xff);
print "Size = $size, used = $used, slack = ", $size-$used, "\n";
# Output sorted list of calculated positions
foreach (sort { $a <=> $b } @todo) {
printf FILE "op_%02x: equ &%04x ; +$len{$_}\n", $_, $base+$off{$_};
}
close FILE;
#!/usr/bin/perl -w
#
# Calculates opcode addresses for the inline instruction decoding table
#
# Used by the Apple 1 emulator, available from:
#
# http://simonowen.com/sam/apple1emu/
$source = 'apple1emu.asm';
$codeend = 0xd000;
# Assemble, outputting the symbols containing opcode implementation lengths
$_ = `pyz80.py -s op_.*_len $source`;
# Create include file for definitions
my $outfile = 'opdefs.inc';
open(FILE, ">$outfile") or die "$!";
print FILE "; Opcode table positions (auto-generated by opdefs.pl)\n\n";
# Assembly failed?
if ($?)
{
# Create dummy offset list to allow lengths to be calculated
for (0..255) {
printf FILE "op_%02x: equ &%04x\n", $_, $codeend-0x1000;
}
print "Assembly error, creating dummy definitions!\n";
exit;
}
# Create hash from opcode to length
while (/OP_(..)_LEN': (\d+)/g) {
$len{hex $1} = $2;
}
# Position in order of size, largest first
@todo = reverse sort { $len{$a} <=> $len{$b} } keys %len;
my($size,$used) = (0,0);
OPCODE:
foreach $op (@todo)
{
MSB:
# Work up through MSB values until we find a space
for ($msb = 0 ; ; $msb++)
{
# Determine the extent of the opcode in the current MSB
my $start = ($msb << 8) | $op;
my $end = $start + $len{$op}-1;
# Check against what we've already positioned
foreach (keys %off)
{
# Determine extent of existing item
my $start2 = $off{$_};
my $end2 = $start2 + $len{$_}-1;
# Reject MSB if new position would overlap
next MSB unless ($start > $end2 || $end < $start2);
}
# Assign to the free spot we've found
$off{$op} = $start;
# Update size stats
$used += $len{$op};
if ($end > $size) { $size = $end; }
next OPCODE;
}
}
# Position base so code finishes at the required point
$base = $codeend - (($size + 0xff) & ~0xff);
print "Size = $size, used = $used, slack = ", $size-$used, "\n";
# Output sorted list of calculated positions
foreach (sort { $a <=> $b } @todo) {
printf FILE "op_%02x: equ &%04x ; +$len{$_}\n", $_, $base+$off{$_};
}
close FILE;

7088
opimpl.inc

File diff suppressed because it is too large Load Diff