How to load an SC2 type image using Assembly in a ROM type game?

Página 1/2
| 2

Por bestiarum

Rookie (17)

Imagen del bestiarum

14-02-2019, 18:36

Hello MSX friends!

I am in a very hard journey of learning assembly. This stuff is the most difficult thing that I ever study in my life!!!!!!! But, I am moving along very well now. I am now able to create sprites, put those on VRAM, move the sprites, collision, change character graphics, draw lines, circles, get input data from the keyboard, put text on screen and change color. This was very difficult to learn, but I am Ok now!

But, I am completely stuck in a subject. I would like to load images(like: myimage.sc2) in screen 2 using assembly in my ROM game. Does anyone have a simple code/routine for that purpose?

My goal is just make in assembly, what is done in BASIC with the use of: BLOAD"IMAGE.SC2",S

thanks!

Login sesión o register para postear comentarios

Por thegeps

Paladin (828)

Imagen del thegeps

14-02-2019, 18:42

let me understand: bload? you want to create a rom game that bload a file from disk? Don't you think it's easier simply include bin file in your code before compile it and than load data from rom to vram?

Por bestiarum

Rookie (17)

Imagen del bestiarum

14-02-2019, 21:34

Hi Thegeps

Thank you for the reply.

Quote:

let me understand: bload? you want to create a rom game that bload a file from disk?

- No. I just comment about BLOAD, because this is the only method that I know of load an .SC2 image inside MSX.

Quote:

Don't you think it's easier simply include bin file in your code before compile it and than load data from rom to vram?

- It can be done with .SC2 type images? I just need to load it on VRAM like a set of graphics like bellow? There is any special way to do it?

-------
CHARCHAN: DB $18,$3C,$7E,$5A,$3C,$7E,$FF,$24
-------

Por thegeps

Paladin (828)

Imagen del thegeps

14-02-2019, 22:03

Usually assemblers can include bin files with pseudo commands like "incbin" (glass can do it). I don't know exactly how sc2 files are coded. I think they are 6144+6144 bytes (first 6144 for pixel informations and 6144 for colors). You can discover it by opening a sc2 file in a hex editor. Or you can bload it in basic, copy attribute table and colors information in RAM and then bsave two separate files that you can include (or copy/paste from a hex editor) in your source code

Por bestiarum

Rookie (17)

Imagen del bestiarum

14-02-2019, 22:11

Thank you Thegeps!

Do you know an easy way to load images using assembly?

Por thegeps

Paladin (828)

Imagen del thegeps

14-02-2019, 22:49

I told you. when you have the image data in ROM (or in RAM) you can copy it in VRAM using (for example) LDIRVM Bios routine at 05Ch.
LD HL,address of video data in ram (pixel information)
LD DE,0 ;address of attribute table in vram for screen2
LD BC,6144 ;bytes to copy
CALL 05CH
LD HL,address of colors data in ram
LD DE,8192 ;address of colour table in VRAM for screen2
LD BC,6144 ;bytes to copy
CALL 05CH

Por bestiarum

Rookie (17)

Imagen del bestiarum

14-02-2019, 22:55

Thank you very much thegeps! I will use that info!

Por thegeps

Paladin (828)

Imagen del thegeps

14-02-2019, 23:13

you are welcome Smile

Por gdx

Enlighted (4491)

Imagen del gdx

15-02-2019, 01:31

Default VRAM map for SCREEN 2:

00000h~017FFh: Pattern generator table address
01800h~01AFFh: Pattern name table address
01B00h~01B7Fh: Sprite attribute table address
01B80h~01FFFh: Unused
02000h~037FFh: Color table address
03800h~03FFFh: Sprite generator table address

For SC2 binary file it's almost same, only a header of 7 bytes has been added.

By cons, when a Rom is executed, the disks are not installed yet. There are some procedures for the ROM to boot after installing the disks. For example, first run a Basic program in ROM.

Por bestiarum

Rookie (17)

Imagen del bestiarum

15-02-2019, 01:45

Thank you very much GDX!

Por Grauw

Ascended (9905)

Imagen del Grauw

15-02-2019, 09:27

gdx wrote:

By cons, when a Rom is executed, the disks are not installed yet. There are some procedures for the ROM to boot after installing the disks. For example, first run a Basic program in ROM.

The official way is to hook H.STKE in the initialisation routine and then return.

(But I think not relevant to bestiarum atm.)

Página 1/2
| 2