Subject: Resulting object code

From: Owen Brand <[email-masked]>
Date: Sun, 31 Jan 2010 09:42:50 -0500

The resulting object code is sitting on my computer desktop now....  
However, during assembly I received several error notices, namely  
"Invalid Register.". So.... The resulting object code is worthless?

Owen Brand
**Oprysoft**
Opry99er.com

---

From: "opry99er" <[email-masked]>
Date: Sun, 31 Jan 2010 14:52:26 -0000

It might help to see the docs on this compiler::::

The BASIC and Extended BASIC languages
are arguably the most versatile of the
languages available for the TI9/4A.
Programs are easy to write, relatively
understandable, and simple to modify
and edit, with lots of error checking
to facilitate the process.  The main
drawback is that the interpreted nature
of these languages make them extremely
slow..
.
The intent in writing my BASIC compiler
was to make it possible to take full
advantage of the simple program
development offered by BASIC/XB, then
make an end run around the speed
limitations.  After perfecting the
BASIC/XB program it can then be
compiled into an equivalent code that
functions at a speed approaching that
of assembly language.  The average
BASIC program will run about 20 times
faster after being compiled, and
certain operations will run up to 70
times faster.  Naturally, CALL SOUND
has to function at the same speed as in
BASIC..
.
There are several methods by which the
compiler achieves this speed increase.
First, BASIC must perform a lengthy
prescan operation before a program can
even start.  This is done in advance by
the compiler and becomes part of the
compiled code.  Second, a TI BASIC or
XB program is interpreted twice by the
computer; once by the BASIC
interpreter, and a second time by the
GPL interpreter.  The compiler
generates "pseudocode" which needs its
own interpreter (called the runtime
routines), but at least only one
interpreter is involved, and it's a
fast one! Third, integer arithmetic is
used throughout instead of floating
point arithmetic.  This means that
numbers must be integers from -32768 to
32767.  This alone makes the code run
at least 5 times faster, albeit without
the versatility of 13 digit floating
point accuracy.  Fourth, to increase
the speed even more, virtually no error
trapping is done.  Any error reports
that are given are not very helpful
anyway because you won't know the line
number where the error happened.
Therefore it is IMPERATIVE that the
BASIC program be thoroughly debugged
before you attempt to compile it! .
.
.
Following is a brief outline of how to
use the compiler..
.
1 - Save a BASIC program to disk in
merge format..
2 - Run the compiler.  This reads the
merge format BASIC program and creates
an assembly language source code file..
3 - Run the assembler.  This reads the
assembly language source code file
created by the compiler and creates an
assembly language object code file..
4 - Run the compiler loader.  This
loads the assembly language object code
file into memory in a form that can be
saved and run via Extended BASIC..
.BP.
You can see that five files are used in
the process of compiling a program.  To
help keep track of them, I recommend
using the following conventions.  If
the original BASIC program is called
TEST then:.
TEST = original program.
TEST/M = merge format file.
TEST/S = assembly source code file.
TEST/O = assembly object code file.
TEST/C = compiled code ready to run.
.
.
Assume that you want to compile a BASIC
program with a filename of TEST.  The
following steps explain the procedure
in detail:.
.
Write or load the BASIC program.  This
can be done in either BASIC or XB.
Debug the program; then check the
listing to be sure that only integers
are used in the variables.  .
.
To save a BASIC language copy should
future changes prove necessary:.
SAVE DSKn.TEST<enter>.
.
(All subsequent operations are done
in Extended BASIC.).
.
To create the merge format file
required by the compiler:.
SAVE DSKn.TEST/M,MERGE<enter>.
(When using a Horizon Ram disk you may
happen to SAVE DSK3.TEST/M without the
MERGE.  If you do this you will
discover that you cannot then SAVE
DSK3.TEST/M,MERGE without first doing
DELETE "DSK3.TEST/M").
.
Put the compiler disk into a drive.
(drive #2 in this example.) .
.
To load and RUN the compiler: .
RUN "DSK2.COMPILER"<enter>.
.
You will be prompted for three
things: .
.
XB file to be compiled?.
DSKn.TEST/M<enter> .
Assembly output file name?.
DSKn.TEST/S<enter>.
Load runtime routines from? .
DSK2<enter>.
(Because the runtime routines are on
the compiler disk in drive #2).
Proceed (Y/N).
(Press Y to proceed).
.
The compiler will compile the program.
When finished you are presented with a
menu that lets you run the compiler
again; run the assembler; or end.  I
prefer to run the assembler via
Funnelweb.  This requires 3 files; AS
and AT, plus FW if you have a Horizon
or something that can run EA5 programs,
or LOAD if you want to run F-web via
XB.  (You might want to rename LOAD to
avoid the auto start operation from
DSK1).  Change line 270 in COMPILER so
that funnelweb loads with your
equipment.  Alternatively you can
simply quit the compiler program and go
to Funnelweb .
.BP
In Funnelweb, the Assembler will prompt
you for:.
Source file name?.
DSKn.TEST/S<enter>.
Object file name?.
DSKn.TEST/O<enter>.
List device name?.
<enter>.
Options?.
RC.
Space<enter> (Be sure the only option
is ""R"").
Proceed/redo/back.
<Fctn 6>.
.
The assembler will assemble the
program.  Be sure the runtime routines
(i.e. the compiler disk with the files
RUNTIME1 and RUNTIME2) are in the drive
you said they would be! Make sure your
disk has room on it for the Assembly
source file.  When assembling I've
received a number of DSR error messages
which have perplexed me until I
realized that the disk was full!.
.
When the assembler has finished, return
to XB..
.
With the compiler disk in a drive, load
and RUN the compiler loader from that
drive:.
RUN "DSKn.CLOADER<enter>.
.
You will receive the following prompt:.
Enter filename to be loaded:.
DSKn.TEST/O<enter>.
.
The compiler loader will load the
object file into memory, and create a
program that will run via XB..
.
At this point you are given prompts
that allow you to save the program in
an XB compatible format, or convert it
into an EA5 compatible format..
.
To save the XB compatible program that
the loader just created:.
SAVE DSKn.TEST/C<ENTER>.
.
If desired, follow the prompts to make
an EA5 compatible file..
.
Now you should be able to RUN the
program..
.
The BASIC compiler is able to compile
many TI BASIC programs, although
sometimes minor changes have to be made
to the BASIC code.  Some examples:.
32767+1=32768 in BASIC.
32767+1=-32768 in the compiled code.
10 IF RND>.5 THEN 100 ELSE 200 won't
work properly in the compiled code.
Instead, use 10 IF INT(RND*2)=1 THEN
100 ELSE 200 which gives either a 0 or
a 1 in both BASIC and the compiled
code..
200}200=40000 in BASIC; -25536 in
compiled code..
Remember that the compiler only works
with integer numbers from -32768 to
32767.  If an operation such as
dividing or SQR can give a non integer
result, then you should use INT in the
BASIC program to be sure that the BASIC
and compiled programs function the
same..
The timing of delays loops has to be
modified.  FOR I=1 TO 500::NEXT I gives
a delay of several seconds in XB or
BASIC; a fraction of a second in the
compiled code.  The best way to do a
delay is to use CALL SOUND.  For a 2
second delay you would use CALL
SOUND(2000,110,30)::CALL
SOUND(1,110,30).  Neither BASIC nor the
compiler can process the second call
sound until the first has finished, so
you get the full 2 second delay.  This
method makes it possible to create
delays that work the same in BASIC or
compiled code..
.
 
.
.BP.
Following is a list of the TI BASIC
operations supported by the compiler:.
.
As in XB, simple multiple statement
lines can be used, separating the
statements with the double colon.
.
CALL LINK("RUN") - same as RUN in XB.
Cannot use RUN or RUN line # within a
program..
CALL LINK("CON") - same as CON in XB.
<FCTN 4> breaks the program as in XB
except during INPUT..
.
.
All relational operators work the same
as in BX.  These include < > = <> <= >= .
.
Arithmetic operators all work as they
do in BX. Exponentiation (|) not
supported.  Remember that dividing 5/2
will give 2, not 2.5.  You can use INT
in the BASIC program when dividing (for
example INT(5/2) to be certain that
BASIC and the compiler give the same
results..
.
Logic operators from XB have been
included: NOT; AND; XOR; OR .
.
.
LET - optional.
REM - All remarks will be removed from
the compiled program, but you can GOTO
a REM statement just like in BX.  Use
of REM will not increase the size of
the compiled program..
! - the exclamation point REM from XB
has been included..
END .
STOP .
GOTO .
ON-GOTO .
IF-THEN-ELSE - works only with line
numbers, just like in BASIC.  XB style
of IF-THEN-ELSE not supported..
FOR-TO-STEP - step optional; +1
assumed.
NEXT.
.
INPUT - Can use the optional prompt,
but can input only 1 string or number
per INPUT statement..
READ .
DATA (Do not GOTO a DATA statement!).
RESTORE .
PRINT works like TI BASIC, including
TAB and the print separators ;,:.
DISPLAY - equivalent of PRINT..
.
CALL CLEAR .
CALL COLOR - expanded to work like XB
except for color of sprites..
CALL SCREEN .
CALL CHAR - expanded to work like XB..
CALL HCHAR .
CALL VCHAR .
CALL SOUND - cannot handle frequencies
greater than 32767.  (Neither can my
ears!).
CALL GCHAR .
CALL KEY .
CALL JOYST.
.
ABS .
INT .
RANDOMIZE - can be used, but has no
effect; it is done automatically.
RND - returns a value of 0.  RND is
only useful when it is multiplied by
another number.  i.e.  INT(RND*6) gives
the same results (0,1,2,3,4,5) when
compiled as it does when used in BX..
SGN .
SQR - gives same number as INT(SQR(N))
in BX.
.
ASC .
CHR$ .
LEN .
POS .
SEG$ .
STR$ .
VAL .
String concatenation (i.e. A$&&B$)
works the same as in XB.  String
truncated if over 255 characters; no
warning given..
.
DIM is optional but using it can reduce
size of the compiled program..
OPTION BASE .
ARRAY LIMITATION - Important!! The
program being compiled cannot use
nested arrays. For example, if you have
the two arrays DIM A(10),DIM B(10); you
can use Q=A(X+Y-Z) but you can't nest
the arrays like this: Q=A(B(7)).  Use
of nested arrays will cause the
compiled program to crash!!! For the
above example you would have to split
up the statement something like this:
X=B(7)::Q=A(X).
.
GOSUB .
RETURN .
ON-GOSUB .
.
.
NOT SUPPORTED:.
.
DEF.
ATN.
COS.
EXP.
LOG.
SIN.
TAN.
.
No File processing capabilities have
been implemented at this time..
.
The following have no meaning in a
compiled program:.
LIST.
NUM.
RES.
BREAK.
UNBREAK.
CON - use CALL LINK("CON").
TRACE.
UNTRACE.
EDIT.

---

From: ti99_forever <[email-masked]>
Date: Sun, 31 Jan 2010 09:19:34 -0800 (PST)

Use the "R" option during assembly. Usually that message is generated otherwise when you use "Rx" for register x.

--- On Sun, 1/31/10, Owen Brand <[email-masked]> wrote:

> From: Owen Brand <[email-masked]>
> Subject: [TI994A] Resulting object code
> To: [email-masked]
> Date: Sunday, January 31, 2010, 9:42 AM
> ------------------------------------
> 
> Yahoo! Groups Links
> 
> 
>     [email-masked]
> 
> 
>

---

From: Owen Brand <[email-masked]>
Date: Sun, 31 Jan 2010 12:41:20 -0500

Hmmm.... R option.  I'll have to attempt assembly again when I get  
back home tonight.  I don't remember an "R" option--- but this is my  
first time ever attempting to assemble source.... :) wish me luck.

Owen Brand
**Oprysoft**
Opry99er.com

On Jan 31, 2010, at 12:19 PM, ti99_forever <[email-masked]>  
wrote:

> Use the "R" option during assembly. Usually that message is  
> generated otherwise when you use "Rx" for register x.
>

---

From: ti99_forever <[email-masked]>
Date: Sun, 31 Jan 2010 09:48:59 -0800 (PST)

What assembler? All the ones I've used allow you to specify "Options?" without so much as an explanation, unless you read the manual.

They usually are: RLSTC
R - generate EQUates for R1-R15. The assembler default is to only use a number to refer to a register.
L - generate a listing file
S- generate a symbol table at the end of a listing file
T - in the listing, actually output the bytes of TEXT directives in the object code in the object code portion of a listing file
C - generate compressed object code (not usable with XB)

Option T is not documented in the EA manual, but the assembler accepts it.

From: Owen Brand <[email-masked]>
Subject: Re: [TI994A] Resulting object code
To: "[email-masked]" <[email-masked]>
Date: Sunday, January 31, 2010, 12:41 PM

Hmmm.... R option.  I'll have to attempt assembly again when I get back home tonight.  I don't remember an "R" option--- but this is my first time ever attempting to assemble source.... :) wish me luck. 

Owen Brand**Oprysoft**Opry99er.com
On Jan 31, 2010, at 12:19 PM, ti99_forever <[email-masked]> wrote:

    

--- On Sun, 1/31/10, Owen Brand <owenbrand@opry99er. com> wrote:

> From: Owen Brand <owenbrand@opry99er. com>

> To: TI994A@yahoogroups. com

> The resulting object code is sitting

> on my computer desktop now....  

> However, during assembly I received several error notices,

> namely  

> "Invalid Register.". So.... The resulting object code is

> worthless?

> ------------ --------- --------- ------

>     TI994A-fullfeatured @yahoogroups. com

---

From: Owen Brand <[email-masked]>
Date: Sun, 31 Jan 2010 13:20:19 -0500

Thanks. This is my first attempt at assembling source code so I am not  
fully aware of all the functions of editor assembler. I will have to  
look through the manual a little more to better understand these  
functions. Thanks for your help.

Owen Brand
**Oprysoft**
Opry99er.com

On Jan 31, 2010, at 12:48 PM, ti99_forever <[email-masked]>  
wrote:

> What assembler? All the ones I've used allow you to specify  
> "Options?" without so much as an explanation, unless you read the  
> manual.
>
> They usually are: RLSTC
> T - in the listing, actually output the bytes of TEXT directives in  
> the object code in the object code portion of a listing file

---

From: Owen Brand <[email-masked]>
Date: Sun, 31 Jan 2010 16:05:58 -0500

There is another program that came with the compiler called "CLOADER"  
which is designed to modify the object code that comes out after the  
source is assembled.  The purpose of this program is to modify the  
code for specific use with XB. it is in the docs I posted earlier.

Owen Brand
**Oprysoft**
Opry99er.com

---

From: Owen Brand <[email-masked]>
Date: Sun, 31 Jan 2010 21:56:22 -0500

Assuming I can get this source to assemble properly, would it be an  
EA3 program?  Load and Run?  If so, what should I specify as "PROGRAM  
NAME?". The docs talk about an EA5 option for the object code.... But  
I am not sure how to go about running the assembled code.

Owen Brand
**Oprysoft**
Opry99er.com