Difference between revisions of "ASCII-EX mapper"
From MSX Game Library
(Created page with "Here's a proposal for a mapper format operating with a 16-bit segment register and allowing ROMs of 512 MB (8 KB segment) or 1 GB (16 KB segment). The idea is to use the ASCI...") |
|||
(62 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | Here's a proposal for a mapper format operating with a 16-bit segment register and allowing ROMs of | + | Here's a proposal for a mapper format operating with a 16-bit segment register and allowing ROMs larger than the 2/4 MB limit of classic mappers. |
− | + | == Principles == | |
− | == | + | The idea is to extend the ASCII mapper format using a 16-bit segment register so we could build hardware capable of running standard ASCII8/16 ROMs in addition to the new 16-bit format. |
+ | |||
+ | The lower byte of 16-bit register is mapped to even address of bank switch memory space while higher byte is mapped to odd ones. | ||
+ | This means that older programs, which use the default even addresses (like 6000h), will be able to use this new mapper as if it had an 8-bit register (the low byte of the 16-bit register). | ||
+ | |||
+ | For the time being, we propose to reserve the 4 most significant bits for future extensions for the format (such as SRAM or sound chips support for example). | ||
+ | This leaves 12 bits to select which segment is visible in each bank, for a maximum of 4096 segments. | ||
+ | The reserved bits, must be set to 0. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | !colspan="8"| Higher byte | ||
+ | | | ||
+ | !colspan="8"| Lower byte | ||
+ | |- | ||
+ | ! 15 || 14 || 13 || 12 || 11 || 10 || 9 || 8 | ||
+ | | | ||
+ | ! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 | ||
+ | |- | ||
+ | | 0 || 0 || 0 || 0 | ||
+ | |colspan="4"| Segment MSB | ||
+ | | | ||
+ | |colspan="8"| Segment LSB | ||
+ | |} | ||
+ | |||
+ | The maximum ROM size is therefore 32 MB (for 8 KB segments) or 64 MB (for 16 KB segments). | ||
+ | |||
+ | Detection by emulators should be fairly easy (counting ROM write accesses). | ||
+ | |||
+ | == Format == | ||
+ | |||
+ | Below, the parts in blue are the only additions to the standard ASCII8/16 format. | ||
+ | |||
+ | === ASCII-EX16 mapper === | ||
{| class="wikitable" | {| class="wikitable" | ||
! Bank (16kB) !! Switching address !! Initial segment | ! Bank (16kB) !! Switching address !! Initial segment | ||
|- | |- | ||
− | | 4000h~7FFFh (mirror: C000h~FFFFh) || | + | | 0: 4000h~7FFFh (mirror: C000h~FFFFh) || 6000h {{COLOR|blue|(mirror: even address up to 67FEh)}} || 0000h |
|- | |- | ||
− | | 8000h~BFFFh (mirror: 0000h~3FFFh) || | + | | 1: 8000h~BFFFh (mirror: 0000h~3FFFh) || 7000h {{COLOR|blue|(mirror: even address up to 77FEh)}} || 0000h |
|} | |} | ||
− | == | + | * Maximum number of segments: 4096 |
+ | * Maximum ROM size: 64 MB | ||
+ | |||
+ | === ASCII-EX8 mapper === | ||
{| class="wikitable" | {| class="wikitable" | ||
! Bank (8kB) !! Switching address !! Initial segment | ! Bank (8kB) !! Switching address !! Initial segment | ||
|- | |- | ||
− | | 4000h~5FFFh (mirror: C000h~DFFFh) || | + | | 0: 4000h~5FFFh (mirror: C000h~DFFFh) || 6000h {{COLOR|blue|(mirror: even address up to 67FEh)}} || 0000h |
|- | |- | ||
− | | 6000h~7FFFh (mirror: E000h~FFFFh) || | + | | 1: 6000h~7FFFh (mirror: E000h~FFFFh) || 6800h {{COLOR|blue|(mirror: even address up to 6FFEh)}} || 0000h |
|- | |- | ||
− | | 8000h~9FFFh (mirror: 0000h~1FFFh) || | + | | 2: 8000h~9FFFh (mirror: 0000h~1FFFh) || 7000h {{COLOR|blue|(mirror: even address up to 77FEh)}} || 0000h |
|- | |- | ||
− | | A000h~BFFFh (mirror: 2000h~3FFFh) || | + | | 3: A000h~BFFFh (mirror: 2000h~3FFFh) || 7800h {{COLOR|blue|(mirror: even address up to 7FFEh)}} || 0000h |
|} | |} | ||
+ | |||
+ | * Maximum number of segments: 4096 | ||
+ | * Maximum ROM size: 32 MB | ||
+ | |||
+ | == Appendix == | ||
+ | |||
+ | === Bank switching cost === | ||
+ | The cost of switching only the lower or higher byte of the 16-bit segment register is the same that switching segment for standard ASCII mappers. | ||
+ | |||
+ | ; Direct access | ||
+ | LD A,n ; 8 t-states | ||
+ | LD (nn),A ; 14 t-states | ||
+ | |||
+ | ; Indirect access | ||
+ | LD HL,nn ; 11 t-states | ||
+ | LD (HL),n ; 11 t-states | ||
+ | |||
+ | Although a program can avoid having to change the 2 bytes of the segment register at once, there are cases where this may be necessary. In such cases, the cost is higher, but remains reasonable. | ||
+ | |||
+ | ; Direct access | ||
+ | LD HL,nn ; 11 t-states | ||
+ | LD (nn),HL ; 17 t-states | ||
+ | |||
+ | ; Indirect access | ||
+ | LD DE,nn ; 11 t-states | ||
+ | LD HL,nn ; 11 t-states | ||
+ | LD (HL),E ; 8 t-states | ||
+ | INC HL ; 7 t-states | ||
+ | LD (HL),D ; 8 t-states | ||
+ | |||
+ | === Naming === | ||
+ | If the ASCII-EX (extended ASCII) name poses any legal issue, we could simply called those mappers EX8 and EX16. | ||
+ | |||
+ | === MSXgl === | ||
+ | |||
+ | MSXgl uses macros to encapsulate bank switching mechanisms. It would therefore be totally transparent for a user to switch, for example, from an ASCII8 or even Konami-SCC mapper, to an ASCII-EX8 mapper. | ||
+ | |||
+ | #define SET_BANK_SEGMENT(bank, segment) /* ... */ | ||
+ | |||
+ | // Make segment #30 visible through bank #1 | ||
+ | SET_BANK_SEGMENT(1, 30); | ||
+ | |||
+ | [[Category:Proposal]][[Category:Proposal/Mapper]] |
Latest revision as of 00:07, 12 December 2023
Here's a proposal for a mapper format operating with a 16-bit segment register and allowing ROMs larger than the 2/4 MB limit of classic mappers.
Contents
Principles
The idea is to extend the ASCII mapper format using a 16-bit segment register so we could build hardware capable of running standard ASCII8/16 ROMs in addition to the new 16-bit format.
The lower byte of 16-bit register is mapped to even address of bank switch memory space while higher byte is mapped to odd ones. This means that older programs, which use the default even addresses (like 6000h), will be able to use this new mapper as if it had an 8-bit register (the low byte of the 16-bit register).
For the time being, we propose to reserve the 4 most significant bits for future extensions for the format (such as SRAM or sound chips support for example). This leaves 12 bits to select which segment is visible in each bank, for a maximum of 4096 segments. The reserved bits, must be set to 0.
Higher byte | Lower byte | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | |
0 | 0 | 0 | 0 | Segment MSB | Segment LSB |
The maximum ROM size is therefore 32 MB (for 8 KB segments) or 64 MB (for 16 KB segments).
Detection by emulators should be fairly easy (counting ROM write accesses).
Format
Below, the parts in blue are the only additions to the standard ASCII8/16 format.
ASCII-EX16 mapper
Bank (16kB) | Switching address | Initial segment |
---|---|---|
0: 4000h~7FFFh (mirror: C000h~FFFFh) | 6000h (mirror: even address up to 67FEh) | 0000h |
1: 8000h~BFFFh (mirror: 0000h~3FFFh) | 7000h (mirror: even address up to 77FEh) | 0000h |
- Maximum number of segments: 4096
- Maximum ROM size: 64 MB
ASCII-EX8 mapper
Bank (8kB) | Switching address | Initial segment |
---|---|---|
0: 4000h~5FFFh (mirror: C000h~DFFFh) | 6000h (mirror: even address up to 67FEh) | 0000h |
1: 6000h~7FFFh (mirror: E000h~FFFFh) | 6800h (mirror: even address up to 6FFEh) | 0000h |
2: 8000h~9FFFh (mirror: 0000h~1FFFh) | 7000h (mirror: even address up to 77FEh) | 0000h |
3: A000h~BFFFh (mirror: 2000h~3FFFh) | 7800h (mirror: even address up to 7FFEh) | 0000h |
- Maximum number of segments: 4096
- Maximum ROM size: 32 MB
Appendix
Bank switching cost
The cost of switching only the lower or higher byte of the 16-bit segment register is the same that switching segment for standard ASCII mappers.
; Direct access LD A,n ; 8 t-states LD (nn),A ; 14 t-states ; Indirect access LD HL,nn ; 11 t-states LD (HL),n ; 11 t-states
Although a program can avoid having to change the 2 bytes of the segment register at once, there are cases where this may be necessary. In such cases, the cost is higher, but remains reasonable.
; Direct access LD HL,nn ; 11 t-states LD (nn),HL ; 17 t-states ; Indirect access LD DE,nn ; 11 t-states LD HL,nn ; 11 t-states LD (HL),E ; 8 t-states INC HL ; 7 t-states LD (HL),D ; 8 t-states
Naming
If the ASCII-EX (extended ASCII) name poses any legal issue, we could simply called those mappers EX8 and EX16.
MSXgl
MSXgl uses macros to encapsulate bank switching mechanisms. It would therefore be totally transparent for a user to switch, for example, from an ASCII8 or even Konami-SCC mapper, to an ASCII-EX8 mapper.
#define SET_BANK_SEGMENT(bank, segment) /* ... */ // Make segment #30 visible through bank #1 SET_BANK_SEGMENT(1, 30);