adapter converters, preparations for DOS Wedge from within the monitor

This commit is contained in:
FeralChild64 committed 2021-01-11 06:54:33 +01:00
1 parent ec0a03cb07
commit 409b01aec4
10 files changed
+341 -360

No files matched your search

+1 -1
View File
@@ -392,7 +392,7 @@ $(DIR_M65)/kernal.seg_1 $(DIR_M65)/KERNAL_1_combined.vs $(DIR_M65)/KERNAL_1_comb
$(DIR_M65)/dos.seg_1 $(DIR_M65)/DOS_1_combined.vs $(DIR_M65)/DOS_1_combined.sym: \
$(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_DOS_M65) $(CFG_M65)
$(DIR_M65)/mon.seg_1 $(DIR_M65)/MON_1_combined.vs $(DIR_M65)/MON_1_combined.sym: \
$(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_MON_M65) $(CFG_M65) $(DIR_M65)/KERNAL_0_combined.sym
$(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_MON_M65) $(CFG_M65) $(DIR_M65)/KERNAL_0_combined.sym $(DIR_M65)/BASIC_1_combined.sym
$(DIR_M65)/zvm.seg_1 $(DIR_M65)/ZVM_1_combined.vs $(DIR_M65)/ZVM_1_combined.sym: \
$(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_ZVM_M65) $(CFG_M65) $(DIR_M65)/KERNAL_0_combined.sym $(DIR_M65)/KERNAL_C_combined.sym
+2 -5
View File
@@ -112,6 +112,7 @@
!ifdef CONFIG_MB_MEGA65 {
!ifdef CONFIG_IEC_BURST_CIA1 { !error "Do not use CONFIG_IEC_BURST_CIA1 options for MEGA65 motherboard, CONFIG_IEC_BURST_M65 instead" }
!ifdef CONFIG_IEC_BURST_CIA2 { !error "Do not use CONFIG_IEC_BURST_CIA2 options for MEGA65 motherboard, CONFIG_IEC_BURST_M65 instead" }
!ifndef CONFIG_DOS_WEDGE { !error "MEGA65 build requires CONFIG_DOS_WEDGE" }
}
!ifndef CONFIG_MB_MEGA65 {
!ifdef CONFIG_IEC_BURST_M65 { !error "CONFIG_IEC_BURST_M65 is only possible for MEGA65 motherboard" }
@@ -343,7 +344,7 @@
; Handle IEC configuration
; Handle IEC and tape configuration
!ifdef CONFIG_IEC_BURST_CIA1 { !set HAS_IEC_BURST = 1 }
!ifdef CONFIG_IEC_BURST_CIA2 { !set HAS_IEC_BURST = 1 }
@@ -352,10 +353,6 @@
!ifdef CONFIG_IEC_JIFFYDOS { !set CONFIG_IEC_JIFFYDOS_OR_DOLPHINDOS = 1 }
!ifdef CONFIG_IEC_DOLPHINDOS { !set CONFIG_IEC_JIFFYDOS_OR_DOLPHINDOS = 1 }
; Handle tape configuration
!ifdef CONFIG_TAPE_NORMAL { !set HAS_TAPE = 1 }
!ifdef CONFIG_TAPE_TURBO { !set HAS_TAPE = 1 }
+2
View File
@@ -40,12 +40,14 @@
;; #ALIAS# map_end = KERNAL_0.map_end
;; #ALIAS# map_NORMAL = KERNAL_0.map_NORMAL
;; #ALIAS# map_BASIC_1 = KERNAL_0.map_BASIC_1
;; #ALIAS# map_MON_1 = KERNAL_0.map_MON_1
;; #ALIAS# M65_MODEGET = KERNAL_0.M65_MODEGET
;; #ALIAS# M65_MODESET = KERNAL_0.M65_MODESET
;; #ALIAS# M65_SETWIN_Y = KERNAL_0.M65_SETWIN_Y
;; #ALIAS# m65_colorset = KERNAL_0.m65_colorset
;; #ALIAS# m65_shadow_BZP = KERNAL_0.m65_shadow_BZP
;
; Ultimate 64 specific parts
@@ -27,10 +27,8 @@
!addr VB1__prepare_direct_execution = $4000 + 2 * 12
!addr VB1__helper_ask_if_sure = $4000 + 2 * 13
!addr VB1__helper_eggshell = $4000 + 2 * 14
!ifdef CONFIG_DOS_WEDGE {
!addr VB1__wedge_dos = $4000 + 2 * 15
}
!addr VB1__wedge_dos = $4000 + 2 * 15
!addr VB1__wedge_dos_monitor = $4000 + 2 * 15
} else {
@@ -51,10 +49,7 @@
!word prepare_direct_execution
!word helper_ask_if_sure
!word helper_eggshell
!ifdef CONFIG_DOS_WEDGE {
!word wedge_dos
}
!word wedge_dos_monitor
}
+17
View File
@@ -8,6 +8,23 @@
!ifdef CONFIG_DOS_WEDGE {
!ifdef SEGMENT_M65_BASIC_0 {
wedge_dos_monitor: ; entry point for the MONITOR
jsr m65_shadow_BZP
jsr map_BASIC_1
jsr (VB1__wedge_dos_monitor)
jsr m65_shadow_BZP
jmp map_MON_1
} else ifdef SEGMENT_M65_BASIC_1 {
wedge_dos_monitor:
rts
}
; .X has to contain size of the buffer
wedge_dos:
+2 -44
View File
@@ -24,52 +24,10 @@ proxy_M1_end:
jmp map_MON_1
; Routines below typicaly do not change mapping - but it is still possible they'll do
; Memory acccess routines
proxy_M1_SECOND:
jsr SECOND
bra proxy_M1_end
proxy_M1_TKSA:
jsr TKSA
bra proxy_M1_end
proxy_M1_ACPTR:
jsr ACPTR
bra proxy_M1_end
proxy_M1_CIOUT:
jsr CIOUT
bra proxy_M1_end
proxy_M1_UNTLK:
jsr UNTLK
bra proxy_M1_end
proxy_M1_UNLSN:
jsr UNLSN
bra proxy_M1_end
proxy_M1_LISTEN:
jsr LISTEN
bra proxy_M1_end
proxy_M1_TALK:
jsr TALK
bra proxy_M1_end
!addr Long__TMP = $3C ; has to be the same as Long_TMP in monitor
!addr Long__TMP = $64 ; has to be the same as Long_TMP in monitor
proxy_M1_memread:
+3 -8
View File
@@ -56,13 +56,8 @@
!addr Op_Mne = $2C ; 3 bytes for mnemonic
!addr Op_Ix = $2F ; type of constant
!addr Op_Len = $30 ; length of operand
!addr Disk_Track = $31 ; logical track 1 -> 255
!addr Disk_Sector = $32 ; logical sector 0 -> 255
!addr Disk_Status = $33 ; BCD value of status
; $34-$3B - free space, unused for now
; $31-$63 - free space, unused for now
!addr Long_TMP = $3C ; temporary pointer, for fetching/storing memory content; has to be the same as Long__TMP in Kernal
!addr Disk_Msg = $40 ; 40 bytes, disk status as text message ; XXX rework code to make it not needed
!addr Mon_Data = $68 ; 40 bytes, buffer for hunt and filename
!addr Long_TMP = $64 ; temporary pointer, for fetching/storing memory content; has to be the same as Long__TMP in Kernal
!addr Mon_Data = $68 ; 40 bytes, buffer for hunt
+13 -286
View File
@@ -10,7 +10,7 @@ Mon_Call:
; *******
jsr PRIMM
!pet $0D, "* warning * - adaptation to open roms not finished yet", $0D, $0D, $00
!pet $0D, "* warning * port not finished yet", $0D, $0D, $00
JSR Print_Commands
@@ -163,7 +163,7 @@ Print_Commands:
; *************
JSR PRIMM
!pet KEY_RETURN,KEY_RVS_ON," commands: "
!pet KEY_RETURN," ",KEY_RVS_ON," commands: "
; ***********
Command_Char:
@@ -176,7 +176,7 @@ Command_Char:
Cons_Prefix:
; **********
!pet "$+&%'"
!pet "$+&%"
; ***************
Load_Save_Verify:
@@ -206,10 +206,10 @@ Jump_Table:
!word Mon_Set_Memory ; > XXX to be debugged/adapted
!word Mon_Set_Register ; ; XXX to be debugged/adapted
!word Mon_Help ; ?
!word Converter ; $ XXX to be debugged/adapted
!word Converter ; + XXX to be debugged/adapted
!word Converter ; & XXX to be debugged/adapted
!word Converter ; % XXX to be debugged/adapted
!word Converter ; $
!word Converter ; +
!word Converter ; &
!word Converter ; %
; *******
Mon_Exit:
@@ -1881,8 +1881,9 @@ Converter:
LDX #0
STX Buf_Index
JSR Get_LAC
LBCS Mon_Error
JSR Get_Addr_To_LAC
LBEQ Mon_Error
JSR Print_CR
LDX #0
@loop PHX
JSR CR_Erase
@@ -1896,6 +1897,7 @@ Converter:
INX
CPX #4
BCC @loop
JSR Print_CR
JMP Main
Conv_Tab !word Print_Hexval
@@ -2018,288 +2020,13 @@ Print_BCD:
BNE @loopa
RTS
; **************
Get_Disk_Status:
; **************
LDA FA
JSR TALK
LDA #$6f
JSR TKSA
JSR ACPTR ; 1st. digit
STA Disk_Msg
ASL
ASL
ASL
ASL
STA Disk_Status ; BCD
JSR ACPTR ; 2nd. digit
STA Disk_Msg+1
AND #15
ORA Disk_Status
STA Disk_Status ; complete BCD number
LDY #1
@loop INY
JSR ACPTR
STA Disk_Msg,Y
CMP #' '
BCS @loop
LDA #0
STA Disk_Msg,Y
JSR UNTLK
LDA Disk_Status
RTS
; ****************
Print_Disk_Status:
; ****************
JSR Get_Disk_Status
; *************
Print_Disk_Msg:
; *************
JSR Print_CR
LDY #0
@loop LDA Disk_Msg,Y
BEQ @exit
JSR CHROUT
INY
BRA @loop
@exit JMP Print_CR
; ******
Mon_DOS:
; ******
; XXX for Open ROMs it should invoke internal DOS wedge!
jmp Main
; ****
DOS_U: ; XXX connect it somehow to command list
; ****
; @[u],U1 mem track startsec [endsec] : read disk sector(s)
; @[u],U2 mem track startsec [endsec] : write disk sector(s)
JSR Get_Char
CMP #'1' ; U1: read
LBCC Mon_Error
CMP #'3' ; U2: write
LBCS Mon_Error
STA Mon_Data+1 ; U type
INC Buf_Index
JSR Get_LAC
LBCS Mon_Error
JSR LAC_To_LPC ; Long_PC = memory address
JSR Get_LAC
LBCS Mon_Error
LDA Long_AC
STA Disk_Track
JSR Get_LAC
LBCS Mon_Error
LDA Long_AC
STA Disk_Sector
JSR Get_LAC
JSR LAC_To_LCT ; Long_CT = sector count
DEW Long_CT ; Long_CT = -1 for single
JSR Open_Disk_Buffer
@loop LDA Mon_Data+1
LSR
BEQ @write
JSR Find_next_Sector
BNE @error
JSR Read_Sector
BRA @next
@write JSR Write_Sector
JSR Find_next_Sector
BNE @error
@next JSR Inc_LPC_Page
INC Disk_Sector
DEW Long_CT
BPL @loop
@error JSR Print_Disk_Msg
JSR Close_Disk_Buffer
JSR wedge_dos_monitor
JMP Main
; ***************
Find_next_Sector:
; ***************
JSR Build_U_String
JSR Send_Disk_Command
JSR Get_Disk_Status
BEQ @return ; OK
CMP #$66 ; illegal track or sector
BNE @error ; error
LDA #0
STA Disk_Sector
INC Disk_Track ; try next track
JSR Build_U_String
JSR Send_Disk_Command
JSR Get_Disk_Status
BEQ @return
@error JSR Print_Disk_Msg
LDA Disk_Status
@return RTS
; *******************
Open_Command_Channel:
; *******************
LDA FA
JSR LISTEN
LDA #$ff
JSR SECOND
LDY #0
STY IOSTATUS
RTS
; ******
Reset_BP
; ******
JSR Open_Command_Channel
@loop LDA BP_ZERO,Y
BEQ @end
JSR CIOUT
INY
BRA @loop
@end JMP UNLSN
; ****************
Send_Disk_Command:
; ****************
JSR Open_Command_Channel
@loop LDA Mon_Data,Y
BEQ @end
JSR CIOUT
INY
BRA @loop
@end JMP UNLSN
; **********
Read_Sector:
; **********
LDA FA
JSR TALK
LDA #$69 ; SA = 9
JSR TKSA
LDZ #0
STZ IOSTATUS
@loop JSR ACPTR
STA [Long_PC],Z
INZ
BNE @loop
JMP UNTLK
; ***********
Write_Sector:
; ***********
JSR Reset_BP ; reset disk buffer pointer
LDA FA
JSR LISTEN
LDA #$69 ; SA = 9
JSR TKSA
LDZ #0
STZ IOSTATUS
@loop LDA [Long_PC],Z
JSR CIOUT
INZ
BNE @loop
JSR UNLSN
RTS
; *****
Set_TS:
; *****
; Input A = track or sector
; X = string index
@100 CMP #100
BCC @10
INC Mon_Data,X
SBC #100
BRA @100
@10 CMP #10
BCC @1
INC Mon_Data+1,X
SBC #10
BRA @10
@1 ORA #'0'
STA Mon_Data+2,X
RTS
; @[u],U1 mem track startsec [endsec] : read disk sector(s)
; U1:CHANNEL DRIVE TRACK SECTOR
; *************
Build_U_String:
; *************
LDX #14
@loop LDA U1,X
STA Mon_Data,X
DEX
CPX #2
BCS @loop
LDA #'U'
STA Mon_Data
LDA Disk_Track
LDX #7
JSR Set_TS
LDA Disk_Sector
LDX #11
JMP Set_TS
; ***************
Open_Disk_Buffer:
; ***************
LDA #0
STA IOSTATUS
LDA FA
JSR LISTEN ; open fa,9,"#"
LDA #$f9 ; sa = 9
JSR SECOND
LDA #'#' ; open buffer
JSR CIOUT
JSR UNLSN
LDA IOSTATUS
LBNE Print_Disk_Status
RTS
; ****************
Close_Disk_Buffer:
; ****************
LDA #0
STA IOSTATUS
LDA FA
JSR LISTEN ; open fa,9,"#"
LDA #$e9 ; sa = 9
JSR SECOND
JSR UNLSN
LDA IOSTATUS
LBNE Print_Disk_Status
RTS
; The 3 letter mnemonics are encoded as three 5-bit values
; and stored in a left byte MNE_L and a right byte MNE_R
@@ -2648,7 +2375,7 @@ Mon_Help:
!pet KEY_ESC,'s',".",KEY_ESC,'u',"<dot> - . address mnemonic operand",KEY_RETURN
!pet KEY_ESC,'s',">",KEY_ESC,'u',"<greater> - > address byte sequence",KEY_RETURN
!pet KEY_ESC,'s',";",KEY_ESC,'u',"<semicolon> - ; register contents",KEY_RETURN
!pet KEY_ESC,'s',"@",KEY_ESC,'u',"dos - @ [dos command]",KEY_RETURN
!pet KEY_ESC,'s',"@",KEY_ESC,'u',"dos - @[dos wedge command]",KEY_RETURN
!pet KEY_ESC,'s',"$",KEY_ESC,'u',"<dollar> - hexadecimal number (default)",KEY_RETURN
!pet KEY_ESC,'s',"+",KEY_ESC,'u',"<plus> - decimal number",KEY_RETURN
!pet KEY_ESC,'s',"&",KEY_ESC,'u',"<ampersand> - octal number",KEY_RETURN
+3 -8
View File
@@ -1,4 +1,5 @@
;; #IMPORT# KERNAL_0 = KERNAL_0_combined.sym
;; #IMPORT# BASIC_0 = BASIC_0_combined.sym
;
; Definitions for calling MEGA65 segment KERNAL_0 routines from MON_1
@@ -13,14 +14,8 @@
;; #ALIAS# CHRIN = KERNAL_0.proxy_M1_CHRIN
;; #ALIAS# CHROUT = KERNAL_0.proxy_M1_CHROUT
;; #ALIAS# SECOND = KERNAL_0.proxy_M1_SECOND
;; #ALIAS# TKSA = KERNAL_0.proxy_M1_TKSA
;; #ALIAS# ACPTR = KERNAL_0.proxy_M1_ACPTR
;; #ALIAS# CIOUT = KERNAL_0.proxy_M1_CIOUT
;; #ALIAS# UNTLK = KERNAL_0.proxy_M1_UNTLK
;; #ALIAS# UNLSN = KERNAL_0.proxy_M1_UNLSN
;; #ALIAS# LISTEN = KERNAL_0.proxy_M1_LISTEN
;; #ALIAS# TALK = KERNAL_0.proxy_M1_TALK
;; #ALIAS# wedge_dos_monitor = BASIC_0.wedge_dos_monitor
; 'Print immediate', original implementation by Mike Barry, adapted to 65CE02, modified to preserve .Y
+295
View File
@@ -0,0 +1,295 @@
; Based on BSM (Bit Shifter's Monitor) - disabled code
!ifdef DISABLED_DISABLED {
!addr Disk_Track = $XX ; logical track 1 -> 255
!addr Disk_Sector = $XX ; logical sector 0 -> 255
!addr Disk_Status = $XX ; BCD value of status
!addr Disk_Msg = $XX ; 40 bytes, disk status as text message
; **************
Get_Disk_Status:
; **************
LDA FA
JSR TALK
LDA #$6f
JSR TKSA
JSR ACPTR ; 1st. digit
STA Disk_Msg
ASL
ASL
ASL
ASL
STA Disk_Status ; BCD
JSR ACPTR ; 2nd. digit
STA Disk_Msg+1
AND #15
ORA Disk_Status
STA Disk_Status ; complete BCD number
LDY #1
@loop INY
JSR ACPTR
STA Disk_Msg,Y
CMP #' '
BCS @loop
LDA #0
STA Disk_Msg,Y
JSR UNTLK
LDA Disk_Status
RTS
; ****************
Print_Disk_Status:
; ****************
JSR Get_Disk_Status
; *************
Print_Disk_Msg:
; *************
JSR Print_CR
LDY #0
@loop LDA Disk_Msg,Y
BEQ @exit
JSR CHROUT
INY
BRA @loop
@exit JMP Print_CR
; ****
DOS_U: ; XXX connect it somehow to command list
; ****
; @[u],U1 mem track startsec [endsec] : read disk sector(s)
; @[u],U2 mem track startsec [endsec] : write disk sector(s)
JSR Get_Char
CMP #'1' ; U1: read
LBCC Mon_Error
CMP #'3' ; U2: write
LBCS Mon_Error
STA Mon_Data+1 ; U type
INC Buf_Index
JSR Get_LAC
LBCS Mon_Error
JSR LAC_To_LPC ; Long_PC = memory address
JSR Get_LAC
LBCS Mon_Error
LDA Long_AC
STA Disk_Track
JSR Get_LAC
LBCS Mon_Error
LDA Long_AC
STA Disk_Sector
JSR Get_LAC
JSR LAC_To_LCT ; Long_CT = sector count
DEW Long_CT ; Long_CT = -1 for single
JSR Open_Disk_Buffer
@loop LDA Mon_Data+1
LSR
BEQ @write
JSR Find_next_Sector
BNE @error
JSR Read_Sector
BRA @next
@write JSR Write_Sector
JSR Find_next_Sector
BNE @error
@next JSR Inc_LPC_Page
INC Disk_Sector
DEW Long_CT
BPL @loop
@error JSR Print_Disk_Msg
JSR Close_Disk_Buffer
JMP Main
; ***************
Find_next_Sector:
; ***************
JSR Build_U_String
JSR Send_Disk_Command
JSR Get_Disk_Status
BEQ @return ; OK
CMP #$66 ; illegal track or sector
BNE @error ; error
LDA #0
STA Disk_Sector
INC Disk_Track ; try next track
JSR Build_U_String
JSR Send_Disk_Command
JSR Get_Disk_Status
BEQ @return
@error JSR Print_Disk_Msg
LDA Disk_Status
@return RTS
; *******************
Open_Command_Channel:
; *******************
LDA FA
JSR LISTEN
LDA #$ff
JSR SECOND
LDY #0
STY IOSTATUS
RTS
; *******
Reset_BP:
; *******
JSR Open_Command_Channel
@loop LDA BP_ZERO,Y
BEQ @end
JSR CIOUT
INY
BRA @loop
@end JMP UNLSN
; ****************
Send_Disk_Command:
; ****************
JSR Open_Command_Channel
@loop LDA Mon_Data,Y
BEQ @end
JSR CIOUT
INY
BRA @loop
@end JMP UNLSN
; **********
Read_Sector:
; **********
LDA FA
JSR TALK
LDA #$69 ; SA = 9
JSR TKSA
LDZ #0
STZ IOSTATUS
@loop JSR ACPTR
STA [Long_PC],Z
INZ
BNE @loop
JMP UNTLK
; ***********
Write_Sector:
; ***********
JSR Reset_BP ; reset disk buffer pointer
LDA FA
JSR LISTEN
LDA #$69 ; SA = 9
JSR TKSA
LDZ #0
STZ IOSTATUS
@loop LDA [Long_PC],Z
JSR CIOUT
INZ
BNE @loop
JSR UNLSN
RTS
; *****
Set_TS:
; *****
; Input A = track or sector
; X = string index
@100 CMP #100
BCC @10
INC Mon_Data,X
SBC #100
BRA @100
@10 CMP #10
BCC @1
INC Mon_Data+1,X
SBC #10
BRA @10
@1 ORA #'0'
STA Mon_Data+2,X
RTS
; @[u],U1 mem track startsec [endsec] : read disk sector(s)
; U1:CHANNEL DRIVE TRACK SECTOR
; *************
Build_U_String:
; *************
LDX #14
@loop LDA U1,X
STA Mon_Data,X
DEX
CPX #2
BCS @loop
LDA #'U'
STA Mon_Data
LDA Disk_Track
LDX #7
JSR Set_TS
LDA Disk_Sector
LDX #11
JMP Set_TS
; ***************
Open_Disk_Buffer:
; ***************
LDA #0
STA IOSTATUS
LDA FA
JSR LISTEN ; open fa,9,"#"
LDA #$f9 ; sa = 9
JSR SECOND
LDA #'#' ; open buffer
JSR CIOUT
JSR UNLSN
LDA IOSTATUS
LBNE Print_Disk_Status
RTS
; ****************
Close_Disk_Buffer:
; ****************
LDA #0
STA IOSTATUS
LDA FA
JSR LISTEN ; open fa,9,"#"
LDA #$e9 ; sa = 9
JSR SECOND
JSR UNLSN
LDA IOSTATUS
LBNE Print_Disk_Status
RTS
}