Universal RAM allocator (Development MSX Fora)MSX Resource Center MSXdev 2008 - MSX1 development bonanza!           
            
English Nederlands Español Português Russian         
 Nieuws
   Voorpagina
  Nieuws archief
  Nieuws onderwerpen

 Informatie
   MSX Fora
  Artikelen
  Recensies
  Beursverslagen
  Fotoreportages
  Beurzen en meetings
  Enquêtes
  Links
  Zoek

 Software
   Downloads
  Webshop

 MRC
   Wie we zijn
  Kom bij ons team
  Doneren
  Policies
  Contact met het MRC
  Link naar Ons
  Statistieken

 Zoek
 
  

  

 Login
 

Gebruikersnaam

Wachtwoord




Ben je nog niet lid? Klik hier en word MSX vriend!


 Statistieken
 

Er zijn 138 gasten en 2 MSX vrienden online

Je bent een anonieme bezoeker.
 

MSX Fora


MSX Fora

Development - Universal RAM allocator

Ga naar pagina ( 1 | 2 Volgende pagina )
Schrijver

Universal RAM allocator

pitpan
msx master
Berichten: 1368
Geplaatst: 12 Juli 2005, 22:39   
Hi everyone.

I'm really frustated because apparently I cannot produce a routine able to locate RAM in pages 0 and 1 of ANY MSX computer with at least 64 KB of RAM installed. Could you please give me a clue? I'm asuming that there's already RAM allocated in pages 2 and 3 (BIOS does it).

For MSX computers without memory mapper, I explore every slot and subslot looking for RAM.
For MSX computers with a mapper, I don't exactly know what to do.

How can I prevent other types of RAM of being located? (for example, SCC/SCC-I memory or memory for other devices).

I'm sorry to ask here such a n00b question, but I cannot find a right answer. I've tried different techniques, and every time that I publish a new WAV file, someone reports an error related to RAM allocation. Damn!

Sonic_aka_T

msx guru
Berichten: 2262
Geplaatst: 12 Juli 2005, 23:14   
Like you said, it boots with RAM present on page 3, rite? Just use whatever slot is located there. Any mapper will have at least 64kB, so there shouldn't be a problem. I don't fiddle around with RAM too much, (other than banking) but I remember doing a LD A,($F341) LD H,$40 CALL $0024 whenever I needed some extra RAM in the BASIC environment. It might not be pretty, but it should be pretty much compatible on most (all?) machines that have a mapper.
pitpan
msx master
Berichten: 1368
Geplaatst: 12 Juli 2005, 23:59   
But there are a lot of MSX2/2+ without mapper and MSX1 with mapper as well. What should I do?
Sonic_aka_T

msx guru
Berichten: 2262
Geplaatst: 13 Juli 2005, 02:19   
Quote:

But there are a lot of MSX2/2+ without mapper and MSX1 with mapper as well. What should I do?

I don't know, can't you just use whatever slot is being used on page 3?
pitpan
msx master
Berichten: 1368
Geplaatst: 13 Juli 2005, 06:46   
No. It would be too easy! That was my first approach, but there are some strange machines around. For example, the Toshiba HX-20 or the SONY HB-900, with RAM divided in different slots. Any clues?
BiFi
msx guru
Berichten: 3142
Geplaatst: 13 Juli 2005, 07:01   
Quote:

I don't fiddle around with RAM too much, (other than banking) but I remember doing a LD A,($F341) LD H,$40 CALL $0024 whenever I needed some extra RAM in the BASIC environment. It might not be pretty, but it should be pretty much compatible on most (all?) machines that have a mapper.

Yes... (yes, here it is ) but, what if it's not a mapper? Memory can be in a different slot for every Z80 page... and $F341 is set by the DiskROM... and...

$F341 = $0000-$3FFF = page0 RAM slot
$F342 = $4000-$7FFF = page1 RAM slot
$F343 = $8000-$BFFF = page2 RAM slot
$F344 = $C000-$FFFF = page3 RAM slot

Only on MSX computers with a memory mapper and an initialized DiskROM your asm will work..
BiFi
msx guru
Berichten: 3142
Geplaatst: 13 Juli 2005, 07:07   
Quote:

But there are a lot of MSX2/2+ without mapper and MSX1 with mapper as well. What should I do?

You need to parse each slot for a page (or each page) to look for RAM. You can use $000C (RDSLT) and $0014 (WRSLT) to hunt for memory without having to set the slot yourself first. SCC-I RAM is detected in a different way. The cartridge is set in ReadOnly mode and you need to set it to RAM mode yourself. SCC is usually ROM anyway and if you write to a switch address in a slot where a MegaROM is detected the ROM area will change in a whole, not change just one byte.

Detecting RAM in general is like this:

Read current value, write test value, read test value, restore old value... if writing and reading the test value succeeds it's most likely RAM, and if the current value is read after writing the test value, it's most likely ROM.
BiFi
msx guru
Berichten: 3142
Geplaatst: 13 Juli 2005, 07:17   
oh yeah, you need to use $FCC1 (EXPTBL) to determine if the slot is expanded and you need to parse secundary slots as well.
ro
msx guru
Berichten: 2320
Geplaatst: 13 Juli 2005, 07:27   
Like the beefman said.

;Set primairy page in slot
ld a,($F341+slotnr)
ld h,slotnr*16
call $24

And don't forget to (re)set subslots (the famous poke-1,x) Subslot info can be found in #FFFF (value=neg). Use some fiddling to get all slot correct. Gotta check my source again, I'm sure the beefmaster can explain in detail without 'aving to scroll through manuals of sources (bifi's the real online library here)

AFTER that, you might even set mapper values if ya want (and if present)

slots/pages/maps have always been kinda confusing to newbies. don't worry, you're here to lear.
good luck.
NYYRIKKI
msx master
Berichten: 1503
Geplaatst: 13 Juli 2005, 07:44   

If you can expect, that user has DISKDRIVE, then you can use #F341 for page 0 slotID and #F342 for page 1 slotID.

If there is no DISK ROM, then things get quite a bit harder... My suggestion is to search every primary & subslot for RAM and test RAM for types, you want to exclude. You need to repeat this for both pages separately. Mapper does not really make any difference. To avoid possible RAM conflict, do OUT (#FC),0 and OUT (#FD),1 before detection.

In theory the 64KB RAM can be divided to 4 different slots. and to make things even more ugly, some memorymappers don't work at all on pages 0 and 3. Remember, that correct slot needs to be selected to page 3 in order to select subslots... Aargh!







BiFi
msx guru
Berichten: 3142
Geplaatst: 13 Juli 2005, 08:48   
Quote:


If you can expect, that user has DISKDRIVE, then you can use #F341 for page 0 slotID and #F342 for page 1 slotID.

If there is no DISK ROM, then things get quite a bit harder... My suggestion is to search every primary & subslot for RAM and test RAM for types, you want to exclude.

I can be wrong, but didn't I say that already?
AuroraMSX

msx master
Berichten: 1231
Geplaatst: 13 Juli 2005, 09:32   
[/quote]I can be wrong, but didn't I say that already? [/quote]

You did, but NYYRIKKI's answer is less obscure
BiFi
msx guru
Berichten: 3142
Geplaatst: 13 Juli 2005, 13:51   
thanks
pitpan
msx master
Berichten: 1368
Geplaatst: 13 Juli 2005, 19:56   
Thanks for the explanations. But once again: there is no SIMPLE method to do it!
Scanning slots and subslots for RAM is booooring! But if there is no other solution, then I'll have to do it.

Arjan
msx addict
Berichten: 454
Geplaatst: 13 Juli 2005, 21:23   
If you want to prevent other types of ram being allocated, you should test the memory at several addresses (like at $0000, $1000, $2000, ...) AND also make sure the ram is not being mirrored.
 
Ga naar pagina ( 1 | 2 Volgende pagina )
 







(c) 1994 - 2008 Stichting MSX Resource Center. MSX is een trademark van MSX Licensing Corporation.