Estex-DSS/SHELL/Commands/INFO.ASM
2025-01-08 01:29:56 +10:00

130 lines
2.7 KiB
NASM

;[ ] 24/06/2024
cmd_info: CALL Get_Path
;
LD DE,MAIN_MSG.INFO_1 ; ¨­¤¥ªá "Drive Label Serial number Size"
CALL ECHO_MESSAGE
;
LD HL,.Collect_Msg
LD C,Dss.PChars
RST ToDSS
;
LD A,":"
LD (Buffers.bat_params.PRM9+1),A
XOR A
LD (Buffers.bat_params.PRM9+2),A ; Drive "X:",0
LD (read_disk_info.full),A
;
LD C,Dss.CurDisk
RST ToDSS
LD B,C
LD C,-1
;
.loop: INC C
PUSH BC
LD A,C
LD (.patch_A),A
ADD "A"
LD (Buffers.bat_params.PRM9),A
LD (.Collect_Msg+1),A
;
LD HL,.Collect_Msg
LD C,Dss.PChars
RST ToDSS
;
.patch_A+1: LD A,0
CALL read_disk_info
JR C,.Unformatted_Partition
; %7 - Volume label
; serial_string - Volume serial number string
; full_space_high \
; full_space_medium - Partition size
; full_space_low /
;
LD HL,serial_string
LD DE,Buffers.bat_params.PRM4 ; Volume serial number string
CALL ncopy_string
; full capacity
ld a,(full_space_high)
ld hl,(full_space_medium) ; áâ. à §àï¤
exx
ld hl,(full_space_low) ; ¬«. à §àï¤
.convert_hex: CALL PRN_DISK_SIZE
; %5..6 - Full size
;
; ä®à¬ â¨à®¢ ­¨¥ PRM5
LD HL,Buffers.bat_params.PRM5 - 1
LD DE,Buffers.bat_params.PRM5
.clear_spaces: INC HL
LD A,(HL)
CP " "
JR Z,.clear_spaces
AND A
CALL NZ,copy_string
;
.print_info_2: LD DE,MAIN_MSG.INFO_2 ; ¨­¤¥ªá "Drive Label Serial number Size"
CALL ECHO_MESSAGE
;
.next_drv: POP BC
DJNZ .loop
;
LD A,"\n"
LD C,Dss.PutChar
RST ToDSS
JP RESTORE_ALL.path
;RET
;
.Unformatted_Partition:
LD HL,.none_string
LD DE,Buffers.bat_params.PRM4 ; Volume serial number string
CALL ncopy_string
LD HL,.none_string
LD DE,Buffers.bat_params.PRM7 ; Volume label
CALL ncopy_string
LD HL,.Unknown_str
LD DE,Buffers.bat_params.PRM8 ; Volume file system
CALL ncopy_string
;
POP BC
PUSH BC
LD A,C
CP "C" - "A"
JR C,.ItIsFDD
LD DE,Dss.DRV.GenIOCTL.Enter
LD BC,Dss.DRV.GenIOCTL.GetParams
RST ToDSS.DRV ; !FIXIT ­¥ ¢®§¢à é ¥â à §¬¥à ᥪâ®à , ¯®í⮬ã å à¤ª®à ¯® 512
JR NC,.calc_size
.ItIsFDD: ;
LD HL,.Unknown_str
LD DE,Buffers.bat_params.PRM5 ; Drive size
CALL ncopy_string
JR .print_info_2
; HL:DE * 512 = A:H'L':HL ;!HARDCODE sector size
.calc_size: RL E
RL D
RL L
RL H
LD A,H
EX AF,AF
LD A,E
LD H,L
LD L,D
EXX
LD H,A
LD L,0
EX AF,AF
JR .convert_hex
;
.Collect_Msg: DZ " A: <WAITING>\r" ; ¯ âç¨âáï ¡ãª¢  ¤à ©¢  ¢ 横«¥
.Unknown_str: DZ "unknown"
.none_string: DZ "none"
/*
0 1 2 3 4 5 6 7
01234567890123456789012345678901234567890123456789012345678901234567890123456789;
Drive File System Label Serial number Size in bytes
C: FAT32 NO NAME xxxx-xxxx 147,102,629,888
D: FAT16 SP_SYS xxxx-xxxx 147,102,629,888
;
*/