cartridge ram & rom banking

This commit is contained in:
Piotr Jaczewski 2020-07-29 11:12:19 +02:00
parent 65605db9b6
commit dc5ad5f3ac
10 changed files with 218 additions and 207 deletions

35
address_decoder.jed Normal file
View File

@ -0,0 +1,35 @@

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-22-120
*
NOTE PINS RW:2 PHI:3 A9:4 A8:5 A7:6 A6:7 A5:8 A4:9 A3:10 A2: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
0111111111111111111111101110111011011110
0101111111111111111111111111111111011110
0101111111111111111111111111111111101101*
L0640
1111111111111111111111111111111111111111
1110011111111111111111011110111011011110
1110011111111111111111111111111111101101
1110011111111111111111111111110111011110
1110011111111111111111111101111011011110*
L2560
10000000*
L2632
11111111*
L2640
1100000011110000111110000000000000000000000000000000000000000000*
L2704
01*
C3073*
0000

73
address_decoder.log Normal file
View File

@ -0,0 +1,73 @@
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 RW pos,com input
3 PHI pos,com input
4 A9 pos,com input
5 A8 pos,com input
6 A7 pos,com input
7 A6 pos,com input
8 A5 pos,com input
9 A4 pos,com input
10 A3 pos,com input
11 A2 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
18 A11 pos,com input
19 A10 pos,com input
20 RAM 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/8 (62.5%)
No of feedbacks used as dedicated outputs : 3/8 (37.5%)
------------------------------------------
Pin Label Terms Usage
------------------------------------------
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 4/7 (57.1%)
------------------------------------------
Total Terms 11/64 (17.2%)
------------------------------------------
EQN2JED - Boolean Equations to JEDEC file assembler (Version V101)
Copyright (c) National Semiconductor Corporation 1990-1993
Chip diagram (DIP)
._____ _____.
| \__/ |
CLK | 1 24 | VCC
RW | 2 23 | BANK
PHI | 3 22 | FF
A9 | 4 21 | ROM
A8 | 5 20 | RAM
A7 | 6 19 | A10
A6 | 7 18 | A11
A5 | 8 17 | A12
A4 | 9 16 | A13
A3 | 10 15 | A14
A2 | 11 14 | A15
GND | 12 13 | /OE
|______________|

15
addressdecoder.eqn Normal file
View File

@ -0,0 +1,15 @@
chip GAL20V8
NC=1 RW=2 PHI=3 A2=11 A3=10 A4=9 A5=8 A6=7 A7=6 A8=5 A9=4 A10=19 GND=12
A11=18 A12=17 A13=16 A14=15 A15=14 RAM=20 ROM=21 FF=22 BANK=23 VCC=24
equations
/ROM = /A15 * A14 * /A13 * /A12 * /A11 * RW
+ /A15 * A14 * RW * BANK
+ A15 * /A14 * RW * BANK
/RAM = /A15 * A14 * /A13 * /A12 * A11 * /BANK * PHI
+ A15 * /A14 * /BANK * PHI
+ /A15 * A14 * A13 * /BANK * PHI
+ /A15 * A14 * /A13 * A12 * /BANK * PHI
FF = A2 * A3 * A4 * A5 * A6 * A7 * A8 * A9 * A10 * /A11 * /A12 * /A13 * A14 * /RW * PHI

View File

@ -1,4 +1,3 @@
#!/bin/sh
xa -W -C -v -O ASCII -c src/cartridge.xa -l cartridge.label -o cartridge.bin
xa -W -C -v -O ASCII -c src/cartridge_applesoft.xa -l cartridge_applesoft.label -o cartridge_applesoft.bin

View File

@ -5,6 +5,10 @@
#define kbd_data $D010
#define kbd_cr $D011
; cartridge bank control constants
#define rom_bank $47FF
#define ram_bank $47FE
; zero page variables
; content copy variables
@ -34,6 +38,10 @@
start
; enable rom bank
sta rom_bank
; print entries and get option
jsr print_entries
jsr get_option
@ -150,6 +158,9 @@ load_program
lda (dest_addr),Y
sta jmp_addr+1
; enable ram bank to make jmp
sta ram_bank
jmp (jmp_addr)
skip_entry
@ -182,11 +193,19 @@ init_copy
sta copy_counter
sta copy_counter+1
copy
; load byte from rom into ram
; load byte from rom
ldy #$00
lda (src_addr),Y
; enable ram bank
stx ram_bank
; store byte to ram
sta (dest_addr),Y
; enable rom bank
stx rom_bank
; increment source address
ldx #src_addr
jsr increment_16bit
@ -218,6 +237,7 @@ increment_copy_counter
;;; load-end
;;; printing
print_entries
; print welcome string
lda #<welcome_str
@ -475,5 +495,5 @@ add_to_addr_done
welcome_str .byt $15,$0D,"AVAILABLE OPTIONS:",$0D,$0D
choose_str .byt $0F,$0D,"CHOOSE OPTION:"
rom_content
loader_end
#include "src/rom_content.xa"

View File

@ -1,135 +0,0 @@
; zero page variables
; content copy variables
#define dest_addr $30
#define src_addr $32
#define src_len $34
#define copy_counter $36
; entries scanning variables
#define entries_scan_addr $43
; jmp addr variable
#define jmp_addr $47
* = $4000
;;; load-start
load_entry
; init entries scan addr
lda #<rom_content
sta entries_scan_addr
lda #>rom_content
sta entries_scan_addr+1
load_segment
; load segment length
ldy #$00
lda (entries_scan_addr),Y
sta src_len
ldx #entries_scan_addr
jsr increment_16bit
lda (entries_scan_addr),Y
sta src_len+1
; load dest addr
ldx #entries_scan_addr
jsr increment_16bit
lda (entries_scan_addr),Y
sta dest_addr
ldx #entries_scan_addr
jsr increment_16bit
lda (entries_scan_addr),Y
sta dest_addr+1
; load source addr
ldx #entries_scan_addr
jsr increment_16bit
lda (entries_scan_addr),Y
sta src_addr
ldx #entries_scan_addr
jsr increment_16bit
lda (entries_scan_addr),Y
sta src_addr+1
; copy segment from source to destination
jsr init_copy
load_program
ldx #entries_scan_addr
jsr increment_16bit
; load entry jump address
lda entries_scan_addr
sta dest_addr
lda entries_scan_addr+1
sta dest_addr+1
ldy #$00
lda (dest_addr),Y
sta jmp_addr
iny
lda (dest_addr),Y
sta jmp_addr+1
jmp (jmp_addr)
init_copy
lda #$00
sta copy_counter
sta copy_counter+1
copy
; load byte from rom into ram
ldy #$00
lda (src_addr),Y
sta (dest_addr),Y
; increment source address
ldx #src_addr
jsr increment_16bit
; increment destination address
ldx #dest_addr
jsr increment_16bit
; compare counter lower byte with source length lower byte
; if not equal increment counter
lda src_len
cmp copy_counter
bne increment_copy_counter
; compare counter upper byte with content length upper byte
; if not equal increment counter
lda src_len+1
cmp copy_counter+1
bne increment_copy_counter
rts
increment_copy_counter
ldx #copy_counter
jsr increment_16bit
jmp copy
;;; load-end
;;; tools
increment_16bit
inc $00,X
bne increment_16bit_done
inx
inc $00,X
increment_16bit_done
rts
;;; tools-end
rom_content
#include "src/rom_applesoft.xa"

View File

@ -1,7 +0,0 @@
applesoft
applesoft_len .word $1F65
applesoft_addr .word $6000
applesoft_cont_start .word applesoft_cont
applesoft_jmp_addr .word $6000
applesoft_cont .bin 0,8037,"inc/applesoft.bin"

View File

@ -1,2 +1,73 @@
;#include "src/rom_content1.xa"
#include "src/rom_content2.xa"
* = $4800
.dsb (*-loader_end), $FF
* = $4800
rom_content = $4800
number_of_entries .byt $05
basic
basic_seg .byt $01
basic_len .word $1000
basic_addr .word $e000
basic_cont_start .word basic_cont
basic_str .byt $0D,"INTEGER BASIC"
basic_jmp_addr .word $e000
apple30th
apple30th_seg .byt $01
apple30th_len .word $0D80
apple30th_addr .word $0280
apple30th_cont_start .word apple30th_cont
apple30th_str .byt $13,"APPLE 30TH BIRTHDAY"
apple30th_jmp_addr .word $0280
/* 00: <start_low_byte> <start_high_byte> <end_low_byte> <end_high_byte> */
/* test address expected actual */
/*
0 - All zeros - each byte of memory is verified that a 0x00 value can be written and read
1 - All ones - each byte of memory is verified that a 0xff value can be written and read
2 - Floating ones - eight passes, starting with 0x01 and moving the 1 bit to left each succeeding pass
0x02 0x04 0x08 0x10 0x20 0x40 0x80
3 - Floating zeros - eight passes, starting with 0x7f and shifting the 0 bit to the right each succeeding pass
0xBF 0xDF 0xEF 0xF7 0xFB 0xFD 0xFE
4 - Address in Address 1 - one pass with low eight bits of the locations address is written to that location
if this fails, you have a problem with one of the low eight address lines (this is pretty unlikely to fail,
since you need these address lines in order to load and run this program)
5 - Address in Address 2 - one pass with high eight bits of the locations address written to that location
if this fails, you have a problem with one of the eight high address lines
*/
memorytest
memorytest_seg .byt $02
memorytest_1_len .word $0010
memorytest_1_addr .word $0000
memorytest_1_cont_start .word memorytest_cont
memorytest_2_len .word $0122
memorytest_2_addr .word $0280
memorytest_2_cont_start .word memorytest_cont+16
memorytest_str .byt $10,"MEMORY TEST 280R"
memorytest_jmp_addr .word $FF1F
/* 44: <low_byte> <high_byte> */
disassembler
disassembler_seg .byt $01
disassembler_1_len .word $0200
disassembler_1_addr .word $0800
disassembler_1_cont_start .word disassembler_cont
disassembler_str .byt $11,"DISASSEMBLER 800R"
disassembler_jmp_addr .word $FF1F
applesoft
applesoft_seg .byt $01
applesoft_len .word $1F65
applesoft_addr .word $6000
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"

View File

@ -1,20 +0,0 @@
number_of_entries .byt $02
basic
basic_seg .byt $01
basic_1_len .word $1000
basic_1_addr .word $e000
basic_1_cont_start .word basic_cont
basic_str .byt $05,"BASIC"
basic_jmp_addr .word $e000
apple30th
apple30th_seg .byt $01
apple30th_len .word $0D80
apple30th_addr .word $0280
apple30th_cont_start .word apple30th_cont
apple30th_str .byt $13,"APPLE 30TH BIRTHDAY"
apple30th_jmp_addr .word $0280
basic_cont .bin 0,4096,"inc/basic.bin"
apple30th_cont .bin 0,3456,"inc/apple30th.bin"

View File

@ -1,40 +0,0 @@
number_of_entries .byt $02
/* 00: <start_low_byte> <start_high_byte> <end_low_byte> <end_high_byte> */
/* test address expected actual */
/*
0 - All zeros - each byte of memory is verified that a 0x00 value can be written and read
1 - All ones - each byte of memory is verified that a 0xff value can be written and read
2 - Floating ones - eight passes, starting with 0x01 and moving the 1 bit to left each succeeding pass
0x02 0x04 0x08 0x10 0x20 0x40 0x80
3 - Floating zeros - eight passes, starting with 0x7f and shifting the 0 bit to the right each succeeding pass
0xBF 0xDF 0xEF 0xF7 0xFB 0xFD 0xFE
4 - Address in Address 1 - one pass with low eight bits of the locations address is written to that location
if this fails, you have a problem with one of the low eight address lines (this is pretty unlikely to fail,
since you need these address lines in order to load and run this program)
5 - Address in Address 2 - one pass with high eight bits of the locations address written to that location
if this fails, you have a problem with one of the eight high address lines
*/
memorytest
memorytest_seg .byt $02
memorytest_1_len .word $0010
memorytest_1_addr .word $0000
memorytest_1_cont_start .word memorytest_cont
memorytest_2_len .word $0122
memorytest_2_addr .word $0280
memorytest_2_cont_start .word memorytest_cont+16
memorytest_str .byt $10,"MEMORY TEST 280R"
memorytest_jmp_addr .word $FF1F
/* 44: <low_byte> <high_byte> */
disassembler
disassembler_seg .byt $01
disassembler_1_len .word $0200
disassembler_1_addr .word $0800
disassembler_1_cont_start .word disassembler_cont
disassembler_str .byt $11,"DISASSEMBLER 800R"
disassembler_jmp_addr .word $FF1F
memorytest_cont .bin 0,306,"inc/a1mt.bin"
disassembler_cont .bin 0,512,"inc/disassembler.bin"