News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

CPR and Interrupt Mode

Started by Jelonertz, 23:04, 06 March 22

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jelonertz

Hi,
I've seen in several places that when you're programming for the PLUS series, the most common place to place your code is &0000 (i.e: https://cpctech.cpc-live.com/source/cart.asm). I supposed that you should use IM2 in order to move the interruption handler out of the first bank (38H for IM1), since you're placing your code there, but I see that IM1 is still used. Is that the right way to do it, or should I use IM2 instead? 
What are the minimum requirements for a CPR to run? Today I add the ROM, BASIC and Firmware, then another 16KB with my code (which I place at &8000, btw), and then the data for my program (graphics, and so on), and it works, but maybe I'm not doing it the right way...

Thank you!

andycadley

The minimum requirement for a cart to run is that it contains code in the lower ROM (i.e. cart bank 0) since that is what will be paged in when you first start the machine and code will execute from address 0.

Whether you want to use IM1 or IM2 is entirely up to you. Obviously if you're going to page out (or move) the lower ROM then you'll need to make sure you place a suitable interrupt handler in RAM as well (or in whatever other ROM you page into that address).

The original design of the Plus hardware was clearly geared towards using IM2 with auto vectorisation as it's primary interrupt style, but the implementation is buggy and so was dropped from the official docs (though you can kind of use it if you work around the bugs). The ability to move the lower ROM so that it won't page over the lower part of the address space means that you can fairly effectively use IM1 without worrying about paging implications, if you structure your memory map accordingly.

FWIW you don't need the BASIC ROM or Firmware at all if you're writing cart software.

roudoudou


as a cartridge will boot on lower ROM and upper ROM (rom 0 in #0000 AND in #C000), the first thing to keep in mind is to disable interrupts 

or put some EI:RET in #38 of the ROM
My pronouns are RASM and ACE

andycadley

The Z80 starts up with interrupts disabled, so it shouldn't actually be a problem unless you specifically enable them without configuring a suitable handler.

Powered by SMFPacks Menu Editor Mod