2Mビットフラッシュメモリカートリッジその3

ぴゅう太に16KB ROM(8000-BFFF)として2Mビットフラッシュメモリ(256KB)をつないでBIOSフラッシュメモリに吸い出したい

http://d.hatena.ne.jp/tanam/20160220/1455962516

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

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

***************************************************************
*
* FLASH MEMORY WRITER for PYUTA
*
* 2017/07/12  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,>3000
        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
;
; EN29F002T.EQN - EN29F002T PYUTA BIOS DUMPER
;

TITLE EN29F002T PYUTA BIOS DUMPER
PATTERN A
REVISION 1.0
AUTHOR TANAM1972
COMPANY PARALLEL COMPUTER INC
DATE 7/12/17

CHIP EN29F002T GAL22V10D

NC A15 A14 NC NC NC NC NC NC NC NC GND
NC CE_n A14_n CE NC NC NC NC NC NC NC VCC

EQUATIONS

CE_n = /A15 + A14

A14_n = A14

CE = A15 * /A14
       27C020 PYUTA GAL22V10D JUMPER
PIN 1  VPP                    VCC
PIN 2 A16                    GND
PIN 3 A15                    GND
PIN 4 A12    A3
PIN 5 A7     A8
PIN 6 A6     A9
PIN 7 A5     A10
PIN 8  A4     A11
PIN 9  A3     A12
PIN10  A2     A13
PIN11  A1     A14
PIN12  A0     A15
PIN13  D0     D7
PIN14  D1     D6
PIN15  D2     D5
PIN16  GND    GND      GND
PIN17  D3     D4
PIN18  D4     D3
PIN19 D5     D2
PIN20 D6     D1
PIN21 D7     D0
PIN22 /CE             CE_n
PIN23 A10    A5
PIN24  /OE    /DBIN
PIN25  A11    A4
PIN26  A9     A6
PIN27  A8     A7
PIN28  A13    A2
PIN29  A14             A14_n
PIN30  A17                    GND
PIN31  /WE    /WE
PIN32  VCC    VCC      VCC
              A1       A14
              A0       A15
              SELEXM   CE