some work on BASIC/KERNAL side of the monitor

This commit is contained in:
FeralChild64 committed 2020-12-14 15:54:39 +01:00
1 parent 688213032e
commit 62e4acdc89
11 files changed
+90 -45

No files matched your search

+1
View File
@@ -407,6 +407,7 @@ Note: this is likely to change in the future, possibly in an incompatible way!
| Address | Name | Status | Remarks | | Address | Name | Status | Remarks |
| :-------: | :------- | :------: | :--------------------------------------------------------------------: | | :-------: | :------- | :------: | :--------------------------------------------------------------------: |
| ? | MONITOR | WIP | launches a machine language monitor |
| ? | PRHEX | DONE | print hex value from .A | | ? | PRHEX | DONE | print hex value from .A |
| `$FF7D` | PRIMM | DONE | print immediate, address compatible with C128 and C65 ROMs | | `$FF7D` | PRIMM | DONE | print immediate, address compatible with C128 and C65 ROMs |
| `$FFF8` | | DONE | reset vector for usage within hypervisor, starts in legacy mode | | `$FFF8` | | DONE | reset vector for usage within hypervisor, starts in legacy mode |
+4
View File
@@ -98,6 +98,10 @@ Displays BASIC memory usage information:
* `STRS` - bytes occupied by strings, also the ones belonging to arrays * `STRS` - bytes occupied by strings, also the ones belonging to arrays
* `FREE` - unused space * `FREE` - unused space
### `MONITOR` (MEGA65)
Invokes a machine language monitor
### `SYSINFO` (MEGA65) ### `SYSINFO` (MEGA65)
Displays various system information. Displays various system information.
+1
View File
@@ -19,6 +19,7 @@
;; #ALIAS# printf = KERNAL_0.printf ;; #ALIAS# printf = KERNAL_0.printf
;; #ALIAS# PRIMM = KERNAL_0.PRIMM ;; #ALIAS# PRIMM = KERNAL_0.PRIMM
;; #ALIAS# MONITOR = KERNAL_0.MONITOR
;; #ALIAS# plot_set = KERNAL_0.plot_set ;; #ALIAS# plot_set = KERNAL_0.plot_set
;; #ALIAS# print_hex_byte = KERNAL_0.print_hex_byte ;; #ALIAS# print_hex_byte = KERNAL_0.print_hex_byte
+1 -3
View File
@@ -7,9 +7,7 @@ cmd_old:
; First make sure we are in direct mode ; First make sure we are in direct mode
ldx CURLIN+1 jsr helper_ensure_direct_mode
inx
+bne do_DIRECT_MODE_ONLY_error
; Now try to restore program linkage and VARTAB ; Now try to restore program linkage and VARTAB
@@ -0,0 +1,12 @@
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# * BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
helper_ensure_direct_mode:
ldx CURLIN+1
inx
+bne do_DIRECT_MODE_ONLY_error
rts
+3 -2
View File
@@ -4,6 +4,7 @@
cmd_monitor: cmd_monitor:
; XXX implement this jsr helper_ensure_native_mode
jsr helper_ensure_direct_mode
jmp do_NOT_IMPLEMENTED_error jmp MONITOR
+1 -1
View File
@@ -23,6 +23,6 @@ map_BASIC_1:
taz taz
lda #$20 lda #$20
ldx #$C2 ; $4000 <- map 16KB from $22000 ldx #$C2 ; $4000 <- map 16KB from $26000
jmp map_end jmp map_end
+20 -2
View File
@@ -62,7 +62,7 @@ map_KERNAL_1:
tay tay
taz taz
ldx #$42 ; $4000 <- map 8KB from $20000 ldx #$42 ; $4000 <- map 8KB from $24000
bra map_end bra map_end
@@ -85,7 +85,7 @@ map_DOS_1:
ldx #$C1 ; $4000 <- map 16KB ROM from $20000 ldx #$C1 ; $4000 <- map 16KB ROM from $20000
map map
bra map_end_no_eom ; no EOM, we do not want interrupts within DOS! bra map_end_no_eom ; no EOM, we do not want interrupts within DOS!
map_NORMAL_from_DOS_1: map_NORMAL_from_DOS_1:
@@ -99,3 +99,21 @@ map_NORMAL_from_DOS_1:
tab tab
bra map_NORMAL_common bra map_NORMAL_common
map_MON_1:
php
pha
phx
phy
phz
lda #$00
tay
taz
lda #$E0
ldx #$42 ; $4000 <- map 8KB from $30000
map
bra map_end
+9
View File
@@ -0,0 +1,9 @@
;; #LAYOUT# M65 KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
MONITOR:
jsr map_MON_1
; XXX call the monitor here
jmp map_NORMAL
+10
View File
@@ -0,0 +1,10 @@
;; #LAYOUT# M65 KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
; Launches the machine language monitor
JMONITOR:
jmp MONITOR
+28 -37
View File
@@ -60,17 +60,8 @@
; operating system variables ; operating system variables
!addr STATUS = $90
!addr VERCK = $93
!addr FNLEN = $b7
!addr SA = $b9
!addr FA = $ba
!addr FNADR = $bb
!addr MODE_80 = $d7 ; 80 column / 40 volumn flag !addr MODE_80 = $d7 ; 80 column / 40 volumn flag
!addr Buffer = $0200 ; input buffer
!addr IIRQ = $0314 !addr IIRQ = $0314
!addr IBRK = $0316 !addr IBRK = $0316
!addr EXMON = $032e !addr EXMON = $032e
@@ -244,7 +235,7 @@ Main_A
; **** ; ****
@loop JSR CHRIN @loop JSR CHRIN
STA Buffer,X STA BUF,X
INX INX
CPX #80 CPX #80
BCS Mon_Error ; input too long BCS Mon_Error ; input too long
@@ -253,7 +244,7 @@ Main_A
LDA #0 LDA #0
STA Buf_Index STA Buf_Index
STA Buffer-1,X ; terminate buffer STA BUF-1,X ; terminate buffer
@getcomm JSR Get_Char @getcomm JSR Get_Char
BEQ Main BEQ Main
CMP #' ' CMP #' '
@@ -287,7 +278,7 @@ Mon_Error
Mon_Select Mon_Select
; ******** ; ********
STA VERCK STA VERCKK
CPX #22 CPX #22
LBCS Load_Save LBCS Load_Save
TXA TXA
@@ -858,7 +849,7 @@ Load_Save
; STY BA ; STY BA
; STY FNLEN ; STY FNLEN
; STY FNBANK ; STY FNBANK
; STY STATUS ; STY IOSTATUS
; LDA #>Mon_Data ; LDA #>Mon_Data
; STA FNADR+1 ; STA FNADR+1
; LDA #<Mon_Data ; LDA #<Mon_Data
@@ -871,7 +862,7 @@ Load_Save
; LBNE Mon_Error ; LBNE Mon_Error
; LDX Buf_Index ; LDX Buf_Index
; @copyfn LDA Buffer,X ; copy filename ; @copyfn LDA BUF,X ; copy filename
; BEQ @do ; no more input ; BEQ @do ; no more input
; INX ; INX
; CMP #KEY_QUOTE ; CMP #KEY_QUOTE
@@ -899,7 +890,7 @@ Load_Save
; JSR Print_CR ; JSR Print_CR
; LDX Long_AC ; X/Y = end address ; LDX Long_AC ; X/Y = end address
; LDY Long_AC+1 ; LDY Long_AC+1
; LDA VERCK ; A = load/verify/save ; LDA VERCKK ; A = load/verify/save
; CMP #'S' ; CMP #'S'
; LBNE Mon_Error ; must be Save ; LBNE Mon_Error ; must be Save
; LDA #0 ; LDA #0
@@ -908,15 +899,15 @@ Load_Save
; JSR SAVE ; JSR SAVE
; @exit JMP Main ; @exit JMP Main
; @do LDA VERCK ; @do LDA VERCKK
; CMP #'V' ; Verify ; CMP #'V' ; Verify
; BEQ @exec ; BEQ @exec
; CMP #'L' ; Load ; CMP #'L' ; Load
; LBNE Mon_Error ; LBNE Mon_Error
; LDA #0 ; 0 = LOAD ; LDA #0 ; 0 = LOAD
; @exec JSR LOAD ; A == 0 : LOAD else VERIFY ; @exec JSR LOAD ; A == 0 : LOAD else VERIFY
; BBR4 STATUS,@exit ; BBR4 IOSTATUS,@exit
; LDA VERCK ; LDA VERCKK
; LBEQ Mon_Error ; LBEQ Mon_Error
; LBCS Main ; LBCS Main
; JSR PRIMM ; JSR PRIMM
@@ -1323,9 +1314,9 @@ Mon_Assemble
!pet KEY_RETURN,"a ",0 !pet KEY_RETURN,"a ",0
LDA #'A' LDA #'A'
STA Buffer STA BUF
LDA #' ' LDA #' '
STA Buffer+1 STA BUF+1
LDY #2 LDY #2
LDX #2 ; 6 digits LDX #2 ; 6 digits
LDA Long_PC,X LDA Long_PC,X
@@ -1334,11 +1325,11 @@ Mon_Assemble
@auto PHX @auto PHX
LDA Long_PC,X LDA Long_PC,X
JSR A_To_Hex JSR A_To_Hex
STA Buffer,Y STA BUF,Y
JSR CHROUT JSR CHROUT
INY INY
TXA TXA
STA Buffer,Y STA BUF,Y
JSR CHROUT JSR CHROUT
INY INY
PLX PLX
@@ -1346,7 +1337,7 @@ Mon_Assemble
BPL @auto BPL @auto
LDA #' ' LDA #' '
STA Buffer,Y STA BUF,Y
JSR CHROUT JSR CHROUT
INY INY
TYA TYA
@@ -1992,7 +1983,7 @@ Get_Glyph
LDA #' ' LDA #' '
@loop LDX Buf_Index @loop LDX Buf_Index
INC Buf_Index INC Buf_Index
CMP Buffer,X CMP BUF,X
BEQ @loop BEQ @loop
PLX ; fall through PLX ; fall through
@@ -2009,7 +2000,7 @@ Get_Char
PHX PHX
LDX Buf_Index LDX Buf_Index
INC Buf_Index INC Buf_Index
LDA Buffer,X LDA BUF,X
CPX #1 CPX #1
PLX PLX
BCC @regc BCC @regc
@@ -2228,7 +2219,7 @@ Mon_Disk
DEC Buf_Index DEC Buf_Index
LDX Buf_Index LDX Buf_Index
LDA Buffer,X LDA BUF,X
BEQ Print_Disk_Status BEQ Print_Disk_Status
STA Long_CT ; dir marker STA Long_CT ; dir marker
LDY #$ff ; SA = 15 LDY #$ff ; SA = 15
@@ -2239,7 +2230,7 @@ Mon_Disk
JSR LISTEN JSR LISTEN
TYA ; SA TYA ; SA
JSR SECOND JSR SECOND
@loop LDA Buffer,X @loop LDA BUF,X
BEQ @close BEQ @close
JSR CIOUT JSR CIOUT
INX INX
@@ -2349,12 +2340,12 @@ Directory
STA SA STA SA
JSR TKSA JSR TKSA
LDA #0 LDA #0
STA STATUS STA IOSTATUS
LDZ #6 ; load address, pseudo link, pseudo number LDZ #6 ; load address, pseudo link, pseudo number
@loopb TAX ; X = previous byte @loopb TAX ; X = previous byte
JSR ACPTR ; A = current byte JSR ACPTR ; A = current byte
LDY STATUS LDY IOSTATUS
BNE @exit BNE @exit
DEZ DEZ
BNE @loopb ; X/A = last read word BNE @loopb ; X/A = last read word
@@ -2368,7 +2359,7 @@ Directory
@loopc JSR ACPTR ; print file entry @loopc JSR ACPTR ; print file entry
BEQ @cr BEQ @cr
LDY STATUS LDY IOSTATUS
BNE @exit BNE @exit
JSR CHROUT JSR CHROUT
BCC @loopc BCC @loopc
@@ -2462,7 +2453,7 @@ Open_Command_Channel
LDA #$ff LDA #$ff
JSR SECOND JSR SECOND
LDY #0 LDY #0
STY STATUS STY IOSTATUS
RTS RTS
; ****** ; ******
@@ -2498,7 +2489,7 @@ Read_Sector
LDA #$69 ; SA = 9 LDA #$69 ; SA = 9
JSR TKSA JSR TKSA
LDZ #0 LDZ #0
STZ STATUS STZ IOSTATUS
@loop JSR ACPTR @loop JSR ACPTR
STA [Long_PC],Z STA [Long_PC],Z
INZ INZ
@@ -2515,7 +2506,7 @@ Write_Sector
LDA #$69 ; SA = 9 LDA #$69 ; SA = 9
JSR TKSA JSR TKSA
LDZ #0 LDZ #0
STZ STATUS STZ IOSTATUS
@loop LDA [Long_PC],Z @loop LDA [Long_PC],Z
JSR CIOUT JSR CIOUT
INZ INZ
@@ -2572,7 +2563,7 @@ Open_Disk_Buffer
; ************** ; **************
LDA #0 LDA #0
STA STATUS STA IOSTATUS
LDA FA LDA FA
JSR LISTEN ; open fa,9,"#" JSR LISTEN ; open fa,9,"#"
LDA #$f9 ; sa = 9 LDA #$f9 ; sa = 9
@@ -2580,7 +2571,7 @@ Open_Disk_Buffer
LDA #'#' ; open buffer LDA #'#' ; open buffer
JSR CIOUT JSR CIOUT
JSR UNLSN JSR UNLSN
LDA STATUS LDA IOSTATUS
LBNE Print_Disk_Status LBNE Print_Disk_Status
RTS RTS
@@ -2589,13 +2580,13 @@ Close_Disk_Buffer
; *************** ; ***************
LDA #0 LDA #0
STA STATUS STA IOSTATUS
LDA FA LDA FA
JSR LISTEN ; open fa,9,"#" JSR LISTEN ; open fa,9,"#"
LDA #$e9 ; sa = 9 LDA #$e9 ; sa = 9
JSR SECOND JSR SECOND
JSR UNLSN JSR UNLSN
LDA STATUS LDA IOSTATUS
LBNE Print_Disk_Status LBNE Print_Disk_Status
RTS RTS