RAMTST: SEI ;disable interrupts, we don't want monitor calls made while the rom is switched out LDA $C083 ;switches out rom for ram LDA $C083 LDA #$00 ;woohoo, register initialization! LDX #$00 DEP: STA $E000,X ;the magic loop for zeroing out the ram, stores register A in $E0000+index register X INX ;increment register X for the next address CPX #$FF ;see if we've hit $E0FF yet BNE DEP ;if we haven't, repeat the process LDX #$00 ;nao for reading it back! RDR: LDA #$00 ;initializing registers again CMP $E000,X ;compare A to $E000+X BNE ERR ;if its not equal, branch to the error routine INX ;increment X for the next address CPX #$FF ;see if we've hit $E0FF BNE RDR ;if not, repeat process CLI ;turn interrupts back on LDA $C081 ;swap it all back in RTS ;return back to the monitor ERR: CLI ;error handler, switches interrupts back on, swaps rom back in LDA $C081 JSR $FF2D ;calls the routine in the monitor that makes it beep, and display "ERR" on the display RTS .END