*       TOASTROM.ASM 11/14/82
*       BURNS 2708 EPROMS USING WAVEMATE JUPITER II PROM TOASTER HARDWARE
*       BURNS PROM FROM 1024 BYTE BUFFER SUPPLIED BY BASIC PROGRAM
*       READS PROM CONTENTS INTO 1024 BUFFER SPECIFIED BY BASIC PROGRAM
*
PDATA   EQU     $FFD4
PADDR   EQU     $FFD6
CDATA   EQU     $FFD5
CADDR   EQU     $FFD7


TOASTY  BSR     INIT    INIT PIA
        CLRB            REPEAT COUNT
TOAST0  LDX     BUFFERPOINTER FETCH POINTER TO BUFFER TO WRITE
TOAST1  LDAA    0,X
        STAA    PDATA
        LDAA    PDATA
        LDAA    #$34
        BSR     DORTS
        STAA    CDATA
        LDAA    #$3C
        BSR     DORTS
        STAA    CDATA
TOAST2  LDAA    CDATA
        BPL     TOAST2
        INX
        INC     PADDR
        TST     CADDR
        BPL     TOAST1
        INCB
        BNE     TOAST0
        CLC
DORTS   RTS

BUFFERPOINTER FDB  0    POINTS TO 1024 BYTE BUFFER

INIT    LDX     2,X     FETCH POINTER TO BUFFER
        INX             MAKE POINT TO 1ST BYTE TO FILL
        INX             (NOTE: MUST BE 1024 BYTE BUFFER)
        INX
        INX
        STX     BUFFERPOINTER
        LDAA    #$38
        STAA    CDATA
        STAA    CADDR
        LDAA    #$FF
        STAA    PDATA
        STAA    PADDR
        LDAA    #$3C
        STAA    CDATA
        STAA    CADDR
INIT1   INC     PADDR
        LDAA    CADDR
        BPL     INIT1
        CLC
        RTS

READBACK
        BSR     INIT
        LDX     BUFFERPOINTER
        LDAA    #$34
        STAA    CADDR
        LDAA    #$FF
        STAA    PDATA
READB1  LDAA    PDATA
        INC     PADDR
        STAA    0,X
        INX
        LDAA    CADDR
        BPL     READB1
        CLC
        RTS

        END
