-bug in GETWORD: fixed "cd x:" incorrect behavior

This commit is contained in:
Anatoliy Belyanskiy 2024-03-20 22:08:52 +10:00
parent 54b1e804ba
commit f13fdf4eab
13 changed files with 174 additions and 244 deletions

View File

@ -310,7 +310,7 @@ SET_PRM: PUSH BC
LD A,B
LD C,BIOS.DRV_GET_PAR
RST ToBIOS_18
LD A,(BOOT.S_P_T)
LD A,(BOOT.SectorsPerTrack)
LD L,A
POP AF
PUSH AF
@ -358,16 +358,16 @@ NX2: LD HL,(BOOT+510)
LD D,(IY+_sBOOT_SECTOR_PARAMS.RESERVED_SECTORS+1)
ADD HL,DE
LD (FAT_FRM),HL ;first sector FAT
LD E,(IY+_sBOOT_SECTOR_PARAMS.S_P_F) ;sectors in FAT
LD D,(IY+_sBOOT_SECTOR_PARAMS.S_P_F+1)
LD A,(BOOT.FAT_NUM) ;amount FATs
LD E,(IY+_sBOOT_SECTOR_PARAMS.SectorsPerFAT16) ;sectors in FAT
LD D,(IY+_sBOOT_SECTOR_PARAMS.SectorsPerFAT16+1)
LD A,(BOOT.Number_of_FATs) ;amount FATs
C_DATA1: ADD HL,DE
DEC A
JR NZ,C_DATA1
LD (DIR_FRM),HL ;first sector DIR
EX DE,HL
LD L,(IY+_sBOOT_SECTOR_PARAMS.F_P_DIR) ;Number file handel
LD H,(IY+_sBOOT_SECTOR_PARAMS.F_P_DIR+1)
LD L,(IY+_sBOOT_SECTOR_PARAMS.FilesInRootDIR) ;Number file handel
LD H,(IY+_sBOOT_SECTOR_PARAMS.FilesInRootDIR+1)
ADD HL,HL
ADD HL,HL
ADD HL,HL
@ -381,10 +381,10 @@ C_DATA1: ADD HL,DE
ADD HL,DE
LD (DAT_FRM),HL ;First sector data
LD C,(IY+_sBOOT_SECTOR_PARAMS.B_P_S) ;Size sector
LD B,(IY+_sBOOT_SECTOR_PARAMS.B_P_S+1)
LD C,(IY+_sBOOT_SECTOR_PARAMS.BytesPerSector) ;Size sector
LD B,(IY+_sBOOT_SECTOR_PARAMS.BytesPerSector+1)
LD HL,0
LD A,(BOOT.S_P_C)
LD A,(BOOT.SectorsPerCluster)
NEXTAD3:
ADD HL,BC ;calc. cluster size
DEC A
@ -518,7 +518,7 @@ FLOAD: LD (READMEM),DE
LD_FILE: PUSH HL
CALL NSECTOR
LD DE,(READMEM)
LD A,(BOOT.S_P_C)
LD A,(BOOT.SectorsPerCluster)
CP #20
JR C,SMALL_CLUSTER
LD BC,#20*256 + BIOS.DRV_READ_LONG
@ -554,7 +554,7 @@ SMALL_CLUSTER:
; DEC HL
; DEC HL
; EX DE,HL
; LD A,(BOOT.S_P_C)
; LD A,(BOOT.SectorsPerCluster)
; LD B,A
; LD HL,0
; LD IX,0
@ -578,7 +578,7 @@ NSECTOR:
LD DE,0
DEC HL
DEC HL
LD A,(BOOT.S_P_C)
LD A,(BOOT.SectorsPerCluster)
XOR 1
JR Z,.skip
;
@ -643,7 +643,7 @@ R_F_F12 LD D,H
RR L
PUSH AF
EX DE,HL
LD HL,(BOOT.B_P_S)
LD HL,(BOOT.BytesPerSector)
LD B,H
LD C,L
ADD HL,HL

View File

@ -30,6 +30,6 @@ CHDIR: CALL GETWORD ;
LD HL,TMPNAME
LD A,(HL)
OR A
CALL NZ,OPENDIR
RET
RET Z
JP OPENDIR
;

View File

@ -3,8 +3,6 @@
; A - File attribute
; OUTPUT: A - FM
////////////////////////////////////////////////////////////////////////
CREATE_FN:
AND FAT_ATTR.NoVolID ; [x] 2/12/23 ¢à¥¬¥­­ë© ä¨ªá ¤«ï volume ID
CREATE: ;!TEST Current Dir ;[x] 15/10/23
PUSH HL
LD C,A
@ -13,7 +11,7 @@ CREATE: ;!TEST Current Dir ;[x] 15/10/23
POP BC
POP HL
RET C
LD A,C ;
LD A,C
;
CALL .Prepare
RET C
@ -30,8 +28,8 @@ CREATE: ;!TEST Current Dir ;[x] 15/10/23
LD A,DSS_Error.sys.FILE_NOT_FOUND
RET
;
.NEW_FN:
AND FAT_ATTR.NoVolID ; [x] 2/12/23 ¢à¥¬¥­­ë© ä¨ªá ¤«ï volume ID
; INPUT: HL - "C:\DIR1\DIR2\filename.ext",#00
; OUTPUT: A - FM
.NEW: ;!TEST Current Dir ;[x] 15/10/23
PUSH HL
LD C,A
@ -69,7 +67,7 @@ CREATE: ;!TEST Current Dir ;[x] 15/10/23
.loop1: LD (HL),C
INC HL
DJNZ .loop1
;
;AaRR
PUSH HL
CALL SYSTIME
CALL MK_TIME
@ -97,7 +95,8 @@ CREATE: ;!TEST Current Dir ;[x] 15/10/23
LD (OPEN_FN.TMP),A
JP OPEN_FN.FILE ;R008
.Prepare:
AND #E7 ;R004 %76A00SHR = !FAT_ATTR ;!HARDCODE
;AND #E7 ;R004 %76A00SHR = !FAT_ATTR ;!HARDCODE
AND FAT_ATTR.NoDIRnoVolID
LD (.TMP),A
LD (.PATH0),HL
CALL GETWORD
@ -111,7 +110,4 @@ CREATE: ;!TEST Current Dir ;[x] 15/10/23
LD A,DSS_Error.sys.FILE_EXISTS
CCF
RET
; INPUT: HL - "C:\DIR1\DIR2\filename.ext",#00
; OUTPUT: A - FM
CREAT_N EQU CREATE.NEW_FN
;

View File

@ -143,7 +143,7 @@ MKDIR: ;!TEST Current Dir ;[x] 15/10/23
;
POP HL
CALL NSECTOR
LD A,(CORE_BUFFERS.BootSector.S_P_C) ; ᥪâ®à®¢ ­  ª« áâ¥à
LD A,(CORE_BUFFERS.BootSector.SectorsPerCluster) ; ᥪâ®à®¢ ­  ª« áâ¥à
.MKD12: PUSH AF
PUSH HL ; áâ. à §àï¤
PUSH IX ; ­®¬¥à «®£. ᥪâ®à 

View File

@ -42,7 +42,7 @@ RMDIR: ;!TEST Current Dir ;[x] 15/10/23
PUSH IX
.RMD17: PUSH HL
CALL NSECTOR
LD A,(CORE_BUFFERS.BootSector.S_P_C)
LD A,(CORE_BUFFERS.BootSector.SectorsPerCluster)
; ­ ç¨­ ¥¬ ¢ëç¨â뢠âì ᮤ¥à¦¨¬®¥ ª â «®£  ¯®á¥ªâ®à­®
.read_dir_loop:
PUSH AF
@ -93,7 +93,7 @@ RMDIR: ;!TEST Current Dir ;[x] 15/10/23
POP AF
DEC A
JR NZ,.read_dir_loop
;
; [ ] fat32
POP HL ; ­®¬¥à ª« áâ¥à 
CALL READ_FROM_FAT ; ¯à®ç¨â âì ¨§ ª¥è  FAT-  ­®¬¥à á«¥¤. ª« áâ¥à 
EX DE,HL ; hl=­®¬¥à á«¥¤. ª« áâ¥à 

View File

@ -122,8 +122,8 @@ DISKINF:; [ ] 22/11/23
LD E,C
LD HL,(FAT_Max_Cluster_L)
DEC HL
LD BC,(CORE_BUFFERS.BootSector.B_P_S)
LD A,(CORE_BUFFERS.BootSector.S_P_C)
LD BC,(CORE_BUFFERS.BootSector.BytesPerSector)
LD A,(CORE_BUFFERS.BootSector.SectorsPerCluster)
AND A
RET
;

View File

@ -116,7 +116,7 @@ GETWORD:
LD A,(HL)
CP 'a'
JR C,.next
CP '{'
CP 'z'+1
JR NC,.next
SUB #20
.next: SUB 'A'
@ -129,9 +129,9 @@ GETWORD:
RET C
LD A,(HL)
OR A
RET Z
JR Z,.done
CP ' ' ;
RET Z
JR Z,.done
CP '\' ;
SCF
LD A,DSS_Error.sys.PATH_NOT_FOUND
@ -160,6 +160,10 @@ GETWORD:
SCF
RET
;
.done: XOR A
LD (TMPNAME),A
RET
;
.DIR_NAME:
XOR A
LD (DE),A
@ -260,6 +264,7 @@ OPENDSK:;!TEST DRV.Open
;----------------------------------------------------------------------;
; ¢å®¤: HL - ¨¬ï ¤¨à¥ªâ®à¨¨
OPENDIR:;[x] some optimizations
;XOR A
;CALL SET_FM

View File

@ -358,7 +358,7 @@ ADRST10: ;DS 512 ;,0
;...............................................[LOW ADDRESS ]:
; 0 1 2 3 4 5 6 7 8 9 DEC HEX
DB low F_START, low CHNDISK_FN, low CURDISK_FN,low DISKINF, low NOPS, low NOPS, low NOPS, low NOPS, low SCANDRV, low BOOTDSK ; 0 00..09
DB low CREATE_FN, low CREAT_N, low NOPS, low NOPS, low DEL_FN, low NOPS, low RENAME, low OPEN_FN, low CLOSE_FN, low READ ; 1 0A..13
DB low CREATE, low CREATE.NEW, low NOPS, low NOPS, low DEL_FN, low NOPS, low RENAME, low OPEN_FN, low CLOSE_FN, low READ ; 1 0A..13
DB low WRITE, low MOVE_FP, low ATTRIB, low GET_D_T, low PUT_D_T, low F_FIRST, low F_NEXT, low MKDIR, low RMDIR, low CHDIR_FN ; 2 14..1D
DB low CURRDIR_FN,low NOPS, low NOPS, low SYSTIME, low SETTIME, low NOPS, low NOPS, low NOPS, low NOPS, low NOPS ; 3 1E..27
DB low NOPS, low NOPS, low NOPS, low NOPS, low NOPS, low NOPS, low NOPS, low NOPS, low WAITKEY, low SCANKEY ; 4 28..31
@ -385,7 +385,7 @@ ADRST10: ;DS 512 ;,0
ENDIF
;...............................................[HIGH ADDRESS]:
DB high F_START, high CHNDISK_FN,high CURDISK_FN,high DISKINF,high NOPS, high NOPS, high NOPS, high NOPS, high SCANDRV, high BOOTDSK
DB high CREATE_FN, high CREAT_N, high NOPS, high NOPS, high DEL_FN, high NOPS, high RENAME, high OPEN_FN,high CLOSE_FN,high READ
DB high CREATE, high CREATE.NEW,high NOPS, high NOPS, high DEL_FN, high NOPS, high RENAME, high OPEN_FN,high CLOSE_FN,high READ
DB high WRITE, high MOVE_FP, high ATTRIB, high GET_D_T,high PUT_D_T,high F_FIRST,high F_NEXT, high MKDIR, high RMDIR, high CHDIR_FN
DB high CURRDIR_FN,high NOPS, high NOPS, high SYSTIME,high SETTIME,high NOPS, high NOPS, high NOPS, high NOPS, high NOPS
DB high NOPS, high NOPS, high NOPS, high NOPS, high NOPS, high NOPS, high NOPS, high NOPS, high WAITKEY, high SCANKEY

View File

@ -16,7 +16,8 @@
; (HANDBUF) = file's direcory record
; CF - ª â «®£ ­¥ ­ ©¤¥­
SEARCH:
.Dir: LD A,FAT_ATTR.DIRECTORY
.Dir: ;LD A,FAT_ATTR.DIRECTORY
LD A,FAT_ATTR.HiddenSysDir
CALL SEARCH.Custom
RET NC
CP DSS_Error.sys.PATH_NOT_FOUND + 1
@ -40,12 +41,12 @@ SEARCH:
; LD DE,0
; EXX
;
.loop: LD A,(IX+00)
.loop: LD A,(IX+_sFAT_DIRECTORY_RECORD.NAME)
OR A
JR Z,.error_file_not_found
CP #E5 ;!HARDCODE #E5 - § ¯¨áì ¢ ¤¨à¥ªâ®à¨¨ ᢮¡®¤­ , â ª ª ª ä ©«/¤¨à¥ªâ®à¨ï ¡ë«¨ 㤠«¥­ë
JR Z,.next_record
LD A,(IX+11)
LD A,(IX+_sFAT_DIRECTORY_RECORD.ATTRIBUT)
AND C
JR NZ,.next_record
LD HL,MASKARE
@ -345,7 +346,7 @@ LOADDIR:
; [ ] fat32
LD A,(IY+_sFM.FS_REC.FIRST_CLUSTER_L)
OR (IY+_sFM.FS_REC.FIRST_CLUSTER_L+1)
JP Z,.LROTDIR ; root ??
JP Z,.LoadRootDir
;
LD HL,DIRPAGE.buffer ; ªã¤ 
LD DE,#4000 ; ᪮«ìª®
@ -355,11 +356,11 @@ LOADDIR:
POP AF
OUT (SLOT3),A
RET
.LROTDIR:
LD HL,(FatBuffer.DIR_FRH) ; áâ. à §àï¤
LD IX,(FatBuffer.DIR_FRL) ; ­®¬¥à «®£. ᥪâ®à 
LD A,(FatBuffer.DIR_S_S)
LD B,32 ; !HARDCODE 16384/(sector 512). à §¬¥à root-ª â «®£ 
.LoadRootDir:
LD HL,(FatBuffer.RootDirFirstSector_H) ; áâ. à §àï¤
LD IX,(FatBuffer.RootDirFirstSector_L) ; ­®¬¥à «®£. ᥪâ®à 
LD A,(FatBuffer.DirSizeInSectros)
LD B,32 ; !HARDCODE sector size 512. 16384/(sector 512). à §¬¥à root-ª â «®£ 
CP B
JR NC,.RTD1
LD B,A ; ç¨á«® ᥪâ®à®¢
@ -420,7 +421,7 @@ WRT_HND: SET_PAGE_X DIRPAGE
SBC HL,DE
JR NC,SAVEDIR
LD HL,(SAVEDIR.DIRSIZE)
LD BC,(FatBuffer.B_P_C)
LD BC,(FatBuffer.BytesPerCluster)
ADD HL,BC
LD (SAVEDIR.DIRSIZE),HL
AND A
@ -448,7 +449,7 @@ SAVEDIR:
LD E,(IY+_sFM.FS_REC.FIRST_CLUSTER_L+1)
LD A,D
OR E
JP Z,.SROTDIR
JP Z,.SaveRootDir
LD HL,DIRPAGE.buffer
; à §¬¥à ᯨ᪠ ª â «®£  size_cash_directory
;!FIXIT ¥á«¨ ®­  ­ã¦­ , â® ¯à®¢¥à¨âì ­  ¡ £¨ (­ ¯à¨¬¥à, à §¬¥à ¤¨à४â®à¨¨ ¬¥­ìè¥ ¯à¨ ®âªàë⨨ ¨ ¡®«ìè¥ ¯®á«¥ ¯à ¢®ª)
@ -460,11 +461,11 @@ SAVEDIR:
OUT (SLOT3),A
AND A
RET
.SROTDIR:
LD HL,(FatBuffer.DIR_FRH)
LD IX,(FatBuffer.DIR_FRL)
LD A,(FatBuffer.DIR_S_S)
LD B,32 ;!HARDCODE
.SaveRootDir:
LD HL,(FatBuffer.RootDirFirstSector_H)
LD IX,(FatBuffer.RootDirFirstSector_L)
LD A,(FatBuffer.DirSizeInSectros)
LD B,32 ;!HARDCODE sector size 512
SUB B
JR NC,.RTD1S
ADD A,B
@ -496,18 +497,13 @@ RD_BPB: LD C,SLOT3
IN A,(SLOT0)
OUT (SLOT3),A
LD A,(FatBuffer.DRIVE)
;R08
;LD DE,BOOT+#C000
LD DE,CORE_BUFFERS.SECBUF+#C000
;R08
LD DE,CORE_BUFFERS.SECBUF+#C000 ;R08
LD C,Dss.DRV.GetBPB
RST ToDSS.DRV
POP BC
OUT (C),B
JP C,DOS_X_Error.Not_ready
//PUSH IY ; ¯®ª  ¡¥§ ¨­¤¥ªá­®£®, ­® ¬®¦¥â ¯à¨£®¤¨âìáï
LD DE,#AA55 ; ᨣ­ âãà  ;R05
LD HL,(CORE_BUFFERS.SECBUF+_sBOOT_SECTOR.MBR_SIGNATURE) ;R08 ;R07
;R05
@ -520,39 +516,21 @@ RD_BPB: LD C,SLOT3
LD BC,_sBOOT_SECTOR_PARAMS ; size
LDIR
;
//LD IY,BootSector ; ¯®ª  ¡¥§ ¨­¤¥ªá­®£®, ­® ¬®¦¥â ¯à¨£®¤¨âìáï
//LD A,(IY+_sBOOT_SECTOR_PARAMS.DRIVE_TYPE)
LD A,(CORE_BUFFERS.BootSector.DRIVE_TYPE)
CP #F0
JP C,DOS_X_Error.UnknownBPB
;!TEST
;LD HL,0 ; calc. first sector FAT
;LD E,(IY+_sBOOT_SECTOR_PARAMS.RESERVED_SECTORS) ;Reserve sec
;LD D,(IY+_sBOOT_SECTOR_PARAMS.RESERVED_SECTORS+1)
;ADD HL,DE
//LD L,(IY+_sBOOT_SECTOR_PARAMS.RESERVED_SECTORS) ;Reserve sec
//LD H,(IY+_sBOOT_SECTOR_PARAMS.RESERVED_SECTORS+1)
; calc. first sector FAT
LD HL,(CORE_BUFFERS.BootSector.RESERVED_SECTORS)
;
; LD E,(IY+_sBOOT_SECTOR_PARAMS.HIDDEN) ;Hidden sec
; LD D,(IY+_sBOOT_SECTOR_PARAMS.HIDDEN+1)
; ADD HL,DE
;LD (FatBuffer.FAT_FRM),HL ; first sector FAT
;
LD (FatBuffer.FAT1_SEC_L),HL ; first sector FAT #1
LD (FatBuffer.FAT2_SEC_L),HL
//LD E,(IY+_sBOOT_SECTOR_PARAMS.S_P_F) ; sectors in FAT
//LD D,(IY+_sBOOT_SECTOR_PARAMS.S_P_F+1)
LD DE,(CORE_BUFFERS.BootSector.S_P_F)
LD A,(CORE_BUFFERS.BootSector.FAT_NUM) ; amount FATs
LD (FatBuffer.FAT2_SEC_L),HL ; first sector FAT #2
;
LD DE,(CORE_BUFFERS.BootSector.SectorsPerFAT16)
LD A,(CORE_BUFFERS.BootSector.Number_of_FATs) ; amount FATs
CP 1
JR Z,.loop1
DEC A
@ -562,80 +540,47 @@ RD_BPB: LD C,SLOT3
.loop1: ADD HL,DE
DEC A
JR NZ,.loop1
LD (FatBuffer.DIR_FRL),HL ; first sector DIR
; CF = ? ¬ «® «¨
AND A
; CF = 0
//LD C,(IY+_sBOOT_SECTOR_PARAMS.B_P_S) ; Size sectors
//LD B,(IY+_sBOOT_SECTOR_PARAMS.B_P_S+1)
LD BC,(CORE_BUFFERS.BootSector.B_P_S)
; RL C
; RL B
; RL C
; RL B
; RL C
; RL B
; LD C,B
; LD B,0 ; BC - File handels in sectors
; LD A,C
;;;;
;
LD (FatBuffer.RootDirFirstSector_L),HL ; first sector DIR
LD BC,(CORE_BUFFERS.BootSector.BytesPerSector)
LD A,B
AND A
;
RL C
RLA
;
RL C
RLA
;
RL C
RLA
;
LD C,A
LD B,0 ; BC - File handels in sectors
;;;;
LD (FatBuffer.F_P_S),A
//LD E,(IY+_sBOOT_SECTOR_PARAMS.F_P_DIR) ; Number file handel
//LD D,(IY+_sBOOT_SECTOR_PARAMS.F_P_DIR+1)
LD DE,(CORE_BUFFERS.BootSector.F_P_DIR)
LD (FatBuffer.FilesPerSector),A
;
EX DE,HL
DEC HL
LD HL,(CORE_BUFFERS.BootSector.FilesInRootDIR) ; 0 for fat32
DEC HL ; [ ]fat32
XOR A
;NEXTAD2
.loop2: INC A
JP Z,DOS_X_Error.UnknownBPB
SBC HL,BC
JR NC,.loop2
;
EX DE,HL
LD C,A ; A - sectors in DIR
LD B,0
LD (FatBuffer.DIR_S_S),A
LD (FatBuffer.DirSizeInSectros),A
ADD HL,BC ; Start DATA area
LD (FatBuffer.DAT_FRL),HL
;!TODO ­¥ ¨á¯®«ì§ãîâáï §­ ç¥­¨ï ¢ëç¨á«ï¥¬ë¥ ¨ á®åà ­ï¥¬ë¥ ¢ FatBuffer
////////////////////////////////////////////////////////////////////////
;IF COMPILE_UNUSED_CODE
;LD HL,0
;LD H,B ; âãâ ¢ B ­®«ì ¤®«¦¥­ ¡ëâì
;LD L,B
;LD C,(IY+_sBOOT_SECTOR_PARAMS.B_P_S) ; Size sector
;LD B,(IY+_sBOOT_SECTOR_PARAMS.B_P_S+1)
//LD L,(IY+_sBOOT_SECTOR_PARAMS.B_P_S) ; Size sector
//LD H,(IY+_sBOOT_SECTOR_PARAMS.B_P_S+1)
LD HL,(CORE_BUFFERS.BootSector.B_P_S) ; Size sector
LD A,(CORE_BUFFERS.BootSector.S_P_C)
LD (FatBuffer.FirstDataSector_L),HL
; B = 0
;
LD HL,(CORE_BUFFERS.BootSector.BytesPerSector)
LD A,(CORE_BUFFERS.BootSector.SectorsPerCluster)
;!TODO FATcacheSize
;NEXTAD3
; .loop3: ADD HL,BC ; calc. cluster size
; DEC A
; JR NZ,.loop3
XOR 1 ; calc. cluster size
; calc. cluster size
XOR 1
JR Z,.loop3.end
RRA
.loop3: ADD HL,HL
@ -643,7 +588,7 @@ RD_BPB: LD C,SLOT3
JP NC,.loop3
.loop3.end:
;
LD (FatBuffer.CLU_LEN),HL
LD (FatBuffer.BytesPerCluster),HL
EX DE,HL
LD HL,#3FFF ;!HARDCODE ;!TODO FATcacheSize
XOR A
@ -652,11 +597,9 @@ RD_BPB: LD C,SLOT3
JP Z,DOS_X_Error.UnknownBPB
SBC HL,DE
JR NC,.loop4
LD (FatBuffer.C_P_B),A ; A - Clusters per bank (16k)
;ENDIF
////////////////////////////////////////////////////////////////////////
;!TODO detect fat type by clusters!
LD (FatBuffer.ClusterPerBank),A ; A - Clusters per bank (16k)
;
;!TODO detect fat type by clusters!
;[ ] fat32 reset fat32 variables
LD HL,0
LD (FatBuffer.ENDCLUS_HIGH),HL
@ -707,57 +650,36 @@ RD_BPB: LD C,SLOT3
LD (FatBuffer.FAT_TYPE),A
LD (FatBuffer.ENDCLUS_LOW),HL
;!TODO ­¥ ¨á¯®«ì§ãîâáï §­ ç¥­¨ï ¢ëç¨á«ï¥¬ë¥ ¨ á®åà ­ï¥¬ë¥ ¢ FatBuffer
;!TODO ­¥ ¨á¯®«ì§ã¥âáï §­ ç¥­¨¥ ¢ëç¨á«ï¥¬®¥ ¨ á®å࠭塞®¥ ¢ FatBuffer
////////////////////////////////////////////////////////////////////////
;IF COMPILE_UNUSED_CODE
LD HL,0
//LD C,(IY+_sBOOT_SECTOR_PARAMS.S_P_T) ; Sector per track
//LD B,(IY+_sBOOT_SECTOR_PARAMS.S_P_T+1)
LD BC,(CORE_BUFFERS.BootSector.S_P_T) ; Sector per track
LD A,(CORE_BUFFERS.BootSector.HEADS) ;!!!!!   ¥á«¨ IY ¨á¯®«ì§ã¥âáï ¤«ï ¯¥à¥¬¥­­®£® BootSector, â® ¡ã¤¥â ¡ £ 
.BPB_L1: ; calc. sector per cylinder
ADD HL,BC
DEC A
JR NZ,.BPB_L1
LD (FatBuffer.S_X_H),HL
;ENDIF
; LD HL,0
; LD BC,(CORE_BUFFERS.BootSector.SectorsPerTrack) ; Sector per track
; LD A,(CORE_BUFFERS.BootSector.HEADS)
; .BPB_L1:; calc. sector per cylinder
; ADD HL,BC
; DEC A
; JR NZ,.BPB_L1
; LD (FatBuffer.S_X_H),HL
////////////////////////////////////////////////////////////////////////
LD DE,(FatBuffer.DAT_FRL)
; LD E,(IY+_sBOOT_SECTOR_PARAMS.HIDDEN) ;Hidden sec
; LD D,(IY+_sBOOT_SECTOR_PARAMS.HIDDEN+1)
; AND A
; SBC HL,DE
; EX DE,HL
//LD L,(IY+_sBOOT_SECTOR_PARAMS.S_P_D)
//LD H,(IY+_sBOOT_SECTOR_PARAMS.S_P_D+1)
LD HL,(CORE_BUFFERS.BootSector.S_P_D)
; [ ] fat32
LD HL,(CORE_BUFFERS.BootSector.SectorsPerDrive)
LD DE,(FatBuffer.FirstDataSector_L)
LD A,H
OR L
JP NZ,.HDDSMAL
;
//LD L,(IY+_sBOOT_SECTOR_PARAMS.BPB_BIG_TOTAL_SECTORS)
//LD H,(IY+_sBOOT_SECTOR_PARAMS.BPB_BIG_TOTAL_SECTORS+1)
LD HL,(CORE_BUFFERS.BootSector.BPB_BIG_TOTAL_SECTORS_L)
//LD C,(IY+_sBOOT_SECTOR_PARAMS.BPB_BIG_TOTAL_SECTORS+2)
//LD B,(IY+_sBOOT_SECTOR_PARAMS.BPB_BIG_TOTAL_SECTORS+3)
LD BC,(CORE_BUFFERS.BootSector.BPB_BIG_TOTAL_SECTORS_H)
AND A
SBC HL,DE
JP NC,.HDDBIG
DEC BC
JP .HDDBIG
.HDDSMAL:
;AND A ;âãâ CF ¯®«î¡ á á¡à®è¥­ ¤®«¦¥­ ¡ëâì
;
.HDDSMAL:; CF = 0
SBC HL,DE
LD BC,0
.HDDBIG: LD A,(CORE_BUFFERS.BootSector.S_P_C) ;!!!!!   ¥á«¨ IY ¨á¯®«ì§ã¥âáï ¤«ï ¯¥à¥¬¥­­®£® BootSector, â® ¡ã¤¥â ¡ £ 
.HDDBIG: LD A,(CORE_BUFFERS.BootSector.SectorsPerCluster)
SCF
.S4C01: RRA
JR C,.S4C02
@ -768,9 +690,7 @@ RD_BPB: LD C,SLOT3
JP .S4C01
.S4C02: INC HL
LD (FAT_Max_Cluster_L),HL
//POP IY
;
XOR A
LD H,A
LD L,A
@ -808,7 +728,6 @@ RD_BPB: LD C,SLOT3
;
DOS_X_Error:
.UnknownBPB:
//POP IY
LD A,DSS_Error.sys.UNKNOWN_FORMAT
SCF
RET
@ -823,22 +742,21 @@ FatBuffer:
.MSG: DB 'FAT'
.READ_PG: DB #00 ;!TODO ­¥ ¨á¯®«ì§ãîâáï ­¥ª®â®àë¥ §­ ç¥­¨ï, ­® § ¤ã¬ª  ­¥¯«®å ï)))
.BLOCK: DB #00
.DIR_CLU_L: DW #0000
.DIR_CLU_H: DW #0000 ; [ ] fat32
.RootDirStartCluster_L: DW #0000
.RootDirStartCluster_H: DW #0000 ; [ ] fat32
.DRIVE: DB #FF
.FAT1_SEC_L: DW #0000 ; MSD_FAT_SEC first sector FAT (FAT_FRM)
.FAT1_SEC_H: DW #0000 ; [ ] fat32
.FAT2_SEC_L: DW #0000
.FAT2_SEC_H: DW #0000 ; [ ] fat32
.DIR_FRH: DW #0000 ; MSD_CAT_SEC first sector DIR ; !TODO ®£à ­¨ç¥­¨¥ ¢ 32 ƒ¨£  ;!FIXIT ­¥ ¨á¯®«ì§ã¥âáï
.DIR_FRL: DW #0000 ; MSD_CAT_SEC first sector DIR
.F_P_S: DB #00 ; ç¨á«® ä ©«®¢ëå § ¯¨á¥© ¢ ᥪâ®à¥
.DIR_S_S: DB #00 ; DIR_SEC_SIZE
.DAT_FRL: DW #0000 ; MSD_DAT_SEC low
.DAT_FRH: DW #0000 ; MSD_DAT_SEC high ; !TODO ®£à ­¨ç¥­¨¥ ¢ 32 ƒ¨£  ;!FIXIT ­¥ ¨á¯®«ì§ã¥âáï
.CLU_LEN:
.B_P_C: DW #0000 ; CLUSTER_LEN
.C_P_B: DB #00 ; A - Clusters per bank (16k) (ç¨á«® ª« áâ¥à®¢ ­  ¡«®ª އ“) ; ????? íâ® ¨á¯®«ì§ã¥âáï?
.RootDirFirstSector_H: DW #0000 ; MSD_CAT_SEC first sector DIR ; !TODO ®£à ­¨ç¥­¨¥ ¢ 32 ƒ¨£  ;!FIXIT ­¥ ¨á¯®«ì§ã¥âáï
.RootDirFirstSector_L: DW #0000 ; MSD_CAT_SEC first sector DIR
.FilesPerSector: DB #00 ; ç¨á«® ä ©«®¢ëå § ¯¨á¥© ¢ ᥪâ®à¥
.DirSizeInSectros: DB #00 ; DIR_SEC_SIZE
.FirstDataSector_L: DW #0000 ; MSD_DAT_SEC low
.FirstDataSector_H: DW #0000 ; MSD_DAT_SEC high ; !TODO ®£à ­¨ç¥­¨¥ ¢ 32 ƒ¨£  ; [ ] fat32
.BytesPerCluster: DW #0000 ; CLUSTER_LEN
.ClusterPerBank: DB #00 ; A - Clusters per bank (16k) (ç¨á«® ª« áâ¥à®¢ ­  ¡«®ª އ“) ; ????? íâ® ¨á¯®«ì§ã¥âáï?
.FAT_TYPE: DB #00 ; TYPE FAT (12 - 12bit, 16 - 16bit, 32 - 32bit) ; [x] fat32
.S_X_H: DW #0000 ; ª®«¨ç¥á⢮ ᥪâ®à®¢ ­  樫¨­¤à¥ ; ????? íâ® ¨á¯®«ì§ã¥âáï?
.ENDCLUS_LOW: DW #FFFF

View File

@ -327,7 +327,7 @@ WRITE_FAT_TABLE:
LD DE,FAT_CACHE.Sectors
ADD HL,DE ;+ SIZE CASH (16 SECTORS)
LD A,E ;!HARDCODE ; MAX ç¨á«® ᥪâ®à®¢ ¤«ï ç⥭¨ï ¢ ªíè
LD DE,(CORE_BUFFERS.BootSector.S_P_F) ; ᥪâ®à®¢ ­  FAT
LD DE,(CORE_BUFFERS.BootSector.SectorsPerFAT16) ; ᥪâ®à®¢ ­  FAT
AND A
SBC HL,DE
JR C,.WALLFAT
@ -520,13 +520,13 @@ GET_FAT12_CELL:
RET
; in: HL - CLUSTER
; in: DE:HL - CLUSTER
; out: HL:IX - SECTOR
NSECTOR:;[x] fat32
LD DE,(FAT_Max_Cluster_H)
NSECTOR:;[ ] fat32
LD DE,(FAT_Max_Cluster_H) ; [ ] fat32 - § ¬¥­¨âì ¤à㣮© ¯¥à¥¬¥­­®©
DEC HL
DEC HL
LD A,(CORE_BUFFERS.BootSector.S_P_C)
LD A,(CORE_BUFFERS.BootSector.SectorsPerCluster)
XOR 1
JR Z,.skip
;
@ -541,11 +541,16 @@ NSECTOR:;[x] fat32
.skip: EX DE,HL
LD XL,E
LD XH,D
LD DE,(FatBuffer.DAT_FRL) ;first data sector
XOR A
LD DE,(FatBuffer.FirstDataSector_L)
; [x] fat32
;XOR A
;
ADD IX,DE
LD D,A
LD E,A
; [x] fat32
LD DE,(FatBuffer.FirstDataSector_H)
;LD D,A
;LD E,A
;
ADC HL,DE
;!TODO   ­ ¤® «¨ ¯à®¢¥àïâì ¯¥à¥¯®«­¥­¨¥ HL:IX?
RET
@ -603,9 +608,8 @@ NSECTOR:;[x] fat32
;;
BLOCK_READ.ECL2:
;[x] GET/SAVE CLUSTER NUMBER BEFORE/AFTER READ/WRITE
POP BC
;
;POP DE ; [ ] áâ à襥 á«®¢® ­®¬¥à  ª« áâ¥à  (à ­ìè¥ ¨£­®à¨à®¢ «®áì)
POP BC ; [x] GET/SAVE CLUSTER NUMBER BEFORE/AFTER READ/WRITE
POP BC
POP DE
AND A
@ -614,25 +618,30 @@ BLOCK_READ.ECL2:
;READ SECTORS OF FILE
;HL:DE - FP (in sectors)
; B - Amount sectors
; IX - buffer in RAM
; 225ÿ937ÿ408 / 512 = 0x6BBC4 / 4 = 0x1AEF1
BLOCK_READ:
PUSH BC
LD (READ.PointerOnBuffer),IX
LD A,(CORE_BUFFERS.BootSector.S_P_C) ;SECTORS PER CLUSTER
LD A,(CORE_BUFFERS.BootSector.SectorsPerCluster) ;SECTORS PER CLUSTER
LD C,A
LD B,0
;HL:DE / BC => DE:IX HL-OSTATOK
CALL DIV_for_SPC
; [ ] fat32. ¤ «¥¥ § â®çª  ­  â®, çâ® ¢ DE ¢á¥£¤  0 - ä ©« ­¥ ¡®«ìè¥ 2Gb
; [ ] fat32. ¤ «¥¥ § â®çª  ­  â®, çâ® ¢ DE ¢á¥£¤  0 - ä ©« ­¥ ¡®«ìè¥ 2Gb. ˆá¯®«ì§®¢ âì DE
LD B,XH
LD C,XL
PUSH HL ;RESIDUE
PUSH HL ; ®áâ â®ª DIV_for_SPC
LD L,(IY+_sFM.FS_REC.FIRST_CLUSTER_L) ;START CLUSTER
LD H,(IY+_sFM.FS_REC.FIRST_CLUSTER_L+1)
LD A,H
OR L
LD A,L
OR H
;OR (IY+_sFM.FS_REC.FIRST_CLUSTER_H+1)
;[x] GET/SAVE CLUSTER NUMBER BEFORE/AFTER READ/WRITE
;JR NZ,BLOKRD2
PUSH BC
;PUSH DE ; [ ] áâ à襥 á«®¢® ­®¬¥à  ª« áâ¥à  (à ­ìè¥ ¨£­®à¨à®¢ «®áì)
JR Z,.ECL2
;JP ECL2 ;RY01 JR BLOKRD0
_GetSavedCluster .enter_loop1
@ -650,12 +659,13 @@ BLOCK_READ:
INC B
DEC BC
DJNZ .loop1
;POP DE ; [ ] áâ à襥 á«®¢® ­®¬¥à  ª« áâ¥à  (à ­ìè¥ ¨£­®à¨à®¢ «®áì)
;[x] GET/SAVE CLUSTER NUMBER BEFORE/AFTER READ/WRITE
_SaveGetedCluster
;
POP DE
POP BC
LD A,(CORE_BUFFERS.BootSector.S_P_C)
POP DE ; ®áâ â®ª DIV_for_SPC
POP BC ; HL:DE - FP (in sectors)
LD A,(CORE_BUFFERS.BootSector.SectorsPerCluster)
SUB E
LD C,A ;\
CP B ; \
@ -680,7 +690,7 @@ BLOCK_READ:
JR C,.Error
POP BC
LD HL,(READ.PointerOnBuffer)
LD DE,(CORE_BUFFERS.BootSector.B_P_S)
LD DE,(CORE_BUFFERS.BootSector.BytesPerSector)
;!TEST
LD A,B
LD B,C
@ -695,7 +705,7 @@ BLOCK_READ:
RET Z
LD B,A
;
.loop4: LD HL,CORE_BUFFERS.BootSector.S_P_C
.loop4: LD HL,CORE_BUFFERS.BootSector.SectorsPerCluster
LD A,B
SUB (HL)
LD B,A
@ -724,7 +734,7 @@ BLOCK_READ:
JR C,.Error
POP BC
LD HL,(READ.PointerOnBuffer)
LD DE,(CORE_BUFFERS.BootSector.B_P_S)
LD DE,(CORE_BUFFERS.BootSector.BytesPerSector)
.loop3: ADD HL,DE
DEC C
JR NZ,.loop3
@ -759,7 +769,7 @@ BLOCK_READ:
BLOK_WR:
PUSH BC
LD (READ.PointerOnBuffer),IX
LD A,(CORE_BUFFERS.BootSector.S_P_C) ;SECTORS PER CLUSTER
LD A,(CORE_BUFFERS.BootSector.SectorsPerCluster) ;SECTORS PER CLUSTER
LD C,A
LD B,0
;HL:DE / BC => DE:IX HL-OSTATOK
@ -820,7 +830,7 @@ BLOK_WR:
;
POP DE
POP BC
LD A,(CORE_BUFFERS.BootSector.S_P_C)
LD A,(CORE_BUFFERS.BootSector.SectorsPerCluster)
SUB E
LD C,A
CP B
@ -846,7 +856,7 @@ BLOK_WR:
JR C,.ErrorWrite
POP BC
LD HL,(READ.PointerOnBuffer)
LD DE,(CORE_BUFFERS.BootSector.B_P_S)
LD DE,(CORE_BUFFERS.BootSector.BytesPerSector)
;
.loop2: ADD HL,DE
DEC C
@ -860,7 +870,7 @@ BLOK_WR:
RET Z
;
.big_loop:
LD HL,CORE_BUFFERS.BootSector.S_P_C
LD HL,CORE_BUFFERS.BootSector.SectorsPerCluster
LD A,B
SUB (HL)
LD B,A
@ -894,7 +904,7 @@ BLOK_WR:
JR C,.ErrorWrite
POP BC
LD HL,(READ.PointerOnBuffer)
LD DE,(CORE_BUFFERS.BootSector.B_P_S)
LD DE,(CORE_BUFFERS.BootSector.BytesPerSector)
.loop3: ADD HL,DE
DEC C
JR NZ,.loop3
@ -1050,7 +1060,7 @@ FAT_Max_Cluster_H: WORD #0000 ;
; NSECTOR: DEC HL
; DEC HL
; EX DE,HL
; LD A,(CORE_BUFFERS.BootSector.S_P_C)
; LD A,(CORE_BUFFERS.BootSector.SectorsPerCluster)
; LD B,A
; LD HL,0
; LD IX,0
@ -1058,7 +1068,7 @@ FAT_Max_Cluster_H: WORD #0000 ;
; JR NC,ADD_DE2
; INC HL
; ADD_DE2: DJNZ ADD_DE1
; LD DE,(FatBuffer.DAT_FRL) ;first data sector
; LD DE,(FatBuffer.FirstDataSector_L) ;first data sector
; ADD IX,DE
; LD DE,#0000
; ADC HL,DE

View File

@ -2,7 +2,7 @@
;=======================================================================
;BPB
;LD (FatBuffer.FAT2_SEC_L),HL
;LD (FatBuffer.DIR_FRL),HL ; first sector DIR
;LD (FatBuffer.RootDirFirstSector_L),HL ; first sector DIR
;BPB32
;LD HL,(CORE_BUFFERS.BootSector+#2C) ;fat32 <20>¥à¢ë© ª« áâ¥à ª®à­¥¢®£® ª â «®£  (®¡ëç­® 2) 4 ¡ ©â 
;FAT Max Cluster
@ -31,7 +31,7 @@ CHECK_INC_HIGH_CLUSTER:
ENDMODULE
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;-----------------------------------------------------------------------
;¢å®¤: DE:HL - ­®¬¥à ª« áâ¥à 
;¢ë室: HL -  ¤à¥á ­ã¦­®© ï祩ª¨ ¢ áâà ­¨æ¥ FATPAGE
GET_FAT32_CELL:
@ -54,8 +54,7 @@ GET_FAT32_CELL:
0xEAB1022 - block 0x1D562
D E H
0xEAB10 >>> 0x1D562
*/
[ ] fat32 ¤®¤¥« âì âãâ
LD A,H
LD B,H
AND #0F
@ -79,6 +78,8 @@ GET_FAT32_CELL:
LD DE,FATPAGE.cache ; ­ ç «® ª¥è  FAT- 
ADD HL,DE ; ­  ï祩ªã FAT
RET
*/
;-----------------------------------------------------------------------
/*
; <20>à®ç¨â âì ¢ ª¥è 16 ᥪâ®à®¢ FAT- 

View File

@ -161,6 +161,11 @@ EMOUSE: RES 7,C
;!TODO ­  ¡¨®á.
MS_INIT:
DI
; ᪮à®áâì ¯®àâ  - ¢â®à®© ¬­®¦¨â¥«ì
LD A,#55
OUT (Z84.CTC.Ch_0),A
LD A,MOUSE_BAUD.multiplier_2
OUT (Z84.CTC.Ch_0),A
; reg 0
XOR A
OUT (PORT_MOUSE.Ctrl),A
@ -199,11 +204,6 @@ MS_INIT:
XOR A
OUT (PORT_MOUSE.Ctrl),A
ENDIF
; ᪮à®áâì ¯®àâ  - ¢â®à®© ¬­®¦¨â¥«ì
LD A,#55
OUT (Z84.CTC.Ch_0),A
LD A,MOUSE_BAUD.multiplier_2
OUT (Z84.CTC.Ch_0),A
;
EI
XOR A

View File

@ -1 +1 @@
958
946