APPENDIX TWELVE DEST EQU SOURCE+2 START EQU $0600 ;START address OSROM EQU $C000 ;address of OS ROM start OSRAM EQU $4000 ;address of ROM destination NMIEN EQU $D40E ;NMI enable register PORTB EQU $D301 ;memory mgt control latch ORG START LDA #low OSROM STA SOURCE STA DEST ;initialize copy addrs LDA #high OSROM STA SOURCE+1 LDA #high OSRAM STA DEST+l LDY #0 ;Repeat Pass1 LDA (SOURCE),Y ;copy ROM to RAM STA (DEST),Y INY BNE Pass1 INC DEST+1 INC SOURCE+1 BEQ Swap ;If done LDA SOURCE+l CMP #$D0 BNE Pass1 ;skip 2K block at $D000 LDA #$D8 STA SOURCE+1 BNE Pass1 ;Until SOURCE = $0000 Swap PHP ;save processor status SEI ;disable IRQs LDA NMIEN PHA ;save NMIEN LDA #0 STA NMIEN ;disable NMIs LDA PORTB AND #$FE ;turn off ROMs STA PORTB ;(leaving BASIC unchanged!) LDA #high OSROM STA DEST+1 ;set up block copy LDA #high OSRAM STA SOURCE+1 ;Repeat