                            Intel Assembler Manual
                                    V0.21
                      Era Scarecrow / rtcvb32@yahoo.com

Table of Contents

1) Introduction

2) Using the program
+Numbers:
|_Hexadecimal
|_Decimal
|_Octal
L_Binary

Types and Examples, and uses: (compiler)

+Distance:
|_SHORT
|_NEAR
L_FAR

+Byte's Sizes: (defining)
|_BYTE
|_WORD
L_QUAD

Labels:

Programming Formats:

Assembler Odds and Ends:

3) Debugging

4) How can YOU help?
------------------------------------------------------------

1) Introduction

 I would just like to introduce this product as it is, and like to tell
you a little about it. This is Intel Assembler. I have built this for use
with IBM computers, and I have had to start from scratch to get it done.

 But Now that it IS almost done, there are only little bugs to fix along
the way. I have various notes on the program, but these I won't get into
detail on it. If you want to understand the program, read it.. Want to use
the program? Run it. The program, unfortunately, is too large for an EXE
file to be compiled to use with. I know this will cause some problems, as
my last version, wasn't nearly as complete, but could run as an EXE file,
so you can just add it to your list. But, it does a lot more control, it's
got many improvements over the previous version, it uses SOME of the older
item's stuff.

 Although built now to do 32 bit power, it is not perfect, but most things
you won't have any problems on. Just keep track of your code, and it will
do the rest. I recommend if you are doing this with DOS's stuff without
using a lot of other software (like I have) use "INT 3" A LOT!!.. it's
quick, helpful.. to the point. And if you want, it's also useful to do this.

stop1: int 3
mov byte ptr [stop1],CCh

 Use the stop number and that, and after the int 3 is clear, it will remake
it for the next loop.. nice for certain situations, like working with files
with reading and writing...

 Also this is FREE software.. Open source, I hold nothing back, and I think
more people should do this. I show this open, free, change as you like, and
do as you want. Just give the appropriate credit to me for the work. Any
changes done by you can be noted. I suggest in the history file.

 This assembler is done (until updated) V0.21 on 9/27/00.

 Enough rambling.. on with the next part.
------------------------------------------------------------
2) Using the program

 This will be extensive notes on the assembler, and what to do and what NOT
to do. But every program has it's quirks, right?

 I will try and put this in the most logical order, and some of this
information can be noted from the history file. (History2.txt) This history
file tells what I have worked on, and when.

 ALSO a brief note.. In my previous assembler, it only supported HEX for all
the information. This made it troublesome for some programming. BUT in this
version, these formats are supported. (DECIMAL is default)

 HEXADECIMAL:
 This format is well known in the computer world. It's 0-9 and A-F, going
16 total numbers (0-F) It's most known in these two formats.
Hex (6) + Dec (10)

0x0000 - 0x This format, I have no idea where it came from, but the X
         identifies it as HEX.. I have seen it done, so I just added it.

0000h  - H  This HEX format is most common. Add the H and it's hex.

 DECIMAL:
 Decimal, Is a format we ALL use naturally. This format is the default one
of them all. I am NOT going to change this... Unless someone likes using
HEX or something else, and then I suggest you STILL use the symbols.

 Dec (10) doesn't use any symbol, so it's on it's own

 OCTAL:
 Octal, is a format used a little different, unlike the others, this has
only 8 (OCT) different choices. Also, it only uses 3 bits, so be sparring,
as it can easily make calculating certain bits hard.

0000o  - O  O, Rarely used, it didn't need much to tell it apart.

 BINARY:
 Binary, this is the SMALLEST format known on computer scales. done with
2 numbers (BI) 0, and 1. This doesn't change, but with a line of these
numbers you can get any number you want. used mostly for multiplying or for
certain results that you need a certain bit on, and all the rest off.. or
certain bits on.

0000b  - B  This format is the only one I know of. Uses 0's and 1's, and
            It does the rest.

 NOTE: For mov's, adds, memory, instructions subtraction, and all those
       goodies, it does this check. NOTE that it only does 1 number, don't
       mix it up please, I hate bad code.


--------------------Types and Examples, and uses--------------------

(These types are used before the name)

 ^ - 1 byte
 @ - 2 bytes
 % - 4 bytes

--------------------------------------------------------------------------
 ^: This symbol I choose (I don't know why) for 1 byte. It is for labels
    that don't require a lot of space, simpler, and will help with some
    debugging issues
--------------------------------------------------------------------------
 @: This symbol I have chosen, works for 2 bytes. This is based off the
    Quickbasic's format choosing of 16 bits. It was also used in my
    previous assembler, and does for most labels.
--------------------------------------------------------------------------
 %: This Symbol, is based off Quickbasic's Format for 32 bits, and will be
    used as such. It's also the default choice for LABELS that are for
    memory locations. This does well with 32 bit memory usage. it can also
    hold large numbers.
--------------------------------------------------------------------------

NOTE: In a later version, I may add certain support for these symbols, so
      you don't have to use BYTE, WORD, or QUAD to get certain tasks done.

 Using them:
 This is simple enough. Just put the type on, and then an answer.
[type]Name number

@Opened 10000       - is 10000
^Opened 10000o      - is 4096 (too large for a byte)
%Opened 100000111b  - is 263

NOTE: names and labels are just that, they are replaced by the numbers they
      represent. So 'MOV [somestuff+3],AX' does NOT work. Take this ahead of
      time.

--------------------Distance--------------------
   Short, 127   forward and 128   back (not including the size)
   Near,  32767 forward and 32678 back
   Far,   Direct, 16 bit offset, 16 bit segment address
   Ptr,   is a pointer (uses one of the other codes to help it point)
These are simple and to the point. 

 These are to be used with distance related jumps, loops, commands, and
anything requiring change. NEAR is assumed.
Example:
Jmp Short blah  ;this will do a short jump to blah. But if the jump is
                ;too far away, it returns 0, failing the jump

and if you do
je helloworld   ;this assumes NEAR.. which nothing wrong is, but it's
                ; 2 bytes larger, and it uses the 386+ set, so it's
                ;compadibility is broken.


--------------------Byte's Sizes--------------------
 BYTE - 1 byte big, smallest combined data format
 WORD - 2 bytes long
 QUAD - 4 bytes long. (386+)

 This is used with undefined formats.. like the following.

 Mov [1000h],12 ;this has 12, but is that a byte, word, or doubleword?
 use this:
 MOV BYTE PTR [1000h],12 ;and it is defined for the compiler

NOTE: In my programs, i don't see a use for PTR, but you can use them anyway
      for compadility if you want.

--------------------Labels--------------------
 Labels is one of the easiest ways to set up pointers for jumps, data and
other important stuff. Most locations are put under 32 bit ones for later
compatibility.

 NOTE: My previous version only used 16 bits for memory allocation, this
       does NOT bring incompatibility, since only the compiler actually
       used the numbers.

--------------------Programming Formats--------------------

 The programming is done in different ways, but the most used is this format

Label: Instruction / information ;comment
So this is legal
TESTING: rep movsb          ;move 1 byte at a time

NOTE: Rep is actually another instruction, but it's only used with certain
      data transferring/scanning instructions.

 In my previous format, I didn't see the use of the format at the time, and
you had to do it like this.

TESTING:
rep
movsb

 This, although not hindering, does get irritating. It takes up extra room,
it's chunky, it's pointless... but it had to be used in my previous programs.
I have updated the L-fun.bas to support the new format, and the old format
is still supported, it's just not as... obvious...

Assembler odds and ends:

--------------------------------------------------------------------------
 CPX - This is a REALLY special instruction. It isn't part of the 386
       instructions, rather.. It is part of the compiler, it tracks the
       length and position of each character, giving label's their proper
       locations, and helps with certain.. other tasks.
--------------------------------------------------------------------------
 $   - This, is another prefix, like the ^, @ and %. The difference, is this
       is yet another counter. It's treated like a label, but what's special
       about it, is it counts the distance between the last label used, and
       the current label name.
Ex:

Label: db "Testing",13,10
$label1

 This will make Label1 have the value 9, using the 32 bit counter. (just
in case something memory wise :) )
--------------------------------------------------------------------------
 #   - Includes. This is a bit different then other compilers, but in a
       way, very familiar. what it does is open a file for includes, but
       doesn't get anything. This is linked closely with the !.
Ex:

#somefile.txt

 It just opens the file for it, nothing else. read along :)
--------------------------------------------------------------------------
 !   - This takes a certain subroutine, and copies it to the end of the
       assembly file. This is useful for certain types of files, and you
       don't have to copy and paste.. just add in, and it works.
Ex:
#somefile.txt
!Add2things

 NOTE: if you use CPX at the end of your program, like I do sometimes, it
       can REALLY mess up the program. Make a habit of making those at
       the end of the file, but with includes go on the end, so it's
       confusing. I will add a feature soon.
--------------------------------------------------------------------------
 *   - This is a different include, it takes ALL the subroutines in a file
       and adds them onto the program. There is no checking to see if labels
       are used again, so be careful.
Ex:
*Somefile.txt

 NOTE: On ALL includes, after the information is posted on, all the
       information directly following the !,#, and *'s are deleted, and
       a temp.asm file is made where it is all processed.
--------------------------------------------------------------------------
 L-Fun.bas - THIS program is a really useful essential. For my assembler,
             it tracks the subroutines, and where they are. and the length,
             but that is quite limited on it's own scale. Here's how you
             use it.

Get some subroutines.

test1: adc [bx],4
ret

test3: sub [si],2
ret

 These will do. Now at the VERY beginning of the file, add these codes.
!test1
!test3
 These codes are actually the !'s and the first label of your subroutine.
Put them in order as they are in the file, and when it gets to the next one,
it will keep them in order. So when you run L-Fun.bas, you will get this

!test1 3 5
!test3 6 8
test1: adc [bx],4
ret

test3: sub [si],2
ret

 Simple as that, and now my assembler will work with then.
--------------------------------------------------------------------------
 FASTFILE - I almost forgot about this. This is a feature I added for
            programmers, who when they make a product, ready to compile,
            the ones compiling it doesn't have to wait nearly as long. I
            know that most of the time is used getting it ready for making,
            not making it. So, this skips all that, and gets it all done.
            to use? Add it to the A$ part, which is

            'A$=command$
            a$="XD"
            Put M for make fast file. and F to use a fastfile. It's almost
            automatic. once it's done, here we go :) But you can still
            compile things without the fast file, just make sure not to use
            it on something you just changed, because it uses the fastfile
            instead of the assembler.
------------------------------------------------------------
  "XXX"   - I need to tell you about this. This feature is a little
            different, when you use codes (like MOV) you can use this
            code for comparing, moving, changing, subtracting, adding..
            For Example.
mov al,[bx] ;grab number
sub al,"0"  ;Kill ASCII and make real number
add bx,ax   ;Add?
add al,"1"  ;increase by 1? (I don't know, this is example code!!)

 OR

; (LCASE)
LCASE:          mov al,[bx]       ;grab letter
                cmp al,"A"        ;see if in range
                jb short skipall  ;skip
                cmp al,"Z"        ;see if in range
                ja short skipall  ;not in range
                sub al,"A"        ;Kill Big letter,
                add al,"a"        ;Make Small Letter
skipall:        ret

 Does this look simple or what? :) rather then knowing "A" is 41h,
and "Z" is 5Ah and "a" is at blah blah... (don't forget labels too :) )
(this is one of the best features I could have put in)

NOTE: when it subtracts from ""'s they are turned into numbers before
hand.. so if you have "S" (53h) you take away 41h from it and get 12h,
then add "a" (61h) and you get "s" (73h) cool huh?
------------------------------------------------------------
3) Debugging
 I would take a note now that most problems are from unknowingly setting
up something the computer hasn't completely understood. For example, making
a jump to a label you haven't added. Until it IS added, it will treat it
like a number, rather then a link, and it will try to jump to some far
position rather then a short or near jump it should be. If you have
problems, look at the Subroutine's Variables, and have it print them. Most
Problems can be noted here.. if not. I can try to help you, either by email
or you can send me your code and I will quickly go through it.

 Now, there are a couple debugging features. Not many, but they can greatly
help you when you are working with your code. these are the features

--------------------------------------------------------------------------
 Debug.txt - This text is made after EVERY compiling. It overwrites all
             data previously entered in there, it tells the locations of
             the instructions, the size, and sometimes leaves notes. It
             doesn't include the label names, just straight assembly code
             (as the compiler sees it)
--------------------------------------------------------------------------
 Bunny.bas - silly name, but useful. This breaks a file apart into it's
             bits, one byte at a time, as well as what the bytes are. this
             is ALL it does. Use this for files you are working with, the
             programs you build, and others to see what's going on.
--------------------------------------------------------------------------

 These are all the debugging tools I have for your programs right now, I
highly suggest using a debugger program, like debug.exe until you know
what's going on. and fix it. it's a great help. And the more you learn from
your mistakes, the fewer mistakes you will later make.

4) How can YOU help?

 This is FREEWARE software, so you can distribute it to everyone, freely,
but DON'T change the contents of this zip file, or the actual programs.

 If you want to help, if you see any odd bugs, or happenings, write me
about it, what instructions you used, anything really odd that was
happening, and your thoughts on it. If you send me your code too, I will
read through it, and see what was wrong. And when I get the bug fixed, I
will update it in the new version.

 If you really like my product, and although I am not one to charge for
my services, or for my work, if you really appreciate my work, you can
send $20 (more or less, it's up to you, and Voluntary) to:

 Ryan Cecil
 1203 16th St.
 Wheatland WY, 82201

 With some more time, I can make a totally free assembler, as powerful, or
more then the current one. But with 5 MAIN differences.

1) Built in assembly (smaller)
2) FASTER!! (not interpreted)
3) Compatible (uses Intel code, not msdos only like others)
4) Some Libraries (Here comes the easy road :P)
5) More Features (Well, when I get to them anyway :) )
