Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 20th, 2006, 6:12 PM   #11
grimpirate
King of Portal
 
grimpirate's Avatar
 
Join Date: Sep 2005
Posts: 439
Rep Power: 4 grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
The menuetOS code doesn't set those up, all the Bochs emulator has is its own emulated BIOS code of which apparently one of them is the interrupt vector 10h. The menuetOS isn't an OS that I'm loading on the system. I'm EXCLUSIVELY using the menuetOS code that is listed here (the TOTAL code actually loaded the OS, I just stripped it down to display a string) and from what I can tell in the code it's not redefining any interrupts and it also makes use of 10h. The major difference is that the menuetOS code segment works. I cannot say more about the emulated BIOS that Bochs is currently using because I don't know enough about it. All I know is that these two code segments when executed individually under the same procedure and environment. One works and one doesn't. Therefore, the answer lies somewhere in the code that I have posted here. I'm hoping that someone can point out what that key difference is.
__________________
Lo, there do I see my father. 'Lo, there do I see My mother, and my sisters, and my brothers. 'Lo, there do I see The line of my people... Back to the beginning. 'Lo, they do call to me. They bid me take my place among them. In the halls of Valhalla... Where the brave... May live... ...forever.. GrimBB | Mimesis
grimpirate is offline   Reply With Quote
Old Oct 20th, 2006, 6:53 PM   #12
grimpirate
King of Portal
 
grimpirate's Avatar
 
Join Date: Sep 2005
Posts: 439
Rep Power: 4 grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
Never mind I believe I've discovered the problem and it was in my own code, apparently I need to make a series of declarations regarding the sectors per cluster and other such things immediately after the jmp and nop since apparently these are required by BIOS or DOS or something or other. To see what I mean look here http://www.exegesis.uklinux.net/gand...t/disk.htm#7.3 that information is included in the MenuetOS code which works (I neglected to post it here thinking it was superfluous data).
__________________
Lo, there do I see my father. 'Lo, there do I see My mother, and my sisters, and my brothers. 'Lo, there do I see The line of my people... Back to the beginning. 'Lo, they do call to me. They bid me take my place among them. In the halls of Valhalla... Where the brave... May live... ...forever.. GrimBB | Mimesis
grimpirate is offline   Reply With Quote
Old Oct 20th, 2006, 8:47 PM   #13
niteice
Programmer
 
niteice's Avatar
 
Join Date: Aug 2005
Posts: 98
Rep Power: 4 niteice is on a distinguished road
Send a message via AIM to niteice
That's only if you're interested in writing anything to do with FAT-formatted disks.
niteice is offline   Reply With Quote
Old Oct 20th, 2006, 9:43 PM   #14
grimpirate
King of Portal
 
grimpirate's Avatar
 
Join Date: Sep 2005
Posts: 439
Rep Power: 4 grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
Yes the majority of that deals with writing to a FAT filesystem. However, it shows the general structure of the boot sector before any file operations. The code for the menuetOS that I posted previously for instance, won't load. However this code:
boot_program	   equ 07c00h ;position for boot code
   
		   jmp start_program
		   nop
   
oemname 	   db 'MENUETOS'
bytespersector	   dw 512
sectorspercluster  db 1
ressectors	   dw 1
numcopiesfat	   db 2
maxallocrootdir    dw 224
maxsectors	   dw 2880 ;for 1.44 mbytes disk
mediadescriptor    db 0f0h ;fd = 2 sides 18 sectors
sectorsperfat	   dw 9
sectorspertrack    dw 18
heads		   dw 2
hiddensectors	   dd 0
hugesectors	   dd 0 ;if sectors > 65536
drivenumber	   db 0
		   db 0
bootsignature	   db 029h ;extended boot signature
volumeid	   dd 0
volumelabel	   db 'MENUET DISK'
filesystemtype	   db 'FAT12   '


start_program:

  xor ax,ax
  mov ss,ax
  mov sp,boot_program
  push ss
  pop ds

  mov  si,loading+boot_program
loop_loading:
  lodsb
  or al,al
  jz procura_arquivo_novamente
  mov ah,0eh
  mov bx,07h
  int 010h
  jmp loop_loading


procura_arquivo_novamente:

  push ss
  pop es

  mov  bp,16

newtry:

  dec bp

loop_envio_mensagem:

  lodsb
  or al,al
  jz espera_digitar_tecla
  mov ah,0eh
  mov bx,07h
  int 010h
  jmp loop_envio_mensagem

espera_digitar_tecla:

  jmp $

loading   db 13,10,'Starting MenuetOS ',00h


times 0x1fe-$ db 00h

  db 55h,0aah ;boot signature
With the relevant declarations of bytes and words at the beginning does launch successfully. So I'm figuring that snippet of code is what makes all the difference. As the author of the link that I stated he shows that the boot sector can be divided into 6 areas:
Assembly Language Jump to Boot Code
Disk Parameters Needed by DOS
Assembly Language Boot Code
Error Messages
System File Names
DOS Signature
The DOS Signature refers to the 'magic number' 55aah, the Assembly Language Jump to Boot Code is a DOS requirement according to the author along with a NOP after it, precisely as the menuetOS author is doing. The Disk Paramters Needed by DOS are those that the menuetOS author has included on his code, finally the actual boot strapper code is located in Assembly Language Boot Code, the Error Messages and System File Names are also part of that if I'm not mistaken but are this FAT system specific code of the author.
__________________
Lo, there do I see my father. 'Lo, there do I see My mother, and my sisters, and my brothers. 'Lo, there do I see The line of my people... Back to the beginning. 'Lo, they do call to me. They bid me take my place among them. In the halls of Valhalla... Where the brave... May live... ...forever.. GrimBB | Mimesis
grimpirate is offline   Reply With Quote
Old Oct 20th, 2006, 11:17 PM   #15
grimpirate
King of Portal
 
grimpirate's Avatar
 
Join Date: Sep 2005
Posts: 439
Rep Power: 4 grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
Ya my idea doesn't seem to work either. Man this is discouraging, Polyphemus was SO right lol. Don't I have access to the BIOS interrupts once the BIOS transfers control to my boot loader?
__________________
Lo, there do I see my father. 'Lo, there do I see My mother, and my sisters, and my brothers. 'Lo, there do I see The line of my people... Back to the beginning. 'Lo, they do call to me. They bid me take my place among them. In the halls of Valhalla... Where the brave... May live... ...forever.. GrimBB | Mimesis
grimpirate is offline   Reply With Quote
Old Oct 20th, 2006, 11:32 PM   #16
niteice
Programmer
 
niteice's Avatar
 
Join Date: Aug 2005
Posts: 98
Rep Power: 4 niteice is on a distinguished road
Send a message via AIM to niteice
Yes.

I don't see why you would need to declare the FAT header if you're not doing any FAT operations yet.
niteice is offline   Reply With Quote
Old Oct 21st, 2006, 12:13 AM   #17
grimpirate
King of Portal
 
grimpirate's Avatar
 
Join Date: Sep 2005
Posts: 439
Rep Power: 4 grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
I don't know why either, but apparently Bochs requires it 'cause I just got some workng code! :banana:
jmp boot_code
nop

SystemID                db      'ComandOS'
BytesPerSector          dw      512
SectorsPerCluster       db      1
ReservedSector          dw      1
NumOfFATS               db      2
RootDirEntries          dw      224
SectorsOnDisk           dw      2880
FormatID                db      0f0h
SectorsPerFat           dw      9
SectorsPerTrack         dw      18
NumOfHeads              dw      2
HiddenSectors           dd      0
BigSectors              dd      0
DriveNumber             db      0
Reserved                db      0
ExtendedBootSig         db      029h
VolumeSerialNum         dd      0
VolumeLabel             db      'COS DISK   '
FileSystemType          db      'FAT12   '

boot_code:
mov ah, 0eh
mov al, 97
int 10h
@@:
nop
jmp @b

times 0x1fe-$ db 00h
db 55h,0aah
It prints the character 'a' :banana:
__________________
Lo, there do I see my father. 'Lo, there do I see My mother, and my sisters, and my brothers. 'Lo, there do I see The line of my people... Back to the beginning. 'Lo, they do call to me. They bid me take my place among them. In the halls of Valhalla... Where the brave... May live... ...forever.. GrimBB | Mimesis
grimpirate is offline   Reply With Quote
Old Nov 14th, 2006, 7:32 AM   #18
faital
Newbie
 
Join Date: Nov 2006
Posts: 1
Rep Power: 0 faital is on a distinguished road
Hi, This post is very informative, however I would like some specific information. If someone can help me then please send me a private message. Best Regards,
faital is offline   Reply With Quote
Old Dec 5th, 2006, 8:13 PM   #19
Harakim
Hobbyist Programmer
 
Join Date: May 2006
Location: West Jordan, Utah, United States
Posts: 176
Rep Power: 3 Harakim is on a distinguished road
When you use 'int 10h', you are telling your BIOS that you want to change the display mode to whatever mode is in register ah.
It is possible your hardware's graphic mode 9 is not the same as it is in Boch's. In this case you may be displaying pixels rather than text or something like that and the pixel may be too dim or small to see. Make sure you are using the right modes with your 10h interrupt. (I do know it works now, though.)

Just a thought.

P.S. Remember, usually in text mode one memory location is the character and right next to it are the color settings. Putting a string into memory on your gfx card won't usually work.
Harakim is offline   Reply With Quote
Old Dec 5th, 2006, 10:01 PM   #20
lectricpharaoh
SEXY SHOELESS GOD OF WAR!
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Wet west coast of Canada
Posts: 1,200
Rep Power: 5 lectricpharaoh will become famous soon enough
Quote:
Originally Posted by Harakim View Post
When you use 'int 10h', you are telling your BIOS that you want to change the display mode to whatever mode is in register ah.
It is possible your hardware's graphic mode 9 is not the same as it is in Boch's. In this case you may be displaying pixels rather than text or something like that and the pixel may be too dim or small to see. Make sure you are using the right modes with your 10h interrupt. (I do know it works now, though.)

Just a thought.

P.S. Remember, usually in text mode one memory location is the character and right next to it are the color settings. Putting a string into memory on your gfx card won't usually work.
Two things: INT 10H in the BIOS on most (IBM-compatible) PCs is actually a whole mess of functions, not just mode set. It depends on the register values you pass, though I can't recall which is which (been a long time since I've perused Ralf's list). Second: You certainly can put a string into the memory of your graphics card, at least with most display adapters. The 'text mode' that most are in at system startup is a block of memory with one 16-bit word per character. One byte of each word is the attribute (bit flags for color, basically), and the other is the character itself.
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot.
- Vaarsuvius, Order of the Stick
lectricpharaoh is online now   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
tables dont work in firefox; they work in IE angry_asian HTML / XHTML / CSS 3 Aug 5th, 2006 7:00 PM
my console apps just close...system("pause") doesnt work angry_asian C++ 22 Jul 2nd, 2006 5:38 PM
Help:::::::: Why Wont This Work?????? paulchwd ASP 1 Jul 10th, 2005 2:34 PM
Can't get loop to work rockybalboa Java 3 Mar 20th, 2005 7:19 PM
40 Things you'd like to say out loud at work big_k105 Coder's Corner Lounge 11 Jan 25th, 2005 3:13 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:07 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC