Difference between revisions of "Modules/system/Usage"
From MSX Game Library
(Created page with "Some examples: <syntaxhighlight lang="c"> Sys_StopClickSound(); // Stop keyboard "click" sound DisableInterrupt(); // Code you don't want to be interrupted EnableInterrupt();...") |
|||
Line 3: | Line 3: | ||
Sys_StopClickSound(); // Stop keyboard "click" sound | Sys_StopClickSound(); // Stop keyboard "click" sound | ||
− | DisableInterrupt(); | + | DisableInterrupt(); // Disable interruption. ISR will not been called event is interruption signal is set |
// Code you don't want to be interrupted | // Code you don't want to be interrupted | ||
− | EnableInterrupt(); | + | EnableInterrupt(); // Restore interruption |
while(1) | while(1) | ||
Line 17: | Line 17: | ||
<syntaxhighlight lang="c"> | <syntaxhighlight lang="c"> | ||
u8 prevSeg = GET_BANK_SEGMENT(3); // Backup previous segment number in bank #3 (for mapper ROM) | u8 prevSeg = GET_BANK_SEGMENT(3); // Backup previous segment number in bank #3 (for mapper ROM) | ||
− | SET_BANK_SEGMENT(3, 10); // Set segment #10 in bank #3 | + | SET_BANK_SEGMENT(3, 10); // Set segment #10 in bank #3 |
// Here you can access to segment #10 data at addresses A000~BFFFh | // Here you can access to segment #10 data at addresses A000~BFFFh | ||
− | SET_BANK_SEGMENT(3, prevSeg); // Restore the previous segment number in bank #3 | + | SET_BANK_SEGMENT(3, prevSeg); // Restore the previous segment number in bank #3 |
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 21:10, 7 January 2024
Some examples:
Sys_StopClickSound(); // Stop keyboard "click" sound DisableInterrupt(); // Disable interruption. ISR will not been called event is interruption signal is set // Code you don't want to be interrupted EnableInterrupt(); // Restore interruption while(1) { Halt(); // Wait for signal (should be screen synchronization) // Code to be synchronized at 50/60 Hz }
Example for mapped ROM (for a 8K mapper):
u8 prevSeg = GET_BANK_SEGMENT(3); // Backup previous segment number in bank #3 (for mapper ROM) SET_BANK_SEGMENT(3, 10); // Set segment #10 in bank #3 // Here you can access to segment #10 data at addresses A000~BFFFh SET_BANK_SEGMENT(3, prevSeg); // Restore the previous segment number in bank #3