[Tutor] bits taken by variable type
alan.gauld@bt.com
alan.gauld@bt.com
Wed, 26 Jun 2002 17:12:02 +0100
------_=_NextPart_001_01C21D2C.34DD9AA0
Content-type: text/plain; charset="iso-8859-1"
> I guess I would prefer portable psuedo code, because I would be able to
work on it
> without being on a computer. Its a tough call for me to make. If you
have a protable
> assembler then you don't have to write it all again.
If its portable the only difference is how much code you need to write to do
the same thing
or how fast you need it to run. C claims to be portable assembler, Python
claims to be
executable pseudo code and portable...
> Say you format a floppy on a Win machine, can you then use it in a Linux
machine or a Mac?
> I was under the imprecion that the machines would recognize the format.
Ah but that's a different question because to format a floppy for an OS you
would use the
OS formats which are already written and by definition different. So you are
not doing the
same thing at an asembler level you are writing two completely different
sets of data.
If OTOH you were writing a *driver* for a particular floppy drive on an
Intel chip or on
a Motorola chip bypassing the OS functions then you could get close to the
same code(in C)
because you would be writing raw bytes to specific ports in a specific order
using
C's in(), out() functions etc. When you compile the C for the different
chips you wind
up with a common set of APIs for the floppy. The OS device driver then gets
written
to map the OS I/O calls to the floppy API.
Maybe the best example is the Unix kernel (and Linux by extension) where
90%+ of
the source code is identical regardless of the hardware (Intel, powerPC,
Alpha, Sparc etc)
Alan g.
------_=_NextPart_001_01C21D2C.34DD9AA0
Content-type: text/html; charset="iso-8859-1"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4807.2300" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial><FONT size=2><SPAN class=740240716-26062002><FONT
face="Courier New" color=#0000ff>> </FONT></SPAN>I guess I would prefer
portable psuedo code, because I would be able to work on it <SPAN
class=740240716-26062002><FONT face="Courier New"
color=#0000ff> </FONT></SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN class=740240716-26062002><FONT
face="Courier New" color=#0000ff>> </FONT> </SPAN>without being on a
computer. Its a tough call for me to make. If you have a
protable <SPAN class=740240716-26062002><FONT face="Courier New"
color=#0000ff> </FONT></SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN class=740240716-26062002><FONT
face="Courier New" color=#0000ff>> </FONT> </SPAN>assembler then you
don't have to write it all again. <SPAN
class=740240716-26062002><FONT face="Courier New"
color=#0000ff> </FONT></SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN
class=740240716-26062002></SPAN></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN class=740240716-26062002>If its
portable the only difference is how much code you need to write to do the same
thing</SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN class=740240716-26062002>or how fast
you need it to run. C claims to be portable assembler, Python claims to be
</SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN class=740240716-26062002>executable
pseudo code and portable...</SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN
class=740240716-26062002></SPAN></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN class=740240716-26062002><FONT
face="Courier New" color=#0000ff>> </FONT></SPAN>Say you format a floppy on a
Win machine, can you then use it in a Linux machine or a Mac? <SPAN
class=740240716-26062002><FONT face="Courier New"
color=#0000ff> </FONT></SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN class=740240716-26062002>>
</SPAN>I was under the imprecion that the machines would recognize the
format. <SPAN class=740240716-26062002><FONT face="Courier New"
color=#0000ff> </FONT></SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN
class=740240716-26062002></SPAN></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN class=740240716-26062002>Ah but that's
a different question because to format a floppy for an OS you would use the
</SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN
class=740240716-26062002>OS formats which are already written and by
definition different. So you are not doing the </SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN class=740240716-26062002>same thing at
an asembler level you are writing two completely different sets of
data.</SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN
class=740240716-26062002></SPAN></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN class=740240716-26062002>If OTOH you
were writing </SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN
class=740240716-26062002>a *driver* for a particular floppy drive on an Intel
chip or on </SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN class=740240716-26062002>a Motorola
chip bypassing the OS functions then you could
</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN
class=740240716-26062002>get close to the same code(in C)
</SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN class=740240716-26062002>because you
would be writing raw bytes to specific </SPAN></FONT></FONT><FONT
face=Arial><FONT size=2><SPAN class=740240716-26062002>ports in a specific order
using </SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN class=740240716-26062002>C's in(),
out() functions etc. When you compile the C for the different chips you wind
</SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN class=740240716-26062002>up with a
common set of APIs for the floppy. The OS device driver then gets written
</SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN class=740240716-26062002>to map the OS
I/O calls to the floppy API.</SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN
class=740240716-26062002></SPAN></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN class=740240716-26062002>Maybe the best
example is the Unix kernel (and Linux by extension) where 90%+ of
</SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN class=740240716-26062002>the source
</SPAN></FONT></FONT><FONT face=Arial><FONT size=2><SPAN
class=740240716-26062002>code is identical regardless of the hardware (Intel,
powerPC, Alpha, Sparc etc)</SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN
class=740240716-26062002></SPAN></FONT></FONT><FONT face=Arial><FONT
size=2><SPAN class=740240716-26062002></SPAN></FONT></FONT> </DIV>
<DIV><SPAN class=670570014-24062002><FONT face="Courier New" color=#0000ff
size=2><SPAN class=740240716-26062002>Alan
g.</SPAN></FONT></SPAN></DIV></BODY></HTML>
------_=_NextPart_001_01C21D2C.34DD9AA0--