|
Post by rmgillmore on Nov 13, 2020 23:30:19 GMT 1
When running in a 32-bit console, I am able (in 16-bit assembly language), to read a DOS drive serial number by executing this procedure: public absoluteDiskRead
diskReadFrame struc diskRead_OldFrame Dw ? diskRead_RtnAddr Dd ? driveNumber Db ? driveNumberIsByte Db ? controlPacketPtr Dd ? statusPtr Dd ? diskReadFrame ends
absoluteDiskRead proc far Push Bp Mov Bp, Sp
; ensure that DOS knows the disk media format by executing ; interrupt 21h, function 47h
Mov Ah, 47h Mov Dl, [Bp].driveNumber Inc Dx Mov Si, sysCallAsmModule_Data Push Si Pop Ds Mov Si, offset diskBuffer Int 21h
; use interrupt 25h to read the requested sector(s)
Mov Al, [Bp].driveNumber ; the drive number is only a byte, so Xor Ah, Ah ; ignore the upper byte in the word Lds Bx, [Bp].controlPacketPtr Mov Cx, -1 Int 25h ; absolute disk read
Les Bx, [Bp].statusPtr ; prepare for save of error value Mov Word Ptr Es:[Bx], Ax
Add Sp, 2 ; handle DOS disk read anomaly Pop Bp ret absoluteDiskRead endp The serial number is located at the 29h offset into the buffer whose address is specified in the control packet. HOWEVER, when trying the same code in vDOS, I get an error 0103h (259) when attempting to read from sector zero. What I am trying to capture is reported by the vDos internal DIR command (reported as "Volume Serial Number"). I am not afraid to write ASM, been doing it for almost 40 years now. But where is the serial number?
|
|
|
Post by Jos on Nov 14, 2020 4:51:22 GMT 1
vDos doesn't support low level disk access. The Volume Serial Number reported by DIR is fake. It's based on the also fake drive name, A_DRIVE, B_DRIVE etc.
Jos
|
|