Bios is called at linesplit? (Development Foros MSX)MSX Resource Center            
                       
English Nederlands Espa�ol Portugu�s Russian                  
 Noticias
   Página principal
  Almacén de noticias
  Temas de noticias

 Recursos
   Foros MSX
  Artículos
  Analisis
  Informe de ferias/RUs
  Álbum de fotos
  Ferias y encuentros
  Encuestas
  Enlaces
  Buscar

 Software
   Descargas
  Tienda Online

 MRC
   Quiénes somos
  Únete a nuestro equipo
  Donar
  Políticas
  Contacta con nosotros
  Enlázanos
  Estadísticas

 Buscar
 
  

  

 Login
 

Login

Contraseña




¿Aún no tienes una cuenta? ¡Conviértete en miembro del MSX Resource Center! ¡Únete a nosotros!.


 Estadísticas
 

Hay 45 invitados y 3 miembros en línea

Eres un usuario anónimo.
 

Foros MSX


Foros MSX

Development - Bios is called at linesplit?

Ir a la página ( Página anterior 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Siguiente página )
Autor

Bios is called at linesplit?

ro
msx guru
Mensajes: 2347
Publicado: Diciembre 20 2005, 15:53   
sec.slot is to set correct page 2&3 atleast.

when starting WB2 and executing the above code, it will ofcourse NOT work because you've set RAM in page 0 and later call #24. . . which ain't there anymore
yup, the chicken or the hen problem. you might do make a copy of ROM first, to be sure.
I can't remember what I did the first time I made use of RAM in page 0

I know that in WB2 you can set page 0,x,x and have acces to RAM instantly. from there you might wanna look further... why would you use RAM in page 0 again? (ok, ok. I did.. gheh. but you have to make some copies of some routines. like the slotsroutines etc.)
oh, and don't forget when having ints enabled and setting page 0 to RAM, RST#38 might be lost !! so it'll crash indeed.. gheh. DI might do it.
man, this is fun.


why not call himem directly? dunno if it's located on the same adr on every msx machine.

norakomi
msx professional
Mensajes: 861
Publicado: Diciembre 20 2005, 16:01   
Quote:

when starting WB2 and executing the above code, it will ofcourse NOT work because you've set RAM in page 0 and later call #24. . . which ain't there anymore
yup, the chicken or the hen problem. you might do make a copy of ROM first, to be sure.
I can't remember what I did the first time I made use of RAM in page 0


Quote:

Ok, this is what I did:

;copy page 0 to page 1
ld hl,0 ;start
ld de,$4000 ;destiny
ld bc,$4000 ;lenght
ldir ;copy block

;set page 0 to RAM
ld a,(#F341) ; get RAM primslot for page 0
ld h,0 (indicates page 0 to be set)
call #24 ; change slot

ld hl,$4000 ;start
ld de,0 ;destiny
ld bc,$4000 ;lenght
ldir ;copy block

So I copied page 0 to page 1
then I changed page 0 to RAM
then I copied page 1 back to page 0


Quote:

why would you use RAM in page 0 again?

I need more free memory
Quote:

oh, and don't forget when having ints enabled and setting page 0 to RAM, RST#38 might be lost !! so it'll crash indeed.. gheh. DI might do it.
man, this is fun.

Ok ill try
Quote:


why not call himem directly? dunno if it's located on the same adr on every msx machine.

whats himem? (I guess it might seem Im from another planet)


ro
msx guru
Mensajes: 2347
Publicado: Diciembre 20 2005, 16:06   
himmem is in page 3, it's where system vars and system routines are stored.
#f341 for example is a system variable holding primairy slot information.
just keep page 3 ALWAY as it is and you'll be fine

extra memory? you mean LINEAR memory don't you? cuz the memory map can be mapped on every page (pref. page 2 for data and page 1 for code)
ARTRAG
msx master
Mensajes: 1747
Publicado: Diciembre 20 2005, 16:13   
@ro
from the msx red book:

Quote:


0024H ENASLT 025EH Enable any slot permanently


.....
Quote:


Address... 025EH
Name...... ENASLT
Entry..... A=Slot ID, HL=Address
Exit...... None
Modifies.. AF, BC, DE, DI

Standard routine to switch in a page permanently from any
slot. Unlike the RDSLT, WRSLT and CALSLT standard routines the
Primary Slot switching is performed directly and not by a
Workspace Area routine. Consequently addresses in page 0 (0000H
to 3FFFH) will cause an immediate system crash.



Avoid calls at 24H for setting page 0!!!!!!!!!!!
norakomi
msx professional
Mensajes: 861
Publicado: Diciembre 20 2005, 16:14   
page 1 is allready filled with code.
page 2 is filled completely with data.
page 3 has music and sfx data, and has HIMEM.
So Id love to use page 0!!

Ok, what about this:

org $c000
;page1 to mapper 6
ld a,6
ld ($fd),a

;make a copy of page 0 (ROM) to page 1 (RAM)
ld hl,0 ;start
ld de,$4000 ;destiny
ld bc,$4000 ;lenght
ldir ;copy block

DI

;set page 0 to RAM
ld a,(#F341) ; get RAM primslot for page 0
ld h,0 (indicates page 0 to be set)
call #24 ; change slot

;restore the stored ROM info from page 1 (RAM) to page 0 (NOW ALSO RAM !!)
ld hl,$4000 ;start
ld de,0 ;destiny
ld bc,$4000 ;lenght
ldir ;copy block

;set page 0 back to ROM
ld a,0
ld h,0
call $24

EI

ret


this routine should make a copy of page 0 (ROM), then after enabling RAM to page 0 copying page 1 (the stored ROM info) to page 0.
After that it enables ROM again, and goes back to WBASS2

buttttt.........not really
ARTRAG
msx master
Mensajes: 1747
Publicado: Diciembre 20 2005, 16:18   
norakomi
msx professional
Mensajes: 861
Publicado: Diciembre 20 2005, 16:18   
Quote:


0024H ENASLT 025EH Enable any slot permanently

OK also interesting.
How could I use this for my purpose (switching page 0 to RAM)?
Im starting to sweat here
ARTRAG
msx master
Mensajes: 1747
Publicado: Diciembre 20 2005, 16:19   
memman is good for you
if you start your project from 0, you should invest in durable
and reusable knowledge about memory management.


norakomi
msx professional
Mensajes: 861
Publicado: Diciembre 20 2005, 16:22   
Quote:

memman is good for you

What does it taste like?
ARTRAG
msx master
Mensajes: 1747
Publicado: Diciembre 20 2005, 16:24   
I tried it in msxdos, but the basic version should be similar.
You run the TSR at the boot and you get a bios extention that
allows you to forget the HW.
You can ask for segments that are fixed at a given page or for
mapped segments that can be activated at any page.
Each ram segment has a unique 16 bit code, and you can ask for
activating it by passing its code.
ro
msx guru
Mensajes: 2347
Publicado: Diciembre 20 2005, 16:27   
Quote:

@ro
from the msx red book:

Quote:


0024H ENASLT 025EH Enable any slot permanently


.....
Quote:


Address... 025EH
Name...... ENASLT
Entry..... A=Slot ID, HL=Address
Exit...... None
Modifies.. AF, BC, DE, DI

Standard routine to switch in a page permanently from any
slot. Unlike the RDSLT, WRSLT and CALSLT standard routines the
Primary Slot switching is performed directly and not by a
Workspace Area routine. Consequently addresses in page 0 (0000H
to 3FFFH) will cause an immediate system crash.



Avoid calls at 24H for setting page 0!!!!!!!!!!!


I'm gonna look into my sources again cuz it made me a bit confused... how did I do it back then?!?!? (yeah, it's been 10 years orso..)
I'll pass you the damn source to switch slots correctly, aight. (hope I can find them on my PC somewhere)
ARTRAG
msx master
Mensajes: 1747
Publicado: Diciembre 20 2005, 16:34   
MemMan divides the available memory in segments of 16kB. Before a segment can be used, it must be allocated. After usage it must be freed again. There are two kinds of segments, the so-called page-specific PSEGs and the flexible FSEGs.

PSEGs are segments which are allocated for usage on a certain page, for example from #4000 to #7FFF or from #8000 to #BFFF. When a PSEG-segment is requested, MemMan will assign as much non-mapper segments as possible.

FSEGs are segments which can be switched into a random page. These segments always come from memory mappers. No matter which kind of segment is being requested, MemMan will return a 16-bit ‘segment code’. This segment code is needed when selecting or freeing a segment. If you only need memory in the #8000 to #BFFF area it’s best to request PSEGs. Memman will then use as much memory as possible from ‘old’ 16- and 64-kB modules and will only after that start using the mapper.

So, with the help of MemMan a program will never have to look for memory again. Just request a page, use it, and ultimately free it again. It’s as simple as that. On a sidenote, there is a page which won’t be switched by MemMan. Page 3 contains, except for the MemMan code itself, also the stack (usually), and a large amount of system variables. There are quite some difficulties when switching all that away.


norakomi
msx professional
Mensajes: 861
Publicado: Diciembre 20 2005, 16:37   
IM ALLMOST THERE !!!

PLEASE WALK THROUGH THESE STEPS:

org $c000

;page1 to mapper 5
ld a,5
ld ($fd),a

;make a copy of page 0 (ROM) to page 1 (RAM)
ld hl,0 ;start
ld de,$4000 ;destiny
ld bc,$4000 ;lenght
ldir ;copy block

;page0 to mapper 6 THIS IS THE STEP I FORGOT
ld a,6
ld ($fd),a

DI

;set page 0 to RAM
ld a,(#F341) ; get RAM primslot for page 0
ld h,0 (indicates page 0 to be set)
call #24 ; change slot

;restore the stored ROM info from page 1 (RAM) to page 0 (NOW ALSO RAM !!)
ld hl,$4000 ;start
ld de,0 ;destiny
ld bc,$4000 ;lenght
ldir ;copy block

EI

RET


This seems to work,
however when running my game after I did this (Loading all the files in memory etc.etc) doesnt work.
I goes until a file is loaded into memory....
The diskdrive is accessed, and then the screenmode swithes (to screen 1???), and everything stops ....

Im allmost there !!
ARTRAG
msx master
Mensajes: 1747
Publicado: Diciembre 20 2005, 16:43   
ld a,5
ld ($fd),a??

do you mean

out ($fd),a?


ARTRAG
msx master
Mensajes: 1747
Publicado: Diciembre 20 2005, 16:45   
About memman, look at function 50

Quote:


Name: Info
Number: 50
Function: Provides information about amongst others
the entry adddresses of certain MemMan functions
In: B = Information number (0..8)
Out: HL = Information
Information number overview. The corresponding MemMan function codes are between brackets.

Entry address of FastUse0 (function 0)
Entry address of FastUse1 (function 1)
Entry address of FastUse2 (function 2)
Entry address of TsrCall (function 63)
Entry address of BasicCall
Entry address of FastCurSeg (function 32)
Entry address of MemMan’s function handler
MemMan’s version number, format: version #H.L
Entry address of XTsrCall (function 61)
The abovementioned function addresses may be directly called by an application or a TSR. All entry addresses are guaranteed to be in page 3.

The functions will be executed swiftly because the MemMan CALL to the EXTBIO hook is left out, and because the function codes in registers D and E won’t have to be examined. Another advantage is that parameters can also be passed through the DE register, which is mainly of importance for the TsrCall and BasicCall functions.

For example, the initialization routine of a TSR can request the necessary function entry addresses through the INFO function and subsequently store those for later use in the TSR’s code, which will improve the TSR’s speed significantly.

An exact description of the above functions can be found at the MemMan function of which the number is given between the brackets.
Keep in mind however that the ‘fast’ functions differ from the ‘normal’ MemMan functions on the following points:

fastUse0-2:
Selects a segment into a certain memory page. See the description at the MemMan ‘Use’ functions.
tsrCall:
Register [DE] will be passed to the TSR unchanged. This in contrary to the function 63 (TsrCall), register DE is in that case already occupied to pass the MemMan function number.
FastCurSeg:
No valid value will be returned in register [A]. The MemMan CurSeg function (32) will indicate if it is an FSEG or a PSEG.
xTsrCall
All main registers (AF, BC, DE, HL) will be passed unchanged to the TSR. The TSR-ID code is to be placed in register IX.



and at functions 0,1 and 2
Quote:


Name: Use0
Number: 0
Function: Enabling a segment on page 0 (address range #0000..#3FFF)
In: HL = segment code
Out: A = result code (-1 = failed, 0 = succeeded)
Enabling a segment on page 0 is only possible if the segment contains the standard MSX slotswitching entry points.

Remark: This functions may not be called through the EXTBIO hook. This function may only be called through a direct call of the MemMan function handler, or the FastUse0 function. The addresses on which these routines can be called, can be obtained through the Info function (50).

Name: Use1
Number: 1
Function: Enabling a segment on page 1 (address range #4000..#7FFF)
In: HL = segment code
Out: A = result code (-1 = failed, 0 = succeeded)
Remark: This functions may not be called through the EXTBIO hook. This function may only be called through a direct call of the MemMan function handler, or the FastUse1 function. The addresses on which these routines can be called, can be obtained through the Info function (50).

Name: Use2
Number: 2
Function: Enabling a segment on page 2 (address range #8000..#BFFF)
In: HL = segment code
Out: A = result code (-1 = failed, 0 = succeeded)
Remark: This functions may not be called through the EXTBIO hook. This function may only be called through a direct call of the MemMan function handler, or the FastUse2 function. The addresses on which these routines can be called, can be obtained through the Info function (50).




segments are allocated and allocated with a "malloc" like sequence

Quote:


Name: Alloc
Number: 10
Function: Allocate a segment
In: B = Segment preferrence code
Out: HL = Segment code (0000 = no free segments)
B = Segment type code (-1 = FSEG, 0=PSEG)
Segment preferrence code overview (register B):

Bit 7 6 5 4 3 2 1 0
^ ^ ^ ^ ^ ^ ^ ^
| | | | | | | |
| | | | | | +-+-- Segment Type. 00 = PSEG0000
| | 0 0 0 0 01 = PSEG4000
| | 02 = PSEG8000
| | 03 = FSEG
| +-------------- 1 = Prefer TPA (in other words, the
| standard MSXDOS RAM slot)
+---------------- 1 = Prefer unexpanded (hence, fast) slot
Bits 5-2 are unused and must be 0.

In case a PSEG type segment was allocated but is not available - if possible - an FSEG will be used instead.

Name: DeAlloc
Number: 20
Function: Free a segment
In: HL = segment code
On termination of a program this function is to be used to give all allocated segments back to MemMan. The eventual reserved status of the to be returned segment will automatically be cancelled. Segments which are also controlled by DOS2, will also be available through the DOS2 mapper routines again.




 
Ir a la página ( Página anterior 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Siguiente página )
 







(c) 1994 - 2008 Fundación MSX Resource Center. MSX es una marca registrada de MSX Licensing Corporation