O.S. SWAPPING DURING THE VBI ---------------------------- By TML Last month I was working on a music demo and I hadn't enough RAM to use. I was also working on the last game of ANG: "Simple Minds". (You should get this game! Your editor is in it with a nice picture). Anyway, for this game I needed almost all RAM for main routines, pictures and musix. I could put some pictures in the OS RAM area, but I should disable interrupts when I needed a new picture. Not so nice idea, because the music should play the same time... Flits! An idea! I should copy the music and player into the RAM/OS area and disable the OS during the VBI... Is it possible. I talked to Freddy about the subject. 'Hmmm... maybe... Hmmm... maybe not...' was his answer. I took my MAC65 and made some simple routines to test this idea. Yes! Eureka! An interrupt routine in the OS/RAM area! Finaly I took the Chaos composer, made some stupid musix, wrote it to disk, wrote the player to disk, replaced the load headers, wrote a copy routine to copy the music to $C000 and wrote the interrupt routine. Getting nervous, loading, running.... MUSIC!!! So, in the future we can switch off the Operating System in the main loop (you have to disable interrupts!) or we can switch off the OS in an interrupt! I prefer the last option. I haven't tested it in other interrupts, but it should work. What can you put in the RAM area? Simple: -Music player -Music data -Main VBI routine -Color data -Sinus tables -etc. An example: LDA #7 ;INIT VBI ROUTINE LDY #>VBI LDX #>VBI JSR $E45C DO JMP DO ; VBI LDA #$FE ;OS 'OFF' STA $D301 JSR $C000 ;RAM AREA INC $D301 JMP $E45C This small VBI takes 23 bytes of the available normal RAM, the main VBI may be 14 kilobytes and you still have all normal OS routines. Copy the main VBI routines including all data to $C000 - $FFFF. Activate this routine and see... Don't forget to assemble your main VBI into right ram area and replace the loadheaders or re-write the loadroutines. I did this in the game Simple Minds. I wrote a sector reader and a half page copier. So, I needed 128 bytes RAM ($400-$47F) as buffer and 6 zero page pointers to copy the code into the right ram area. Switch off the OS before the copyroutine and switch it on at the end of the copyroutine. Write your routines to the right sectors on disk and ready! On side B of this magazine you will find a small package with some music, comfiles and MAC65 sources. DUMMY .COM : A runable example In the OSSWAP.LZH archieve.... OSSWAP .M65 : The source in MAC/65 LORIEN1 .CMC : Music data LORIEN1 .REP : Music player Play with it and let me (Megazine) know if you have any other ideas to this 'new' idea. The Missing Link.