Autor
| set palette
|
norakomi msx professional Mensajes: 861 | Publicado: Mayo 25 2005, 15:19   |
Quote:
| This routine loads a file from disk, which should be 32 bytes in size, and contains the palette, stored in the same format as the VDP uses (also the same format Basic stores at address #7680). Basically it doesn't do much interesting - just loads the data into the temporary buffer, then calls a function which sets that palette.
|
FILE: DB "level100.SC5",0 Quote:
| ;Load palette file
;DE = filename
;
Load_Palet:
ld de,file
ld c,_OPEN ;Open File Handle (no flags)
xor a
call Bdos
jp nz,Error
push bc
ld de,TEMP1
ld hl,32
ld c,_READ ;Read From File Handle
call Bdos
jp nz,Error
pop bc
ld c,_CLOSE ;Close File Handle
call Bdos
jp nz,Error
ld hl,TEMP1 ;Set palette
jp SetPalet
|
Quote:
| ;Set the VDP's palette to the palette HL points to
;Changes: AF, BC, HL (=updated)
;
SetPalet: xor a ;Set p#pointer to zero.
di
out (#99),a
ld a,16+128
ei
out (#99),a
ld c,#9A
DW #A3ED,#A3ED,#A3ED,#A3ED ;32x OUTI instruction
DW #A3ED,#A3ED,#A3ED,#A3ED ; (faster than OTIR)
DW #A3ED,#A3ED,#A3ED,#A3ED
DW #A3ED,#A3ED,#A3ED,#A3ED
DW #A3ED,#A3ED,#A3ED,#A3ED
DW #A3ED,#A3ED,#A3ED,#A3ED
DW #A3ED,#A3ED,#A3ED,#A3ED
DW #A3ED,#A3ED,#A3ED,#A3ED
ret
|
I tried to translate this file in order to use it in dos1
I changed:
Bdos equ $F37D
_OPEN equ $1A
_READ equ $0F
but I can´t find what I should use for _CLOSE
When I load my picture in screen 5 and call Load_Palet,
the palette is indeed changed, but not in the way I want it.
I pointed DE to the file name and
TEMP1 equ $4000 (I also tried $8000)
|
|
norakomi msx professional Mensajes: 861 | Publicado: Mayo 25 2005, 15:44   |
Naam : RSTPLT (COLOR=RESTORE)
Adres : #0145
Functie: Stelt palette opnieuw in vanuit VRAM
Wijzig.: AF, BC, DE
I found this in MSX-2 BIOS-calls
Albert Beevendorp, 01-09-94 MILC website
So I edited a new file like this
org $c000
call $145
ret
and guess what happened after I ran this programm.....
THIS CALL FORMATS THE FILE (but it did ask for aproval first !!!)
goddamn, almost lost all my data
haha
|
|
[D-Tail]
 msx guru Mensajes: 3020 | Publicado: Mayo 25 2005, 17:20   |
BiFi?! No shit! hahaha!  |
|
Sonic_aka_T
 msx guru Mensajes: 2269 | Publicado: Mayo 25 2005, 19:27   |
Maybe the documents on MiLC were altered using photoshop!?!  (either that or it's a routine from the subrom and not the main rom  ) |
|
The_Engineer msx user Mensajes: 39 | Publicado: Mayo 25 2005, 19:50   |
RSTPAL == subrom, not main rom!
Norakomi: please find yourself the ASCII MSX2 TECHNICAL HANDBOOK. In the handbook there is (most) of the information necessary for programming the MSX2 (except for explanation of how to use the memory mapper, line interrupt and the MSX AUDIO).
Look here and thank poor Nestor Soriano for a lot of typing
http://members.chello.nl/h.otten/frontmag.htm
Get the book, it really helps you with a lot of things and will make sure that you don't format your stuff again! |
|
Sonic_aka_T
 msx guru Mensajes: 2269 | Publicado: Mayo 25 2005, 19:54   |
Hi JW!  |
|
NYYRIKKI msx master Mensajes: 1528 | Publicado: Mayo 25 2005, 20:29   |
He he
With that code, you will end up to FORMAT routine in #147
Try this one:
LD IX,#145
CALL #15F ; EXTROM = Executes inter-slot call to SUB-ROM
Quote:
|
_OPEN equ $1A
_READ equ $0F
but I can´t find what I should use for _CLOSE
|
_OPEN equ #F
_READ equ #14
_CLOSE equ #10
You also need to setup transfer address with BDOS #1A and create FCB entry instead of file handle. For more info search DOS2FUNC.DOC and download it. In DOS1 file handling is more difficult than in DOS2.
|
|
BiFi msx guru Mensajes: 3142 | Publicado: Mayo 25 2005, 20:31   |
|
|
norakomi msx professional Mensajes: 861 | Publicado: Mayo 25 2005, 21:02   |
I decided to load the file into page 2
and then call my own palette using r#16 and 32 OUTI´s.
This is better anyway, because I will be needing to change the
palette within the game also......
(I didn´t succeed doing a COLOR=RESTORE in assembly,
but I realised I didnt need it, since I can set the palette manually)
I did check MSX Assembly page, but I will read more when I need it.......
So I managed to make a routine which loads several .bin files,
and a .sc5 file !!!
Now, I will return to my game...........
Thanx
|
|
BiFi msx guru Mensajes: 3142 | Publicado: Mayo 26 2005, 07:40   |
|
|
ro msx guru Mensajes: 2347 | Publicado: Mayo 26 2005, 07:49   |
quote:
"I pointed DE to the file name and TEMP1 equ $4000 (I also tried $8000)"
NO! I said earlier, ya can't load data directly into page 1 (#4000-#7fff) !!! use page 2 instead. period.
Save your page 1 for your CODE
|
|
NYYRIKKI msx master Mensajes: 1528 | Publicado: Mayo 26 2005, 08:40   |
This must be one-chip MSX code as we already have 16bit accumulator. Cool.
|
|
BiFi msx guru Mensajes: 3142 | Publicado: Mayo 26 2005, 12:16   |
oops, must have been sleeping
should be
ld ix,$145
|
|
norakomi msx professional Mensajes: 861 | Publicado: Mayo 26 2005, 19:12   |
Quote:
| NO! I said earlier, ya can't load data directly into page 1 (#4000-#7fff) !!! use page 2 instead. period.
Save your page 1 for your CODE
|
I cannot load my game into page 1 !!
Because if I type Page 2,3,0,3 and then load all my data in page 2
I cannot use page 1 anymore for my game....
So my game has to start in page 2 !!?
(If I load my game in page 1 by typing page 1,3,0,3 after loading the data in page 2, I get errors) |
|
Sonic_aka_T
 msx guru Mensajes: 2269 | Publicado: Mayo 26 2005, 19:16   |
Hmmm... perhaps this would be a good time to tell you there's an LDIR instruction plus the ability to LOAD the data to $8000 and then 'switch/page/whatever' it to $4000. Just set the page you wish to use at $8000 (out page number to $FE), load the data, and then set that page at $4000 (out page number to $FD. That's it... Normally you'd also have to set RAM at address $4000 first, but WB already does this for you.  |
|
|
|
|