| www.retrosoftware.co.uk http://www.retrosoftware.co.uk/forum/ |
|
| Programming the Master - using the extra memory. http://www.retrosoftware.co.uk/forum/viewtopic.php?f=73&t=477 |
Page 1 of 1 |
| Author: | PitfallJ [ Sun May 16, 2010 4:27 pm ] |
| Post subject: | Programming the Master - using the extra memory. |
So how do you get at the Masters extra memory? Is there a call to page in the ram and what address does it appear at? Could you setup a 16 colour 320 mode? The Master manual sort of suggests that if you start a video mode with the mode number+128 then it appears in 'shadow ram' - so I guess that means you get an extra 20K from $3000-$8000 for your program - but then how do you page in the shadow ram to poke the sprites onto the screen - does it appear at a different address? Also as the master has a whopping 128K how do you access all the rest of that ram? Thanks for any help. - PJ |
|
| Author: | TomW [ Sun May 16, 2010 9:00 pm ] |
| Post subject: | Re: Programming the Master - using the extra memory. |
PitfallJ wrote: So how do you get at the Masters extra memory? Is there a call to page in the ram and what address does it appear at? You have several chunks of RAM on the Master : 0000-7FFF - Normal RAM 3000-7FFF - Shadow RAM 8000-BFFF - Sideways RAM (4 banks - 4,5,6 and 7) 8000-8FFF - VDU workspace C000-DFFF - FS workspace Sideways RAM can be got at via &FE30, just like sideways ROMs. Shadow RAM can be used via the OS, by setting screen modes 128-135. However the screen can then only be got at by the OS VDU routines, and you're probably better off accessing it directly. The relevant registers are : Code: Rom Select Register (ROMSEL) at &FE30 b7 b6 b5 b4 b3 b2 b1 b0 RAM 0 0 0 PM3 PM2 PM1 PM0 RAM (bit 7) : 1 - Map 4K MOS Ram into &8000-&8FFF PM0-PM3 : Determine sideways rom/ram paged in. Access Control Register (ACCCON) at &FE34 b7 b6 b5 b4 b3 b2 b1 b0 IRR TST IFJ ITU Y X E D IRR (bit 7) : 1 - Cause an IRQ to the CPU TST (bit 6) : 0 at all times IFJ (bit 5) : 1 - &FC00-FDFF directed to cartridge 0 - &FC00-FDFF directed to 1Mhz bus ITU (bit 4) : 1 - CPU can access internal co-pro 0 - CPU can access external co-pro Y (bit 3) : 1 - &C000-DFFF 8K Private ram 0 - &C000-DFFF VDU driver code (MOS) X (bit 2) : 1 - 20K Shadow ram at &3000-7FFF 0 - Main ram at &3000-7FFF E (bit 1) : 1 - Causes either the main or shadow RAM to be accessed in locations 3000-7FFF depending on the current operation. RAM in the main map is accessed in all cases except when the address of the current operation code lies in the range C000-DFFF, ie within the MOS VDU code. 0 - All accesses to locations 3000-7FFF are directed to the RAM in the main map. D (bit 0) : 1 - Causes the shadow ram to be displayed by the CRT 0 - Causes the main memory to be displayed by the CRT Quote: Could you setup a 16 colour 320 mode? No, the video hardware isn't capable of it. Even if it was, a 40k frame buffer would be impossible normally as the limit is 32k, and if you could work around that you'd have the strangest memory map ever seen. |
|
| Author: | PitfallJ [ Sun May 16, 2010 9:53 pm ] |
| Post subject: | Re: Programming the Master - using the extra memory. |
Hi Tom. Thanks for the info - simple! So I get 4 extra pages of 16K at $8000-$BFFF like: LDA #BANK_INDEX STA ROMSEL Does the Master 512 just have more banks? It sounds like if your screen drawing code is in memory at <$3000 or >$8000 you could use the video shadow ram with your own program as well - I'll have to give it a try. As for the 16 color 320 mode - what if you set up a smaller screen - like 256x192 - that would only take 24K and fit in memory ok. I'd be interested if anyone has any example code for setting up 'custom' sized screens - the main problem I'm finding with writing BBC programs is that I'm always running out of ram - I can see why a lot of commercial games cut down the screen size now. - PJ |
|
| Author: | TomW [ Sun May 16, 2010 10:34 pm ] |
| Post subject: | Re: Programming the Master - using the extra memory. |
PitfallJ wrote: So I get 4 extra pages of 16K at $8000-$BFFF like: LDA #BANK_INDEX STA ROMSEL Yes that's right, though it's probably best if you also do STA &F4, that way OS and interrupt routines won't randomly map out RAM. Quote: Does the Master 512 just have more banks? No, the Master 512 is just a Master 128 with an 80186 copro (which has 512k RAM which you can't really get at from the 6502). Quote: As for the 16 color 320 mode - what if you set up a smaller screen - like 256x192 - that would only take 24K and fit in memory ok. No - the video hardware just doesn't have the bandwidth for that. I'm sure I just had this discussion on the STH forum... Quote: I'd be interested if anyone has any example code for setting up 'custom' sized screens - the main problem I'm finding with writing BBC programs is that I'm always running out of ram - I can see why a lot of commercial games cut down the screen size now. Dead easy. The code you want is something like : Code: LDA #1 ;Display width STA &FE00 LDA #64 ;64 characters (256 pixels in mode 1) STA &FE01 LDA #6 ;Display height STA &FE00 LDA #24 ;24 characters (192 pixels) STA &FE01 LDA #12 ;Display address high STA &FE00 LDA #10 ;Start at &5000 STA &FE01 More fiddling is needed to get the display centered, but that ought to get you started. |
|
| Page 1 of 1 | All times are UTC [ DST ] |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|