diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-03-21 22:25:26 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-03-21 22:30:44 -0700 |
commit | 0c3f126377c2f14fe3b063dca686d6e1608f80d4 (patch) | |
tree | 535b14518d703d1dd35e90e5e94c053cfc83fbc3 | |
parent | fba2146593b077829845efcfe4b343ce809f5d88 (diff) | |
download | mu-0c3f126377c2f14fe3b063dca686d6e1608f80d4.tar.gz |
snapshot: reading secondary drive also works
dd if=/dev/zero of=data.img count=20160 echo '(+ 1 1)' |dd of=data.img conv=notrunc ./translate ex2.mu && qemu-system-i386 -hda disk.img -hdb data.img Compare output with `xxd data.img |head`. This works because primary and secondary drives on the primary bus share the same ports. All we have to do is select the right drive by flipping a bit.
-rw-r--r-- | boot.subx | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/boot.subx b/boot.subx index 1a2a6e64..2bd4e0b8 100644 --- a/boot.subx +++ b/boot.subx @@ -941,12 +941,10 @@ read-a-sector: (abort "primary bus has no drives") } # kick off read - (ata-drive-select 0xe0) # primary drive; 4 LSBs contain 4 upper bits of LBA (here 0) -#? (ata-drive-select 0xa0) # primary drive in CHS + head number + (ata-drive-select 0xf0) # primary bus, secondary drive; 4 LSBs contain 4 upper bits of LBA (here 0) (ata-error 0) (ata-sector-count 1) (ata-lba 0 0 0) # lower 24 bits of LBA -#? (ata-cyl-sector 1 0 0) (ata-command 0x20) # read sectors with retries # poll for results (poll-ata-primary-bus-primary-drive-regular-status-word) |