Loading image to Screen 11 using Assembly

Page 1/2
| 2

By albs_br

Champion (341)

albs_br's picture

03-10-2021, 17:32

Hi guys, I'm trying to do something simple, but it's not working:
Steps:
-Create an image using MSX2BMP, saving it in the program format (.sra);
-Remove the first 7 bytes (header), and keeping only the first 16384 bytes (in order to fit on a MegaROM page);
-In my program I change the screen mode with CHGMOD;
-use INCBIN to include the image file;
-load it to VRAM address 0x0000

The very same steps work like a charm on Screen 8 (or 5).

The test is being done with openMSX, and machines 2+ and Turbo R.

What can be missing? I feel that there is very few info about MSX 2+ on internet, comparing to 1 or 2.

Source:
https://github.com/albs-br/msx-tests/blob/master/show-image-...
ROM:
https://github.com/albs-br/msx-tests/blob/master/show-image-...

Thanks for any help.

Login or register to post comments

By gdx

Enlighted (4802)

gdx's picture

03-10-2021, 18:16

I don't know if this fixes your problem but it's better to do VDP register accesses like below.

    ld      a,(REG9SAV) 
    and     07Fh	
    ld      b, a
    ld      c, 9            ; register #
    call    BIOS_WRTVDP

    ; set color 0 to transparent
    ld      a,(REG8SAV) 
    and     0DFh	
    ld      b, a
    ld      c, 8            ; register #
    call    BIOS_WRTVDP

    ; set NAMTBL to 0x00000
    ; ld      b, 0001 1111 b  ; data
    ; ld      c, 2            ; register #
    ; call    BIOS_WRTVDP

By Metalion

Paragon (1451)

Metalion's picture

03-10-2021, 20:40

What exactly does not work ?
You don't get an image at all ? Or do you see garbage ?

By albs_br

Champion (341)

albs_br's picture

03-10-2021, 23:29

Metalion wrote:

What exactly does not work ?
You don't get an image at all ? Or do you see garbage ?

I get garbage:

https://webmsx.org/?ROM=https://github.com/albs-br/msx-tests...

By ARTRAG

Enlighted (6564)

ARTRAG's picture

03-10-2021, 23:46

You are probably exceeding the size of the rom page.
The image is about 64Kb and the rom page is 16kb
You should load a bulk of 16kb, change page, load another page of 16kb data, change page etc etc

By albs_br

Champion (341)

albs_br's picture

03-10-2021, 23:44

gdx wrote:

I don't know if this fixes your problem but it's better to do VDP register accesses like below.

    ld      a,(REG9SAV) 
    and     07Fh	
    ld      b, a
    ld      c, 9            ; register #
    call    BIOS_WRTVDP

    ; set color 0 to transparent
    ld      a,(REG8SAV) 
    and     0DFh	
    ld      b, a
    ld      c, 8            ; register #
    call    BIOS_WRTVDP

    ; set NAMTBL to 0x00000
    ; ld      b, 0001 1111 b  ; data
    ; ld      c, 2            ; register #
    ; call    BIOS_WRTVDP

Indeed, it is a very good practice, I was looking for something like that. This way I can change only some bits keeping the state of the others.

Unfortunally it make no difference on this current problem.

By albs_br

Champion (341)

albs_br's picture

03-10-2021, 23:47

ARTRAG wrote:

You are probably exceeding the size of the rom page.
The image is about 64Kb and the rom page is 16kb

Not really, I'm cutting all bytes above the first 16384. The same procedure is working fine with screen 8, which has the same screen size (one byte per pixel). I should be seeing a image with only 64 lines on top of screen...

By ARTRAG

Enlighted (6564)

ARTRAG's picture

03-10-2021, 23:56

You are using change mode from the bios with 11 as parameter
It could not work for msx2+ modes
Try the method depicted here
http://map.grauw.nl/articles/yjk/

By albs_br

Champion (341)

albs_br's picture

04-10-2021, 00:21

ARTRAG wrote:

You are using change mode from the bios with 11 as parameter
It could not work for msx2+ modes
Try the method depicted here
http://map.grauw.nl/articles/yjk/

I tried it now, and to my surprise, it WORKED!

I have seen this before, but my understanding were that it was necessary only for the few MSX 2 with 9958 VDP. On MSX 2+ the BIOS knows to handle modes 10 to 12...

Thanks!

By ARTRAG

Enlighted (6564)

ARTRAG's picture

04-10-2021, 15:22

In the end, CHGMOD seems to not support msx2+ modes

By Grauw

Ascended (10146)

Grauw's picture

04-10-2021, 15:59

I see, surprising but I confirmed in the disassembled BIOS source code (“msxsyssrc”) that on MSX2+ and turboR it returns immediately for any mode value above 8. I’ve amended the article.

Page 1/2
| 2