Showing a SCR2 image without use BLOAD twice

Pagina 1/2
| 2

Door mcavalcanti

Rookie (20)

afbeelding van mcavalcanti

19-03-2013, 01:07

Hello. Is there a way to load a Screen2 image and, later, load it again without use bload twice? Maybe using DEFUSR or VPOKE? Something like this:

10 SCREEN2
20 BLOAD"OPENING.SCR",R
30 SCREEN1
40 A$=INKEY$
50 IFA$=INKEY$(32) GOTO 70
60 GOTO 40
70 SCREEN2
80 REM #COMMAND TO SHOW THE IMAGE WITHOUT BLOAD AGAIN#
100 GOTO 100

Best.

Aangemeld of registreer om reacties te plaatsen

Van kanima

Master (193)

afbeelding van kanima

19-03-2013, 01:23

First off, you probably want to use BLOAD "OPENING.SCR",S instead, since you don't want to execute the screen file, but rather load it into screen memory (i.e. VRAM).

Secondly: yes, it is possible, but it requires a little trickery. You basically have two options:

1) after loading the screen the first time; use some machine code (i.e. Z80 code) to copy the contents of the VRAM to RAM. You'll probably want to do some memory mapping here as well so you can copy the 16K of VRAM to address $4000, leaving everything above $8000 for BASIC. Then, when you want to show the screen again, switch to SCREEN 2 and call some more machine code to copy the 16K from RAM at $4000 to VRAM again. This would even work on an MSX1 with just 48K of RAM (i.e. 48K RAM + 16K VRAM)

2) if you're targeting MSX2 and above there's another trick; alter your OPENING.SCR file to load from address $4000 in VRAM instead of address $0000. Then, after switching to SCREEN 2 you'd just have to setup the VDP registers right so that the name table address, pattern table address etc all point to the new addresses and load the file. If BASIC doesn't allow BLOAD,S to addresses $4000 and higher in SCREEN 2 you might have to use SCREEN 4 instead (which is very much like SCREEN 2, so shouldn't be a problem).

Van NYYRIKKI

Enlighted (5669)

afbeelding van NYYRIKKI

19-03-2013, 10:20

Yes you can... First write:
OPEN "OPENING.SCR" for input as #1:A$=INPUT$(5,1):?ASC(INPUT$(1,1))+ASC(INPUT$(1,1))*256:CLOSE

... This will give you some number xxx. After fixing your program use this number on line 80:
80 DEFUSR=xxx:A=USR(0)

kanima wrote:

First off, you probably want to use BLOAD "OPENING.SCR",S instead, since you don't want to execute the screen file, but rather load it into screen memory (i.e. VRAM).

This works only in MSX2 and better, not on MSX1. Even on MSX2 this works only if you have disk drive, so it is normal that SCREEN 2 pictures are packed with a loader.

Van Poltergeist

Champion (276)

afbeelding van Poltergeist

19-03-2013, 14:54

I don't get it. Why would screendata suddenly be executable code, and how does it render to screen? Or is opening.scr not vdp data, but already an executable? Me thinks me is getting confused and old...

Van NYYRIKKI

Enlighted (5669)

afbeelding van NYYRIKKI

19-03-2013, 15:50

Poltergeist wrote:

I don't get it. Why would screendata suddenly be executable code, and how does it render to screen? Or is opening.scr not vdp data, but already an executable? Me thinks me is getting confused and old...

If the picture is displayed when there is ",R"-parameter then there must be executable code already embedded. Naturally this does not happen by it self, but it is very typical way to implement loading screen to MSX1 games. The VDP-data can be packed, but typically the data is just RAW and the code is simple BIOS-call that asks the data to be transferred to VRAM.

Van Poltergeist

Champion (276)

afbeelding van Poltergeist

19-03-2013, 16:41

Thanks! I was simply assuming that the ,R was wrong, and should be ,S. Assumption, mother, f*ck-ups, you know what I mean... Using ,R makes sense on an MSX1, as bload,s is only available on diskbased systems...

Van mcavalcanti

Rookie (20)

afbeelding van mcavalcanti

19-03-2013, 18:06

Hello, NYYRIKKI.

Thanks. This method seens to be easy, but I got the number 0 as response. Is there anything wrong? Question

Best.

Van mcavalcanti

Rookie (20)

afbeelding van mcavalcanti

19-03-2013, 18:06

Hello, NYYRIKKI.

Thanks. This method seens to be easy, but I got the number 0 as response. Is there anything wrong? Question

Best.

Van NYYRIKKI

Enlighted (5669)

afbeelding van NYYRIKKI

20-03-2013, 08:05

My bad... I thought that:
20 BLOAD"OPENING.SCR",R
... was used to load the picture, but instead you used that to reset your MSX. I had a wrong assumption, please check the other replies.

Quote:

Thanks! I was simply assuming that the ,R was wrong, and should be ,S. Assumption, mother, f*ck-ups, you know what I mean... Using ,R makes sense on an MSX1, as bload,s is only available on diskbased systems...

... and this time your assumption that this was incorrect was better than mine.

Van mcavalcanti

Rookie (20)

afbeelding van mcavalcanti

20-03-2013, 19:49

So, is the best solution that by kanima? Use OPEN will not work?

Quote:

1) after loading the screen the first time; use some machine code (i.e. Z80 code) to copy the contents of the VRAM to RAM. You'll probably want to do some memory mapping here as well so you can copy the 16K of VRAM to address $4000, leaving everything above $8000 for BASIC. Then, when you want to show the screen again, switch to SCREEN 2 and call some more machine code to copy the 16K from RAM at $4000 to VRAM again. This would even work on an MSX1 with just 48K of RAM (i.e. 48K RAM + 16K VRAM)

Van NYYRIKKI

Enlighted (5669)

afbeelding van NYYRIKKI

22-03-2013, 14:18

Yes, kanima's solution is best. No, OPEN will not work.

Pagina 1/2
| 2