MASKING NOT MASKABLES! ---------------------- Or, how to use the NMI! The ATARI 8-bit computer has a quite good designed ROM package which makes using DLI's and VBI's very easy. As you know there are several vectors which can be changed so they'll point to your own routine. For example $200 and $201 is the lo/hi pointer to a DLI routine. Watch diz: $200,$201 : DLI vector $222,$223 : VBI immediate $224,$225 : VBI deferred This are just some of the most used vectors. There are also some timer vectors which counters are updated by the ROM routines. Then there are some routines which can be used to set these pointers. Many guys use $E45C to initialize the VBI vectors. In fact that's the best way to do it! If you directly store values in the $222...$225 addresses, it could cause trouble! This is probably the problem in the BIG demo, the digi sample menu. If you didn't noticed there is a bug in that screen, mostly while selecting the 'Heavy guitar' sample the computer will lock up! So always use that $E45C routine! (U2 LOD!) Well, were was I? Oh yes, this was the easy part. You know, the part were everybody thinks 'What a craptalk, I already know that!'. Did you ever switched off the OS of your 8-bitter? You probably started with a routine which copied ROM into RAM, switched off the ROM and copied the RAM (which was ROM!) back, but this time under ROM! With other words; copies the ROM under ROM (where it's RAM) and use this RAM as the ROM package! (WHAT?) After that you can (for example) load a new font directly into $E000. But why copy the ROM!? We don't need to have stored the temporary colours into their hardware addresses and we also don't need a cassette or printer handler! So we just leave the RAM underneath ROM empty? Yes! That's possible! Only if you don't use the NMI and IRQ. For example if you wanna play samples. Be sure you always switch off the IRQ and NMI first! This is done by clearing $D20E (IRQ enable) and $D40E (NMI enable). So this way you've got 14K RAM extra to store your samples (Note: $D000...$D7FF is always ROM). All these lame tricks are very old and you probably know them already right? But if you want that extra 14K RAM but still need to use VBI's and DLI's!? Yeah, there we are.... then we should enable the NMI again. Wait! How can we use the NMI when the NMI routines aren't available? Just make our own NMI routines ofcourse you jerk! Oh shut up you clothless sheep! Hmm, I think my brain is getting double sided again.. please wait.. (scratch scratch, waggle waggle).. Yeah, I'm back again. Are you readers still there? Let's explain something about the NMI now (finally). But first here are the greetinx.. greetinx to: WFMH, OUR 5OFT.. (just a bad joke) The NMI vector is located at $FFFA, $FFFB (lo/hi), so this vector must point to our own shitty routine. Do that after you switch off your ROM (you know, putting $FE in $D301), but be sure you've cleared the NMI enable ($D40E) and the IRQ enable ($D20E) first! If the NMI vector is set you can turn the NMI enable back on again ($C0 in $D40E?). Before I go on I should tell you that DLI and VBI vectors doesn't really exist for the computer hardware. They are just invented by the maker of the 8-bit OS (Operating Shit). If you don't use DLI's in your screen than it's easy. Always store everything you use on the stack (I mean Accu, X and Y). If you only use the accumulator you just have to do a PHA as first instruction of your NMI and a PLA as the last. The very last instruction is ofcourse an RTI because you must return from the interrupt (hence the name haha). But this isn't all you have to do! You should always clear the NMI status ($D40F). This is easy. Let me show you a short program: NMI STA NMIST ($D40F) > your VBI routine < RTI When using DLI's and VBI's you have to check the NMI status because you wanna know if it was a DLI or a VBI which was generated by the NMI. So here's a example of a DLI/VBI NMI: NMI BIT $D40F BPL VBI DLI > your DLI routine < RTI VBI > your VBI routine < RTI That's all! If you don't understand any of this you can always read 'Mapping the ATARI' and look at the NMI vector yourself! You will see that the NMI will normally point to a routine in ROM where it generates a VBI or a DLI depending on $D40F! Also keep in mind that you have to do everything yourself if you use your own NMI, so always use the hardware addresses instead of the shadow registers! Hardware addresses who not going to changed during the program can be initialized. For example, if you always use a black screen you just put a zero in $D018 at the beginning of the program and that's all! People with a ROM switch can simply test if a program uses ROM or RAM by switching between the operating systems while the program is still running. If it locks up then they use ROM. Otherwise you can even remove the OS ROM chips while the program keeps running. However I never tried this. The reset vector is located at $FFFC, $FFFD (lo/hi), but it seems that the reset button can not be trapped by changing this vector. If reset is pressed, the computer generates a chip reset and I think that's why it's impossible to really trap the reset button. I'm talking about trapping reset in a way that pressing reset won't even result in a flickering on the screen. A few times I got into the situation that my computer locked up and pressing reset was like pressing any of the other console keys. So, if anybody knows how to 'really' trap reset then contact me! (write to MEGA magazine) -Frankenstein-