Re: TIB:86ASM Module Builder


[Prev][Next][Index][Thread]

Re: TIB:86ASM Module Builder




Hey Jason K., (and those interested),

I am the guy who posted the e-mail about the 86 module builder/Compiler. 
I don't think you quite understand how it is supposed to work, so I'll
explain it in detail...

Because the TI86 has built in Assembly support, you can call assembly
programs from BASIC by using the Asm( command.  So lets say you want to
write a game in TIBASIC called Tetris, and you want it to have some cool
Asm graphics and maybe some inverted text.  To do this the game will
consist of 2 prgms: the BASIC prgm, and an ASM prgm that you will create
in the Basic Editor and then compile into assembly with ASM Module
Builder/Compiler.

Here is an example of what the TI-BASIC prgm and ASM Module prgm could
look like. The Asm prgm is created in the Basic Editor and will be
compiled into Asm later.

TI-BASIC PRGM: "TETRIS"                     ASM MODULE:	"TETASM"
:1->A					:If A==1:Goto TITLE
:Asm(TETASM)				:If A==2:Goto ASMPIC
:begin game code....			:Lbl TITLE
:Lbl Picture				:ClLCD
:2->A					:Contrast(20
:Asm(TETASM)				:Line(1,2,3,4,1
:game code...				:Invert(5,4,"TIBASIC TETRIS"
:End					:Sprite(2,3,00FFEF00...etc.
					:Return
					:Lbl ASMPIC
					:AsmPic(picture
					:Return

Notice how the Basic prgm calls the Assembly module when it needs some
Asm capability, then the Asmprgm jumps back to the Basic prgm to continue
the game.
Also notice that there is only one Asmprgm needed to do all of the
assembly graphics for the game, because of the use of Goto commands in
the Asm prgm.

Now for the game to work, you have to compile TETASM into a working
Assembly Prgm.  This will be done by an on-calc compiler.  The AMB
compiler will ask you for the name of your BASIC prgm to be converted to
Asm, in this case TETASM.  It will check to make sure that "AMBprgm" is
the first command, so it knows you are not trying to compile a real
TI-BASIC prgm.  Then the compiler will copy all the commands in the prgm
to a TI-OS string variable. I am going to do this because I don't have
enough knowledge of Asm to make a compiler that will compile stuff
written in a prgm.  AMB will then go through the commands and convert
them to Asm one by one using a database of Asm routines in Ascii Code. 
The ASCII Code ASM prgm will be created as the Compiler moves along.  For
example, the compiler will go along and when it sees a command like
"Contrast(20", It will copy the appropriate routine code (with a few
changes made to it; in this case contrast will be set to 20) to the
executable ASM prgm. After all the commands are compiled, and the jumps
done, and maybe some error checking, you will have an executable ASM prgm
that you can run using "Asm(TETASM)".

Now you have a compact little assembly prgm ( a module) that can be
called by your BASIC prgm to do cool stuff.

The benefit of doing it this way is that the programmer can distribute
his games with only 2 prgms, and the programmer can put exactly what he
wants into his ASM module.

You may be thinking that calling and Asm prgm all the time will be slow,
but I don't think it will be that noticeable

Now let me explain all the commands:

1.) CONTRAST(value    
    Contrast can be set to a certain # or decreased/increased by 1.
2.) IF/LBL/GOTO
     will allow an easy way to make one Asm prgm do all the work for your
Basic      prgm.
3.) SPRITE(X,Y,Ascii hex codes 
     8x8 aligned for the fastest and easiest routine.  this command will
also read hex data stored in a TIOS string.
4.) RENAME(var, newvar
     maybe I would add this.
5.)GETKY  :A must.
6.)SHUTDWN
    Great for Basic GUI's, or whatever else you want to do with it.  It
is easy b/c it is just one romcall.
7.) LINE(X1,Y1,X2,Y2,parameter 	
   The option of erasing lines, or white lines, is not available on the
86, so this is a must in my opinion, plus its an easy rom call.
8.) RUNON/RUNOFF
     Probably will add because its just one simple Rom Call.
9.) FREEMEM 
     Again, easy Rom Call.  I will add it because people can use their
imaginations to make other uses for this besides GUI's.  Don't disclude
an easy command b/c you don't see a use for it...you never know what
people may come up with.
10.) BASIC(tibasic prgm
    This command is needed so that the ASM module can call other Basic
prgms.
11.) ASM(asm prgm
      required so that the module can execute other modules
12.) INVERT(
      Could be like Outpt command, or like a INVERTON/OFF (which would be
easier) 
13.) OUTPT(
       Allows module to do text and maybe display large font on graph
screen.
14.) ASMPIC(picstring)
      Very easy command. will display an ASM pic stored in a string.
15.) RETURN
       needed so Asmprgm can return to BASIC prgm
16.) BLOAT(string  /  UNBLOAT(string
       Hehe, just thought of this.  Will use SCaBBy's "Bloat" compression
utility to compress and uncompress strings for levels, data, etc.  Sounds
complicated, but easy to do.  Its all just cutting and pasting the
routine...

Any more ideas?

What Jason said......
>Just dont make routines for specific things that one Basic program may 
>use,
>but all others dont, and then it would be a waste of space to keep on 
>the
>calc.

This is what is so great about ASM Module Builder. The programmer makes a
Asm prgm that does exactly what he wants, and nothing else.  NO
Libraries.  

Compiler should not be that difficult to program.  Mostly just cut and
paste. Jumps will be difficult though.

Now tell me what you think?

~Philip
pmadsen@juno.com

___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com/getjuno.html
or call Juno at (800) 654-JUNO [654-5866]