NASM - The Netwide Assembler
NASM Forum => Using NASM => Topic started by: BCD on May 02, 2008, 06:32:45 AM
-
Hi, I am just trying to learn ASM today, sorry if what I ask is a bit stupid! I have a soldi state HDD I need to stress test. I want to write a boot sector to a FDD, that will write all 1's to the first sector of the first HDD, and then write all 0's, and do it over and over, and display a count on screen of how many time it has done it so far (a read/verify in the middle would be good too). I am finding it all a bit alien atm though. So far I have writing of some txt (kind of) working:
[BITS 16]
[ORG 0x7c00]
wdata db "TESTTESTTESTTEST"
mov ah, 02h ;Set to 1,1
mov dh, 1
mov dl, 1
Int 10h
mov ah, 0eh ; Print S
xor bl, bl
mov al, 'S'
Int 10h
mov ah, 0eh ; Print T
xor bl, bl
mov al, 'T'
Int 10h
mov ah, 0eh ; Print A
xor bl, bl
mov al, 'A'
Int 10h
mov ah, 0eh ; Print R
xor bl, bl
mov al, 'R'
Int 10h
mov ah, 0eh ; Print T
xor bl, bl
mov al, 'T'
Int 10h
loop:
mov ah, 03h ;Write mode
mov al, 1 ; write 1 sector (512 bytes).
mov cl, 1 ; sector
mov ch, 0 ; cylinder
mov dh, 0 ; head
mov dl, 80h ; first HDD
mov bx, wdata
mov es, [wdata]
Int 13h
jmp loop
TIMES 510-($-$$) DB 0
DW 0xAA55
Can anyone give me any advice? thanks!
-
> Can anyone give me any advice?
1. Optimize your text write routine
2. "mov es, [wdata]" ???
3. FASM forum is full of bootsextors and INT $13 examples ;-)
-
I strongly advise you to abandon this project! No offense, but you don't know what you're doing, and I would advise you to learn before you attempt to write to a hard drive. As shown, your code will render any computer that runs it unbootable. Do some .com files, then learn to read from drives, then learn to write to a floppy, *then* try writing to a hard drive. You're gonna shoot yourself in the foot!
Best,
Frank
-
> You're gonna shoot yourself in the foot!
Maybe GoodVista prevents you from doing this ? :-)
> As shown, your code will render any computer that runs it unbootable
Just take a bootable DOS floppy or CD then ;-)
> I would advise you to learn before you attempt to write to a hard drive
Agree. Do you really understand how the 16-bit RM seg/off thingie works ? Your code suggests "NO" :-(