Jump to content
IGNORED

XB line encoding


moulinaie

Recommended Posts

Hi,

 

Where to find the information about how a X-BASIC line is encoded?

What I need is this:

 

I have a line number..

 

I want to get its address in CPU RAM (I assume that the 32K is attached)

I want to parse the line

Then I want to get the next line and so on...

 

Guillaume.

Link to comment
Share on other sites

Somewhere I have a whole assembly program (source code) which lists an Extended BASIC program, together with a checksum for each line. It's on 5 1/4" disks for the real 99/4A, so before I try to transfer it to something more modern, would such a program be helpful to you?

 

Sure, this would help !

Guillaume.

Link to comment
Share on other sites

I'm pretty sure this is discussed in the Smart Programmer magazines. These are all available for download on the WHT FTP site IIRC. There's not that many of them so it will not take too much time to search through them. You'll find lots of other interesting stuff at the same time!

 

Mark

Link to comment
Share on other sites

Here you go all the tokens used:



[0299] ***********************************************************
[0300] * BASIC TOKEN TABLE
[0301] * EQU >80 spare token
[0302] 0081 ELSEZ EQU >81 ELSE
[0303] 0082 SSEPZ EQU >82 ::
[0304] 0083 TREMZ EQU >83 $
[0305] 0084 IFZ EQU >84 IF
[0306] 0085 GOZ EQU >85 GO
[0307] 0086 GOTOZ EQU >86 GOTO
[0308] 0087 GOSUBZ EQU >87 GOSUB
[0309] 0088 RETURZ EQU >88 RETURN
[0310] 0089 DEFZ EQU >89 DEF
[0311] 008A DIMZ EQU >8A DIM
[0312] 008B ENDZ EQU >8B END
[0313] 008C FORZ EQU >8C FOR
[0314] 008D LETZ EQU >8D LET
[0315] 008E BREAKZ EQU >8E BREAK
[0316] 008F UNBREZ EQU >8F UNBREAK
[0317] 0090 TRACEZ EQU >90 TRACE
[0318] 0091 UNTRAZ EQU >91 UNTRACE
[0319] 0092 INPUTZ EQU >92 INPUT
[0320] 0093 DATAZ EQU >93 DATA
[0321] 0094 RESTOZ EQU >94 RESTORE
[0322] 0095 RANDOZ EQU >95 RANDOMIZE
[0323] 0096 NEXTZ EQU >96 NEXT
[0324] 0097 READZ EQU >97 READ
[0325] 0098 STOPZ EQU >98 STOP
[0326] 0099 DELETZ EQU >99 DELETE
[0327] 009A REMZ EQU >9A REM
[0328] 009B ONZ EQU >9B ON
[0329] 009C PRINTZ EQU >9C PRINT
[0330] 009D CALLZ EQU >9D CALL
[0331] 009E OPTIOZ EQU >9E OPTION
[0332] 009F OPENZ EQU >9F OPEN
[0333] 00A0 CLOSEZ EQU >A0 CLOSE
[0334] 00A1 SUBZ EQU >A1 SUB
[0335] 00A2 DISPLZ EQU >A2 DISPLAY
[0336] 00A3 IMAGEZ EQU >A3 IMAGE
[0337] 00A4 ACCEPZ EQU >A4 ACCEPT
[0338] 00A5 ERRORZ EQU >A5 ERROR
[0339] 00A6 WARNZ EQU >A6 WARNING
[0340] 00A7 SUBXTZ EQU >A7 SUBEXIT
[0341] 00A8 SUBNDZ EQU >A8 SUBEND
[0342] 00A9 RUNZ EQU >A9 RUN
[0343] 00AA LINPUZ EQU >AA LINPUT
[0344] * EQU >AB Zpare token (LIBRARY)
[0345] * EQU >AC Zpare token (REAL)
[0346] * EQU >AD Zpare token (INTEGER)
[0347] * EQU >AE Zpare token (SCRATCH)
[0348] * EQU >AF Zpare token
[0349] 00B0 THENZ EQU >B0 THEN
[0350] 00B1 TOZ EQU >B1 TO
[0351] 00B2 STEPZ EQU >B2 STEP
[0352] 00B3 COMMAZ EQU >B3 ,
[0353] 00B4 SEMICZ EQU >B4 ;
[0354] 00B5 COLONZ EQU >B5 :
[0355] 00B6 RPARZ EQU >B6 )
[0356] 00B7 LPARZ EQU >B7 (
[0357] 00B8 CONCZ EQU >B8 & (CONCATENATE)
[0358] * EQU >B9 spare token
[0359] 00BA ORZ EQU >BA OR
[0360] 00BB ANDZ EQU >BB AND
[0361] 00BC XORZ EQU >BC XOR
[0362] 00BD NOTZ EQU >BD NOT
[0363] 00BE EQUALZ EQU >BE =
[0364] 00BF LESSZ EQU >BF <
[0365] 00C0 GREATZ EQU >C0 >
[0366] 00C1 PLUSZ EQU >C1 +
[0367] 00C2 MINUSZ EQU >C2 -
[0368] 00C3 MULTZ EQU >C3 *
[0369] 00C4 DIVIZ EQU >C4 /
[0370] 00C5 CIRCUZ EQU >C5 ^
[0371] * EQU >C6 spare token
[0372] 00C7 STRINZ EQU >C7 QUOTED STRING
[0373] 00C8 UNQSTZ EQU >C8 UNQUOTED STRING
[0374] 00C8 NUMZ EQU >C8 ALSO NUMERICAL STRING
[0375] 00C8 NUMCOZ EQU >C8 ALSO UNQUOTED STRING
[0376] 00C9 LNZ EQU >C9 LINE NUMBER CONSTANT
[0377] * EQU >CA spare token
[0378] 00CB ABSZ EQU >CB ABS
[0379] 00CC ATNZ EQU >CC ATN
[0380] 00CD COSZ EQU >CD COS
[0381] 00CE EXPZZ EQU >CE EXP
[0382] 00CF INTZ EQU >CF INT
[0383] 00D0 LOGZ EQU >D0 LOG
[0384] 00D1 SGNZZ EQU >D1 SGN
[0385] 00D2 SINZ EQU >D2 SIN
[0386] 00D3 SQRZ EQU >D3 SQR
[0387] 00D4 TANZ EQU >D4 TAN
[0388] 00D5 LENZ EQU >D5 LEN
[0389] 00D6 CHRZZ EQU >D6 CHR$
[0390] 00D7 RNDZ EQU >D7 RND
[0391] 00D8 SEGZZ EQU >D8 SEG$
[0392] 00D9 POSZ EQU >D9 POS
[0393] 00DA VAL EQU >DA VAL
[0394] 00DB STRZZ EQU >DB STR$
[0395] 00DC ASCZ EQU >DC ASC
[0396] 00DD PIZ EQU >DD PI
[0397] 00DE RECZ EQU >DE REC
[0398] 00DF MAXZ EQU >DF MAX
[0399] 00E0 MINZ EQU >E0 MIN
[0400] 00E1 RPTZZ EQU >E1 RPT$
[0401] * EQU >E2 to >E7
[0402] 00E8 NUMERZ EQU >E8 NUMERIC
[0403] 00E9 DIGITZ EQU >E9 DIGIT
[0404] 00EA UALPHZ EQU >EA UALPHA
[0405] 00EB SIZEZ EQU >EB SIZE
[0406] 00EC ALLZ EQU >EC ALL
[0407] 00ED USINGZ EQU >ED USING
[0408] 00EE BEEPZ EQU >EE BEEP
[0409] 00EF ERASEZ EQU >EF ERASE
[0410] 00F0 ATZ EQU >F0 AT
[0411] 00F1 BASEZ EQU >F1 BASE
[0412] * EQU >F2 spare token (TEMPORARY)
[0413] * EQU >F3 spare token (VARIABLE)
[0414] * EQU >F4 spare token (RELATIVE)
[0415] * EQU >F5 spare token (INTERNAL)
[0416] 00F6 SEQUEZ EQU >F6 SEQUENTIAL
[0417] 00F7 OUTPUZ EQU >F7 OUTPUT
[0418] 00F8 UPDATZ EQU >F8 UPDATE
[0419] 00F9 APPENZ EQU >F9 APPEND
[0420] 00FA FIXEDZ EQU >FA FIXED
[0421] 00FB PERMAZ EQU >FB PERMANENT
[0422] 00FC TABZ EQU >FC TAB
[0423] 00FD NUMBEZ EQU >FD #
[0424] 00FE VALIDZ EQU >FE VALIDATE
[0425] * EQU >FF ILLEGAL VALUE
[0426] ***********************************************************
[/code]

Of course this is in HEX as it is the Source code from RXB or XB but these are the tokens now you have to deal with how they are used.

Example is like CALL VCHAR(2,3,44,10)

First you have the byte for how long the line is, then CALL token, then the token UNQSTZ then a how long byte then ( token, then NUMZ token, then the length byte, then the number in byte format, then the COMMAZ token...

The last token is a >00 that was added to the line to indicate the last of the line. Now this is all in MERGE format. In program format it is much harder to see what is going on.

Good luck.

Rich

Link to comment
Share on other sites

Hi,

I think I have now what I want, the idea is to read lines of DATA to compile directly MLC without reading DATA in a string Array.

 

1) So in >8330 there is a pointer to the line table.

2) Each entry is two words long: WORD1 line number, WORD2 line address

3) the table starts with the upper line number

4) the address of a line points to the first byte of the line, and address-1 is the line length including the final zero.

5) a DATA line will be:

>93 (DATA)

>C8 or >C7 (for quoted or unquoted string)

n (string size)

..... the string itself

eventually >B3 for a comma and another string or >00 if it's the end.

 

With this I'll be able to speed up MLC compilation and to reduce the amount of used memory:

 

Before:

MLC program is in DATA lines

DATA are read into a string array (so occupying a lot of VDP RAM)

The array is sent to the compiler that reads back line by line into CPU memory to compile the program.

 

Now (*)

No VDP RAM used

Each string is directly read from CPU RAM and compiled.

 

Guillaume.

 

(*) : let's say.... in a near future.

Link to comment
Share on other sites

In my GPLHOW2 guildes on this site is a Zip with a TI Basic program that prints out on screen or file or paper the XB program in memory.

 

Rich

 

Thanks, but I succeded in what I wanted: the new MLC compiles directly from the DATA lines read in memory.

I had a long fight agains bugs before noting that the lines table can start at an odd adress... Then I had to get the pointers byte by byte instead of words by words... What a pity...

 

Guillaume.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...