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

Subversion Repositories rf6809

[/] [rf6809/] [trunk/] [software/] [boot/] [boot_rom.asm] - Diff between revs 16 and 21

Show entire file | Details | Blame | View Log

Rev 16 Rev 21
Line 90... Line 90...
IOFocusList     EQU             $FFC000 ; to $FF000F
IOFocusList     EQU             $FFC000 ; to $FF000F
IOFocusID               EQU             $FFC010
IOFocusID               EQU             $FFC010
IrqSource               EQU             $FFC011
IrqSource               EQU             $FFC011
IRQFlag                 EQU             $FFC012
IRQFlag                 EQU             $FFC012
RunningID               EQU             $FFC013
RunningID               EQU             $FFC013
 
milliseconds    EQU             $FFC014
 
 
 
; One copy of serial buffer management
 
; 1 serial buffer for system.
 
SerHeadRcv      EQU     $FFC015
 
SerTailRcv      EQU     $FFC016
 
SerHeadXmit     EQU     $FFC017
 
SerTailXmit     EQU     $FFC018
 
SerRcvXon               EQU     $FFC019
 
SerRcvXoff      EQU     $FFC01A
 
SerRcvBuf               EQU     $FFB000 ; 4kB serial recieve buffer
 
 
; Top of boot stack is at $FFC0FF
; Top of boot stack is at $FFC0FF
 
 
; These variables use direct page access
; These variables use direct page access
CursorRow       EQU             $110
CursorRow       EQU             $110
CursorCol       EQU             $111
CursorCol       EQU             $111
Line 108... Line 120...
kbdHeadRcv      EQU     $127
kbdHeadRcv      EQU     $127
kbdTailRcv      EQU     $128
kbdTailRcv      EQU     $128
kbdFifo                 EQU     $40                             ; in local RAM
kbdFifo                 EQU     $40                             ; in local RAM
kbdFifoAlias    EQU     $C00040 ; to $C0007F    ; alias for $40 to $7F
kbdFifoAlias    EQU     $C00040 ; to $C0007F    ; alias for $40 to $7F
SerhZero                EQU     $130
SerhZero                EQU     $130
SerHeadRcv      EQU     $131
 
SertZero                EQU     $132
SertZero                EQU     $132
SerTailRcv      EQU     $133
 
SerHeadXmit     EQU     $136
 
SerTailXmit     EQU     $138
 
SerRcvXon               EQU     $139
 
SerRcvXoff      EQU     $140
 
SerRcvBuf               EQU     $BFF000 ; 4kB serial recieve buffer
 
 
 
farflag EQU             $15F
farflag EQU             $15F
asmbuf  EQU             $160    ; to $17F
asmbuf  EQU             $160    ; to $17F
 
 
QNdx0           EQU             $780
QNdx0           EQU             $780
Line 138... Line 144...
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
BreakpointFlag  EQU             $810
NumSetBreakpoints       EQU     $811
NumSetBreakpoints       EQU     $811    ; to 812
Breakpoints                     EQU             $820    ; to $82F
Breakpoints                     EQU             $820    ; to $82F
BreakpointBytes EQU             $830    ; to $83F
BreakpointBytes EQU             $830    ; to $83F
mon_vectb                               EQU             $880
mon_vectb                               EQU             $880
 
 
; Register save area for monitor
; Register save area for monitor
Line 359... Line 365...
        ldb             #32                             ; number of bytes to zero out
        ldb             #32                             ; number of bytes to zero out
init1:
init1:
        clr             ,x+
        clr             ,x+
        decb
        decb
        bne             init1
        bne             init1
 
        ldx             #128                    ; register to start at
st1:
st1:
        clr             PIC,x                   ; cause code
        clr             PIC,x                   ; cause code
        sta             PIC+1,x
        sta             PIC+1,x
        stb             PIC+2,x
        stb             PIC+2,x
        leax    4,x
        leax    4,x
        cmpx    #256
        cmpx    #256                    ; max reg
        blo             st1
        blo             st1
        lda             #$81                    ; make irq edge sensitive
        lda             #$C1                    ; make irq edge sensitive (bit 7), enable interupt (bit 6), irq (bit 0)
        sta             PIC+$FD
        sta             PIC+$FD
        lda             #31                             ; enable timer interrupt
        lda             #$41                    ; level sensitive, enabled, irq
        sta             PIC+9
        sta             PIC+$D1         ; serial irq is #20
        lda             #COLS
        lda             #COLS
        sta             TEXTREG+TEXT_COLS
        sta             TEXTREG+TEXT_COLS
        lda             #ROWS
        lda             #ROWS
        sta             TEXTREG+TEXT_ROWS
        sta             TEXTREG+TEXT_ROWS
        bsr             ClearScreen
        bsr             ClearScreen
Line 807... Line 814...
;       accb = char to display
;       accb = char to display
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
;
;
DisplayChar:
DisplayChar:
        lbsr    SerialPutChar
        lbsr    SerialPutChar
 
ScreenDisplayChar:
        pshs    d,x
        pshs    d,x
        cmpb    #CR                                     ; carriage return ?
        cmpb    #CR                                     ; carriage return ?
        bne             dccr
        bne             dccr
        clr             CursorCol               ; just set cursor column to zero on a CR
        clr             CursorCol               ; just set cursor column to zero on a CR
        bsr             UpdateCursorPos
        bsr             UpdateCursorPos
Line 1093... Line 1101...
; Serial I/O
; Serial I/O
;==============================================================================
;==============================================================================
 
 
OPT INCLUDE "d:\cores2022\rf6809\software\boot\serial.asm"
OPT INCLUDE "d:\cores2022\rf6809\software\boot\serial.asm"
OPT INCLUDE "d:\cores2022\rf6809\software\boot\S19Loader.asm"
OPT INCLUDE "d:\cores2022\rf6809\software\boot\S19Loader.asm"
 
OPT INCLUDE "d:\cores2022\rf6809\software\boot\xmodem.asm"
 
 
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
; Check if there is a keyboard character available. If so return true (<0)
; Check if there is a keyboard character available. If so return true (<0)
; otherwise return false (0) in accb.
; otherwise return false (0) in accb.
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
Line 1114... Line 1123...
        bne             INCH2
        bne             INCH2
;       ldb             #$800                   ; block if no key available, get scancode directly
;       ldb             #$800                   ; block if no key available, get scancode directly
;       bra             GetKey
;       bra             GetKey
;       jsr             [CharInVec]     ; vector is being overwritten somehow
;       jsr             [CharInVec]     ; vector is being overwritten somehow
        lbsr    SerialPeekCharDirect
        lbsr    SerialPeekCharDirect
 
;       lbsr    SerialGetChar
        tsta
        tsta
        bmi             INCH1                   ; block if no key available
        bmi             INCH1                   ; block if no key available
        leas    1,s                             ; get rid of blocking status
        leas    1,s                             ; get rid of blocking status
        rts
        rts                                                     ; return character
INCH1:
INCH1:
        puls    b                                       ; check blocking status
        puls    b                                       ; check blocking status
        tstb
        tstb
        bmi     INCH                    ; if blocking, loop
        bmi     INCH                    ; if blocking, loop
        ldd             #-1                             ; return -1 if no char available
        ldd             #-1                             ; return -1 if no char available
Line 1291... Line 1301...
 
 
; Command Tables
; Command Tables
 
 
cmdTable1:
cmdTable1:
        fcb             '<','>'+$800
        fcb             '<','>'+$800
        fcb             'b','s'+$800
        fcb             'B','+'+$800
        fcb             'b','c'+$800
        fcb             'B','-'+$800
        fcb             'D','R'+$800
        fcb             'D','R'+$800
        fcb             'D'+$800
        fcb             'D'+$800
        fcb             ':'+$800
        fcb             ':'+$800
        fcb             "FI",'G'+$800
        fcb             "FI",'G'+$800
        fcb             "FI",'L'+$800
        fcb             "FI",'L'+$800
Line 1307... Line 1317...
        fcb             "TI",'R'+$800
        fcb             "TI",'R'+$800
        fcb             'U'+$800
        fcb             'U'+$800
        fcb             "exi",'t'+$800
        fcb             "exi",'t'+$800
        fcb             '?'+$800
        fcb             '?'+$800
        fcb             "CL",'S'+$800
        fcb             "CL",'S'+$800
        fcb             "S1",'9'+$800
        fcb             "C1",'9'+$800
        fcb             "JD",'4'+$800
        fcb             "JD",'4'+$800
 
        fcb             "XM",'R'+$800
 
        fcb             "XM",'S'+$800
 
        fcb             'R','A'+$800
 
        fcb             'R','B'+$800
 
        fcb             "RDP",'R'+$800
 
        fcb             'R','D'+$800
 
        fcb             'R','X'+$800
 
        fcb             'R','Y'+$800
 
        fcb             'R','U'+$800
 
        fcb             'R','S'+$800
 
        fcb             "RCC",'R'+$800
 
        fcb             "RP",'C'+$800
 
        fcb             'L','B'+$800
        fcw             0
        fcw             0
 
 
cmdTable2:
cmdTable2:
        fcw             Redirect
        fcw             Redirect
        fcw             MonArmBreakpoint
        fcw             MonArmBreakpoint
Line 1331... Line 1354...
        fcw             xitMonitor
        fcw             xitMonitor
        fcw             PromptHelp
        fcw             PromptHelp
        fcw             PromptClearscreen
        fcw             PromptClearscreen
        fcw             S19Loader
        fcw             S19Loader
        fcw             $FFD400
        fcw             $FFD400
 
        fcw             xm_ReceiveStart
 
        fcw             xm_SendStart
 
        fcw             SetRegA
 
        fcw             SetRegB
 
        fcw             SetRegDPR
 
        fcw             SetRegD
 
        fcw             SetRegX
 
        fcw             SetRegY
 
        fcw             SetRegU
 
        fcw             SetRegS
 
        fcw             SetRegCCR
 
        fcw             SetRegPC
 
        fcw             ListBreakpoints
 
 
CmdPrompt:
CmdPrompt:
        lbsr    CRLF
        lbsr    CRLF
        ldb             #'$'
        ldb             #'$'
        lbsr    OUTCH
        lbsr    OUTCH
Line 1342... Line 1378...
 
 
msgF09Starting:
msgF09Starting:
        fcb             "Femtiki F09 Multi-core OS Starting",CR,LF,0
        fcb             "Femtiki F09 Multi-core OS Starting",CR,LF,0
 
 
Monitor:
Monitor:
 
        andcc   #$EF                                    ; SWI disables interrupts, re-enable them
 
        lda             #31                                             ; Timer is IRQ #31
 
        sta             PIC+16                          ; register 16 is edge sense reset reg
        ldd             mon_init                        ; check special code to see if monitor has been initialized
        ldd             mon_init                        ; check special code to see if monitor has been initialized
        cmpd    #1234567
        cmpd    #1234567
        beq             mon1
        beq             mon1
        clr             BreakpointFlag
        clr             BreakpointFlag
        clr             NumSetBreakpoints
        clr             NumSetBreakpoints
Line 1391... Line 1430...
; 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
 
        tsta                                                    ; should not get this with blocking
 
        bmi             Prompt3
        cmpb    #CR                                     ; carriage return?
        cmpb    #CR                                     ; carriage return?
        beq             Prompt1
        beq             Prompt1
        lbsr    OUTCH                           ; spit out the character
        lbsr    OUTCH                           ; spit out the character
        bra             Prompt3                 ; and keep going
        bra             Prompt3                 ; and keep going
 
 
Line 1754... Line 1795...
        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     "b+ = set breakpoint",CR,LF
        fcb     "bc = clear breakpoint",CR,LF
        fcb     "b- = clear breakpoint",CR,LF
 
        fcb     "C19 = run C19 loader",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
Line 1770... Line 1812...
;       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
        fcb     "J = Jump to code",CR,LF
        fcb     "J = Jump to code",CR,LF
        fcb     "JD4 = Jump to $FFD400",CR,LF
        fcb     "JD4 = Jump to $FFD400",CR,LF
        fcb "RAMTEST = test RAM",CR,LF
        fcb     "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     "S19 = run S19 loader",CR,LF
 
        fcb     "SP = sprite demo",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
;       db      "P = Piano",CR,LF
 
        fcb     "XM = xmodem transfer",CR,LF
        fcb     "x = exit monitor",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 1873... Line 1914...
;
;
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
 
 
EditMemory:
EditMemory:
        ldu             #8                                              ; set max byte count
        ldu             #8                                              ; set max byte count
 
        lbsr    ignBlanks
        lbsr    GetHexNumber    ; get the start address
        lbsr    GetHexNumber    ; get the start address
        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
Line 1976... Line 2018...
        lbsr    HEX2
        lbsr    HEX2
        bsr             nXBLANK
        bsr             nXBLANK
        lbra    Monitor
        lbra    Monitor
 
 
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
 
; SetRegXXX
 
;
 
; Set the value to be loaded into a register.
 
;------------------------------------------------------------------------------
 
 
 
SetRegA:
 
        lbsr    ignBlanks
 
        lbsr    GetNumber
 
        lda             mon_numwka+3
 
        sta             mon_DSAVE
 
        lbra    Monitor
 
SetRegB:
 
        lbsr    ignBlanks
 
        lbsr    GetNumber
 
        lda             mon_numwka+3
 
        sta             mon_DSAVE+1
 
        lbra    Monitor
 
SetRegD:
 
        lbsr    ignBlanks
 
        lbsr    GetNumber
 
        ldd             mon_numwka+2
 
        std             mon_DSAVE
 
        lbra    Monitor
 
SetRegX:
 
        lbsr    ignBlanks
 
        lbsr    GetNumber
 
        ldd             mon_numwka+2
 
        std             mon_XSAVE
 
        lbra    Monitor
 
SetRegY:
 
        lbsr    ignBlanks
 
        lbsr    GetNumber
 
        ldd             mon_numwka+2
 
        std             mon_YSAVE
 
        lbra    Monitor
 
SetRegU:
 
        lbsr    ignBlanks
 
        lbsr    GetNumber
 
        ldd             mon_numwka+2
 
        std             mon_USAVE
 
        lbra    Monitor
 
SetRegS:
 
        lbsr    ignBlanks
 
        lbsr    GetNumber
 
        ldd             mon_numwka+2
 
        std             mon_SSAVE
 
        lbra    Monitor
 
SetRegDPR:
 
        lbsr    ignBlanks
 
        lbsr    GetNumber
 
        lda             mon_numwka+3
 
        sta             mon_DPRSAVE
 
        lbra    Monitor
 
SetRegCCR:
 
        lbsr    ignBlanks
 
        lbsr    GetNumber
 
        lda             mon_numwka+3
 
        sta             mon_CCRSAVE
 
        lbra    Monitor
 
SetRegPC:
 
        lbsr    ignBlanks
 
        lbsr    GetNumber
 
        ldd             mon_numwka+2
 
        std             mon_PCSAVE+2
 
        ldb             mon_numwka+1
 
        stb             mon_PCSAVE+1
 
        lbra    Monitor
 
 
 
;------------------------------------------------------------------------------
; Jump to code
; Jump to code
;
;
; Registers are loaded with values from the monitor register save area before
; Registers are loaded with values from the monitor register save area before
; the code is jumped to.
; the code is jumped to.
;
;
; J 
; J 
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
 
 
jump_to_code:
jump_to_code:
        bsr             GetNumber
        lbsr    ignBlanks
 
        lbsr    GetNumber
        sei
        sei
        lds             mon_SSAVE
        lds             mon_SSAVE
        ldd             #jtc_exit               ; setup stack for RTS back to monitor
        ldd             #jtc_exit               ; setup stack for RTS back to monitor
        pshs    d
        pshs    d
        ldb             #0
        ldb             #0
        pshs    b
        pshs    b
        ldd             mon_numwka+2    ; get the address parameter
 
        pshs    d
 
        ldb             mon_numwka+1
 
        pshs    b
 
        ldd             mon_USAVE
        ldd             mon_USAVE
        pshs    d
        pshs    d
        ldd             mon_YSAVE
        ldd             mon_YSAVE
        pshs    d
        pshs    d
        ldd             mon_XSAVE
        ldd             mon_XSAVE
Line 2008... Line 2116...
        pshs    a
        pshs    a
        ldd             mon_DSAVE
        ldd             mon_DSAVE
        pshs    d
        pshs    d
        lda             mon_CCRSAVE
        lda             mon_CCRSAVE
        pshs    a
        pshs    a
        puls    far ccr,d,dpr,x,y,u,pc
        puls    far ccr,d,dpr,x,y,u
 
        jmp             far [mon_numwka+1]
jtc_exit:
jtc_exit:
        sts             >mon_SSAVE              ; need to use extended addressing, no direct page setting
        sts             >mon_SSAVE              ; need to use extended addressing, no direct page setting
        leas    $6FFF                                   ; reset stack to system area, dont modify flags register!
        leas    $6FFF                                   ; reset stack to system area, dont modify flags register!
        pshs    ccr                                             ; now the stack can be used
        pshs    ccr                                             ; now the stack can be used
        pshs    a                                                       ; save acca register so we can use it
        pshs    a                                                       ; save acca register so we can use it
Line 2060... Line 2169...
bootpg:
bootpg:
        fcb             $000
        fcb             $000
boot_stack:
boot_stack:
        fcw             $FFC0FF
        fcw             $FFC0FF
numBreakpoints:
numBreakpoints:
        fcb             8
        fcw             8
mon_rom_vectab:
mon_rom_vectab:
        fcw             mon_rom_vecs
        fcw             mon_rom_vecs
mon_rom_vecs:
mon_rom_vecs:
        fcw             Monitor                                         ; enter monitor program
        fcw             Monitor                                         ; enter monitor program
        fcw             INCH                                                    ; input a character
        fcw             INCH                                                    ; input a character
Line 2077... Line 2186...
        fcw             mon_srand
        fcw             mon_srand
        fcw             mon_rand
        fcw             mon_rand
        fcw             0                                                                        ; operating system call
        fcw             0                                                                        ; operating system call
        fcw             GetRange
        fcw             GetRange
        fcw             GetNumber
        fcw             GetNumber
 
        fcw             SerialPutChar
 
 
NumFuncs        EQU     (*-mon_rom_vectab)/2
NumFuncs        EQU     (*-mon_rom_vectab)/2
 
 
; The following table indicates which routines need to return values in the
; The following table indicates which routines need to return values in the
; D and possibly X registers.
; D and possibly X registers.
Line 2097... Line 2207...
        fcb             0                        ; srand
        fcb             0                        ; srand
        fcb             $C00    ; rand
        fcb             $C00    ; rand
        fcb             $C00    ; OS call
        fcb             $C00    ; OS call
        fcb             0                        ; GetRange
        fcb             0                        ; GetRange
        fcb             $800    ; GetNumber
        fcb             $800    ; GetNumber
 
        fcb             0                        ; SerialPutChar
 
 
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
; SWI routine.
; SWI routine.
;
;
; SWI is used to call ROM monitor routines and process breakpoints.
; SWI is used to call ROM monitor routines and process breakpoints.
Line 2115... Line 2226...
swi_rout1:
swi_rout1:
        ldu             11,s                                            ; get program counter (low order 2 bytes)
        ldu             11,s                                            ; get program counter (low order 2 bytes)
        leau    -1,u                                            ; backup a byte
        leau    -1,u                                            ; backup a byte
        tst             BreakpointFlag  ; are we in breakpoint mode?
        tst             BreakpointFlag  ; are we in breakpoint mode?
        beq             swiNotBkpt
        beq             swiNotBkpt
        ldu             #Breakpoints
        ldy             #Breakpoints
        ldb             NumSetBreakpoints
        ldb             NumSetBreakpoints
        beq             swiNotBkpt
        beq             swiNotBkpt
swi_rout2:
swi_rout2:
        cmpu    ,y++
        cmpu    ,y++
        beq             processBreakpoint
        beq             processBreakpoint
Line 2159... Line 2270...
        bpl             swi_rout4
        bpl             swi_rout4
        stx             4,s                                                     ; return value in X
        stx             4,s                                                     ; return value in X
swi_rout4:
swi_rout4:
        rti
        rti
 
 
 
;------------------------------------------------------------------------------
 
; A breakpoint was struck during program execution, process accordingly.
 
;------------------------------------------------------------------------------
 
 
processBreakpoint:
processBreakpoint:
        lda             ,s
        lda             ,s
        sta             mon_CCRSAVE
        sta             mon_CCRSAVE
        ldd             1,s
        ldd             1,s
        std             mon_DSAVE
        std             mon_DSAVE
Line 2173... Line 2288...
        ldd             6,s
        ldd             6,s
        std             mon_YSAVE
        std             mon_YSAVE
        ldd             8,s
        ldd             8,s
        std             mon_USAVE
        std             mon_USAVE
        sts             mon_SSAVE
        sts             mon_SSAVE
 
        ldb             10,s
 
        stb             mon_PCSAVE
        ldd             11,s
        ldd             11,s
        std             mon_PCSAVE
        std             mon_PCSAVE+1
        lds             boot_stack,pcr
        lds             boot_stack,pcr
        ldd             #swi_rout3                      ; setup so monitor can return
        ldd             #swi_rout3                      ; setup so monitor can return
        pshs    d
        pshs    d
        bsr             DisarmAllBreakpoints
        bsr             DisarmAllBreakpoints
        lbra    DumpRegs
        lbra    DumpRegs
 
 
xitMonitor:
xitMonitor:
        bra             ArmAllBreakpoints
        bra             ArmAllBreakpoints
 
 
 
;------------------------------------------------------------------------------
 
;------------------------------------------------------------------------------
 
 
swiCallOS:
swiCallOS:
        leau    1,u                                                     ; next byte is func number
        leau    1,u                                                     ; next byte is func number
        ldb             ,u+
        ldb             ,u+
        cmpb    #NumOSFuncs                     ; check for valid range
        cmpb    #NumOSFuncs                     ; check for valid range
        lbhi    DisplayErr
        lbhi    DisplayErr
Line 2202... Line 2322...
        jsr             [b,x]                                           ; call the OS routine
        jsr             [b,x]                                           ; call the OS routine
oscx:
oscx:
        clr             OSSEMA+1
        clr             OSSEMA+1
        bra             swi_rout3
        bra             swi_rout3
 
 
 
;------------------------------------------------------------------------------
 
; DisarmAllBreakpoints, used when entering the monitor.
 
;------------------------------------------------------------------------------
 
 
DisarmAllBreakpoints:
DisarmAllBreakpoints:
        pshs    d,x,y
        pshs    d,x,y
        ldy             #0
        ldy             #0
        clrb
        clrb
        ldx             #BreakpointBytes        ; x = breakpoint byte table address
        ldx             #BreakpointBytes        ; x = breakpoint byte table address
Line 2220... Line 2344...
        incb                                                                            ; increment to next byte
        incb                                                                            ; increment to next byte
        bra             disarm2                                         ; loop back
        bra             disarm2                                         ; loop back
disarm1:
disarm1:
        puls    d,x,y,pc
        puls    d,x,y,pc
 
 
 
;------------------------------------------------------------------------------
 
;------------------------------------------------------------------------------
 
 
ArmAllBreakpoints:
ArmAllBreakpoints:
        pshs    d,x,y
        pshs    d,x,y
        ldy             #0
        ldy             #0
        clrb
        clrb
        ldx             #BreakpointBytes        ; x = breakpoint byte table address
        ldx             #BreakpointBytes        ; x = breakpoint byte table address
Line 2238... Line 2365...
        incb                                                                            ; increment to next byte
        incb                                                                            ; increment to next byte
        bra             arm2                                                    ; loop back
        bra             arm2                                                    ; loop back
arm1:
arm1:
        puls    d,x,y,pc
        puls    d,x,y,pc
 
 
 
;------------------------------------------------------------------------------
 
;------------------------------------------------------------------------------
 
 
ArmBreakpoint:
ArmBreakpoint:
        pshs    d,x,y
        pshs    d,x,y
        lda             NumSetBreakpoints               ; check if too many breakpoints set
        lda             NumSetBreakpoints               ; check if too many breakpoints set
        cmpa    numBreakpoints
        cmpa    numBreakpoints
        lbhs    DisplayErr
        lbhs    DisplayErr
 
        lbsr    ignBlanks
        lbsr    GetHexNumber                            ; get address parameter
        lbsr    GetHexNumber                            ; get address parameter
 
        tstb
 
        lbmi    DisplayErr
        ldb             NumSetBreakpoints               ; bv= number of set breakpoints
        ldb             NumSetBreakpoints               ; bv= number of set breakpoints
        ldy             mon_numwka+2                            ; get address
        ldy             mon_numwka+2                            ; get address
        lda             ,y                                                                      ; get byte at address
        lda             ,y                                                                      ; get byte at address
        ldx             #BreakpointBytes                ; and store byte in a table
        ldx             #BreakpointBytes                ; and store byte in a table
        sta             b,x                                                                     ; record
        sta             b,x                                                                     ; record
Line 2257... Line 2390...
        aslb                                                                                    ; index for 2 byte values
        aslb                                                                                    ; index for 2 byte values
        sty             b,x
        sty             b,x
        lsrb                                                                                    ; size back to single byte
        lsrb                                                                                    ; size back to single byte
        incb
        incb
        stb             NumSetBreakpoints
        stb             NumSetBreakpoints
        puls    d,x,y,pc
        puls    d,x,y
 
        lbra    Monitor
 
 
 
;------------------------------------------------------------------------------
 
;------------------------------------------------------------------------------
 
 
DisarmBreakpoint:
DisarmBreakpoint:
        pshs    d,x,y,u
        pshs    d,x,y,u
 
        lbsr    ignBlanks
        lbsr    GetHexNumber
        lbsr    GetHexNumber
 
        tstb
 
        lbmi    Monitor
        clrb
        clrb
        clrb
        clrb
        tfr             d,x                                                                     ; x = zero too
        tfr             d,x                                                                     ; x = zero too
disarm6:
disarm6:
        cmpb    numBreakpoints                  ; no more than this many may be set
        cmpb    numBreakpoints                  ; no more than this many may be set
Line 2305... Line 2445...
disarm3:
disarm3:
        leax    2,x
        leax    2,x
        incb
        incb
        bra             disarm6
        bra             disarm6
disarm4:
disarm4:
        puls    d,x,y,u,pc
        puls    d,x,y,u
 
        lbra    Monitor
 
 
 
;------------------------------------------------------------------------------
 
;------------------------------------------------------------------------------
 
 
 
ListBreakpoints:
 
        pshs    d,x
 
        swi
 
        fcb             MF_CRLF
 
        ldx             #0
 
        ldb             #0
 
lbrk1:
 
        cmpb    numBreakpoints
 
        bhs             lbrk2
 
        cmpb    NumSetBreakpoints
 
        bhs             lbrk2
 
        ldd             Breakpoints,x
 
        leax    2,x
 
        incb
 
        pshs    b
 
        swi
 
        fcb             MF_DisplayWordAsHex
 
        swi
 
        fcb             MF_CRLF
 
        puls    b
 
        bra             lbrk1
 
lbrk2:
 
        puls    d,x
 
        lbra    Monitor
 
 
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
swi3_rout:
swi3_rout:
        sei
        sei
Line 2342... Line 2511...
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
firq_rout:
firq_rout:
        rti
        rti
 
 
irq_rout:
irq_rout:
 
        clra
 
        tfr             a,dpr
 
        setdp   $000
;       lbsr    SerialIRQ       ; check for recieved character
;       lbsr    SerialIRQ       ; check for recieved character
        lbsr    TimerIRQ
        lbsr    TimerIRQ
 
 
        ; Reset the edge sense circuit in the PIC
 
;       lda             #31                                                     ; Timer is IRQ #31
 
;       sta             IrqSource               ; stuff a byte indicating the IRQ source for PEEK()
 
;       sta             PIC+16                                  ; register 16 is edge sense reset reg
 
;       lda             VIA+VIA_IFR
 
;       bpl             notTimerIRQ2
 
;       bita    #$800
 
;       beq             notTimerIRQ2
 
;       clr             VIA+VIA_T3LL
 
;       clr             VIA+VIA_T3LH
 
;       inc             $E00037                                 ; update timer IRQ screen flag
 
;notTimerIRQ2:
 
 
 
        lda             IrqBase                 ; get the IRQ flag byte
        lda             IrqBase                 ; get the IRQ flag byte
        lsra
        lsra
        ora             IrqBase
        ora             IrqBase
        anda    #$FE0
        anda    #$FE0
        sta             IrqBase
        sta             IrqBase
 
 
;       inc             TEXTSCR+54              ; update IRQ live indicator on screen
;       inc             TEXTSCR+54              ; update IRQ live indicator on screen
 
;       inc             TEXTSCR+$2000+54
 
 
        ; flash the cursor
        ; flash the cursor
        ; only bother to flash the cursor for the task with the IO focus.
        ; only bother to flash the cursor for the task with the IO focus.
;       lda             COREID
        lda             COREID
;       cmpa    IOFocusID
        cmpa    IOFocusID
;       bne             tr1a
        bne             tr1a
;       lda             CursorFlash             ; test if we want a flashing cursor
        lda             CursorFlash             ; test if we want a flashing cursor
;       beq             tr1a
        beq             tr1a
;       lbsr    CalcScreenLoc   ; compute cursor location in memory
        lbsr    CalcScreenLoc   ; compute cursor location in memory
;       tfr             d,y
        tfr             d,y
;       lda             $2000,y                 ; get color code $2000 higher in memory
        inc             $2000,y                 ; get color code $2000 higher in memory
;       ldb             IRQFlag                 ; get counter
 
;       lsrb
 
;       lsra
 
;       lsra
 
;       lsra
 
;       lsra
 
;       lsrb
 
;       rola
 
;       lsrb
 
;       rola
 
;       lsrb
 
;       rola
 
;       lsrb
 
;       rola
 
;       sta             $E00000,y               ; store the color code back to memory
 
tr1a:
tr1a:
        rti
        rti
 
 
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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