ぴゅう太のBIOSをダンプしてみる その2

ここらへんを参考にぴゅう太フラッシュメモリライタープログラムを作ってみました。

http://p6ers.net/mm/pc-6001/dev/flashromcard/32k_write.html

ぴゅう太(8000-BFFF)から見ると256KBフラッシュメモリ(00000-3FFFF)は16KB(00000-03FFF)なので、20KB(0000-4FFF)のBIOSをDUMPするには前半(0000-1FFF)、後半(2000-4FFF)で2回実行する必要があります。

http://www.geocities.jp/parallel_computer_inc/pyutabios.zip

***************************************************************
*
* FLASH MEMORY WRITER for PYUTA
*
* 2016/02/20  written by TANAM
*
********@*****@*********************@**************************
        AORG >8000
***************************************************************
* HEADER
***************************************************************
        DATA >5555             * GAME CARTRIDGE HEADER
        b    @START            * GOTO MAIN
***************************************************************
* SUB
***************************************************************
FLASH_WRITE
        limi 0
        li   R4,>9000
        li   R9,>0000
*        li   R9,>2000
        li   R15,>2000
*        li   R15,>3000
WR_LOOP
        li   R5,>8555
        li   R6,>AA00
        movb R6,*R5
        li   R5,>8AAA
        li   R6,>5500
        movb R6,*R5
        li   R5,>8555
        li   R6,>A000
        movb R6,*R5
        movb *R9,*R4
        inc  R9
        inc  R4
        dec  R15
        ci   R15,>0000
        jne  WR_LOOP
        limi 3
        b    *R11
ALPHA   ci   R4,>0023
        jgt  SPACE
        ci   R4,>000A
        jlt  SPACE
NUMBER  li   R7,CHAR           * VDP CHAR ADDRESS TABLE
        a    R4,R4             * R4 = R4 + R4
        a    R7,R4             * SET CHAR "0" + R4
        mov  *R4,R7            * SET CHAR ADDRESS TO R7
        b    @>0194            * PRINT NUMBER
SPACE   li   R7,>1922          * SET CHAR " " ADDR TO R7
        b    @>0194            * PRINT SPACE
***************************************************************
***************************************************************
CHAR    DATA >19A2,>19AA,>19B2,>19BA,>19C2,>19CA,>19D2,>19DA
        DATA >19E2,>19EA
        DATA >1A2A,>1A32,>1A3A,>1A42,>1A4A,>1A52
        DATA >1A5A,>1A62,>1A6A,>1A72,>1A7A,>1A82,>1A8A,>1A92
        DATA >1A9A,>1AA2,>1AAA,>1AB2,>1ABA,>1AC2,>1ACA,>1AD2
        DATA >1ADA,>1AE2,>1AEA,>1AF2
***************************************************************
* MAIN
***************************************************************
START   li   R12,>0060         * INITIAL CELL FUNCTION
        bl   @>019c            *
        li   R7,>1800          * VRAM FILL FUNCTION
        li   R8,>f200          *
        li   R9,>2000          *
        bl   @>002c            *
        li   R7,>1800          * SCROLL AREA FUNCTION
        li   R8,>02e0          *
        li   R9,>06e0          *
        bl   @>0180            *
        li   R9,>0000
        li   R15,BOOTMSG
LOOP1   li   R4,>0000
        movb *R15+,R4
        swpb R4
        ci   R4,>0000
        jeq  CMD1
        ai   R4,-55
        bl   @ALPHA
        b    @LOOP1
CMD1    li   R9,>0200
        li   R15,PUSHMSG
LOOP2   li   R4,>0000
        movb *R15+,R4
        swpb R4
        ci   R4,>0000
        jeq  CMD2
        ai   R4,-55
        bl   @ALPHA
        b    @LOOP2
CMD2    bl   @>023c            * LINE INPUT FUNCTION
        nop                    *
        nop                    *
        li   R7,>3f9c          * INITIAL VRAM ADDRESS
        li   R8,>0000          * INITIAL BUFFER
        li   R9,>0300
        li   R15,STARTMSG
LOOP3   li   R4,>0000
        movb *R15+,R4
        swpb R4
        ci   R4,>0000
        jeq  FLASH
        ai   R4,-55
        bl   @ALPHA
        b    @LOOP3
FLASH   li   R4,>F000
        li   R9,FLASH_WRITE
        li   R15,>00a0
LDIR    movb *R9+,*R4+
        dec  R15
        ci   R15,>0000
        jne  LDIR
        bl   @>F000
        li   R9,>0400
        li   R15,COMPMSG
        b    @LOOP4
ERROR   li   R9,>0400
        li   R15,ERRORMSG
LOOP4   li   R4,>0000
        movb *R15+,R4
        swpb R4
        ci   R4,>0000
        jeq  LOOP5
        ai   R4,-55
        bl   @ALPHA
        b    @LOOP4
LOOP5   b    @LOOP5

***************************************************************
* DATA
***************************************************************
BOOTMSG TEXT "PYUTA FLASH MEMORY WRITER"
        BYTE >00

PUSHMSG TEXT "PUSH RT KEY TO START"
        BYTE >00

STARTMSG TEXT "START"
        BYTE >00

ERRORMSG TEXT "ERROR"
        BYTE >00

COMPMSG TEXT "COMPLETE"
        BYTE >00

        END