flat assembler
Message board for the users of flat assembler.

Index > OS Construction > troubles booting from floppy

Author
Thread Post new topic Reply to topic
blueled



Joined: 05 Oct 2006
Posts: 3
blueled
I'm compiled the small OS that comes with with emu8086 tutorial. I compiled it in fasm, and there is a .bin file. I used the writebin program that came with it, to write it to the disk. When i boot it i can hear it click a couple times, and then it just goes to my normal boot screen. After that i can hear the floppy click about every 1.5 seconds when im fully booted up.

Code:
; directive to create BOOT file:
#make_boot#

; Boot record is loaded at 0000:7C00,
; so inform compiler to make required
; corrections:
ORG 7C00h

PUSH    CS   ; make sure DS=CS
POP     DS

; load message address into SI register:
LEA SI, msg

; teletype function id:
MOV AH, 0Eh

print:   MOV AL, [SI]
         CMP AL, 0
         JZ done
         INT 10h   ; print using teletype.
         INC SI
         JMP print

; wait for 'any key':
done:      MOV AH, 0
           INT 16h


; store magic value at 0040h:0072h:
;   0000h - cold boot.
;   1234h - warm boot.
MOV     AX, 0040h
MOV     DS, AX
MOV     w.[0072h], 0000h ; cold boot.

JMP     0FFFFh:0000h     ; reboot!


new_line EQU 13, 10

msg DB  'Hello This is My First Boot Program!'
    DB  new_line, 'Press any key to reboot', 0
    
Post 05 Oct 2006, 08:41
View user's profile Send private message Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 559
smiddy
Hi BlueLED,

So what is your trouble, the clicking?

Reading your code above, it would appear that if you wrote it to the very first sector of your floppy disc that you would do a continual reboot, just after printing Hello This is My First Boot Program! Press any key to reboot and you hitting a key to continue. I assume this is what it is doing, yes?
Post 05 Oct 2006, 12:35
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
Maybe try this:
Code:
ORG 7C00hstart:PUSH    CS   ; make sure DS=CSPOP     DS; load message address into SI register:LEA SI, msg; teletype function id:MOV AH, 0Ehprint:   MOV AL, [SI]         CMP AL, 0         JZ done         INT 10h   ; print using teletype.         INC SI         JMP print; wait for 'any key':done:      MOV AH, 0           INT 16h; store magic value at 0040h:0072h:;   0000h - cold boot.;   1234h - warm boot.MOV     AX, 0040hMOV     DS, AXMOV     w.[0072h], 0000h ; cold boot.JMP     0FFFFh:0000h     ; reboot!new_line EQU 13, 10msg DB  'Hello This is My First Boot Program!'    DB  new_line, 'Press any key to reboot', 0;*************************************; Make program 510 byte's + 0xaa55;*************************************times 510- ($-start)  db 0dw 0xaa55    
Post 05 Oct 2006, 15:27
View user's profile Send private message Reply with quote
blueled



Joined: 05 Oct 2006
Posts: 3
blueled
When I boot it, it doesnt even display the message and wait for my old one.

I tried compiling that Dex4u and it gives me an error saying

(7) LEA SI, msg
(7) error: invalid operand.

Looks fine to me, so i'm not sure what to do Razz
Post 05 Oct 2006, 18:22
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Because is "lea SI, [msg]" or just "mov SI, msg". LEA always need a memory operand (note that LEA never access memory, just store the address), it's typically used for things like "lea bx, [si+di]" or "lea bx, [bp+4]" and things like that but for storing an offset I think MOV is better since it's one byte less).
Post 05 Oct 2006, 19:23
View user's profile Send private message Reply with quote
blueled



Joined: 05 Oct 2006
Posts: 3
blueled
aha, finally it works! thanks for all the help.
Post 05 Oct 2006, 21:28
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.