×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Boot Problem

Boot Problem

Boot Problem

(OP)
I have been attempting to write a bootable floppy in assembly and have got this code so far. The problem is that I don't know where the data has got to ?! Can anyone point me in the right direction for finding it !
  Thanks, Adonai.

PS: the code is here if you want to take a look :)

code segment
  assume cs:code
  org 100h

program:
  dw offset start,7C0h
  jmp start

dataarea:
  msg1 db 'Bootable disk'
  msg2 db 'Loading operating system'

start:
  push cs
  pop ds

; Clear Screen
  mov ax,0600h
  mov cx,0000h
  mov dx,184Fh
  mov bh,03h
  int 10h
; Display a nice message...
  mov si,offset msg1
  call message

message:        ; Dump ds:si to screen.
  lodsb         ; load byte at ds:si into al
  or al,al      ; test if character is 0 (end)
  jz done
  mov ah,0Eh    ; put character
  mov bx,0007h  ; attribute
  int 10h
  jmp message
done:
  ret

; OK, just hang for now...
hang:
  jmp hang

  org 510
  dw 0AA55h ; Boot signature
  ret

ends
end program

RE: Boot Problem

(OP)
Don't worry, I've cracked it by trial and error.
The data I want is at 7C00h, so you have to add 7B00h to the offset of the data you want (because org 100h already gives extra 100h). This compiles as a com file and works when written to the first sector of a floppy and booted.
I've given the test code I used below if anyone else is interested...   Adonai

code segment
  assume cs:code
  org 100h

program:
  jmp 07c0h:start

dataarea:
  msg1 db 'Bootable disk',0
  msg2 db 'Just a hanging system',0

start:
  ; Setup segment registers
  xor ax,ax
  mov ax,cs
  mov ds,ax
  mov es,ax
  ; Clear screen
  mov ax,0003h
  int 10h
  ; Display a message
  mov si,offset msg1
  add si,7b00h
  call message
  ; Move cursor
  mov ah,02h
  mov bh,00h
  mov dx,0300h
  int 10h
  ; Display other message
  mov si,offset msg2
  add si,7b00h
  call message
  mov ah,02h
  mov bh,00h
  mov dx,0000h
  int 10h

  ; Just hang system
hang:
  jmp hang
  
  org 510
  dw 0AA55h ; Boot signature
  ret

message:        ; Dump ds:si to screen.
  lodsb         ; load byte at ds:si into al
  or al,al      ; test if character is 0 (end)
  jz done
  mov ah,0Eh    ; put character
  mov bx,0007h  ; attribute
  int 10h
  jmp message
done:
  ret

ends
end program

RE: Boot Problem

nice little routine you made :)

just a couple things of interest...

i notice you are using a far jump at the start. you could use a relative jump as the code segment on boot is set to 07C0h theres no need for far jumps here.

also...

personally i lost the org 0100h directive and wrote the com file code directly to the sector. this gives you an extra 256 bytes of code. the boot strap starts execution at 07C00:0000h and not 07C00:0100h. setting ds=cs as you have done should remove any further need for far pointers. i dont understand why you are setting si=07B00h unless you set a segment selector to zero?????? and taking into consideration the org 0100h

anyway, you have now got to write a little addition to load more sectors (your kernal) into memory and execute it.

keep up the good work :)
straiph


"There are 10 types of people in this world, those who know binary and those who don't!"

RE: Boot Problem

(OP)
Thanks Straiph.

I only really included the 'org 100h' a t the start because my assembler complains about illegal entry point address when trying to compile. I think I should get another assembler that will just do straightforward binaries!

Just a thought: Have you found anymore info on network assembly code? I'm trying to find the ports for a standard ethernet card, but have had no such luck. I have also written a netbios program, but its not quite working yet.

   Adonai

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close