diff --git a/.gitignore b/.gitignore index d124c9a..ad7a9d7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -cartridge*.bin +*.bin *.label diff --git a/a1monitor2bin.py b/a1monitor2bin.py index 293a447..2fabe65 100644 --- a/a1monitor2bin.py +++ b/a1monitor2bin.py @@ -21,7 +21,7 @@ if __name__ == "__main__": line = file.readline() for x in byte_data: - sys.stdout.write(x) + sys.stdout.buffer.write(x) # to visually compare # paste apple30th.txt <(hexdump -e '"%08.8_Ax\n"' -e '"%08.8_ax " 8/1 " %02x"' -e '"\n"' apple30th.bin) diff --git a/address_decoder.jed b/address_decoder.jed deleted file mode 100644 index 12bb559..0000000 --- a/address_decoder.jed +++ /dev/null @@ -1,37 +0,0 @@ - -GAL20V8 -EQN2JED - Boolean Equations to JEDEC file assembler (Version V101) -Copyright (c) National Semiconductor Corporation 1990-1993 -Assembled from "c:/APPLE1~2/ADDRES~1.EQN". Date: 7-23-120 -* -NOTE PINS RW:2 PHI:3 MOD:4 A9:5 A8:6 A7:7 A6:8 A5:9 A4:10 A3:11* -NOTE PINS GND:12 A15:14 A14:15 A13:16 A12:17 A11:18 A10:19 RAM:20* -NOTE PINS ROM:21 FF:22 BANK:23 VCC:24* -NOTE GALMODE REGISTERED* -QF2706*QP24*F0* -L0000 -1111111111111111111111111111111111111111 -1011011101110111010101100110011001010111* -L0320 -1111111111111111111111111111111111111111 -0111111101111111111111101110111011011110 -0101111101111111111111111111111111011110 -0101111101111111111111111111111111101101* -L0640 -1111111111111111111111111111111111111111 -1110011101111111111111011110111011011110 -1110011101111111111111111111111111101101 -1110011101111111111111111111110111011110 -1110011101111111111111111101111011011110 -1111011110111111111111111111111111011110 -1111011110111111111111111111111111101101* -L2560 -10000000* -L2632 -11111111* -L2640 -1100000011110000111111100000000000000000000000000000000000000000* -L2704 -01* -C39D2* -0000 diff --git a/bas2bin.py b/bas2bin.py new file mode 100644 index 0000000..52454a3 --- /dev/null +++ b/bas2bin.py @@ -0,0 +1,48 @@ +import codecs +import binascii +import sys + +if __name__ == "__main__": + + byte_data = list() + + if len(sys.argv) != 2: + print('Usage: python bas2bin.py ') + exit(1) + + with open(sys.argv[1], 'r') as file: + line_counter = 0 + line = file.readline() + while line: + + if line_counter not in [0, 1]: + bytes_arr = line.strip().split(' ') + if len(bytes_arr) >= 3: + try: + bytes_str_arr = bytes_arr[1].strip().split() + bytes_arr[2].strip().split() + for x in bytes_str_arr: + byte_data.append(codecs.decode(x, 'hex')) + except binascii.Error: + break + + line_counter += 1 + line = file.readline() + + # delete CFFA bytes + del byte_data[256:512] + del byte_data[0:74] + + def output_filename(input_file_name, mem_arr): + output_name = input_file_name + if input_file_name.endswith('.txt'): + output_name = output_name[0:-4] + + output_name = output_name + '-' + mem_arr[1].hex() + mem_arr[0].hex() + '-' + mem_arr[3].hex() + mem_arr[2].hex() + '.bin' + return output_name.lower() + + with open(output_filename(sys.argv[1], byte_data[0:4]), 'wb') as output: + for x in byte_data: + output.write(x) + +# to visually compare +# paste apple30th.txt <(hexdump -e '"%08.8_Ax\n"' -e '"%08.8_ax " 8/1 " %02x"' -e '"\n"' apple30th.bin) diff --git a/addressdecoder.eqn b/mapping/address_decoder.eqn similarity index 79% rename from addressdecoder.eqn rename to mapping/address_decoder.eqn index 85cd81d..3116d2a 100644 --- a/addressdecoder.eqn +++ b/mapping/address_decoder.eqn @@ -1,7 +1,7 @@ chip GAL20V8 -NC=1 RW=2 PHI=3 MOD=4 A3=11 A4=10 A5=9 A6=8 A7=7 A8=6 A9=5 A10=19 GND=12 -A11=18 A12=17 A13=16 A14=15 A15=14 RAM=20 ROM=21 FF=22 BANK=23 VCC=24 +NC=1 PHI=2 RW=3 MOD=4 A3=11 A4=10 A5=9 A6=8 A7=7 A8=6 A9=5 A10=19 GND=12 +A11=18 A12=17 A13=16 A14=15 A15=14 ROM=20 RAM=21 FF=22 BANK=23 VCC=24 equations diff --git a/mapping/address_decoder.jed b/mapping/address_decoder.jed new file mode 100644 index 0000000..5407873 --- /dev/null +++ b/mapping/address_decoder.jed @@ -0,0 +1,37 @@ + +GAL20V8 +EQN2JED - Boolean Equations to JEDEC file assembler (Version V101) +Copyright (c) National Semiconductor Corporation 1990-1993 +Assembled from "d:/ADDRES~1.EQN". Date: 9-29-120 +* +NOTE PINS PHI:2 RW:3 MOD:4 A9:5 A8:6 A7:7 A6:8 A5:9 A4:10 A3:11* +NOTE PINS GND:12 A15:14 A14:15 A13:16 A12:17 A11:18 A10:19 ROM:20* +NOTE PINS RAM:21 FF:22 BANK:23 VCC:24* +NOTE GALMODE REGISTERED* +QF2706*QP24*F0* +L0000 +1111111111111111111111111111111111111111 +0111101101110111010101100110011001010111* +L0320 +1111111111111111111111111111111111111111 +0110111101111111111111011110111011011110 +0110111101111111111111111111111111101101 +0110111101111111111111111111110111011110 +0110111101111111111111111101111011011110 +0111111110111111111111111111111111011110 +0111111110111111111111111111111111101101* +L0640 +1111111111111111111111111111111111111111 +1111011101111111111111101110111011011110 +1101011101111111111111111111111111011110 +1101011101111111111111111111111111101101* +L2560 +10000000* +L2632 +11111111* +L2640 +1100000011111110111100000000000000000000000000000000000000000000* +L2704 +01* +C39F0* +0000 diff --git a/address_decoder.log b/mapping/address_decoder.log similarity index 79% rename from address_decoder.log rename to mapping/address_decoder.log index 71079a0..e8fcebb 100644 --- a/address_decoder.log +++ b/mapping/address_decoder.log @@ -1,13 +1,13 @@ EQN2JED - Boolean Equations to JEDEC file assembler (Version V101) Copyright (c) National Semiconductor Corporation 1990-1993 -Log file for c:/APPLE1~2/ADDRES~1.EQN +Log file for d:/ADDRES~1.EQN Device: 20V8 Pin Label Type --- ----- ---- -2 RW pos,com input -3 PHI pos,com input +2 PHI pos,com input +3 RW pos,com input 4 MOD pos,com input 5 A9 pos,com input 6 A8 pos,com input @@ -23,8 +23,8 @@ Pin Label Type 17 A12 pos,com input 18 A11 pos,com input 19 A10 pos,com input -20 RAM neg,trst,com output -21 ROM neg,trst,com output +20 ROM neg,trst,com output +21 RAM neg,trst,com output 22 FF pos,trst,com output 23 BANK pos,com input 24 VCC power pin @@ -43,10 +43,10 @@ No of feedbacks used as dedicated outputs : 3/8 (37.5%) ------------------------------------------ 22 FF.oe 1/1 (100.0%) 22 FF 1/7 (14.3%) - 21 ROM.oe 1/1 (100.0%) - 21 ROM 3/7 (42.9%) - 20 RAM.oe 1/1 (100.0%) - 20 RAM 6/7 (85.7%) + 21 RAM.oe 1/1 (100.0%) + 21 RAM 6/7 (85.7%) + 20 ROM.oe 1/1 (100.0%) + 20 ROM 3/7 (42.9%) ------------------------------------------ Total Terms 13/64 (20.3%) ------------------------------------------ @@ -59,10 +59,10 @@ Copyright (c) National Semiconductor Corporation 1990-1993 ._____ _____. | \__/ | CLK | 1 24 | VCC - RW | 2 23 | BANK - PHI | 3 22 | FF - MOD | 4 21 | ROM - A9 | 5 20 | RAM + PHI | 2 23 | BANK + RW | 3 22 | FF + MOD | 4 21 | RAM + A9 | 5 20 | ROM A8 | 6 19 | A10 A7 | 7 18 | A11 A6 | 8 17 | A12 diff --git a/mapping/address_decoder_onlyram.eqn b/mapping/address_decoder_onlyram.eqn new file mode 100644 index 0000000..d5b78fd --- /dev/null +++ b/mapping/address_decoder_onlyram.eqn @@ -0,0 +1,9 @@ +chip GAL20V8 + +NC=1 PHI=2 GND=12 A12=17 A13=16 A14=15 A15=14 RAM=21 VCC=24 + +equations + +/RAM = /A15 * /A14 * /A13 * A12 * PHI + + /A15 * /A14 * A13 * /A12 * PHI + + /A15 * /A14 * A13 * A12 * PHI diff --git a/mapping/address_decoder_onlyram.jed b/mapping/address_decoder_onlyram.jed new file mode 100644 index 0000000..e8e8869 --- /dev/null +++ b/mapping/address_decoder_onlyram.jed @@ -0,0 +1,21 @@ + +GAL20V8 +EQN2JED - Boolean Equations to JEDEC file assembler (Version V101) +Copyright (c) National Semiconductor Corporation 1990-1993 +Assembled from "c:/APPLE1~2/ADDRES~1.EQN". Date: 11-10-120 +* +NOTE PINS PHI:2 GND:12 A15:14 A14:15 A13:16 A12:17 RAM:21 VCC:24* +NOTE GALMODE SMALL* +QF2706*QP24*F0* +L0320 +0111111111111111111111011110111011101111 +0111111111111111111111101101111011101111 +0111111111111111111111011101111011101111* +L2632 +00000111* +L2640 +0000000011100000000000000000000000000000000000000000000000000000* +L2704 +10* +C0D2E* +0000 diff --git a/mapping/address_decoder_onlyram.log b/mapping/address_decoder_onlyram.log new file mode 100644 index 0000000..5212630 --- /dev/null +++ b/mapping/address_decoder_onlyram.log @@ -0,0 +1,53 @@ +EQN2JED - Boolean Equations to JEDEC file assembler (Version V101) +Copyright (c) National Semiconductor Corporation 1990-1993 + +Log file for c:/APPLE1~2/ADDRES~1.EQN +Device: 20V8 + +Pin Label Type +--- ----- ---- +2 PHI pos,com input +12 GND ground pin +14 A15 pos,com input +15 A14 pos,com input +16 A13 pos,com input +17 A12 pos,com input +21 RAM neg,com output +24 VCC power pin + + EQN2JED - Boolean Equations to JEDEC file assembler (Version V101) +Copyright (c) National Semiconductor Corporation 1990-1993 + +Device Utilization: + +No of dedicated inputs used : 5/14 (35.7%) +No of dedicated outputs used : 1/2 (50.0%) + + ------------------------------------------ + Pin Label Terms Usage + ------------------------------------------ + 21 RAM 3/8 (37.5%) + ------------------------------------------ + Total Terms 3/64 (4.7%) + ------------------------------------------ + + EQN2JED - Boolean Equations to JEDEC file assembler (Version V101) +Copyright (c) National Semiconductor Corporation 1990-1993 + + Chip diagram (DIP) + + ._____ _____. + | \__/ | + | 1 24 | VCC + PHI | 2 23 | + | 3 22 | + | 4 21 | RAM + | 5 20 | + | 6 19 | + | 7 18 | + | 8 17 | A12 + | 9 16 | A13 + | 10 15 | A14 + | 11 14 | A15 + GND | 12 13 | + |______________| diff --git a/mapping/address_decoder_v2.eqn b/mapping/address_decoder_v2.eqn new file mode 100644 index 0000000..ad369fd --- /dev/null +++ b/mapping/address_decoder_v2.eqn @@ -0,0 +1,20 @@ +chip GAL22V10 + +NC=1 PHI=2 RW=3 MOD=4 A3=11 A4=10 A5=9 A6=8 A7=7 A8=6 A9=5 A10=18 GND=12 +A11=17 A12=16 A13=14 A14=15 A15=13 RAM2=19 RAM1=20 ROM=21 FF=22 BANK=23 VCC=24 + +equations + +/ROM = /A15 * A14 * /A13 * /A12 * /A11 * RW * MOD + + /A15 * A14 * RW * BANK * MOD + + A15 * /A14 * RW * BANK * MOD +/RAM1 = /A15 * /A14 * /A13 * A12 * PHI + + /A15 * /A14 * A13 * /A12 * PHI + + /A15 * /A14 * A13 * A12 * PHI +/RAM2 = /A15 * A14 * /A13 * /A12 * A11 * /BANK * PHI * MOD + + A15 * /A14 * /BANK * PHI * MOD + + /A15 * A14 * A13 * /BANK * PHI * MOD + + /A15 * A14 * /A13 * A12 * /BANK * PHI * MOD + + /A15 * A14 * PHI * /MOD + + A15 * /A14 * PHI * /MOD +FF = A3 * A4 * A5 * A6 * A7 * A8 * A9 * A10 * /A11 * /A12 * /A13 * A14 * /RW * PHI * MOD diff --git a/mapping/address_decoder_v2.jed b/mapping/address_decoder_v2.jed new file mode 100644 index 0000000..d097df9 --- /dev/null +++ b/mapping/address_decoder_v2.jed @@ -0,0 +1,35 @@ + +GAL22V10 +EQN2JED - Boolean Equations to JEDEC file assembler (Version V101) +Copyright (c) National Semiconductor Corporation 1990-1993 +Assembled from "d:\ADDRES~6.EQN". Date: 12-13-120 +* +NOTE PINS PHI:2 RW:3 MOD:4 A9:5 A8:6 A7:7 A6:8 A5:9 A4:10 A3:11* +NOTE PINS GND:12 A15:13 A13:14 A14:15 A12:16 A11:17 A10:18 RAM2:19* +NOTE PINS RAM1:20 ROM:21 FF:22 BANK:23 VCC:24* +QF5828*QP24*F0* +L0440 +11111111111111111111111111111111111111111111 +11110111101101110111010101100110010101100111* +L0924 +11111111111111111111111111111111111111111111 +11111111011101111111111111101110110111101110 +11011111011101111111111111111111110111111110 +11011111011101111111111111111111111011111101* +L1496 +11111111111111111111111111111111111111111111 +11110111111111111111111111111101111011101110 +11110111111111111111111111111110111011011110 +11110111111111111111111111111101111011011110* +L2156 +11111111111111111111111111111111111111111111 +11100111111101111111111111011110110111101110 +11100111111101111111111111111111111011111101 +11100111111101111111111111111111110111011110 +11100111111101111111111111111101110111101110 +11110111111110111111111111111111110111111110 +11110111111110111111111111111111111011111101* +L5808 +01110101010101010101* +C5334* +0000 diff --git a/mapping/address_decoder_v2.log b/mapping/address_decoder_v2.log new file mode 100644 index 0000000..1b2b9ea --- /dev/null +++ b/mapping/address_decoder_v2.log @@ -0,0 +1,76 @@ +EQN2JED - Boolean Equations to JEDEC file assembler (Version V101) +Copyright (c) National Semiconductor Corporation 1990-1993 + +Log file for d:\ADDRES~6.EQN +Device: G22V10 + +Pin Label Type +--- ----- ---- +2 PHI pos,com input +3 RW pos,com input +4 MOD pos,com input +5 A9 pos,com input +6 A8 pos,com input +7 A7 pos,com input +8 A6 pos,com input +9 A5 pos,com input +10 A4 pos,com input +11 A3 pos,com input +12 GND ground pin +13 A15 pos,com input +14 A13 pos,com input +15 A14 pos,com input +16 A12 pos,com input +17 A11 pos,com input +18 A10 pos,com input +19 RAM2 neg,trst,com output +20 RAM1 neg,trst,com output +21 ROM neg,trst,com output +22 FF pos,trst,com output +23 BANK pos,com input +24 VCC power pin + + EQN2JED - Boolean Equations to JEDEC file assembler (Version V101) +Copyright (c) National Semiconductor Corporation 1990-1993 + +Device Utilization: + +No of dedicated inputs used : 12/12 (100.0%) +No of feedbacks used as dedicated inputs : 5/10 (50.0%) +No of feedbacks used as dedicated outputs : 4/10 (40.0%) + + ------------------------------------------ + Pin Label Terms Usage + ------------------------------------------ + 22 FF.oe 1/1 (100.0%) + 22 FF 1/10 (10.0%) + 21 ROM.oe 1/1 (100.0%) + 21 ROM 3/12 (25.0%) + 20 RAM1.oe 1/1 (100.0%) + 20 RAM1 3/14 (21.4%) + 19 RAM2.oe 1/1 (100.0%) + 19 RAM2 6/16 (37.5%) + ------------------------------------------ + Total Terms 17/132 (12.9%) + ------------------------------------------ + + EQN2JED - Boolean Equations to JEDEC file assembler (Version V101) +Copyright (c) National Semiconductor Corporation 1990-1993 + + Chip diagram (DIP) + + ._____ _____. + | \__/ | + CLK | 1 24 | VCC + PHI | 2 23 | BANK + RW | 3 22 | FF + MOD | 4 21 | ROM + A9 | 5 20 | RAM1 + A8 | 6 19 | RAM2 + A7 | 7 18 | A10 + A6 | 8 17 | A11 + A5 | 9 16 | A12 + A4 | 10 15 | A14 + A3 | 11 14 | A13 + GND | 12 13 | A15 + |______________| diff --git a/src/rom_content.xa b/src/rom_content.xa index a8d8376..b10f2aa 100644 --- a/src/rom_content.xa +++ b/src/rom_content.xa @@ -4,7 +4,7 @@ * = $4800 rom_content = $4800 -number_of_entries .byt $05 +number_of_entries .byt $06 /* How to store INTEGER BASIC programs? @@ -74,8 +74,23 @@ applesoft_cont_start .word applesoft_cont applesoft_str .byt $15,"APPLESOFT BASIC 6000R" applesoft_jmp_addr .word $6000 -basic_cont .bin 0,4096,"inc/basic.bin" -apple30th_cont .bin 0,3456,"inc/apple30th.bin" -memorytest_cont .bin 0,306,"inc/a1mt.bin" -disassembler_cont .bin 0,512,"inc/disassembler.bin" -applesoft_cont .bin 0,8037,"inc/applesoft.bin" +matrix +matrix_seg .byt $03 +matrix_1_len .word $1000 +matrix_1_addr .word $E000 +matrix_1_cont_start .word basic_cont +matrix_2_len .word $00B6 +matrix_2_addr .word $004A +matrix_2_cont_start .word matrix_cont +matrix_3_len .word $0800 +matrix_3_addr .word $0800 +matrix_3_cont_start .word matrix_cont+$B6 +matrix_str .byt $0E,"MATRIX (BASIC)" +matrix_jmp_addr .word $E2B3 + +basic_cont .bin 0,0,"inc/basic.bin" +apple30th_cont .bin 0,0,"inc/apple30th.bin" +memorytest_cont .bin 0,0,"inc/a1mt.bin" +disassembler_cont .bin 0,0,"inc/disassembler.bin" +applesoft_cont .bin 0,0,"inc/applesoft.bin" +matrix_cont .bin 0,0,"inc/basic/matrix-0800-1000.bin"