VirtualBox

Ticket #14021: Last.g4b

File Last.g4b, 732 bytes (added by SteveSi, 10 years ago)

grub4dos batch file last.g4b to display last sector

Line 
1!BAT
2# DISK can be 0-9, A-F only
3# Returns: CAP = Capacity of disk displayed in GB
4set DISK=1
5# Get disk capacity
6write 0x60000 0x42
7write 0x60010 0 > nul
8# get size of disk from INT 13h AH=48 into memory at DS:DI+10h - edx=80h is hard disk 0, 81h would be hard disk 1
9/%grub%/bios int=0x13 eax=0x4800 edx=0x8%DISK% ds=0x6000 edi=0x0 > nul
10read 0x60010 > nul
11set /A A=%@retval% & 0xffffffff > nul
12set /a CAP=%A%>>21&0xffffffff > nul
13# Get most significant dword
14read 0x60014 > nul
15set /A B=%@retval% & 0x1ffff > nul
16set /a CAP=%B% * 0x800 + %CAP% > nul
17echo DISK %DISK% = %CAP%GiB (LS_DWORD=%A% MS_DWORD=%B%, TOTAL SECTORS=%B%%%A:~2,999%)
18set /A LAST=%A%-1
19cat --hex --length=0x100 (hd%DISK%)%LAST%+1
20exit
21
22

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette