Difference between revisions of "Build tool/InstallRAMISR"

From MSX Game Library

< Build tool

 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[Build tool]] option '''InstallRAMISR''' is used to automatically select RAM in page 0 then copy data there at startup, so ROM cartridge can take advantage of (almost) 16 KB of additional RAM.
 
[[Build tool]] option '''InstallRAMISR''' is used to automatically select RAM in page 0 then copy data there at startup, so ROM cartridge can take advantage of (almost) 16 KB of additional RAM.
 +
 +
This option requires MSX to have at least 64 KB of RAM (otherwise, no RAM will be available on page 0). So only some MSX1 may be compatible but all the MSX2, MSX2+ and MSX turbo R are.
  
 
As page 0 (addresses 0x0000-0x3FFF) is the place where MSX will search for interruption handler (ISR), the build tool will automatically copy the selected ISR (see [[Build tool/CustomISR|CustomISR]] option).
 
As page 0 (addresses 0x0000-0x3FFF) is the place where MSX will search for interruption handler (ISR), the build tool will automatically copy the selected ISR (see [[Build tool/CustomISR|CustomISR]] option).
Line 7: Line 9:
 
* <tt>RAM0_ISR</tt>: Switch page 0 to RAM then install ISR at 0x0038 (mandatory address)
 
* <tt>RAM0_ISR</tt>: Switch page 0 to RAM then install ISR at 0x0038 (mandatory address)
 
* <tt>RAM0_SEGMENT</tt>: Switch page 0 to RAM, install ISR at 0x0038 , then copy segment data at 0x0100 (for mapped-ROM)
 
* <tt>RAM0_SEGMENT</tt>: Switch page 0 to RAM, install ISR at 0x0038 , then copy segment data at 0x0100 (for mapped-ROM)
 +
 +
== RAM0_ISR ==
 +
When using <tt>RAM0_ISR</tt> option, you have additional RAM of be used from 0x0100 to 0x3FFF.
 +
You can use SDCC's <tt>__at()</tt> directive to place variable in the memory space.
  
 
== RAM0_SEGMENT ==
 
== RAM0_SEGMENT ==
When using <tt>RAM0_SEGMENT</tt> option, you can define a source code file named <tt>{projectName}_p0.c</tt> (or .asm) and it will be automatically added to your mapper data and copy at statup in page 0.
+
When using <tt>RAM0_SEGMENT</tt> option, you have to define a source code file named <tt>{projectName}_p0.c</tt> (or <tt>.asm</tt> or <tt>.s</tt> to add assembler source) and it will be automatically added to your mapper data and copy at statup in page 0.
 
Code and data from your <tt>_p0</tt> file will be available starting from address 0x0100 (after the ISR) so you have a little less than 16 KB available in page 0 (16 KB - 0x100 = 16128 bytes).
 
Code and data from your <tt>_p0</tt> file will be available starting from address 0x0100 (after the ISR) so you have a little less than 16 KB available in page 0 (16 KB - 0x100 = 16128 bytes).
  
<tt>_p0</tt> will be place in segment after your main program. Segment number depend of the mapper format your are using:
+
<tt>_p0</tt> will be place in segment after the 32 KB of your main program. Segment number depend of the mapper format your are using:
 
{| class="wikitable"
 
{| class="wikitable"
 
! Mapper !! Segments
 
! Mapper !! Segments
Line 30: Line 36:
  
 
When you use this option, these segments are reserved for code and data to be copied on page 0 and cannot be used for anything else.
 
When you use this option, these segments are reserved for code and data to be copied on page 0 and cannot be used for anything else.
 +
 +
[[Samples#Software_Sprite|s_swsprt]] sample (software sprite) showcase the use of this option.

Latest revision as of 23:17, 3 December 2024

Build tool option InstallRAMISR is used to automatically select RAM in page 0 then copy data there at startup, so ROM cartridge can take advantage of (almost) 16 KB of additional RAM.

This option requires MSX to have at least 64 KB of RAM (otherwise, no RAM will be available on page 0). So only some MSX1 may be compatible but all the MSX2, MSX2+ and MSX turbo R are.

As page 0 (addresses 0x0000-0x3FFF) is the place where MSX will search for interruption handler (ISR), the build tool will automatically copy the selected ISR (see CustomISR option).

InstallRAMISR can take 3 values:

  • RAM0_NONE: Don't switch page 0 to RAM
  • RAM0_ISR: Switch page 0 to RAM then install ISR at 0x0038 (mandatory address)
  • RAM0_SEGMENT: Switch page 0 to RAM, install ISR at 0x0038 , then copy segment data at 0x0100 (for mapped-ROM)

RAM0_ISR

When using RAM0_ISR option, you have additional RAM of be used from 0x0100 to 0x3FFF. You can use SDCC's __at() directive to place variable in the memory space.

RAM0_SEGMENT

When using RAM0_SEGMENT option, you have to define a source code file named {projectName}_p0.c (or .asm or .s to add assembler source) and it will be automatically added to your mapper data and copy at statup in page 0. Code and data from your _p0 file will be available starting from address 0x0100 (after the ISR) so you have a little less than 16 KB available in page 0 (16 KB - 0x100 = 16128 bytes).

_p0 will be place in segment after the 32 KB of your main program. Segment number depend of the mapper format your are using:

Mapper Segments
ASCII-8 #4 and #5
ASCII-16 #2
KONAMI K4 #4 and #5
KONAMI K5 (SCC) #4 and #5
NEO-8 #6 and #7
NEO-16 #3

When you use this option, these segments are reserved for code and data to be copied on page 0 and cannot be used for anything else.

s_swsprt sample (software sprite) showcase the use of this option.