Need some help

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
weathermanfrank

Need some help

Post by weathermanfrank »

[attachment deleted by admin]
Curufir

Re:Need some help

Post by Curufir »

Code: Select all

OEM_Name???db???'WonkeeOS'
nBytesPerSec???dw???0200h
nSecPerClust???db???01h
nSecRes??????dw???014h
nFATs??????db???02h
nRootEnts???dw???0E0h
nSecs??????dw???0B40h

mDesc??????db???0F0h
nSecPerFAT???dw???09h
nSecPerTrack???dw???012h
nHeads??????dw???02h
nLogSec0
nSecHidden???dd???00h


[org 7c00h]???????????????;makes sure that the program begins here
???jmp???start
This looks very odd indeed. I don't know what NASM will do with that data, but the idea is that the "jmp start" jumps over the disk information to get to the start of your code, so the "jmp start" would be at the top (Along with the org instruction).
This might be the problem, because if execution starts at the first byte of your program (And NASM doesn't move the data you've put there in your code at assemble time) then it's going to be interpreting 'WonkeeOS' as machine code instructions not data. Things would probably fall down at this point pretty rapidly I think.

**

Took another look.
You never setup the data segment (It's probably a typo, but you actually set dx to 0, not ds).

Code: Select all

   jmp???begin_boot
begin_boot:
Not required

You never setup es so it could be anything. The BIOS read sector interrupt stores data at es:bx.

You never setup a stack in real mode. Interrupts are likely impossible to use until you do as they have to push a return address onto the stack in order to iret (I say likely because it's always possible the BIOS has left you with sensible values of SS and SP, but don't count on it).

You're using cl instead of dl as the drive number in the 'ReadA:' function.

You're relying on the attribute byte of all your output text chars to be something useful (Hint: Moving '1 ' [note the space] into video memory will produce a green '1', handy if you just want something to check with).

Basically there's lots of problems. Hopefully what I've pointed out will be useful in fixing them.
jrfritz

Re:Need some help

Post by jrfritz »

Curfir keeps telling me GDTs like that are bad....but he won't tell me how to fix it....Curifir...could you fix the GDT so I could know how to fix it?
jrfritz

Re:Need some help

Post by jrfritz »

I know...I ment code wize to show me ... he IMed me...
Slasher

Re:Need some help

Post by Slasher »

Hi,
Computers just execute bits! and the way your boot code starts it will execute from OEM_Name   db   'WonkeeOS'
what you should bo is place
[org 7c00]
jmp start]

as you first lines in the boot code
weathermanfrank

Re:Need some help

Post by weathermanfrank »

I thank you all for you input. I'll work with this till something comes out. I hope:)

Thank you again
Frank
Post Reply