OpenCores
URL https://opencores.org/ocsvn/rf6809/rf6809/trunk

Subversion Repositories rf6809

[/] [rf6809/] [trunk/] [software/] [boot/] [boot_rom.asm] - Diff between revs 14 and 15

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 14 Rev 15
Line 32... Line 32...
; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;
;
; ============================================================================
; ============================================================================
;
;
CR      EQU     $0D             ;ASCII equates
OPT include "d:\cores2022\rf6809\software\boot\mon_equates.asm"
LF      EQU     $0A
OPT include "d:\cores2022\rf6809\software\boot\io_equates.asm"
TAB     EQU     $09
 
CTRLC   EQU     $03
 
CTRLH   EQU     $08
 
CTRLI   EQU     $09
 
CTRLJ   EQU     $0A
 
CTRLK   EQU     $0B
 
CTRLM   EQU $0D
 
CTRLS   EQU     $13
 
CTRLT EQU $14
 
CTRLX   EQU     $18
 
XON             EQU     $11
 
XOFF    EQU     $13
 
 
 
FIRST_CORE      EQU     1
 
MAX_TASKNO      EQU 63
 
DRAM_BASE       EQU $10000000
 
 
 
 
OPC_SWI                         EQU             $03F
ScreenLocation          EQU             $10
ScreenLocation          EQU             $10
ColorCodeLocation       EQU             $14
ColorCodeLocation       EQU             $14
ScreenLocation2         EQU             $18
ScreenLocation2         EQU             $18
BlkcpySrc                       EQU             $1C
BlkcpySrc                       EQU             $1C
BlkcpyDst                       EQU             $20
BlkcpyDst                       EQU             $20
Strptr                          EQU             $24
Strptr                          EQU             $24
PICptr                          EQU             $28
PICptr                          EQU             $28
; Forth Area
; Forth Area
; 0x30-0x60
; 0x30-0x60
 
 
RunningID                       EQU             $800000
 
 
 
; Task control blocks, room for 256 tasks
; Task control blocks, room for 256 tasks
TCB_NxtRdy              EQU             $00     ; next task on ready / timeout list
TCB_NxtRdy              EQU             $00     ; next task on ready / timeout list
TCB_PrvRdy              EQU             $04     ; previous task on ready / timeout list
TCB_PrvRdy              EQU             $04     ; previous task on ready / timeout list
TCB_NxtTCB              EQU             $08
TCB_NxtTCB              EQU             $08
TCB_Timeout             EQU             $0C
TCB_Timeout             EQU             $0C
Line 91... Line 74...
KeybdBad                EQU             $FFFFFCB00
KeybdBad                EQU             $FFFFFCB00
KeybdAck                EQU             $FFFFFCC00
KeybdAck                EQU             $FFFFFCC00
KeybdLocks              EQU             $FFFFFCD00
KeybdLocks              EQU             $FFFFFCD00
KeybdBuffer             EQU             $FFFFFC000      ; buffer is 16 chars
KeybdBuffer             EQU             $FFFFFC000      ; buffer is 16 chars
 
 
COREID  EQU             $FFFFFFFE0
 
MSCOUNT EQU             $FFFFFFFE4
 
LEDS            EQU             $FFFE60001
 
VIA                     EQU             $FFFE60000
 
VIA_PA          EQU             1
 
VIA_DDRA        EQU             3
 
VIA_ACR                 EQU             11
 
VIA_IFR                 EQU             13
 
VIA_IER                 EQU             14
 
VIA_T3LL                EQU             18
 
VIA_T3LH                EQU             19
 
VIA_T3CMPL      EQU             20
 
VIA_T3CMPH      EQU             21
 
TEXTSCR         EQU             $FFFE00000
 
TEXTREG         EQU             $FFFE0DF00
 
TEXT_COLS       EQU             0
 
TEXT_ROWS       EQU             1
 
TEXT_CURPOS     EQU             34
 
ACIA            EQU             $FFFE30100
 
ACIA_TX         EQU             0
 
ACIA_RX         EQU             0
 
ACIA_STAT       EQU             1
 
ACIA_CMD        EQU             2
 
ACIA_CTRL       EQU             3
 
ACIA_CTRL2      EQU             11
 
RTC                             EQU             $FFFE30500      ; I2C
 
RTCBuf          EQU             $7FC0
 
 
 
KEYBD           EQU             $FFFE30400
 
KEYBDCLR        EQU             $FFFE30402
 
PIC                     EQU             $FFFE3F000
 
SPRITE_CTRL             EQU             $FFFE10000
 
SPRITE_EN                       EQU             $3C0
 
 
 
OUTSEMA EQU     $EF0000
 
SEMAABS EQU     $1000
 
OSSEMA  EQU     $EF0010
 
 
 
BIOS_SCREENS    EQU     $17000000       ; $17000000 to $171FFFFF
BIOS_SCREENS    EQU     $17000000       ; $17000000 to $171FFFFF
 
 
; EhBASIC vars:
; EhBASIC vars:
;
;
NmiBase         EQU             $FF0013
NmiBase         EQU             $FFC013
IrqBase         EQU             $FF0014
IrqBase         EQU             $FFC014
 
 
IOFocusNdx      EQU             $100
IOFocusNdx      EQU             $100
 
 
; These variables in global OS storage area
; These variables in global OS storage area
 
 
IOFocusList     EQU             $FF0000 ; to $FF000F
IOFocusList     EQU             $FFC000 ; to $FF000F
IOFocusID               EQU             $FF0010
IOFocusID               EQU             $FFC010
IrqSource               EQU             $FF0011
IrqSource               EQU             $FFC011
IRQFlag                 EQU             $FF0012
IRQFlag                 EQU             $FFC012
 
RunningID               EQU             $FFC013
 
 
; These variables use direct page access
; These variables use direct page access
CursorRow       EQU             $110
CursorRow       EQU             $110
CursorCol       EQU             $111
CursorCol       EQU             $111
CharColor       EQU             $112
CharColor       EQU             $112
Line 190... Line 136...
 
 
CharOutVec      EQU             $800
CharOutVec      EQU             $800
CharInVec       EQU             $804
CharInVec       EQU             $804
CmdPromptJI     EQU     $808
CmdPromptJI     EQU     $808
MonErrVec       EQU             $80C
MonErrVec       EQU             $80C
 
BreakpointFlag  EQU             $810
 
NumSetBreakpoints       EQU     $811
 
Breakpoints                     EQU             $820    ; to $82F
 
BreakpointBytes EQU             $830    ; to $83F
 
mon_vectb                               EQU             $880
 
 
; Register save area for monitor
; Register save area for monitor
mon_DSAVE       EQU             $900
mon_DSAVE       EQU             $900
mon_XSAVE       EQU             $902
mon_XSAVE       EQU             $902
mon_YSAVE       EQU             $904
mon_YSAVE       EQU             $904
Line 204... Line 155...
mon_CCRSAVE     EQU             $90F
mon_CCRSAVE     EQU             $90F
 
 
mon_numwka      EQU             $910
mon_numwka      EQU             $910
mon_r1          EQU             $920
mon_r1          EQU             $920
mon_r2          EQU             $924
mon_r2          EQU             $924
 
jmpvec          EQU             $928
 
 
; The ORG directive must set an address a multiple of 4 in order for the Verilog
; The ORG directive must set an address a multiple of 4 in order for the Verilog
; output to work correctly.
; output to work correctly.
 
 
        org             $FFD0AC
        org             $FFD0AC
Line 297... Line 249...
        lda             #'F'
        lda             #'F'
        sta             ,x
        sta             ,x
        sync
        sync
        jmp             ,u
        jmp             ,u
 
 
 
dramtest:
 
        ldy             #$10000                 ; DRAM starts here
 
        lda             #1
 
        sta             LEDS
 
        ldu             #$AAA555
 
        lbsr    CRLF
 
dramtest1:
 
        deca
 
        bne             dramtest4
 
        tfr             y,d
 
        lbsr    DispWordAsHex
 
        ldb             #CR
 
        lbsr    OUTCH
 
dramtest4:
 
        stu             ,y++
 
        cmpy    #$E00000                ; DRAM ends here
 
        blo             dramtest1
 
        ; now readback values and compare
 
        ldy             #$10000
 
        lda             #1
 
        lbsr    CRLF
 
dramtest3:
 
        deca
 
        bne             dramtest5
 
        tfr             y,d
 
        lbsr    DispWordAsHex
 
        ldb             #CR
 
        lbsr    OUTCH
 
dramtest5:
 
        cmpu    ,y++
 
        bne             dramerr
 
        cmpy    #$E00000
 
        blo             dramtest3
 
        lda             #2
 
        sta             LEDS
 
        lbra    Monitor
 
dramerr:
 
        lda             #$80
 
        sta             LEDS
 
        ldx             #TEXTSCR
 
        ldb             COREID
 
        abx
 
        lda             #'F'
 
        sta             ,x
 
        lbra    Monitor
 
 
        org             $FFE000
        org             $FFE000
        FDB Monitor
        FDB Monitor
        FDB DumRts      ;       NEXTCMD
        FDB DumRts      ;       NEXTCMD
        FDB INCH
        FDB INCH
        FDB INCHE
        FDB INCHE
Line 329... Line 327...
        sta             VIA+VIA_DDRA
        sta             VIA+VIA_DDRA
        lda             #$55                    ; see if we can at least set LEDs
        lda             #$55                    ; see if we can at least set LEDs
        sta             LEDS
        sta             LEDS
        lda             #1                              ; prime OS semaphore
        lda             #1                              ; prime OS semaphore
        sta             OSSEMA+$1000
        sta             OSSEMA+$1000
 
        sta             OUTSEMA+$1000
        ldu             #st6                    ; U = return address
        ldu             #st6                    ; U = return address
        jmp             ramtest         ; JMP dont JSR
        jmp             ramtest         ; JMP dont JSR
st6:
st6:
        lds             #$6FFF          ; boot up stack area
        lds             #$6FFF          ; boot up stack area
        lda             COREID
        lda             COREID
Line 345... Line 344...
;       ldd             #st7 & $FFFF
;       ldd             #st7 & $FFFF
;       tfr             d,x
;       tfr             d,x
;       jmp             ,x                              ; jump to the BIOS now in local RAM
;       jmp             ,x                              ; jump to the BIOS now in local RAM
st7:
st7:
        bsr             Delay3s         ; give some time for devices to reset
        bsr             Delay3s         ; give some time for devices to reset
 
        clr             BreakpointFlag
 
        clr             NumSetBreakpoints
        lda             #$AA
        lda             #$AA
        sta             LEDS
        sta             LEDS
        lda             #FIRST_CORE
        lda             #FIRST_CORE
        sta             IOFocusID       ; core #2 has focus
        sta             IOFocusID       ; core #2 has focus
        sta             RunningID
        sta             RunningID
Line 368... Line 369...
        bsr             ClearScreen
        bsr             ClearScreen
        ldd             #DisplayChar
        ldd             #DisplayChar
        std             CharOutVec
        std             CharOutVec
        ldd             #SerialPeekCharDirect
        ldd             #SerialPeekCharDirect
        std             CharInVec
        std             CharInVec
        ldb             #24                             ; request IO focus
;       swi
        lbsr    OSCall
;       fcb             MF_OSCALL
 
;       fcb             24                                      ; request IO focus
        ldb             COREID
        ldb             COREID
        cmpb    #FIRST_CORE
        cmpb    #FIRST_CORE
        beq             init
        beq             init
        bra             skip_init
        bra             skip_init
        bra             multi_sieve
        bra             multi_sieve
Line 408... Line 410...
;       sta             PIC+4                   ; reg #4 is the edge sensitivity setting
;       sta             PIC+4                   ; reg #4 is the edge sensitivity setting
;       sta             PIC                             ; reg #0 is interrupt enable
;       sta             PIC                             ; reg #0 is interrupt enable
        lda             #$81                    ; make irq edge sensitive
        lda             #$81                    ; make irq edge sensitive
        sta             PIC+$FD
        sta             PIC+$FD
        lda             #31                             ; enable timer interrupt
        lda             #31                             ; enable timer interrupt
;       sta             PIC+9
        sta             PIC+9
        ldb             #1
        ldb             #1
        stb             OUTSEMA+SEMAABS ; set semaphore to 1 available slot
        stb             OUTSEMA+SEMAABS ; set semaphore to 1 available slot
skip_init:
skip_init:
        andcc   #$EF                    ; unmask irq
        andcc   #$EF                    ; unmask irq
        lda             #56
        lda             #COLS
        sta             TEXTREG+TEXT_COLS
        sta             TEXTREG+TEXT_COLS
        lda             #29
        lda             #ROWS
        sta             TEXTREG+TEXT_ROWS
        sta             TEXTREG+TEXT_ROWS
        bsr             ClearScreen
        bsr             ClearScreen
        bsr             HomeCursor
        bsr             HomeCursor
        lda             #5
        lda             #5
        sta             LEDS
        sta             LEDS
Line 582... Line 584...
        ora             #$C00
        ora             #$C00
        clrb
        clrb
        tfr             d,x
        tfr             d,x
        pshs    d
        pshs    d
        ldy             #TEXTSCR
        ldy             #TEXTSCR
        ldu             #56*29/2
        ldu             #COLS*ROWS/2
cv2s1:
cv2s1:
        ldd             ,x++
        ldd             ,x++
        std             ,y++
        std             ,y++
        leau    -1,u
        leau    -1,u
        cmpu    #0
        cmpu    #0
        bne             cv2s1
        bne             cv2s1
        ; reset the cursor position in the text controller
        ; reset the cursor position in the text controller
        puls    x
        puls    x
        ldb             CursorRow,x
        ldb             CursorRow,x
        lda             #56
        lda             #COLS
        mul
        mul
        tfr             d,y
        tfr             d,y
        ldb             CursorCol,x
        ldb             CursorCol,x
        tfr             y,x
        tfr             y,x
        abx
        abx
Line 609... Line 611...
CopyScreenToVirtualScreen:
CopyScreenToVirtualScreen:
        pshs    d,x,y,u
        pshs    d,x,y,u
        bsr             GetScreenLocation
        bsr             GetScreenLocation
        tfr             d,y
        tfr             d,y
        ldx             #TEXTSCR
        ldx             #TEXTSCR
        ldu             #56*29/2
        ldu             #COLS*ROWS/2
cs2v1:
cs2v1:
        ldd             ,x++
        ldd             ,x++
        std             ,y++
        std             ,y++
        leau    -1,u
        leau    -1,u
        cmpu    #0
        cmpu    #0
Line 649... Line 651...
;               none
;               none
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
 
 
ClearScreen:
ClearScreen:
        pshs    d,x,y,u
        pshs    d,x,y,u
        ldx             #56*29
        ldx             #COLS*ROWS
        tfr             x,u
        tfr             x,u
        bsr             GetScreenLocation
        bsr             GetScreenLocation
        tfr             d,y
        tfr             d,y
        ldb             #' '                            ; space char
        ldb             #' '                            ; space char
cs1:
cs1:
Line 681... Line 683...
;               none
;               none
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
 
 
ScrollUp:
ScrollUp:
        pshs    d,x,y,u
        pshs    d,x,y,u
        ldy             #(56*29-1)/2    ; y = num chars/2 to move
        ldy             #(COLS*ROWS-1)/2        ; y = num chars/2 to move
        bsr             GetScreenLocation
        bsr             GetScreenLocation
        tfr             d,x
        tfr             d,x
        tfr             d,u
        tfr             d,u
        leax    56,x                    ; x = index to source row
        leax    COLS,x          ; x = index to source row
scrup1:
scrup1:
        ldd             ,x++                    ; move 2 characters
        ldd             ,x++                    ; move 2 characters
        std             ,u++
        std             ,u++
        dey
        dey
        bne             scrup1
        bne             scrup1
        lda             #29
        lda             #ROWS-1
        bsr             BlankLine
        bsr             BlankLine
        puls    d,x,y,u,pc
        puls    d,x,y,u,pc
 
 
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
; Blank out a line on the display
; Blank out a line on the display
Line 710... Line 712...
        pshs    d,x
        pshs    d,x
        pshs    a
        pshs    a
        bsr             GetScreenLocation
        bsr             GetScreenLocation
        tfr             d,x
        tfr             d,x
        puls    a
        puls    a
        ldb             #56             ; b = # chars to blank out from video controller
        ldb             #COLS   ; b = # chars to blank out from video controller
        mul                                     ; d = screen index (row# * #cols)
        mul                                     ; d = screen index (row# * #cols)
        leax    d,x
        leax    d,x
        lda             #' '
        lda             #' '
        ldb             #56             ; b = # chars to blank out from video controller
        ldb             #COLS   ; b = # chars to blank out from video controller
blnkln1:
blnkln1:
        sta             ,x+
        sta             ,x+
        decb
        decb
        bne             blnkln1
        bne             blnkln1
        puls    d,x,pc
        puls    d,x,pc
Line 798... Line 800...
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
;
;
CalcScreenLoc:
CalcScreenLoc:
        pshs    x
        pshs    x
        lda             CursorRow
        lda             CursorRow
        ldb             #56
        ldb             #COLS
        mul
        mul
        tfr             d,x
        tfr             d,x
        ldb             CursorCol
        ldb             CursorCol
        abx
        abx
        ldb             COREID                          ; update cursor position in text controller
        ldb             COREID                          ; update cursor position in text controller
Line 837... Line 839...
        lbra            dcx4
        lbra            dcx4
dccr:
dccr:
        cmpb    #$91                            ; cursor right ?
        cmpb    #$91                            ; cursor right ?
        bne             dcx6
        bne             dcx6
        lda             CursorCol
        lda             CursorCol
        cmpa    #56
        cmpa    #COLS
        bhs             dcx7
        bhs             dcx7
        inca
        inca
        sta             CursorCol
        sta             CursorCol
dcx7:
dcx7:
        bsr             UpdateCursorPos
        bsr             UpdateCursorPos
Line 864... Line 866...
        bra             dcx7
        bra             dcx7
dcx9:
dcx9:
        cmpb    #$92                            ; cursor down ?
        cmpb    #$92                            ; cursor down ?
        bne             dcx10
        bne             dcx10
        lda             CursorRow
        lda             CursorRow
        cmpa    #29
        cmpa    #ROWS
        beq             dcx7
        beq             dcx7
        inca
        inca
        sta             CursorRow
        sta             CursorRow
        bra             dcx7
        bra             dcx7
dcx10:
dcx10:
Line 900... Line 902...
        lda             CursorCol
        lda             CursorCol
dcx5:
dcx5:
        ldb             1,x
        ldb             1,x
        stb             ,x++
        stb             ,x++
        inca
        inca
        cmpa    #56
        cmpa    #COLS
        blo             dcx5
        blo             dcx5
        ldb             #' '
        ldb             #' '
        dex
        dex
        stb             ,x
        stb             ,x
        bra             dcx4
        bra             dcx4
Line 936... Line 938...
IncCursorPos:
IncCursorPos:
        pshs    d,x
        pshs    d,x
        lda             CursorCol
        lda             CursorCol
        inca
        inca
        sta             CursorCol
        sta             CursorCol
        cmpa    #56
        cmpa    #COLS
        blo             icc1
        blo             icc1
        clr             CursorCol               ; column = 0
        clr             CursorCol               ; column = 0
        bra             icr1
        bra             icr1
IncCursorRow:
IncCursorRow:
        pshs    d,x
        pshs    d,x
icr1:
icr1:
        lda             CursorRow
        lda             CursorRow
        inca
        inca
        sta             CursorRow
        sta             CursorRow
        cmpa    #29
        cmpa    #ROWS
        blo             icc1
        blo             icc1
        deca                                                    ; backup the cursor row, we are scrolling up
        deca                                                    ; backup the cursor row, we are scrolling up
        sta             CursorRow
        sta             CursorRow
        bsr             ScrollUp
        bsr             ScrollUp
icc1:
icc1:
Line 1211... Line 1213...
        fcw             0
        fcw             0
        fcw             ReleaseIOFocus
        fcw             ReleaseIOFocus
        fcw             0
        fcw             0
        fcw             RequestIOFocus
        fcw             RequestIOFocus
 
 
OSCall:
NumOSFuncs      EQU     (*-OSCallTbl)/2
        ; wait for availability
 
osc1:
 
        tst             OSSEMA+1
 
        beq             osc1
 
        aslb
 
        ldx             #OSCallTbl
 
        abx
 
        tst             ,x
 
        beq             oscx
 
        jmp             [,x]
 
oscx:
 
        clr             OSSEMA+1
 
        rts
 
 
 
RequestIOFocus:
RequestIOFocus:
        ldb             COREID
        ldb             COREID
        ldx             #IOFocusList
        ldx             #IOFocusList
        abx
        abx
Line 1267... Line 1256...
        lbsr    CopyVirtualScreenToScreen
        lbsr    CopyVirtualScreenToScreen
        lbra    oscx
        lbra    oscx
 
 
 
 
;==============================================================================
;==============================================================================
; Disassembler
 
;==============================================================================
;==============================================================================
 
 
OPT     include "d:\cores2022\rf6809\software\boot\disassem.asm"
;------------------------------------------------------------------------------
 
; Seed the random number generator. All channels are seeded with the same
 
; value.
 
;
 
; Parameters:
 
;               d = 'z' part of seed
 
;               x = 'w' part of seed
 
; Returns:
 
;               none
 
;------------------------------------------------------------------------------
 
 
 
mon_srand:
 
        ldy     #0
 
mon_srand1:
 
        sty     PRNG+4                          ; select channel
 
        clr     PRNG+8
 
        clr PRNG+9
 
        std     PRNG+10                         ; update low half of value
 
        clr PRNG+12
 
        clr PRNG+13
 
        stx     PRNG+14                         ; update low half of value
 
        iny
 
        cmpy    #$400                           ; 1k channels
 
        blo             mon_srand1
 
        rts
 
 
 
;------------------------------------------------------------------------------
 
; Get a random number and generate the next one.
 
;
 
; Parameters:
 
;               d = channel to use
 
; Returns:
 
;               x,d = 36 bit random value
 
;------------------------------------------------------------------------------
 
 
 
mon_rand:
 
        std     PRNG+4                          ; select channel
 
        ldx     PRNG+0
 
        ldd     PRNG+2
 
        stb     PRNG+3                          ; trigger calc of next number
 
        rts
 
 
;==============================================================================
;==============================================================================
; System Monitor
; System Monitor
;==============================================================================
;==============================================================================
 
 
 
; Command Tables
 
 
 
cmdTable1:
 
        fcb             '<','>'+$800
 
        fcb             'b','s'+$800
 
        fcb             'b','c'+$800
 
        fcb             'D','R'+$800
 
        fcb             'D'+$800
 
        fcb             ':'+$800
 
        fcb             "FI",'G'+$800
 
        fcb             "FI",'L'+$800
 
        fcb             'F','L'+$800
 
        fcb             'J'+$800
 
        fcb             "RAMTES",'T'+$800
 
        fcb             "SP",'D'+$800
 
        fcb             "TI",'R'+$800
 
        fcb             'U'+$800
 
        fcb             "exi",'t'+$800
 
        fcb             '?'+$800
 
        fcb             "CL",'S'+$800
 
        fcw             0
 
 
 
cmdTable2:
 
        fcw             Redirect
 
        fcw             ArmBreakpoint
 
        fcw             DisarmBreakpoint
 
        fcw             DumpRegs
 
        fcw             DumpMemory
 
        fcw             EditMemory
 
        fcw             $FE0000                                 ; FIG forth
 
        fcw             FillMemory
 
        fcw             DumpIOFocusList
 
        fcw             jump_to_code
 
        fcw             dramtest
 
        fcw             $FF8000                                 ; sprite demo
 
        fcw             rtc_read
 
        fcw             $FF8003                                 ; unassembler
 
        fcw             xitMonitor
 
        fcw             PromptHelp
 
        fcw             PromptClearscreen
 
 
CmdPrompt:
CmdPrompt:
        lbsr    CRLF
        lbsr    CRLF
        ldb             #'$'
        ldb             #'$'
        lbsr    OUTCH
        lbsr    OUTCH
        lbra    OUTCH
        lbra    OUTCH
 
 
msgF09Starting:
msgF09Starting:
        fcb             "Femtiki F09 Multi-core OS Starting",CR,LF,0
        fcb             "Femtiki F09 Multi-core OS Starting",CR,LF,0
 
 
MonitorStart:
MonitorStart:
 
        clr             BreakpointFlag
 
        clr             NumSetBreakpoints
 
        ldd             #123
 
        ldx             #654
 
        lbsr    mon_srand
        ldd             #msgF09Starting
        ldd             #msgF09Starting
        lbsr    DisplayString
        lbsr    DisplayString
        ldd             #HelpMsg
        ldd             #HelpMsg
        lbsr    DisplayString
        lbsr    DisplayString
        ldd             #CmdPrompt
        ldd             #CmdPrompt
        std             CmdPromptJI
        std             CmdPromptJI
        ldd             #DisplayErr
        ldd             #DisplayErr
        std             MonErrVec
        std             MonErrVec
        ldd             #$63FF                  ; default app stack
        ldd             #$63FF                  ; default app stack
        std             mon_SSAVE
        std             mon_SSAVE
 
        clr             mon_DPRSAVE     ;
 
        tfr             ccr,a
 
        sta             mon_CCRSAVE
 
        clr             mon_PCSAVE
 
        ldd             #Monitor
 
        std             mon_PCSAVE+1
 
        clr             mon_XSAVE
 
        clr             mon_YSAVE
 
        clr             mon_USAVE
Monitor:
Monitor:
        leas    $6FFF                           ; reset stack pointer
        leas    $6FFF                           ; reset stack pointer
        clrb                                                    ; turn off keyboard echo
        clrb                                                    ; turn off keyboard echo
        lbsr    SetKeyboardEcho
        lbsr    SetKeyboardEcho
        ; Reset IO vectors
        ; Reset IO vectors
Line 1316... Line 1399...
; Get characters until a CR is keyed
; Get characters until a CR is keyed
 
 
Prompt3:
Prompt3:
        ldd             #-1                                     ; block until key present
        ldd             #-1                                     ; block until key present
        lbsr    INCH
        lbsr    INCH
        cmpb    #CR
        cmpb    #CR                                     ; carriage return?
        beq             Prompt1
        beq             Prompt1
        lbsr    OUTCH
        lbsr    OUTCH                           ; spit out the character
        bra             Prompt3
        bra             Prompt3                 ; and keep going
 
 
; Process the screen line that the CR was keyed on
; Process the screen line that the CR was keyed on
;
;
Prompt1:
Prompt1:
        ldd             #$5050
        ldd             #$5050
        std             LEDS
        std             LEDS
;       ldb             RunningID
;       ldb             RunningID
;       cmpb    #61
;       cmpb    #61
;       bhi             Prompt3
;       bhi             Prompt3
        ldd             #$5151
 
        std             LEDS
 
        clr             CursorCol                       ; go back to the start of the line
        clr             CursorCol                       ; go back to the start of the line
        lbsr    CalcScreenLoc   ; calc screen memory location
        lbsr    CalcScreenLoc   ; calc screen memory location
        tfr             d,y
        tfr             d,y
        ldd             #$5252
 
        std             LEDS
 
skipDollar:
skipDollar:
        bsr             MonGetNonSpace
        bsr             MonGetNonSpace
        cmpb    #'$'
        cmpb    #'$'
        beq             skipDollar              ; skip over '$' prompt character
        beq             skipDollar              ; skip over '$' prompt character
        lda             #$5353
 
        std             LEDS
 
 
 
; Dispatch based on command character
; Dispatch based on command
;
;
Prompt2:
        dey
        cmpb    #'<'
        tfr             y,u                                                     ; save off input position
        bne             PromptHelp
        clrb
        bsr             MonGetch
        ldx             #cmdTable1
        cmpb    #'>'
parseCmd1:
        bne             Monitor
        lda             ,y+                                                     ; get input character
 
        tst             ,x                                                      ; test for end of command
 
        bmi             endOfWord                               ;
 
        cmpa    ,x+                                                     ; does input match command?
 
        beq             parseCmd1
 
scanNextWord:
 
        tst             ,x+
 
        beq             Monitor                                 ; if end of table reached, not a command
 
        bpl             scanNextWord
 
        incb
 
        tfr             u,y                                                     ; reset input pointer
 
        bra             parseCmd1                               ; try again
 
endOfWord:
 
        eora    ,x
 
        asla
 
        bne             scanNextWord
 
        ; we found the command in the table
 
        aslb                                                                    ; b = word index
 
        ldx             #cmdTable2
 
        jmp             [b,x]                                           ; execute command
 
 
 
Redirect:
        bsr             MonGetch
        bsr             MonGetch
        cmpb    #'s'
        cmpb    #'s'
        bne             Prompt2a
        bne             Prompt2a
        ldd             #SerialPeekCharDirect
        ldd             #SerialPeekCharDirect
        std             CharInVec
        std             CharInVec
Line 1367... Line 1465...
        ldd             #GetKey
        ldd             #GetKey
        std             CharInVec
        std             CharInVec
        ldd             #DisplayChar
        ldd             #DisplayChar
        std             CharOutVec
        std             CharOutVec
        bra             Monitor
        bra             Monitor
 
 
PromptHelp:
PromptHelp:
        cmpb    #'?'                    ; $? - display help
 
        bne             PromptC
 
        ldd             #HelpMsg
        ldd             #HelpMsg
        lbsr    DisplayString
        lbsr    DisplayString
        bra             Monitor
        bra             Monitor
PromptC:
 
        cmpb    #'C'
PromptClearscreen:
        bne             PromptD
 
        lbsr    ClearScreen
        lbsr    ClearScreen
        lbsr    HomeCursor
        lbsr    HomeCursor
        bra             Monitor
        bra             Monitor
PromptD:
 
        cmpb    #'D'
 
        bne             PromptColon
 
        bsr             MonGetch
 
        cmpb    #'R'
 
        bne             DumpMemory
 
        bra             DumpRegs
 
PromptColon:
 
        cmpb    #':'
 
        bne             PromptF
 
        lbra    EditMemory
 
PromptF:
 
        cmpb    #'F'
 
        bne             PromptJ
 
        bsr             MonGetch
 
        cmpb    #'I'
 
        bne             PromptFL
 
        bsr             MonGetch
 
        cmpb    #'G'
 
        bne             Monitor
 
        jmp             $FE0000
 
PromptFL:
 
        cmpb    #'L'
 
        bne             Monitor
 
        lbra    DumpIOFocusList
 
PromptJ:
 
        cmpb    #'J'
 
        lbeq    jump_to_code
 
PromptR:
 
        cmpb    #'R'
 
        bne             Prompt_s
 
        ldu             #Monitor
 
        lbra    ramtest
 
Prompt_s:
 
        cmpb    #'s'
 
        bne             PromptT
 
        lbsr    SerialOutputTest
 
        bra             Monitor
 
PromptT:
 
        cmpb    #'T'
 
        bne             PromptU
 
        bsr             MonGetch
 
        cmpb    #'I'
 
        bne             Monitor
 
        bsr             MonGetch
 
        cmpb    #'R'
 
        bne             Monitor
 
        lbsr    rtc_read
 
        bra             Monitor
 
PromptU:
 
        cmpb    #'U'
 
        bne             Monitor
 
        lbra    disassem
 
 
 
MonGetch:
MonGetch:
        ldb             ,y
        ldb             ,y
        iny
        iny
        rts
        rts
Line 1459... Line 1502...
        beq             ignBlanks1
        beq             ignBlanks1
        dey
        dey
        rts
        rts
 
 
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
 
; Multiply number in work area by 10.
 
;------------------------------------------------------------------------------
 
Times10:
 
        ldd             mon_numwka              ; make a copy of the number
 
        std             mon_numwka+8
 
        ldd             mon_numwka+2
 
        std             mon_numwka+10
 
        asl             mon_numwka+3    ; shift left = *2
 
        rol             mon_numwka+2
 
        rol             mon_numwka+1
 
        rol             mon_numwka+0
 
        asl             mon_numwka+3    ; shift left = *4
 
        rol             mon_numwka+2
 
        rol             mon_numwka+1
 
        rol             mon_numwka+0
 
        ldd             mon_numwka+2    ; add in original value
 
        addd    mon_numwka+10   ; = *5
 
        ldb             mon_numwka+1
 
        adcb    mon_numwka+9
 
        stb             mon_numwka+1
 
        lda             mon_numwka+0
 
        adca    mon_numwka+8
 
        sta             mon_numwka+0
 
        asl             mon_numwka+3    ; shift left = * 10
 
        rol             mon_numwka+2
 
        rol             mon_numwka+1
 
        rol             mon_numwka+0
 
        rts
 
 
 
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
GetTwoParams:
GetTwoParams:
        bsr             ignBlanks
        bsr             ignBlanks
        bsr             GetHexNumber    ; get start address of dump
        bsr             GetHexNumber    ; get start address of dump
        ldd             mon_numwka
        ldd             mon_numwka
Line 1615... Line 1688...
        fcb     "**Err",CR,LF,0
        fcb     "**Err",CR,LF,0
 
 
HelpMsg:
HelpMsg:
        fcb             "? = Display help",CR,LF
        fcb             "? = Display help",CR,LF
        fcb     "CLS = clear screen",CR,LF
        fcb     "CLS = clear screen",CR,LF
 
        fcb     "bs = set breakpoint",CR,LF
 
        fcb     "bc = clear breakpoint",CR,LF
;       db      "S = Boot from SD Card",CR,LF
;       db      "S = Boot from SD Card",CR,LF
        fcb     ": = Edit memory bytes",CR,LF
        fcb     ": = Edit memory bytes",CR,LF
;       db      "L = Load sector",CR,LF
;       db      "L = Load sector",CR,LF
;       db      "W = Write sector",CR,LF
;       db      "W = Write sector",CR,LF
        fcb "DR = Dump registers",CR,LF
        fcb "DR = Dump registers",CR,LF
        fcb     "D = Dump memory",CR,LF
        fcb     "D = Dump memory",CR,LF
;       db      "F = Fill memory",CR,LF
        fcb     "F = Fill memory",CR,LF
        fcb "FL = Dump I/O Focus List",CR,LF
        fcb "FL = Dump I/O Focus List",CR,LF
        fcb "FIG = start FIG Forth",CR,LF
        fcb "FIG = start FIG Forth",CR,LF
;       db      "KILL n = kill task #n",CR,LF
;       db      "KILL n = kill task #n",CR,LF
;       db      "B = start tiny basic",CR,LF
;       db      "B = start tiny basic",CR,LF
;       db      "b = start EhBasic 6502",CR,LF
;       db      "b = start EhBasic 6502",CR,LF
Line 1633... Line 1708...
        fcb "RAM = test RAM",CR,LF
        fcb "RAM = test RAM",CR,LF
;       db      "R[n] = Set register value",CR,LF
;       db      "R[n] = Set register value",CR,LF
;       db      "r = random lines - test bitmap",CR,LF
;       db      "r = random lines - test bitmap",CR,LF
;       db      "e = ethernet test",CR,LF
;       db      "e = ethernet test",CR,LF
        fcb     "s = serial output test",CR,LF
        fcb     "s = serial output test",CR,LF
 
        fcb     "SP = sprite demo",CR,LF
;       db      "T = Dump task list",CR,LF
;       db      "T = Dump task list",CR,LF
;       db      "TO = Dump timeout list",CR,LF
;       db      "TO = Dump timeout list",CR,LF
        fcb     "TI = display date/time",CR,LF
        fcb     "TI = display date/time",CR,LF
;       db      "TEMP = display temperature",CR,LF
;       db      "TEMP = display temperature",CR,LF
        fcb     "U = unassemble",CR,LF
        fcb     "U = unassemble",CR,LF
;       db      "P = Piano",CR,LF,0
;       db      "P = Piano",CR,LF
 
        fcb     "x = exit monitor",CR,LF
        fcb             0
        fcb             0
 
 
msgRegHeadings
msgRegHeadings
        fcb     CR,LF,"  D/AB     X      Y      U      S       PC    DP  CCR",CR,LF,0
        fcb     CR,LF,"  D/AB     X      Y      U      S       PC    DP  CCR",CR,LF,0
 
 
Line 1734... Line 1811...
        ldx             mon_numwka+2
        ldx             mon_numwka+2
EditMem2:
EditMem2:
        lbsr    ignBlanks                       ; skip over blanks
        lbsr    ignBlanks                       ; skip over blanks
        lbsr    GetHexNumber    ; get the byte value
        lbsr    GetHexNumber    ; get the byte value
        tstb                                                            ; check for valid value
        tstb                                                            ; check for valid value
        bmi             EditMem1                        ; if invalid, quit
        beq             EditMem1                        ; if invalid, quit
        ldb             mon_numwka+3    ; get value
        ldb             mon_numwka+3    ; get value
        stb             ,x+                                             ; update memory at address
        stb             ,x+                                             ; update memory at address
        leau    -1,u                                    ; decremeent byte count
        leau    -1,u                                    ; decremeent byte count
        cmpu    #0
        cmpu    #0
        bne             EditMem2                        ; go back for annother byte
        bne             EditMem2                        ; go back for annother byte
Line 1761... Line 1838...
EditMem3:
EditMem3:
        lbra    Monitor
        lbra    Monitor
 
 
 
 
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
 
; Fill Memory
 
;
 
; Usage:
 
;       $$F FFFC12 FFFC30 89F
 
;
 
;------------------------------------------------------------------------------
 
 
 
FillMemory:
 
        lbsr    GetRange                        ; get address range to fill
 
        lbsr    ignBlanks
 
        lbsr    GetHexNumber    ; get target byte to write
 
        ldb             mon_numwka+3
 
        ldx             mon_r1+2
 
        clra
 
fillm1:                                                         ; Check for a CTRL-C every page of memory
 
        tsta
 
        bne             fillm2
 
        clrb                                                            ; we want a non-blocking check
 
        clra
 
        lbsr    INCH
 
        cmpb    #CTRLC
 
        lbeq    Monitor
 
        ldb             mon_numwka+3    ; reset target byte
 
fillm2:
 
        stb             ,x+
 
        cmpx    mon_r2+2
 
        bls             fillm1
 
fillm3:
 
        lbra    Monitor
 
 
 
;------------------------------------------------------------------------------
; Dump Registers
; Dump Registers
;
;
;       Usage:
;       Usage:
;               $DR
;               $DR
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
Line 1826... Line 1934...
        pshs    d
        pshs    d
        ldd             mon_YSAVE
        ldd             mon_YSAVE
        pshs    d
        pshs    d
        ldd             mon_XSAVE
        ldd             mon_XSAVE
        pshs    d
        pshs    d
        lda             mon_DPRSave
        lda             mon_DPRSAVE
        pshs    a
        pshs    a
        ldd             mon_DSAVE
        ldd             mon_DSAVE
        pshs    d
        pshs    d
        lda             mon_CCRSAVE
        lda             mon_CCRSAVE
        pshs    a
        pshs    a
Line 1879... Line 1987...
        cmpx    #16
        cmpx    #16
        blo             dfl2
        blo             dfl2
        lbsr    CRLF
        lbsr    CRLF
        lbra    Monitor
        lbra    Monitor
 
 
 
bootpg:
 
        fcb             $000
 
boot_stack:
 
        fcw             $006FFF
 
numBreakpoints:
 
        fcb             8
 
mon_rom_vectab:
 
        fcw             mon_rom_vecs
 
mon_rom_vecs:
 
        fcw             Monitor                                         ; enter monitor program
 
        fcw             INCH                                                    ; input a character
 
        fcw             OUTCH                                                   ; output a character
 
        fcw             CRLF                                                    ; output carriage-return, line feed
 
        fcw             DisplayString
 
        fcw             DispByteAsHex
 
        fcw             DispWordAsHex
 
        fcw             ShowSprites
 
        fcw             mon_srand
 
        fcw             mon_rand
 
        fcw             0                                                                        ; operating system call
 
        fcw             GetRange
 
 
 
NumFuncs        EQU     (*-mon_rom_vectab)/2
 
 
 
;------------------------------------------------------------------------------
 
; SWI routine.
 
;
 
; SWI is used to call ROM monitor routines and process breakpoints.
 
;
 
;       swi
 
;       fcb 
 
;------------------------------------------------------------------------------
 
 
 
swi_rout:
 
        ldb             bootpg,pcr                      ; reset direct page
 
        tfr             b,dp
 
swi_rout1:
 
        ldu             11,s                                            ; get program counter (low order 2 bytes)
 
        leau    -1,u                                            ; backup a byte
 
        tst             BreakpointFlag  ; are we in breakpoint mode?
 
        beq             swiNotBkpt
 
        ldu             #Breakpoints
 
        ldb             NumSetBreakpoints
 
        beq             swiNotBkpt
 
swi_rout2:
 
        cmpu    ,y++
 
        beq             processBreakpoint
 
        decb
 
        bne             swi_rout2
 
swiNotBkpt:
 
        clr             BreakpointFlag
 
        pulu    d                                                               ; get function #, increment PC
 
        cmpb    #NumFuncs
 
        lbhi    DisplayErr
 
        stu             11,s                                            ; save updated PC on stack
 
        cmpb    #MF_OSCALL
 
        beq             swiCallOS
 
        aslb                                                                    ; 2 bytes per vector
 
        ldx             mon_rom_vectab,pcr
 
        abx
 
        ldx             ,x
 
        stx             jmpvec
 
        sts             mon_SSAVE                               ; save the stack pointer
 
        ldd             1,s                                                     ; get back D
 
        ldx             4,s                                                     ; get back X
 
        ldy             6,s                                                     ; get back Y
 
        ldu             8,s                                                     ; get back U
 
        lds             boot_stack,pcr  ; and use our own stack
 
        jsr             [jmpvec]                                ; call the routine
 
swi_rout3:
 
        lds             mon_SSAVE                               ; restore stack
 
        rti
 
 
 
processBreakpoint:
 
        lda             ,s
 
        sta             mon_CCRSAVE
 
        ldd             1,s
 
        std             mon_DSAVE
 
        ldb             3,s
 
        stb             mon_DPRSAVE
 
        ldd             4,s
 
        std             mon_XSAVE
 
        ldd             6,s
 
        std             mon_YSAVE
 
        ldd             8,s
 
        std             mon_USAVE
 
        sts             mon_SSAVE
 
        ldd             11,s
 
        std             mon_PCSAVE
 
        lds             boot_stack,pcr
 
        ldd             #swi_rout3                      ; setup so monitor can return
 
        pshs    d
 
        bsr             DisarmAllBreakpoints
 
        lbra    DumpRegs
 
 
 
xitMonitor:
 
        bsr             ArmAllBreakpoints
 
        rts
 
 
 
swiCallOS:
 
        leau    1,u                                                     ; next byte is func number
 
        ldb             ,u+
 
        cmpb    #NumOSFuncs                     ; check for valid range
 
        lbhi    DisplayErr
 
        stu             11,s                                            ; save updateed PC on stack
 
        aslb                                                                    ; compute vector address
 
        ldx             #OSCallTbl
 
        tst             b,x                                                     ; check for non-zero vector
 
        beq             swi_rout3
 
osc1:
 
;       tst             OSSEMA+1                                ; wait for availability
 
;       beq             osc1
 
        jsr             [b,x]                                           ; call the OS routine
 
oscx:
 
        clr             OSSEMA+1
 
        bra             swi_rout3
 
 
 
DisarmAllBreakpoints:
 
        pshs    d,x,y
 
        ldy             #0
 
        clrb
 
        ldx             #BreakpointBytes        ; x = breakpoint byte table address
 
disarm2:
 
        cmpb    #numBreakpoints         ; safety check
 
        bhs             disarm1
 
        cmpb    NumSetBreakpoints
 
        bhs             disarm1
 
        lda             b,x                                                             ; get memory byte
 
        sta             [Breakpoints,y]         ; and store it back to memory
 
        leay    2,y                                                             ; increment for next address
 
        incb                                                                            ; increment to next byte
 
        bra             disarm2                                         ; loop back
 
disarm1:
 
        puls    d,x,y,pc
 
 
 
ArmAllBreakpoints:
 
        pshs    d,x,y
 
        ldy             #0
 
        clrb
 
        ldx             #BreakpointBytes        ; x = breakpoint byte table address
 
arm2:
 
        cmpb    numBreakpoints          ; safety check
 
        bhs             arm1
 
        cmpb    NumSetBreakpoints
 
        bhs             arm1
 
        lda             [Breakpoints,y]         ; load byte at memory address
 
        sta             b,x                                                             ; save in table
 
        leay    2,y                                                             ; increment for next address
 
        incb                                                                            ; increment to next byte
 
        bra             arm2                                                    ; loop back
 
arm1:
 
        puls    d,x,y,pc
 
 
 
ArmBreakpoint:
 
        pshs    d,x,y
 
        lda             NumSetBreakpoints               ; check if too many breakpoints set
 
        cmpa    numBreakpoints
 
        lbhs    DisplayErr
 
        lbsr    GetHexNumber                            ; get address parameter
 
        ldb             NumSetBreakpoints               ; bv= number of set breakpoints
 
        ldy             mon_numwka+2                            ; get address
 
        lda             ,y                                                                      ; get byte at address
 
        ldx             #BreakpointBytes                ; and store byte in a table
 
        lda             #OPC_SWI                                                ; put a SWI instruction in place
 
        sta             ,y
 
        sta             b,x
 
        ldx             #Breakpoints                            ; also store the address in a table
 
        aslb                                                                                    ; index for 2 byte values
 
        sty             b,x
 
        lsrb                                                                                    ; size back to single byte
 
        incb
 
        stb             NumSetBreakpoints
 
        puls    d,x,y,pc
 
 
 
DisarmBreakpoint:
 
        pshs    d,x,y,u
 
        lbsr    GetHexNumber
 
        clrb
 
        clrb
 
        tfr             d,x                                                                     ; x = zero too
 
disarm6:
 
        cmpb    numBreakpoints                  ; no more than this many may be set
 
        bhs             disarm4
 
        cmpb    NumSetBreakpoints               ; number actually set
 
        bhs             disarm4
 
        ldy             Breakpoints,x                           ; y = breakpoint address
 
        cmpy    mon_numwka+2                            ; is it the one we want?
 
        bne             disarm3                                                 ; if not, go increment to next
 
        ldx             mon_numwka+2                            ; x = memory address
 
        ldy             #BreakpointBytes
 
        lda             b,y                                                                     ; get saved byte from table
 
        sta             ,x                                                                      ; set the byte at the memory address
 
        ; compress breakpoint table by removing breakpoint
 
        dec             NumSetBreakpoints               ; set the new number of set breakpoints
 
        pshs    b                                                                               ; save the position we're removing from
 
disarm7:
 
        incb                                                                                    ; set index for next byte
 
        lda             b,y                                                                     ; get byte
 
        decb                                                                                    ; and store it back
 
        sta             b,y
 
        incb                                                                                    ; move to next position
 
        cmpb    numBreakpoints                  ; hit end of table?
 
        blo             disarm7
 
        puls    b                                                                               ; get back position
 
        aslb                                                                                    ; times two for word index
 
        clra
 
        tfr             d,y
 
        lsrb                                                                                    ; back to byte index value
 
disarm8:
 
        ldu             2,y                                                                     ; get next breakpoint address
 
        stu             ,y++                                                            ; store in current pos, increment
 
        incb                                                                                    ; increment count
 
        cmpb    numBreakpoints                  ; hit end of table?
 
        blo             disarm8
 
        puls    d,x,y,u,pc
 
disarm3:
 
        leax    2,x
 
        incb
 
        bra             disarm6
 
disarm4:
 
        puls    d,x,y,u,pc
 
 
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
swi3_rout:
swi3_rout:
        sei
        sei
        puls    a
        lda             ,s
        sta             mon_CCRSAVE
        sta             mon_CCRSAVE
        puls    D,DPR,X,Y,U
        ldd             1,s
        std             mon_DSAVE
        std             mon_DSAVE
        stx             mon_XSAVE
        ldb             3,s
        sty             mon_YSAVE
        stb             mon_DPRSAVE
        stu             mon_USAVE
        ldd             4,s
        tfr             dpr,a
        std             mon_XSAVE
        sta             mon_DPRSAVE
        ldd             6,s
        puls    a
        std             mon_YSAVE
        sta             mon_PCSAVE
        ldd             8,s
        puls    D
        std             mon_USAVE
        std             mon_PCSAVE+1
        sts             mon_SSAVE
 
        ldd             11,s
 
        std             mon_PCSAVE
        sts             mon_SSAVE
        sts             mon_SSAVE
        lds             #$3FFF
        lds             #$3FFF
 
        ldd             #swi3_exit
 
        pshs    d
        cli
        cli
        jmp             DumpRegs
        jmp             DumpRegs
swi3_exit:
swi3_exit:
        sei
 
        lds             mon_SSAVE
        lds             mon_SSAVE
        ldd             mon_PCSAVE+1
 
        pshs    d
 
        lda             mon_PCSAVE
 
        pshs    a
 
        ldu             mon_USAVE
 
        ldy             mon_YSAVE
 
        ldx             mon_XSAVE
 
        pshs    x,y,u
 
        lda             mon_DPRSAVE
 
        pshs    a
 
        ldd             mon_DSAVE
 
        pshs    d
 
        lda             mon_CCRSAVE
 
        pshs    a
 
        tfr             a,ccr
 
        cli
 
        rti
        rti
 
 
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
firq_rout:
firq_rout:
        rti
        rti
 
 
irq_rout:
irq_rout:
;       lbsr    SerialIRQ       ; check for recieved character
;       lbsr    SerialIRQ       ; check for recieved character
;       lbsr    TimerIRQ
        lbsr    TimerIRQ
 
 
        ; Reset the edge sense circuit in the PIC
        ; Reset the edge sense circuit in the PIC
        lda             #31                                                     ; Timer is IRQ #31
;       lda             #31                                                     ; Timer is IRQ #31
        sta             IrqSource               ; stuff a byte indicating the IRQ source for PEEK()
;       sta             IrqSource               ; stuff a byte indicating the IRQ source for PEEK()
        sta             PIC+16                                  ; register 16 is edge sense reset reg
;       sta             PIC+16                                  ; register 16 is edge sense reset reg
        lda             VIA+VIA_IFR
;       lda             VIA+VIA_IFR
        bpl             notTimerIRQ2
;       bpl             notTimerIRQ2
        bita    #$800
;       bita    #$800
        beq             notTimerIRQ2
;       beq             notTimerIRQ2
        clr             VIA+VIA_T3LL
;       clr             VIA+VIA_T3LL
        clr             VIA+VIA_T3LH
;       clr             VIA+VIA_T3LH
        inc             $E00037                                 ; update timer IRQ screen flag
;       inc             $E00037                                 ; update timer IRQ screen flag
notTimerIRQ2:
;notTimerIRQ2:
 
 
        lda             IrqBase                 ; get the IRQ flag byte
        lda             IrqBase                 ; get the IRQ flag byte
        lsra
        lsra
        ora             IrqBase
        ora             IrqBase
        anda    #$E0
        anda    #$FE0
        sta             IrqBase
        sta             IrqBase
 
 
;       inc             TEXTSCR+54              ; update IRQ live indicator on screen
;       inc             TEXTSCR+54              ; update IRQ live indicator on screen
 
 
        ; flash the cursor
        ; flash the cursor
Line 2001... Line 2317...
        fcw             rti_insn                ; reserved
        fcw             rti_insn                ; reserved
        fcw             swi3_rout               ; SWI3
        fcw             swi3_rout               ; SWI3
        fcw             rti_insn                ; SWI2
        fcw             rti_insn                ; SWI2
        fcw             firq_rout               ; FIRQ
        fcw             firq_rout               ; FIRQ
        fcw             irq_rout                ; IRQ
        fcw             irq_rout                ; IRQ
        fcw             start                           ; SWI
        fcw             swi_rout                ; SWI
        fcw             nmi_rout                ; NMI
        fcw             nmi_rout                ; NMI
        fcw             start                           ; RST
        fcw             start                           ; RST

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.