This message is FYI :)

- Corrected some bugs, especially the one that caused NestorBASIC 1.0 to
hang on Panasonic WSX machines.

I assume this was a bug in the MoonBlaster MSX-MUSIC detection routine.

The proper way to detect the MSX-MUSIC is this:

1. First check for internal MSX-MUSIC: Check for APRL on 4018h of the MSX-MUSIC ROM. If found, MSX-MUSIC was successfully found.

2. Now check for FM-PAC: Check for OPLL on 401Ch of the MSX-MUSIC ROM. If found: set bit 0 of address 7FF6h. If not found: no FM-PAC inserted.

The bug is caused by MoonBlaster only checking for 'OPLL' and setting bit 0 of address 7FF6h regardless of the MSX-MUSIC was internal or external. On these Panasonic machines 7FF6h belongs to the internal mapper, causing a crash.

Setting of bit 0 address 7FF6h is required on FM-PAC to enable it to listen to I/O commands. Without bit 0 of 7FF6h set, FM-PAC only listens to memory I/O 7FF4h and 7FF5h.

This mechanism has two purposes:
1. to prevent the I/O conflict when an FM-PAC is inserted into machines with MSX-MUSIC on-board.
2. to enable multiple FM-PACs to be used by accessing their memory I/O addresses.


So in short: there's no design flaw in the Panasonic machines (which has been suggested), there's 'just' a bug in the MoonBlaster MSX-MUSIC detection routine.

Full sourcecode of correct MSX-MUSIC detection and initialisation follows.

Greetings,
        Patriek

---
FMSlot: db 0 ; slotnumber of MSX-MUSIC if found.
SearchTemp:     db 0 ; temporary variable

InitFM: xor     a
        ld      [FMSlot],a              ; reset slotnr

        ld      b,4
.pri_l: push    bc
        ld      a,4
        sub     b
        ld      c,a
        ld      hl,EXPTBL
        add     a,l
        ld      l,a
        ld      a,[hl]
        add     a,a
        jr      nc,.notExp

        ld      b,4                     ; slot is expanded
.exp_l: push    bc
        ld      a,24h
        sub     b
        rlca
        rlca
        or      c
        ld      [SearchTemp],a

        call    .SearchFM

        ld      a,[FMSlot]

        or      a
        pop     bc
        jr      nz,.end
        djnz    .exp_l
.nextpri:
        pop     bc
        djnz    .pri_l
        ret

.notExp:                                ; slot is not expanded
        ld      a,c
        ld      [SearchTemp],a

        call    .SearchFM

        ld      a,[FMSlot]

        or      a
        jp      z,.nextpri
.end:   pop     bc
        ret

.SearchFM:
        ld      b,8
        ld      hl,.TxtAPRL
        ld      de,4018h
        call    .Compare
        ret     nc

        ld      b,4
        ld      hl,.TxtOPLL
        ld      de,401Ch
        call    .Compare
        ret     c

        ld      hl,7FF6h
        push    af
        push    hl
        call    RDSLT
        or      1
        ld      e,a
        pop     hl
        pop     af
        call    WRSLT
        or      a
        ret

.Compare:
        ld      a,[SearchTemp]
        ld      c,a
.loop:  push    bc
        push    hl
        push    de
        ld      a,c
        ex      de,hl
        call    RDSLT
        pop     de
        pop     hl
        pop     bc
        cp      [hl]
        scf
        ret     nz

        inc     hl
        inc     de
        djnz    .loop
        ld      a,c
        ld      [FMSlot],a
        or      a
        ret

.TxtAPRL: db     "APRL"
.TxtOPLL: db     "OPLL"


_______________________________________________ MSX mailing list ([EMAIL PROTECTED]) Info page: http://lists.stack.nl/mailman/listinfo/msx

Reply via email to