basic explanation (General discussion 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 132 gasten en 5 MSX vrienden online

Je bent een anonieme bezoeker.
 

MSX Fora


MSX Fora

General discussion - basic explanation

Ga naar pagina ( 1 | 2 Volgende pagina )
Schrijver

basic explanation

pp
msx novice
Berichten: 27
Geplaatst: 29 November 2005, 20:55   
Does anyone know what the following basic code does to an msx2 (please in sandbox level language)?

poke -1,170
clear 20, &HE48F
poke 65535!,168
poke &HFFFF, &HAA
poke &HF3DC,5
poke &HF3DD,1
if peek(&HF677)=128 then poke &HE100,0
poke &HF676,1
poke &HF677,225
defusr=&HE000
print usr(0)
sjoerd
online
msx addict
Berichten: 444
Geplaatst: 29 November 2005, 21:22   
reset?
manuel
msx guru
Berichten: 3378
Geplaatst: 29 November 2005, 21:55   
poke -1,170 is the same as poke &HFFFF, &HAA and is almost the same as poke 65535!,168. This is to set the secondary slot registers. See also the FAQ, misc section about the 'universal slot correct poke'.

clear 20, &HE48F: reserves 20 bytes for basic string space and says that the highest address for basic is E48F

if peek(&HF677)=128 then poke &HE100,0: checks if basic starts at &h8000, and if so, set address E100 to 0. This is necessary if you want to let a basic program start there, but you need this for that as well:
poke &HF676,1: poke &HF677,225: sets the start of basic to &HE101.

defusr=&HE000: print usr(0): starts a machine code routine on address &HE000

poke &HF3DC,5: poke &HF3DD,1: This seems to be the same as LOCATE 5,1


Other folks: please correct me if I'm wrong
pp
msx novice
Berichten: 27
Geplaatst: 29 November 2005, 22:17   
Hi Manuel, thanks for these answers.
What does the "!" mean behind the 65535 poke ?
manuel
msx guru
Berichten: 3378
Geplaatst: 29 November 2005, 22:32   
It's automatically added by basic, because it's such a huge number. It means: treat the number as an integer.

By the way, for the POKE statement, -1, &hFFFF and 65535 are all the same: it's the very last byte in the 64kB range of the Z80, where the Slot Select Register is.
pp
msx novice
Berichten: 27
Geplaatst: 30 November 2005, 08:26   
Why does it have to be &HAA in that address ? Is &HAA for a specific slot number, for example 3-2 ?
manuel
msx guru
Berichten: 3378
Geplaatst: 30 November 2005, 09:53   
&HAA == 170, in binary: 10101010. In groups of 2: 10 10 10 10, in decimal per group: 2 2 2 2. This means that for each of the 4 pages, subslot 2 is selected.
If the mapper is in subslot 3, you will hence need 3 3 3 3 -> 11111111 -> POKE -1, 255. This is for Sony machines. For the turboR, the mapper is in subslot 0, so you will get POKE -1,0.

For this to work, you need to have slot 3 selected for the upper memory block of course: address -1 (FFFF) of the primary slot where the mapper is in should be selected via I/O port &HA8. But this is already the case in most systems, because the top 2 pages need to be RAM, so it has already selected the slot with the memory mapper there.

Again: please correct me if I'm wrong.
AuroraMSX

msx master
Berichten: 1228
Geplaatst: 30 November 2005, 10:57   
Quote:

It's automatically added by basic, because it's such a huge number. It means: treat the number as an integer.


Actually, it means, "treat the number as a single precision floating point number". Integer ranges from -32768 upto 32767.

% -> integer
! -> single
# -> double
$ -> string

pp
msx novice
Berichten: 27
Geplaatst: 30 November 2005, 14:26   
Manuel, your explanation is great ! I'm not sure that I fully understand the term subslot however. What I understand is that an MSX2 has 4 slots and that these 4 slots can be divded per page in another 4 slots, if a mapper exists. Are these the subslots that you mean ? Per page that you select in a slot there can be 4 subslots right ?

So with the poke -1,170 I also select all pages in subslot 3-2, if my mapper is in slot 3 ? Does this mean that I swap out the bios and the basic rom (pages 0 and 1) at that time ?

pp


POISONIC
msx professional
Berichten: 883
Geplaatst: 30 November 2005, 19:19   
hey Power Plant (dutch joke)
pp
msx novice
Berichten: 27
Geplaatst: 30 November 2005, 20:29   
Manuel, which routine uses the &HFFFF address then ? It's nice to fill a RAM address (&HFFFF) with a certain value (170), and call it a slot select register, but you would normally do that because of a routine that is using or reading it.

How is slot selecting transformed in Z80 instructions ? Eventually, the address bus will be split up in 4 pages, but somehow the Z80 will have to give the instructions which slot to select for each page, right ?

How does this work ?

Regards,

pp
Edwin
msx professional
Berichten: 593
Geplaatst: 30 November 2005, 20:49   
Quote:

So with the poke -1,170 I also select all pages in subslot 3-2, if my mapper is in slot 3 ? Does this mean that I swap out the bios and the basic rom (pages 0 and 1) at that time ?



No. But when ROM is swapped for the RAM slot, it will be in that subslot.

Quote:

Manuel, which routine uses the &HFFFF address then ? It's nice to fill a RAM address (&HFFFF) with a certain value (170), and call it a slot select register, but you would normally do that because of a routine that is using or reading it.



It's not just an address, it's writing the mapper register directly. Don't really know if it's address itself, or if the slot/segment is important too.

Quote:

Eventually, the address bus will be split up in 4 pages, but somehow the Z80 will have to give the instructions which slot to select for each page, right ?



Slot selection is done with IO port $A8. Similar as described above. Mapper segments for the 4 pages are selected through ports $FC to $FF.

manuel
msx guru
Berichten: 3378
Geplaatst: 30 November 2005, 22:32   
An MSX has indeed 4 slots and each slot can have 4 subslots. This has nothing to do with mapper. There can be any device in a subslot (any that has memory). Also, it has nothing to do with MSX2, any MSX can have subslotted slots.

As said: selecting main slots goes via I/O port A8, selecting subslots goes via the SSR on address FFFF. This byte cannot be used for normal memory, as you understand. (It' can't be anyway, because the work area with system variables is in the upper part of that page anyway.)

The mapper, which is totally unrelated to subslotting, can be controlled via ports FC-FF, as Edwin also said. So, a mapper could also be in a primary slot.
Note that there are also MSX1 machines with a built in memory mapper, like the Yamaha CX-5MII/128.
pp
msx novice
Berichten: 27
Geplaatst: 01 December 2005, 08:11   
Manuel, forgive me for being a fool, but what is an SSR ?

According to the Z80 manual from Sean Young, I/O ports are also addressed via the address bus. How does the Z80 decide whether it is fetching an I/O port or a RAM address then ?

The system variables are in page 3. Does this include the stack for example ? What can you find there as well ?

Thanks for helping me out !
manuel
msx guru
Berichten: 3378
Geplaatst: 01 December 2005, 09:09   
SSR, as I explained earlier, is a Slot Select Register, the thing on FFFF. Each expanded (subslotted) slot has it.

There are loads of docs online that explain what you can found in page 3. See e.g. the pointers in the FAQ (faq.msxnet.org).
 
Ga naar pagina ( 1 | 2 Volgende pagina )
 







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