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 |
| :-------: | :------- | :------: | :--------------------------------------------------------------------: |
| ? | MONITOR | WIP | launches a machine language monitor |
| ? | PRHEX | DONE | print hex value from .A |
| `$FF7D` | PRIMM | DONE | print immediate, address compatible with C128 and C65 ROMs |
| `$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
* `FREE` - unused space
### `MONITOR` (MEGA65)
Invokes a machine language monitor
### `SYSINFO` (MEGA65)
Displays various system information.
+1
View File
@@ -19,6 +19,7 @@
;; #ALIAS# printf = KERNAL_0.printf
;; #ALIAS# PRIMM = KERNAL_0.PRIMM
;; #ALIAS# MONITOR = KERNAL_0.MONITOR
;; #ALIAS# plot_set = KERNAL_0.plot_set
;; #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
ldx CURLIN+1
inx
+bne do_DIRECT_MODE_ONLY_error
jsr helper_ensure_direct_mode
; 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:
; 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
lda #$20
ldx #$C2 ; $4000 <- map 16KB from $22000
ldx #$C2 ; $4000 <- map 16KB from $26000
jmp map_end
+20 -2
View File
@@ -62,7 +62,7 @@ map_KERNAL_1:
tay
taz
ldx #$42 ; $4000 <- map 8KB from $20000
ldx #$42 ; $4000 <- map 8KB from $24000
bra map_end
@@ -85,7 +85,7 @@ map_DOS_1:
ldx #$C1 ; $4000 <- map 16KB ROM from $20000
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:
@@ -99,3 +99,21 @@ map_NORMAL_from_DOS_1:
tab
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
!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 Buffer = $0200 ; input buffer
!addr IIRQ = $0314
!addr IBRK = $0316
!addr EXMON = $032e
@@ -244,7 +235,7 @@ Main_A
; ****
@loop JSR CHRIN
STA Buffer,X
STA BUF,X
INX
CPX #80
BCS Mon_Error ; input too long
@@ -253,7 +244,7 @@ Main_A
LDA #0
STA Buf_Index
STA Buffer-1,X ; terminate buffer
STA BUF-1,X ; terminate buffer
@getcomm JSR Get_Char
BEQ Main
CMP #' '
@@ -287,7 +278,7 @@ Mon_Error
Mon_Select
; ********
STA VERCK
STA VERCKK
CPX #22
LBCS Load_Save
TXA
@@ -858,7 +849,7 @@ Load_Save
; STY BA
; STY FNLEN
; STY FNBANK
; STY STATUS
; STY IOSTATUS
; LDA #>Mon_Data
; STA FNADR+1
; LDA #<Mon_Data
@@ -871,7 +862,7 @@ Load_Save
; LBNE Mon_Error
; LDX Buf_Index
; @copyfn LDA Buffer,X ; copy filename
; @copyfn LDA BUF,X ; copy filename
; BEQ @do ; no more input
; INX
; CMP #KEY_QUOTE
@@ -899,7 +890,7 @@ Load_Save
; JSR Print_CR
; LDX Long_AC ; X/Y = end address
; LDY Long_AC+1
; LDA VERCK ; A = load/verify/save
; LDA VERCKK ; A = load/verify/save
; CMP #'S'
; LBNE Mon_Error ; must be Save
; LDA #0
@@ -908,15 +899,15 @@ Load_Save
; JSR SAVE
; @exit JMP Main
; @do LDA VERCK
; @do LDA VERCKK
; CMP #'V' ; Verify
; BEQ @exec
; CMP #'L' ; Load
; LBNE Mon_Error
; LDA #0 ; 0 = LOAD
; @exec JSR LOAD ; A == 0 : LOAD else VERIFY
; BBR4 STATUS,@exit
; LDA VERCK
; BBR4 IOSTATUS,@exit
; LDA VERCKK
; LBEQ Mon_Error
; LBCS Main
; JSR PRIMM
@@ -1323,9 +1314,9 @@ Mon_Assemble
!pet KEY_RETURN,"a ",0
LDA #'A'
STA Buffer
STA BUF
LDA #' '
STA Buffer+1
STA BUF+1
LDY #2
LDX #2 ; 6 digits
LDA Long_PC,X
@@ -1334,11 +1325,11 @@ Mon_Assemble
@auto PHX
LDA Long_PC,X
JSR A_To_Hex
STA Buffer,Y
STA BUF,Y
JSR CHROUT
INY
TXA
STA Buffer,Y
STA BUF,Y
JSR CHROUT
INY
PLX
@@ -1346,7 +1337,7 @@ Mon_Assemble
BPL @auto
LDA #' '
STA Buffer,Y
STA BUF,Y
JSR CHROUT
INY
TYA
@@ -1992,7 +1983,7 @@ Get_Glyph
LDA #' '
@loop LDX Buf_Index
INC Buf_Index
CMP Buffer,X
CMP BUF,X
BEQ @loop
PLX ; fall through
@@ -2009,7 +2000,7 @@ Get_Char
PHX
LDX Buf_Index
INC Buf_Index
LDA Buffer,X
LDA BUF,X
CPX #1
PLX
BCC @regc
@@ -2228,7 +2219,7 @@ Mon_Disk
DEC Buf_Index
LDX Buf_Index
LDA Buffer,X
LDA BUF,X
BEQ Print_Disk_Status
STA Long_CT ; dir marker
LDY #$ff ; SA = 15
@@ -2239,7 +2230,7 @@ Mon_Disk
JSR LISTEN
TYA ; SA
JSR SECOND
@loop LDA Buffer,X
@loop LDA BUF,X
BEQ @close
JSR CIOUT
INX
@@ -2349,12 +2340,12 @@ Directory
STA SA
JSR TKSA
LDA #0
STA STATUS
STA IOSTATUS
LDZ #6 ; load address, pseudo link, pseudo number
@loopb TAX ; X = previous byte
JSR ACPTR ; A = current byte
LDY STATUS
LDY IOSTATUS
BNE @exit
DEZ
BNE @loopb ; X/A = last read word
@@ -2368,7 +2359,7 @@ Directory
@loopc JSR ACPTR ; print file entry
BEQ @cr
LDY STATUS
LDY IOSTATUS
BNE @exit
JSR CHROUT
BCC @loopc
@@ -2462,7 +2453,7 @@ Open_Command_Channel
LDA #$ff
JSR SECOND
LDY #0
STY STATUS
STY IOSTATUS
RTS
; ******
@@ -2498,7 +2489,7 @@ Read_Sector
LDA #$69 ; SA = 9
JSR TKSA
LDZ #0
STZ STATUS
STZ IOSTATUS
@loop JSR ACPTR
STA [Long_PC],Z
INZ
@@ -2515,7 +2506,7 @@ Write_Sector
LDA #$69 ; SA = 9
JSR TKSA
LDZ #0
STZ STATUS
STZ IOSTATUS
@loop LDA [Long_PC],Z
JSR CIOUT
INZ
@@ -2572,7 +2563,7 @@ Open_Disk_Buffer
; **************
LDA #0
STA STATUS
STA IOSTATUS
LDA FA
JSR LISTEN ; open fa,9,"#"
LDA #$f9 ; sa = 9
@@ -2580,7 +2571,7 @@ Open_Disk_Buffer
LDA #'#' ; open buffer
JSR CIOUT
JSR UNLSN
LDA STATUS
LDA IOSTATUS
LBNE Print_Disk_Status
RTS
@@ -2589,13 +2580,13 @@ Close_Disk_Buffer
; ***************
LDA #0
STA STATUS
STA IOSTATUS
LDA FA
JSR LISTEN ; open fa,9,"#"
LDA #$e9 ; sa = 9
JSR SECOND
JSR UNLSN
LDA STATUS
LDA IOSTATUS
LBNE Print_Disk_Status
RTS