News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

BIOS Programming

Started by alb0001, May 21, 2005, 01:25:59 AM

Previous topic - Next topic

alb0001

I am trying to program a VERY simple BIOS for a 486 computer of mine so I can have my own fully customizable embedded system... I dont want anything fancy, just the basic. I have a good knowledge of low level programming but I am experiencing a big problem. I cant get to initialize the video hardware! I think that this is somehow DRAM related, cause we should first initialize the interrupts or at least the DRAM timer and the video card depends on the RAM to work. Could someone please help me on this first steps or just point me to the right direction?

Mark_Larson

Quote from: alb0001 on May 21, 2005, 01:25:59 AM
I am trying to program a VERY simple BIOS for a 486 computer of mine so I can have my own fully customizable embedded system... I dont want anything fancy, just the basic. I have a good knowledge of low level programming but I am experiencing a big problem. I cant get to initialize the video hardware! I think that this is somehow DRAM related, cause we should first initialize the interrupts or at least the DRAM timer and the video card depends on the RAM to work. Could someone please help me on this first steps or just point me to the right direction?

  You should make really sure you want to modify the BIOS.  It's a very hard thing to do, and you can easily mess things up.  You can probably do everything you need to do without modifying it.  Systems back then didn't have easily upgradeable BIOSes, you really should get a second BIOS chip if you are going to do this, or a BIOS on a card.  So what exactly are you looking to do with it?  You'd probably be better off making your own OS ,that you can use however you like.  Doing a BIOS from scratch is probably doing this the hard way.


  One of the things you have to do for devices with Option ROMs ( video falls into that category), is call the video option ROM.  The other problem is if you have onboard video it might be embedded in the BIOS you have on your system currently.  And there probably isn't an easy means of finding it and getting it out.
BIOS programmers do it fastest, hehe.  ;)

My Optimization webpage
htttp://www.website.masmforum.com/mark/index.htm

Manos

You can use VESA interrupts to write direct in screen without using BIOS.
BIOS is very slow.But if you run in protected mode,the things are more complex.
Have a look in VESA site to download VBE3 documentation.
Also,if you are making some O.S.,you should use FASM instead of MASM.

Manos.

MichaelW

I agree with Mark, doing this at the OS level would be by far the easiest method. If your customizations must be stored in ROM, an alternative that should be much easier than creating a full BIOS, even a simple one, would be to store them in an Option ROM on an ISA card. By locating the Option ROM at the correct address, you should be able to ensure that it would initialize last, after the System BIOS, VGA BIOS, SCSI BIOS, etc had completed all of the hard stuff.
eschew obfuscation

alb0001

Thank you for your answers, I do know this is not either the cleanest nor fastest method, but it is the most rewarding. I want to build a very basic system with a simple program "booting" form within my ROM (the BIOS). I don't want to use any existing interrupts or routines. I want to write them myself. I do know about the ROMs in the isa/pci cards, but I want one that replaces the mainboard BIOS. The main problem here is initializing the DRAM and setting the timer to refresh it, can somebody please help me on this one?

Mark_Larson

Quote from: alb0001 on May 22, 2005, 07:39:53 PM
Thank you for your answers, I do know this is not either the cleanest nor fastest method, but it is the most rewarding. I want to build a very basic system with a simple program "booting" form within my ROM (the BIOS). I don't want to use any existing interrupts or routines. I want to write them myself. I do know about the ROMs in the isa/pci cards, but I want one that replaces the mainboard BIOS. The main problem here is initializing the DRAM and setting the timer to refresh it, can somebody please help me on this one?

  The way the BIOS works currently is a Intel provides the memory reference code for the memory controller ( The current generation of Intel motherboards have what is called an MCH.  Stands for Memory Controller Hub).   Outside of that you could go to the manufacturer's website and find documentation on how to program it.  I honestly don't think you will find anything doing this method, because back then no one documented anything on their website.  The last thing you can try is if someone wrote an open source BIOS to support your motherboard, you can use their code.  Again most modern open source BIOSes are based on modern memory controllers, and I seriously doubt they will support yours.  You can't program it without documentation, and coming by the documentation is probably going to be next to impossible.
BIOS programmers do it fastest, hehe.  ;)

My Optimization webpage
htttp://www.website.masmforum.com/mark/index.htm

Mark_Larson


  Why don't you post the information about your 486 system.  Who made it, model #, maybe any information on the chipset ( northbridge and southbridge).  Someone might know where to dig up information for it on the internet, or someone might have documentation on it. 
BIOS programmers do it fastest, hehe.  ;)

My Optimization webpage
htttp://www.website.masmforum.com/mark/index.htm

RKeller

I used to work at Phoenix Technologies and can confirm that writing an IBM-compliant BIOS is a non-trivial process (in the early 1990s, Phoenix, Award and AMI kept some 150 guys busy full-time writing BIOS code; the hard part was taking advantage of the modern chipsets).  Keep in mind, that the PC Basic Input Output System (BIOS) has three general functions: 1) start-up hardware diagnostics, 2) runtime interface to DOS (Microsoft says Windows don't need no stinkin' BIOS for runtime), 3) hardware configuration utilities for disk drives types, RAM refresh, chipset interface and such.

Two suggestions if you're serious:  1) Get the appropriate IBM Technical reference manual off eBay and glean the code you need.  TechRef manuals come in at least three flavors (Original PC 8088, XT 8088 and AT 80286). The AT is the best bet if you have a 386 or 486.  2) I have a hard-to-find 8086 book at home with some primative start-up code in assembler.  Again, if you're serious, I could scan those pages for you.

Also, a company in San Diego used to sell a C language BIOS, including source, but that probably doesn't help.

RK