101 lines
4.2 KiB
NASM
101 lines
4.2 KiB
NASM
|
|
; ----------------- assembly instructions ----------------------------
|
||
|
|
;
|
||
|
|
;****************************************************************************
|
||
|
|
; Reset, Interrupt, & Break Handlers
|
||
|
|
;****************************************************************************
|
||
|
|
*= $FF00 ; put this in last page of ROM
|
||
|
|
|
||
|
|
;--------------Reset handler----------------------------------------------
|
||
|
|
Reset SEI ; diable interupts
|
||
|
|
CLD ; clear decimal mode
|
||
|
|
LDX #$FF ;
|
||
|
|
TXS ; init stack pointer
|
||
|
|
;
|
||
|
|
; you can patch in a test for keypress here to bypass memory erase.
|
||
|
|
; It will then test the vectors, and jump to your routine.
|
||
|
|
;
|
||
|
|
Set_Vectors LDX #<Start_OS ; *** only outside reference in reset routine
|
||
|
|
LDA #>Start_OS ; *** points to Monitor Boot routine
|
||
|
|
sta RESvector+1 ;
|
||
|
|
stx RESvector ;
|
||
|
|
LDX #<INTret ; set up to point to RTI command
|
||
|
|
LDA #>INTret ; (no system NMI applications)
|
||
|
|
sta NMIvector+1 ;
|
||
|
|
stx NMIvector ;
|
||
|
|
LDX #<INTret ; set up to point to RTI command
|
||
|
|
LDA #>INTret ; (no system INT applications)
|
||
|
|
sta INTvector+1 ;
|
||
|
|
stx INTvector ;
|
||
|
|
LDX #<BRKroutine ; set up to point to my BRK routine
|
||
|
|
LDA #>BRKroutine ;
|
||
|
|
sta BRKvector+1 ;
|
||
|
|
stx BRKvector ;
|
||
|
|
lda #<ACIA1_Scan
|
||
|
|
sta VEC_IN
|
||
|
|
lda #>ACIA1_Scan
|
||
|
|
sta VEC_IN+1
|
||
|
|
lda #<ACIA1_Output
|
||
|
|
sta VEC_OUT
|
||
|
|
lda #>ACIA1_OUTPUT
|
||
|
|
sta VEC_OUT+1
|
||
|
|
lda #<Psave
|
||
|
|
sta VEC_SV
|
||
|
|
lda #>Psave
|
||
|
|
sta VEC_SV+1
|
||
|
|
lda #<pload
|
||
|
|
sta VEC_LD
|
||
|
|
lda #>pload
|
||
|
|
sta VEC_LD+1
|
||
|
|
;
|
||
|
|
; select the IO device driver here
|
||
|
|
;
|
||
|
|
jsr ACIA1_init ; init the I/O devices
|
||
|
|
|
||
|
|
Clr_regs lda #$00 ; Clear registers
|
||
|
|
TAY ;
|
||
|
|
TAX ;
|
||
|
|
CLC ; clear flags
|
||
|
|
CLD ; clear decimal mode
|
||
|
|
CLI ; Enable interrupt system
|
||
|
|
JMP (RESvector) ; Monitor for cold reset
|
||
|
|
;
|
||
|
|
NMIjump jmp (NMIvector) ;
|
||
|
|
INTret RTI ; Null Interrupt return
|
||
|
|
Interrupt PHX ;
|
||
|
|
PHA ;
|
||
|
|
TSX ; get stack pointer
|
||
|
|
LDA $0103,X ; load INT-P Reg off stack
|
||
|
|
AND #$10 ; mask BRK
|
||
|
|
BNE BrkCmd ; BRK CMD
|
||
|
|
PLA ;
|
||
|
|
PLX ;
|
||
|
|
jmp (INTvector) ; let user routine have it
|
||
|
|
BrkCmd pla ;
|
||
|
|
plx ;
|
||
|
|
jmp (BRKvector) ; patch in user BRK routine
|
||
|
|
RRTS rts ; documented RTS instruction
|
||
|
|
;
|
||
|
|
;
|
||
|
|
;
|
||
|
|
; *** VERSION Notes ***
|
||
|
|
; 3.5 added the text dump command, 'q'
|
||
|
|
; 4.0 reorganized structure, added RAM vectors for chrin, scan_in, and chrout
|
||
|
|
; 4.1 fixed set time routine so 20-23 is correct
|
||
|
|
; 4.2 RST, IRQ, NMI, BRK all jmp ind to 02xx page to allow user prog to control
|
||
|
|
; 4.3 added status register bits to printreg routine
|
||
|
|
; 4.4 refined set time to reduce unneeded sec's and branches, disp time added CR,
|
||
|
|
; and added zeromem to the reset routine, ensuring a reset starts fresh every time!
|
||
|
|
; continued to re-organize - moved monitor's brk handler into mon area.
|
||
|
|
|
||
|
|
; 65C02 Firmware Notes
|
||
|
|
;
|
||
|
|
; NMIjmp = $FFFA
|
||
|
|
; RESjmp = $FFFC
|
||
|
|
; INTjmp = $FFFE
|
||
|
|
|
||
|
|
*= $FFFA
|
||
|
|
.word NMIjump
|
||
|
|
.word Reset
|
||
|
|
.word Interrupt
|
||
|
|
;end of file
|