URL
https://opencores.org/ocsvn/socgen/socgen/trunk
Subversion Repositories socgen
[/] [socgen/] [trunk/] [Projects/] [opencores.org/] [Mos6502/] [sw/] [boot_basic/] [boot_basic.asm] - Rev 131
Compare with Previous | Blame | View Log
; minimal monitor for EhBASIC and 6502 simulator V1.05; To run EhBASIC on the simulator load and assemble [F7] this file, start the simulator; running [F6] then start the code with the RESET [CTRL][SHIFT]R. Just selecting RUN; will do nothing, you'll still have to do a reset to run the code..include "basic.asm"; put the IRQ and MNI code in RAM so that it can be changedIRQ_vec = VEC_SV+2 ; IRQ code vectorNMI_vec = IRQ_vec+$0A ; NMI code vector; setup for the 6502 simulator environmentIO_AREA = $F000 ; set I/O area for this monitorACIAsimwr = IO_AREA+$01 ; simulated ACIA write portACIAsimrd = IO_AREA+$04 ; simulated ACIA read port; now the code. all this does is set up the vectors and interrupt code; and wait for the user to select [C]old or [W]arm start. nothing else; fits in less than 128 bytes*= $FF80 ; pretend this is in a 1/8K ROM; reset vector points hereRES_vecCLD ; clear decimal modeLDX #$FF ; empty stackTXS ; set the stack; set up vectors and interrupt code, copy them to page 2LDY #END_CODE-LAB_vec ; set index/countLAB_stlpLDA LAB_vec-1,Y ; get byte from interrupt codeSTA VEC_IN-1,Y ; save to RAMDEY ; decrement index/countBNE LAB_stlp ; loop if more to do; now do the signon message, Y = $00 hereLAB_signonLDA LAB_mess,Y ; get byte from sign on messageBEQ LAB_nokey ; exit loop if doneJSR V_OUTP ; output characterINY ; increment indexBNE LAB_signon ; loop, branch alwaysLAB_nokeyJSR V_INPT ; call scan input deviceBCC LAB_nokey ; loop if no keyAND #$DF ; mask xx0x xxxx, ensure upper caseCMP #'W' ; compare with [W]arm startBEQ LAB_dowarm ; branch if [W]arm startCMP #'C' ; compare with [C]old startBNE RES_vec ; loop if not [C]old startJMP LAB_COLD ; do EhBASIC cold startLAB_dowarmJMP LAB_WARM ; do EhBASIC warm start; byte out to simulated ACIAACIAoutSTA ACIAsimwr ; save byte to simulated ACIARTS; byte in from simulated ACIAACIAinLDA ACIAsimrd ; get byte from simulated ACIABEQ LAB_nobyw ; branch if no byte waitingSEC ; flag byte receivedRTSLAB_nobywCLC ; flag no byte receivedno_load ; empty load vector for EhBASICno_save ; empty save vector for EhBASICRTS; vector tablesLAB_vec.word ACIAin ; byte in from simulated ACIA.word ACIAout ; byte out to simulated ACIA.word no_load ; null load vector for EhBASIC.word no_save ; null save vector for EhBASIC; EhBASIC IRQ supportIRQ_CODEPHA ; save ALDA IrqBase ; get the IRQ flag byteLSR ; shift the set b7 to b6, and on down ...ORA IrqBase ; OR the original back inSTA IrqBase ; save the new IRQ flag bytePLA ; restore ARTI; EhBASIC NMI supportNMI_CODEPHA ; save ALDA NmiBase ; get the NMI flag byteLSR ; shift the set b7 to b6, and on down ...ORA NmiBase ; OR the original back inSTA NmiBase ; save the new NMI flag bytePLA ; restore ARTIEND_CODELAB_mess.byte $0D,$0A,"6502 EhBASIC [C]old/[W]arm ?",$00; sign on string; system vectors*= $FFFA.word NMI_vec ; NMI vector.word RES_vec ; RESET vector.word IRQ_vec ; IRQ vector
