List Info

Thread: Re: ROM BIOS




Re: ROM BIOS
country flaguser name
United States
2008-03-27 22:06:32
On Mar 27, 2008, at 7:53 PM, Jim Leonard wrote:

> Eric Smith wrote:
>> Suppose you're trying to market a PC clone.  How
successful will  
>> you be
>> if some piece of popular software for the PC won't
run on your clone,
>> because that software depends on direct calls into
the ROM, or direct
>> access to tables in the ROM (e.g., the character
generator)?  Back in
>> those days, *lots* of software did wacky things
like that.
>
> Yes, but *why*?  I am getting to be what I consider a
pretty decent  
> assembler programmer, specifically on the 5150/5160,
and I honestly  
> can't see *why* I would *ever* want to specifically
jump directly  
> into the middle of the BIOS.  I *call* BIOS routines,
obviously, but  
> what possible benefit or purpose could there be to
jumping directly  
> into ROM?

1. Because you can.
2. Because it can save a bit of RAM.  Remember in the early
days of  
the PC, saving bytes was important for a number of programs.
 They had  
to fit in "typical" machines at the time.  In many
cases this was on a  
16K machine, every byte counted and not all of the functions
in the  
BIOS were exported by INT xx entry points.  In many ways IBM
made it  
easy because they published the complete assembly listing of
the BIOS  
ROM.

While I was at IBM (Boca Raton, FL), there were rules on the
locations  
of certain BIOS routines (ie their entry points needed to be
at a  
certain address in the ROM).  This continued into the
1990's.

TTFN - Guy

Re: ROM BIOS
country flaguser name
United States
2008-03-27 22:50:08
Guy Sotomayor wrote:
> 
> 2. Because it can save a bit of RAM.  Remember in the
early days of the 
> PC, saving bytes was important for a number of
programs.  They had to 
> fit in "typical" machines at the time.  In
many cases this was on a 16K 
> machine, every byte counted and not all of the
functions in the BIOS 
> were exported by INT xx entry points.  In many ways IBM
made it easy 
> because they published the complete assembly listing of
the BIOS ROM.

While I can appreciate this philosophy, I still can't see
how it would 
be beneficial on the 5150/5160.  For example, let's say I
want to move 
the cursor to a new location, say (10,15).  Typical way is
something 
like this:

	mov ah,2  ;set video mode
	mov bh,0  ;video page 0
	mov dh,15 ;col 15
	mov dl,10 ;row 10
	int 10h   ;do it

That's 10 bytes.

The INT call pushes the flags, CS, and IP onto the stack,
jumps to the 
routine, the routine executes, and then *in the ROM routine
itself* 
there is an IRET, which POPs IP, CS, and flags and then
continues from 
that point.  It is the IRET that is causing me trouble on
how to figure 
out what better way to do this, because once you hit the
IRET you had 
better have the IP, CS, and flags on the stack because
they're going to 
get restored whether you want them to or not.  And you can't
just patch 
in a JMP into the ROM code to return, because it's ROM.

So the only scenario I can think of is something like, maybe
you only 
want to move the cursor downward, on the same page, and you
don't want 
to set those extra input registers.  Let's also assume that
you know the 
exact location in ROM where you want to JMP so that the BIOS
routine can 
do only what you want it to.  You would still have to do
something like 
this:

	mov bh,0  ;set video page 0
	mov dl,10 ;move cursor down only
	CALL 1234:5678 (go directly to your magic function)

That's 9 bytes.  So you have saved ONE byte, yes, but that
is for an 
extremely specific optimized case.  The CALL is necessary
because of the 
IRET that is coming at the end of the function.

If that was a more common practice than I realize, then I
guess I stand 
corrected.  But it just doesn't seem worth it.  When I'm
*that* 
pressured for space, I use code overlays (if the language
allows it) or 
something else, like using non-visible video RAM for
storage.  (Yes, 
that's disgusting, but I'm not going to turn down 12K of
free RAM just 
because I'm only using one video page!  Remember, even a
monochrome 
card, with it's single 80x25 video page, has 96 bytes of
unused ram...)
-- 
Jim Leonard (trixteroldskool.org)            http://www.oldskool.org/

Help our electronic games project:           http://www.mobygames.com/
Or check out some trippy MindCandy at     http://www.mindcandydvd.
com/
A child borne of the home computer wars: http://trixter.wordpres
s.com/

Re: ROM BIOS
country flaguser name
Canada
2008-03-28 05:42:04
> While I can appreciate this philosophy, I still can't
see how it would 
> be beneficial on the 5150/5160.  For example, let's say
I want to move 
> the cursor to a new location, say (10,15).  Typical way
is something 
> like this:

It has nothing to do with efficiency, it has to do with
compatibility.

Everyone was jumping on the IBM bandwagon, and they were not
all good
designers - lots of commercial code depended on details of
the ROM that
they should not have ... but they did.

Your clone might have a fantastically wonderful BIOS.
Faster, more bug
free than IBM, and code that was a work of art to
appreciate... but as
soon as some bit of software called a function in the IBM
rom that you
didn't provide, or provide in the right place, you machine
became one
of the many "incompatibles" that didn't make it.



--
dave06a (at)    Dave Dunfield
dunfield (dot)  Firmware development services & tools:
www.dunfield.com
com             Collector of vintage computing equipment:
                http://
www.classiccmp.org/dunfield/index.html

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )