Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; SPDX-License-Identifier: WTFPL
- ; nasm test.asm -o test.img
- lance_base equ 2000h
- section .text
- use16
- jmp short start
- nop
- ; disk description table (to emulate floppy)
- db "TESTCODE" ; OEMLabel
- dw 512 ; BytesPerSector
- db 1 ; SectorsPerCluster
- dw 1 ; ReservedForBoot
- db 2 ; NumberOfFats
- dw 224 ; RootDirEntries
- dw 2880 ; LogicalSectors
- db 0f0h ; MediumByte
- dw 9 ; SectorsPerFat
- dw 18 ; SectorsPerTrack
- dw 2 ; Sides
- dd 0 ; HiddenSectors
- dd 0 ; LargeSectors
- dw 0 ; DriveNo
- db 41 ; Signature
- dd 0 ; VolumeID
- db "TESTCODE000" ; VolumeLabel
- db "FAT12 " ; FileSystem
- start:
- cli
- ; WIO/DWIO mode is unknown, try both reset
- mov dx, (lance_base + 14h)
- in ax, dx ; reset (16bit)
- mov dx, (lance_base + 18h)
- in eax, dx ; reset (32bit)
- mov dx, (lance_base + 10h)
- xor eax, eax
- out dx, eax ; select CSR0, enter DWIO mode
- mov dx, (lance_base + 14h)
- mov eax, 14h
- out dx, eax ; select BCR20
- mov dx, (lance_base + 1ch)
- in eax, dx
- ; already in DWIO mode
- mov dx, (lance_base + 18h)
- in eax, dx ; reset (32bit)
- mov dx, (lance_base + 10h)
- xor eax, eax
- out dx, eax ; select CSR0
- mov dx, (lance_base + 14h)
- mov eax, 14h
- out dx, eax ; select BCR20
- mov dx, (lance_base + 1ch)
- in eax, dx ; *** CRASH HERE ***
- stop:
- jmp short stop
- ; end of boot sector and blank contents
- times 510 - ($ - $$) db 0
- dw 0aa55h
- times (2879 * 512) db 0xe5
Advertisement
Add Comment
Please, Sign In to add comment