Files
OpenSuperClone/res/oscscripts/myscripts/wd_royl_dump_rom_old.osc
T

61 lines
1.2 KiB
Plaintext

seti $printhelp = $printhelp
if $printhelp = 1
exit 0
endif
include good_subroutines.osc
# enable vendor specific commands
buffersize 0
setreadpio
ata28cmd 0x45 0x0b 0x00 0x44 0x57 0xa0 0x80
# check if command failed
gosub status_check
# vsc to prepare for rom read
buffersize 0x200
clearbuffer
setbuffer 0
24 00 01 00 00 00 00 00 00 00 03 00 00 00 00 00
endbuffer
setwritepio
ata28cmd 0xd6 0x01 0xbe 0x4f 0xc2 0xa0 0xb0
# check if command failed
gosub status_check
# vsc to get a section of the rom
# the buffer size is based on the second byte of the command
# 0x80 sectors * 0x200 bytes per sector = 0x10000
buffersize 0x10000
clearbuffer
setreadpio
ata28cmd 0xd5 0x80 0xbf 0x4f 0xc2 0xa0 0xb0
# check if command failed
gosub status_check
# write the buffer to file
writebuffer 3rom0.bin 0 0 0x10000
# vsc to get another section of the rom
clearbuffer
ata28cmd 0xd5 0x80 0xbf 0x4f 0xc2 0xa0 0xb0
# check if command failed
gosub status_check
# write the buffer to file
writebuffer 3rom1.bin 0 0 0x10000
# vsc to get another section of the rom
clearbuffer
ata28cmd 0xd5 0x80 0xbf 0x4f 0xc2 0xa0 0xb0
# check if command failed
gosub status_check
# write the buffer to file
writebuffer 3rom2.bin 0 0 0x10000
previousscript
end