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

Subversion Repositories rf6809

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

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

Rev 15 Rev 16
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
 
; 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
CharColor       EQU             $112
CharColor       EQU             $112
Line 156... Line 157...
 
 
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
jmpvec          EQU             $928
 
mon_init        EQU             $92C
 
mon_retflag     EQU     $930
 
 
; 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 241... Line 244...
        sta             LEDS
        sta             LEDS
        jmp             ,u
        jmp             ,u
ramerr:
ramerr:
        lda             #$80
        lda             #$80
        sta             LEDS
        sta             LEDS
        ldx             #TEXTSCR
 
        ldb             COREID
        ldb             COREID
 
        cmpb    #$20
 
        beq             ramerr1
 
        ldx             #TEXTSCR
        abx
        abx
        lda             #'F'
        lda             #'F'
        sta             ,x
        sta             ,x
        sync
        sync
 
ramerr1:
        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
Line 329... Line 290...
        sta             LEDS
        sta             LEDS
        lda             #1                              ; prime OS semaphore
        lda             #1                              ; prime OS semaphore
        sta             OSSEMA+$1000
        sta             OSSEMA+$1000
        sta             OUTSEMA+$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
        cmpa    #FIRST_CORE
        cmpa    #FIRST_CORE
;       beq             st8
;       beq             st8
Line 348... Line 309...
        bsr             Delay3s         ; give some time for devices to reset
        bsr             Delay3s         ; give some time for devices to reset
        clr             BreakpointFlag
        clr             BreakpointFlag
        clr             NumSetBreakpoints
        clr             NumSetBreakpoints
        lda             #$AA
        lda             #$AA
        sta             LEDS
        sta             LEDS
 
        lda             COREID
 
        cmpa    #$20
 
        beq             st11
        lda             #FIRST_CORE
        lda             #FIRST_CORE
 
st11:
        sta             IOFocusID       ; core #2 has focus
        sta             IOFocusID       ; core #2 has focus
        sta             RunningID
        sta             RunningID
        ; Clear IO focus list
        ; Clear IO focus list
        ldx             #0
        ldx             #0
st9:
st9:
Line 375... Line 340...
;       fcb             MF_OSCALL
;       fcb             MF_OSCALL
;       fcb             24                                      ; request IO focus
;       fcb             24                                      ; request IO focus
        ldb             COREID
        ldb             COREID
        cmpb    #FIRST_CORE
        cmpb    #FIRST_CORE
        beq             init
        beq             init
 
        cmpb    #$20                            ; CmodA709 core?
 
        beq             init2
        bra             skip_init
        bra             skip_init
        bra             multi_sieve
        bra             multi_sieve
st3:
st3:
        lda             #$FF
        lda             #$FF
        sta             LEDS
        sta             LEDS
Line 392... Line 359...
        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
        lbsr    TimerInit
 
        lbsr    InitSerial
 
        ldx             #128
 
        lda             #1                      ; set irq(bit0), clear firq (bit1), disable int (bit 6), clear edge sense(bit 7)
 
        ldb             #FIRST_CORE                     ; serving core id
 
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
        blo             st1
        blo             st1
;       lda             #4                              ; make the timer interrupt edge sensitive
 
;       sta             PIC+4                   ; reg #4 is the edge sensitivity setting
 
;       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
 
        stb             OUTSEMA+SEMAABS ; set semaphore to 1 available slot
 
skip_init:
 
        andcc   #$EF                    ; unmask irq
 
        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
        bsr             HomeCursor
        bsr             HomeCursor
        lda             #5
 
        sta             LEDS
 
        ldd             #msgStartup
 
        bsr             DisplayString
 
        ldx             #0
        ldx             #0
        ldd             #0
        ldd             #0
        lbsr    ShowSprites
        lbsr    ShowSprites
        lbsr    KeybdInit
        lbsr    KeybdInit
        ldd             KeybdID
        ldd             KeybdID
        bsr             DispWordAsHex
        bsr             DispWordAsHex
        jmp             MonitorStart
init2:
 
        lbsr    TimerInit
 
        lbsr    InitSerial
 
        ldx             #128
 
        lda             #1                      ; set irq(bit0), clear firq (bit1), disable int (bit 6), clear edge sense(bit 7)
 
        ldb             #FIRST_CORE                     ; serving core id
 
;       lda             #4                              ; make the timer interrupt edge sensitive
 
;       sta             PIC+4                   ; reg #4 is the edge sensitivity setting
 
;       sta             PIC                             ; reg #0 is interrupt enable
 
        ldb             #1
 
        stb             OUTSEMA+SEMAABS ; set semaphore to 1 available slot
 
skip_init:
 
        andcc   #$EF                    ; unmask irq
 
        lda             #5
 
        sta             LEDS
 
        ldd             #msgStartup
 
        bsr             DisplayString
 
st10:
 
        swi
 
        fcb             MF_Monitor
 
        bra             st10
 
 
msgStartup
msgStartup
        fcb             "rf6809 12-bit System Starting.",CR,LF,0
        fcb             "rf6809 12-bit System Starting.",CR,LF,0
 
 
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
Line 737... Line 708...
 
 
GetScreenLocation:
GetScreenLocation:
        lda             COREID                  ; which core are we?
        lda             COREID                  ; which core are we?
        cmpa    IOFocusID               ; do we have the IO focus
        cmpa    IOFocusID               ; do we have the IO focus
        bne             gsl1                            ; no, go pick virtual screen address
        bne             gsl1                            ; no, go pick virtual screen address
 
        cmpa    #$20                            ; CmodA709?
 
        beq             gsl1
        ldd             #TEXTSCR                ; yes, we update the real screen
        ldd             #TEXTSCR                ; yes, we update the real screen
        rts
        rts
gsl1:
gsl1:
        ldd             #$7800
        ldd             #$7800
        rts
        rts
Line 758... Line 731...
        clr             CursorRow
        clr             CursorRow
        clr             CursorCol
        clr             CursorCol
        ldb             COREID
        ldb             COREID
        cmpb    IOFocusID
        cmpb    IOFocusID
        bne             hc1
        bne             hc1
 
        cmpb    #$20
 
        beq             hc1
        clra
        clra
        sta             TEXTREG+TEXT_CURPOS
        sta             TEXTREG+TEXT_CURPOS
hc1:
hc1:
        puls    d,x,pc
        puls    d,x,pc
 
 
Line 776... Line 751...
UpdateCursorPos:
UpdateCursorPos:
        pshs    d,x
        pshs    d,x
        ldb             COREID                          ; update cursor position in text controller
        ldb             COREID                          ; update cursor position in text controller
        cmpb    IOFocusID                       ; only for the task with the output focus
        cmpb    IOFocusID                       ; only for the task with the output focus
        bne             ucp1
        bne             ucp1
 
        cmpb    #$20                                    ; and not for CmodA709
 
        beq             ucp1
        lda             CursorRow
        lda             CursorRow
        anda    #$3F                                    ; limit of 63 rows
        anda    #$3F                                    ; limit of 63 rows
        ldb             TEXTREG+TEXT_COLS
        ldb             TEXTREG+TEXT_COLS
        mul
        mul
        tfr             d,x
        tfr             d,x
Line 808... Line 785...
        ldb             CursorCol
        ldb             CursorCol
        abx
        abx
        ldb             COREID                          ; update cursor position in text controller
        ldb             COREID                          ; update cursor position in text controller
        cmpb    IOFocusID                       ; only for the task with the output focus
        cmpb    IOFocusID                       ; only for the task with the output focus
        bne             csl1
        bne             csl1
 
        cmpb    #$20
 
        beq             csl1
        stx             TEXTREG+TEXT_CURPOS
        stx             TEXTREG+TEXT_CURPOS
csl1:
csl1:
        bsr             GetScreenLocation
        bsr             GetScreenLocation
        leax    d,x
        leax    d,x
        tfr             x,d
        tfr             x,d
Line 970... Line 949...
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
;
;
DisplayString:
DisplayString:
        pshs    d,x
        pshs    d,x
        tfr             d,x
        tfr             d,x
 
        lda             COREID
 
        cmpa    #$20
 
        beq             dspj1B
dspj2:                                          ; lock semaphore for access
dspj2:                                          ; lock semaphore for access
        lda             OUTSEMA+1
        lda             OUTSEMA+1
        beq             dspj2
        beq             dspj2
dspj1B:
dspj1B:
        ldb             ,x+                             ; move string char into acc
        ldb             ,x+                             ; move string char into acc
Line 1110... Line 1092...
;==============================================================================
;==============================================================================
; 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"
 
 
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
; 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 1324... Line 1307...
        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             "JD",'4'+$800
        fcw             0
        fcw             0
 
 
cmdTable2:
cmdTable2:
        fcw             Redirect
        fcw             Redirect
        fcw             ArmBreakpoint
        fcw             MonArmBreakpoint
        fcw             DisarmBreakpoint
        fcw             MonDisarmBreakpoint
        fcw             DumpRegs
        fcw             DumpRegs
        fcw             DumpMemory
        fcw             DumpMemory
        fcw             EditMemory
        fcw             EditMemory
        fcw             $FE0000                                 ; FIG forth
        fcw             $FE0000                                 ; FIG forth
        fcw             FillMemory
        fcw             FillMemory
        fcw             DumpIOFocusList
        fcw             DumpIOFocusList
        fcw             jump_to_code
        fcw             jump_to_code
        fcw             dramtest
        fcw             $FFD400
        fcw             $FF8000                                 ; sprite demo
        fcw             $FF8000                                 ; sprite demo
        fcw             rtc_read
        fcw             rtc_read
        fcw             $FF8003                                 ; unassembler
        fcw             $FF8003                                 ; unassembler
        fcw             xitMonitor
        fcw             xitMonitor
        fcw             PromptHelp
        fcw             PromptHelp
        fcw             PromptClearscreen
        fcw             PromptClearscreen
 
        fcw             S19Loader
 
        fcw             $FFD400
 
 
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:
Monitor:
 
        ldd             mon_init                        ; check special code to see if monitor has been initialized
 
        cmpd    #1234567
 
        beq             mon1
        clr             BreakpointFlag
        clr             BreakpointFlag
        clr             NumSetBreakpoints
        clr             NumSetBreakpoints
        ldd             #123
        ldd             #123
        ldx             #654
        ldx             #654
        lbsr    mon_srand
        lbsr    mon_srand
Line 1379... Line 1369...
        ldd             #Monitor
        ldd             #Monitor
        std             mon_PCSAVE+1
        std             mon_PCSAVE+1
        clr             mon_XSAVE
        clr             mon_XSAVE
        clr             mon_YSAVE
        clr             mon_YSAVE
        clr             mon_USAVE
        clr             mon_USAVE
Monitor:
        ldd             #1234567
 
        std             mon_init
 
mon1:
        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
        ldd             #SerialPeekCharDirect
        ldd             #SerialPeekCharDirect
Line 1487... Line 1479...
        bsr             MonGetCh
        bsr             MonGetCh
        cmpb    #' '
        cmpb    #' '
        beq             MonGetNonSpace
        beq             MonGetNonSpace
        rts
        rts
 
 
 
MonArmBreakpoint:
 
        lbsr    ArmBreakpoint
 
        ldb             #$FFF
 
        stb             BreakpointFlag
 
        lbra    Monitor
 
MonDisarmBreakpoint:
 
        lbsr    DisarmBreakpoint
 
        lbra    Monitor
 
 
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
; Ignore blanks in the input
; Ignore blanks in the input
; Y = text pointer
; Y = text pointer
; D destroyed
; D destroyed
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
Line 1505... Line 1506...
 
 
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
; Multiply number in work area by 10.
; Multiply number in work area by 10.
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
Times10:
Times10:
 
        pshs    d
        ldd             mon_numwka              ; make a copy of the number
        ldd             mon_numwka              ; make a copy of the number
        std             mon_numwka+8
        std             mon_numwka+8
        ldd             mon_numwka+2
        ldd             mon_numwka+2
        std             mon_numwka+10
        std             mon_numwka+10
        asl             mon_numwka+3    ; shift left = *2
        bsr             shl_numwka              ; shift left = *2
        rol             mon_numwka+2
        bsr             shl_numwka              ; shift left = *4
        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
        ldd             mon_numwka+2    ; add in original value
        addd    mon_numwka+10   ; = *5
        addd    mon_numwka+10   ; = *5
        ldb             mon_numwka+1
        ldb             mon_numwka+1
        adcb    mon_numwka+9
        adcb    mon_numwka+9
        stb             mon_numwka+1
        stb             mon_numwka+1
        lda             mon_numwka+0
        lda             mon_numwka+0
        adca    mon_numwka+8
        adca    mon_numwka+8
        sta             mon_numwka+0
        sta             mon_numwka+0
        asl             mon_numwka+3    ; shift left = * 10
        bsr             shl_numwka              ; shift left = * 10
        rol             mon_numwka+2
        puls    d,pc
        rol             mon_numwka+1
 
        rol             mon_numwka+0
 
        rts
 
 
 
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
GetTwoParams:
GetTwoParams:
        bsr             ignBlanks
        bsr             ignBlanks
        bsr             GetHexNumber    ; get start address of dump
        bsr             GetNumber                       ; get start address of dump
        ldd             mon_numwka
        ldd             mon_numwka
        std             mon_r1
        std             mon_r1
        ldd             mon_numwka+2
        ldd             mon_numwka+2
        std             mon_r1+2
        std             mon_r1+2
        bsr             ignBlanks
        bsr             ignBlanks
        bsr             GetHexNumber    ; get end address of dump
        bsr             GetNumber                       ; get end address of dump
        ldd             mon_numwka
        ldd             mon_numwka
        std             mon_r2
        std             mon_r2
        ldd             mon_numwka+2
        ldd             mon_numwka+2
        std             mon_r2+2
        std             mon_r2+2
        rts
        rts
Line 1605... Line 1598...
        blo             gthxn2
        blo             gthxn2
gthxn1:
gthxn1:
        tfr             x,d
        tfr             x,d
        puls    x,pc
        puls    x,pc
 
 
;GetDecNumber:
GetBinNumber:
 
        clrd
 
        std             mon_numwka
 
        std             mon_numwka+2
 
        pshs    x
 
        ldx             #0
 
gtbin2:
 
        bsr             MonGetch
 
        bsr             AsciiToBinDigit
 
        tstb
 
        bmi             gtbin1
 
        bsr             shl_numwka
 
        orb             mon_numwka+3
 
        stb             mon_numwka+3
 
        inx
 
        cpx             #48
 
        blo             gtbin2
 
gtbin1:
 
        tfr             x,d
 
        puls    x,pc
 
 
 
GetDecNumber:
 
        clrd
 
        std             mon_numwka
 
        std             mon_numwka+2
 
        pshs    x
 
        ldx             #0
 
gtdec2:
 
        bsr             MonGetch
 
        bsr             AsciiToDecDigit
 
        tstb
 
        bmi             gtdec1
 
        bsr             Times10
 
        addb    mon_numwka+3
 
        stb             mon_numwka+3
 
        ldb             mon_numwka+2
 
        adcb    #0
 
        stb             mon_numwka+2
 
        ldb             mon_numwka+1
 
        adcb    #0
 
        stb             mon_numwka+1
 
        ldb             mon_numwka+0
 
        adcb    #0
 
        stb             mon_numwka+0
 
        inx
 
        cpx             #15
 
        blo             gtdec2
 
gtdec1:
 
        tfr             x,d
 
        puls    x,pc
 
 
 
GetNumber:
 
        bsr             MonGetch
 
        cmpb    #'+'
 
        beq             GetDecNumber
 
        cmpb    #'%'
 
        beq             GetBinNumber
 
        dey
 
        bra             GetHexNumber
 
 
;       phx
;       phx
;       push    r4
;       push    r4
;       push    r5
;       push    r5
;       ldx             #0
;       ldx             #0
;       ld              r4,#10
;       ld              r4,#10
Line 1660... Line 1712...
        rts
        rts
gthx3:
gthx3:
        ldb             #-1             ; not a hex number
        ldb             #-1             ; not a hex number
        rts
        rts
 
 
AsciiToDecNybble:
AsciiToDecDigit:
        cmpb    #'0'
        cmpb    #'0'
        bcc             gtdc3
        blo             gtdc3
        cmpb    #'9'+1
        cmpb    #'9'
        bcs             gtdc3
        bhi             gtdc3
        subb    #'0'
        subb    #'0'
        rts
        rts
gtdc3:
gtdc3:
        ldb             #-1
        ldb             #-1
        rts
        rts
 
 
 
AsciiToBinDigit:
 
        cmpb    #'0'
 
        bne             abd1
 
        clrb
 
        rts
 
abd1:
 
        cmpb    #'1'
 
        bne             abd2
 
        ldb             #1
 
        rts
 
abd2:
 
        ldb             #-1
 
        rts
 
 
DisplayErr:
DisplayErr:
        ldd             #msgErr
        ldd             #msgErr
        lbsr    DisplayString
        lbsr    DisplayString
        jmp             Monitor
        jmp             Monitor
 
 
Line 1698... Line 1764...
;       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
        fcb     "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
        fcb     "J = Jump to code",CR,LF
        fcb     "J = Jump to code",CR,LF
        fcb "RAM = test RAM",CR,LF
        fcb     "JD4 = Jump to $FFD400",CR,LF
 
        fcb "RAMTEST = 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     "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
Line 1917... Line 1985...
;
;
; J 
; J 
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
 
 
jump_to_code:
jump_to_code:
        bsr             GetHexNumber
        bsr             GetNumber
        sei
        sei
        lds             mon_SSAVE
        lds             mon_SSAVE
        ldd             #
        ldd             #jtc_exit               ; setup stack for RTS back to monitor
        pshs    d
        pshs    d
        ldb             #>jtc_exit
        ldb             #0
        pshs    b
        pshs    b
        ldd             mon_numwka+2    ; get the address parameter
        ldd             mon_numwka+2    ; get the address parameter
        pshs    d
        pshs    d
        ldb             mon_numwka+1
        ldb             mon_numwka+1
        pshs    b
        pshs    b
Line 1990... Line 2058...
        lbra    Monitor
        lbra    Monitor
 
 
bootpg:
bootpg:
        fcb             $000
        fcb             $000
boot_stack:
boot_stack:
        fcw             $006FFF
        fcw             $FFC0FF
numBreakpoints:
numBreakpoints:
        fcb             8
        fcb             8
mon_rom_vectab:
mon_rom_vectab:
        fcw             mon_rom_vecs
        fcw             mon_rom_vecs
mon_rom_vecs:
mon_rom_vecs:
Line 2008... Line 2076...
        fcw             ShowSprites
        fcw             ShowSprites
        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
 
 
NumFuncs        EQU     (*-mon_rom_vectab)/2
NumFuncs        EQU     (*-mon_rom_vectab)/2
 
 
 
; The following table indicates which routines need to return values in the
 
; D and possibly X registers.
 
 
 
mon_rettab:
 
        fcb             0                        ; monitor
 
        fcb             $800    ; INCH
 
        fcb             0                        ; OUTCH
 
        fcb             0                        ; CRLF
 
        fcb             0                        ; DisplayString
 
        fcb             0                        ; DisplayByte
 
        fcb             0                        ; DisplayWord
 
        fcb             0                        ; show sprites
 
        fcb             0                        ; srand
 
        fcb             $C00    ; rand
 
        fcb             $C00    ; OS call
 
        fcb             0                        ; GetRange
 
        fcb             $800    ; GetNumber
 
 
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
; 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 2049... Line 2136...
        aslb                                                                    ; 2 bytes per vector
        aslb                                                                    ; 2 bytes per vector
        ldx             mon_rom_vectab,pcr
        ldx             mon_rom_vectab,pcr
        abx
        abx
        ldx             ,x
        ldx             ,x
        stx             jmpvec
        stx             jmpvec
 
        lsrb
 
        ldx             #mon_rettab
 
        abx
 
        ldb             ,x
 
        stb             mon_retflag
        sts             mon_SSAVE                               ; save the stack pointer
        sts             mon_SSAVE                               ; save the stack pointer
        ldd             1,s                                                     ; get back D
        ldd             1,s                                                     ; get back D
        ldx             4,s                                                     ; get back X
        ldx             4,s                                                     ; get back X
        ldy             6,s                                                     ; get back Y
        ldy             6,s                                                     ; get back Y
        ldu             8,s                                                     ; get back U
        ldu             8,s                                                     ; get back U
        lds             boot_stack,pcr  ; and use our own stack
        lds             boot_stack,pcr  ; and use our own stack
        jsr             [jmpvec]                                ; call the routine
        jsr             [jmpvec]                                ; call the routine
swi_rout3:
swi_rout3:
        lds             mon_SSAVE                               ; restore stack
        lds             mon_SSAVE                               ; restore stack
 
        tst             mon_retflag
 
        bpl             swi_rout4
 
        std             1,s                                                     ; return value in D
 
        asl             mon_retflag
 
        bpl             swi_rout4
 
        stx             4,s                                                     ; return value in X
 
swi_rout4:
        rti
        rti
 
 
processBreakpoint:
processBreakpoint:
        lda             ,s
        lda             ,s
        sta             mon_CCRSAVE
        sta             mon_CCRSAVE
Line 2083... Line 2182...
        pshs    d
        pshs    d
        bsr             DisarmAllBreakpoints
        bsr             DisarmAllBreakpoints
        lbra    DumpRegs
        lbra    DumpRegs
 
 
xitMonitor:
xitMonitor:
        bsr             ArmAllBreakpoints
        bra             ArmAllBreakpoints
        rts
 
 
 
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
Line 2150... Line 2248...
        lbsr    GetHexNumber                            ; get address parameter
        lbsr    GetHexNumber                            ; get address parameter
        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
        lda             #OPC_SWI                                                ; put a SWI instruction in place
        lda             #OPC_SWI                                                ; put a SWI instruction in place
        sta             ,y
        sta             ,y
        sta             b,x
 
        ldx             #Breakpoints                            ; also store the address in a table
        ldx             #Breakpoints                            ; also store the address in a table
        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

powered by: WebSVN 2.1.0

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