
Please asm newbie with few questions
writes:
Quote:
>Hello to all you assembler gurus out there!
>I have just started learning assembler, and even with all the info I have
>(books, txt files, etc), there are a few questions which I have not been
>able to answer.
>1. When writing new code from scratch, why does it always start at an
>offset of 0100h ? What's in the gap between 0000h and 0100h ?
The examples you have seen must be for writing .COM programs. They start
at 100h because they are in the same segment with the PSP, which is 100h
(256) bytes long.
EXE programs can start at offset 0.
Quote:
>2. How does one do floating point arithmetic if one does not have a math
>coprocessor (on an 80286) for example?
In assembly, without a floating point co-processor, you must write all
the
code to do the floating point arithmetic. (Or get a library). Just to
do
a 32-bit floating point addition, might be several hundred
instructions.
Quote:
>3. How can one support the asm equivalent of C's long int etc???
On the 386 and above the registers are 32-bits. On the 286 and below,
you'll
have to use 2 registers. If you put one value in DX:AX (DX has high
word)
and the other in CX:BX you can add them like this:
add ax, bx ; do the equivalent of: add dx:ax, cx:bx
adc dx, cx
Subtraction is quite similar, but multiply and divide require writing a
loop
with a dozen or two instructions -- ideal for writing a library
routine.
Mike Schmit
-------------------------------------------------------------------
408-244-6826 Pentium Processor Programming Tools
800-765-8086 ISBN: 0-12-627230-1
-------------------------------------------------------------------