I started work on this project almost a year and a half ago as a BASIC program that used Celtic 3 and Omnicalc. It used Omnicalc for the font hooks and Celtic 3 to modify font data. Using this technique, I made games that used chars as sprites. A little after that, assembly finally clicked.

So I started making a program called SpriteLib that made its own font hook and could edit fontsets itself, but I also added sprite drawing routines and other memory editing features. But then I added much more and I could see that I would run out of room. So, I made the APP called BatLib and here is what it has to offer:

BatLib is designed around memory efficiency and speed. Many functions use pure data as opposed to floating point values or hex. Because of this, there are functions that convert data to make life that much easier. For example, if you want to make sprite data for a game, you could go through the task of coming up with the hex and then compressing it using HexToken, but there is an easier way: Just use GetSprite. It will convert a sprite on the graph screen of whatever size you specify to the correct format used by BatLib.

BASIC programs can sometimes get really involved and thus need all the RAM they can get. Luckily, if a command itself cannot source the data directly out of flash, there are other commands that can. If you want to copy Str8 to Str9 and Str8 is archived, you can do something like dim(21,".Str8→Str9

If you have a sprite that needs to move around (like for a walking sprite) there is a command that draws directly to the LCD. What this means is that you can draw on the graph screen, then after that you can just display the sprite. Updating the LCD removes the sprite without changing what was underneath.

There is a rectangle routine currently that can make 12 fill types and is faster and more reliable than using the OS ROM calls. If you ave ever noticed how some of the OS rectangles clear out the pixels around a border, you will note that BatLib does not do this. Plus, the OS has 5 or 6 rectangle routines whereas BatLib has 10 plus 2 shifting routines. The shifting routines shift the pixels inside the rectangle you specify.

There is a command that lets the user store or recall pictures from RAM or archive and can archive, unarchive, or toggle the archive status of the picture. As a note, it stores the current screen, not necessarily the graph screen and pictures store the whole screen including the last row.

If you have ever used list data for games like RPG's you will appreciate the use of SubList as it allows you to grab a portion of a list from RAM or archive.

There is also a command that initiates BASIC ReCode which was another project I started back in May/June and have since included in BatLib. It doesn't have much, but it is intended to be an interpreted programming language that can be used in BASIC.

If you have ever wanted sound in your programs, BatLib offers the command PlayData that does just that-- it converts data to sound. You will need headphones that fit the serial port.

There are several key hooks that can be installed including one that takes a snapshot of the screen and stores it to the graph and one that lets you control the delay speed of repeating keys.

There is a simple line reading function that lets the user define what byte defines a newline. This needs some work as it does not yet recognise the end of a file (so the last byte needs to be a newline). It does read lines from archived variables, too, though.

There is a drawing function that includes 13 drawing tools including simple lines, filling of the graph screen and pixel options. When modifying a pixel, the previous state of the pixel is stored in Ans.

There is a command that lets the user draw rectangles directly to pictures (like drawing directly to Pic1 for example).

There is a command that uses the drawing functions directly on pictures. That means you can pixel test pictures (big thanks go to DJ_O for this idea).

There is a command that can convert a hex string to some other base using arbitrary precision. The hex string can be up to 248 bits. This is really just a beta/placeholder because I plan to add support for other base inputs and much larger numbers. As it is, converting a 248-bit value to decimal is still pretty neat, right? All 'F's produce a 75 digit base 10 number.

There is also a command that provides 6 different font hooks including experimental 8x8 and 6x8 fonts. I made a cursive font for the 8x8 routine (to give an idea of what can be done).

In the unreleased version I am working on implementing some of my other projects such as CopyProg which copies programs or other vars out of RAM or Archive directly to another variable and GetName which returns the name of a variable (like returning the name of the 1st program in the program list).

There are things that I am sure I have missed and I am still revising things in preparation for the next release. Up until now, I have had to change syntax to remain compatible with other apps and I still need to shift around RAM usage. After the syntax is finalised in this version, I will try to make sure it remains backwards compatible.

Here is a list of commands in BatLib (currently). As a note command 16 needs to be replaced:

00-DisableFont
01-IndicatorOff
02-EnableFont
03-SetData
04-LoadData
05-HexToken
06-TokenHex
07-SetMap
08-GetMap
09-GetTile
10-GetKeyGroup
11-GetBytes
12-StoBytes
13-TileMap
14-VarEditByte
15-VarReadByte
16-VarDrawSprit
17-MemEdit
18-MemRead
19-Editbyte
20-ReadByte
21-GetVar
22-ASMHex
23-ASMToken
24-DPutSprite
25-VarType
26-BatteryLevel
27-IncContrast
28-DecContrast
29-Rectangle
30-ScrnToGraph
31-DispChar
32-SetContrast
33-FlagWrite
34-FlagRead
35-GetSprite
36-PicHandle
37-OutputASCII
38-SubList
39-ZAddress
40-BASIC ReCode
41-GetStats
42-AnsType
43-Get2Key
44-PlayData
45-GetChar
46-PortEdit
47-PortRead
48-ScreenShot
49-SpeedyKeys
50-Uninstall
51-DisableKeyHooks
52-HexSprite
53-TokSprite
54-LineRead
55-SetFont
56-Draw
57-GetVersion
58-ShiftGraphRight
59-BaseX
60-DelVar
61-DrawRectVar
62-DrawToVar
63-PxlTestPic
64-CopyProg
??-DispGraph


BatLib is not complete and I plan to add much more. I plan to add a menu routine similar to the TI-89 function PopUp (that is one of my favorite TI-89 commands) and I plan to add arbitrary precision math routines. I also have a lot of work to do with BASIC ReCode because I have not put any time into it in the past few months and I never made it past a few commands.

Again, there are a bunch of things I have not covered (like stringing commands), but I have to go eat... I am sick and I've only eaten twice in the past three days !_!

Okay, bye for now!
Sorry to hear that you don't feel well. Sad Please excuse the following, as it's not meant to be pessimistic. I'm very impressed with what you've done! I'm wondering what distinguishes this from the Celtic III / xLIB / PicArc / Omnicalc / DCSB Libs quintumvirate supported by Doors CS; looking at your list, I haven't found anything that isn't built into those libraries or at least writeable with a handful of BASIC. Smile Thanks in advance, and keep up the great work.
The font stuff looks pretty unique (you can design your own 8x8 font and use that for a tile map), as does some of the more advanced rectangle stuff, such as shifting the pixels withing a given rectangle. The sublist is a handy routine, and I imagine is much faster than doing the same in BASIC. Drawing directly to a pic variable is more efficient than recalling it, drawing, and then storing.

Here is the list of rectangle types:

Code:
               | Type is the type of rectangle to draw:
               |      0 =White
               |      1 =Black
               |      2 =XOR
               |      3 =Black border
               |      4 =White border
               |      5 =XOR border
               |      6 =Black border, white inside
               |      7 =Black border, XOR inside
               |      8 =White border, black inside
               |      9 =White border, XOR inside
               |      10=Shift Up
               |      11=Shift Down
Here's what xLib provides:
Code:
    3 = Draw an EMPTY RECTANGLE with BLACK OUTLINE
    4 = Draw an EMPTY RECTANGLE with WHITE OUTLINE
    5 = Draw an EMPTY RECTANGLE with INVERTED OUTLINE
    6 = Draw a RECTANGLE with a BLACK FILLING
    7 = Draw a RECTANGLE with a WHITE FILLING
    8 = Draw a RECTANGLE with an INVERTED FILLING
    9 = Draw a WHITE RECTANGLE with a BLACK OUTLINE
    10 = Draw a BLACK RECTANGLE with a WHITE OUTLINE
We were talking earlier today about line drawing routines, and I suggested being able to set the dash pattern and she said she would look in to that. What that would allow is passing in an array of integers that specifies the lengths of alternating dashes and spaces in dashed lines. So {2,2,3,3} would specify a pattern that has two solid pixels followed by two white pixels followed by 3 solid followed by 3 white etc. That's, of course, just speculative right now, but the other stuff definitely improves some of the functionality and adds other.
KermMartian wrote:
Sorry to hear that you don't feel well. Sad Please excuse the following, as it's not meant to be pessimistic. I'm very impressed with what you've done! I'm wondering what distinguishes this from the Celtic III / xLIB / PicArc / Omnicalc / DCSB Libs quintumvirate supported by Doors CS; looking at your list, I haven't found anything that isn't built into those libraries or at least writeable with a handful of BASIC. Smile Thanks in advance, and keep up the great work.

Yeah, I understand. I really don't have anything that can compare to DCS, I was just working on this to pass the time. I was never expecting it to get up to the level of all those great apps anyway. I just enjoy programming Very Happy And I think I'm going to be fine, I'm feeling better already ^-^ Also, as a note, I currently have 8972 bytes left of code space before I fill up the 16384 bytes... my goal has been to fill that up Very Happy I still have about a hundred bytes of unused code that I need to take out because some of the code no longer needs to be there because of the change of some syntax.
Okay, so it has been a while since the last update and there is much that has been added. I have worked out a few more kinks and I have added 26 commands since the last update here. On top of that, I have put some heavy work into command 40 over the past few days so that BASIC ReCode now functions as a programming language capable of producing games. The new commands are:
65-RealToStr
66-StrToReal
67-ListToStr
68-MakeAnsString
69-SubMatrix
70-PlayNote
71-Logic
72-MatrixList
73-Left
74-Right
75-Mid
76-Diag
77-DiagI
78-SubCol
79-SubRow
80-ListToDiag
81-ListToDiagI
82-ListToCol
83-ListToRow
84-ExecVarBASIC
85-GetProgName
86-Timer
87-DrawText
88-DrawDispText
89-ASCIILength
90-DrawTokenStr

It is now at 10606 bytes of code so I have only 5778 bytes to go!
Here are some screenies:
This is a ReCode program:

This is SubMatrix:

Here is a link to the download for v4.00.92.43:
http://www.omnimaga.org/index.php?action=dlattach;topic=5383.0;attach=6555
Looks cool, great job on the updates. Smile
Looks cool, but i have a question: what is if you have to use the normal dim( command of the TiOS, to prevent a invalid dim error?
In the readme she says dim( still works the normal way.
ok, then it is worth downloading it! Very Happy And i think this Lib would be worth adding to DoorsCS! Smile
DCS has very little free space available, so adding this library would require DCS to become a 4 page app instead of a 3 page app.
But having DCS plus this is like having a 4 page app anyway.
Yeah, but it would be cool if DCS would have this Lib, and the 84+ has a lot of RAM! Razz
RAM? Apps are stored in Flash. Maybe Kerm will add it if it starts to become popular.
Whoops, i mean ROM, srry. Razz
Xeda112358 wrote:
Here is a list of commands in BatLib (currently). As a note command 16 needs to be replaced:

00-DisableFont
01-IndicatorOff
02-EnableFont
03-SetData
04-LoadData
05-HexToken
06-TokenHex
07-SetMap
08-GetMap
09-GetTile
10-GetKeyGroup
11-GetBytes
12-StoBytes
13-TileMap
14-VarEditByte
15-VarReadByte
16-VarDrawSprit
17-MemEdit
18-MemRead
19-Editbyte
20-ReadByte
21-GetVar
22-ASMHex
23-ASMToken
24-DPutSprite
25-VarType
26-BatteryLevel
27-IncContrast
28-DecContrast
29-Rectangle
30-ScrnToGraph
31-DispChar
32-SetContrast
33-FlagWrite
34-FlagRead
35-GetSprite
36-PicHandle
37-OutputASCII
38-SubList
39-ZAddress
40-BASIC ReCode
41-GetStats
42-AnsType
43-Get2Key
44-PlayData
45-GetChar
46-PortEdit
47-PortRead
48-ScreenShot
49-SpeedyKeys
50-Uninstall
51-DisableKeyHooks
52-HexSprite
53-TokSprite
54-LineRead
55-SetFont
56-Draw
57-GetVersion
58-ShiftGraphRight
59-BaseX
60-DelVar
61-DrawRectVar
62-DrawToVar
63-PxlTestPic
64-CopyProg
??-DispGraph


BatLib is not complete and I plan to add much more. I plan to add a menu routine similar to the TI-89 function PopUp (that is one of my favorite TI-89 commands) and I plan to add arbitrary precision math routines. I also have a lot of work to do with BASIC ReCode because I have not put any time into it in the past few months and I never made it past a few commands.

Again, there are a bunch of things I have not covered (like stringing commands), but I have to go eat... I am sick and I've only eaten twice in the past three days !_!

Okay, bye for now!

Quote:
The new commands are:
65-RealToStr
66-StrToReal
67-ListToStr
68-MakeAnsString
69-SubMatrix
70-PlayNote
71-Logic
72-MatrixList
73-Left
74-Right
75-Mid
76-Diag
77-DiagI
78-SubCol
79-SubRow
80-ListToDiag
81-ListToDiagI
82-ListToCol
83-ListToRow
84-ExecVarBASIC
85-GetProgName
86-Timer
87-DrawText
88-DrawDispText
89-ASCIILength
90-DrawTokenStr



Jesus is this a giant compilation of Celtic 3, Omnicalc, and xlib? Surprised
90 Commands?!?!?!?!?!?!?!?! That is a LOT! Mabe it'll reach 100! Razz
EDIT: Also, it is 92 commands Very Happy it is 0~90 plus the Update LCD command. Also, ReCode has 44 recognised commands Very Happy

Hey, it has a programming language built in, too! And I do plan to go beyond 100 because there are several commands that I have been meaning to add when I get the time and drive to add them Very Happy My goal has been to pack as much as I possibly can into a one page APP and currently I have almost 6000 bytes to go. Anyway, I have three screenies for your amusement that deal with ReCode. ReCode is an interpreted programming language (like TI-BASIC) that can be used inside BASIC programs! It is even faster than using a parser hook and I am only just starting to add functions to it. Anyway:

This is the BASIC game, Block Eater:

This is the ReCode version:

This is a version I made an hour ago that uses full speed on an SE:


I don't really keep up to date, here, but since you guys are interested, here is the latest version of BatLib:
http://www.omnimaga.org/index.php?action=dlattach;topic=7030.0;attach=6574

If you guys have questions about the commands or command suggestions, feel free to mention them!
You should keep up to date here! My main concern with regards to BatLib, although I feel that you offer lots of cool functions, is that xLIB/Celtic III are so firmly ensconced at this point that it will be hard to convince people that they want to use BatLib over xLIB + Celtic + DCSB Libs or Axe.
This looks great! Keep up the good work. I'm going to have to try this soon and write a few programs in " ReCode"
Yeah, I know what you mean, Kerm. There are going to be a bunch of people that do use BatLib and ReCode, but Celtic 3 and xLIB are well known. But still, I think that the biggest problem is that Celtic 3 and xLIB are finished, so you didn't have to worry about making constant updates to DCS to keep up with Celtic 3 and xLIB compatibility. BatLib has nearly daily updates, though. Heck, over my 9 days off I added 43 functions in ReCode and 21 other functions to BatLib which comes out to about 9 new additions a day. Today I have added only 2 (though I plan to get at least two more finished in the next hour).
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 4
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement