[Icarus Productions] - Click for main page The team Projects Articles Features
What exactly is Usgard?
Usgard is a state-of-the-art operating system for the TI-85 graphing calculator which allows to run assembly programs. This wasn't possible until ZShell, and we took up the idea of ZShell and vastly improved it.

What does the name Usgard stand for?
Usgard is the way you pronounce the word "Asgard" in germanic languages. In ancient norse mythology, Asgard was a place in the world where the gods lived.

Can you give some examples why Usgard is better than any other shell?
Sure. First off, by using "relocation", programs not only get faster, but also smaller. Second, Usgard features many built-in calls and new ROM calls which ease the programmer's live. What's more, it is very configurable by the user, who can choose between various shells, and more. Last but not least, many fantastic Z80 programmers use Usgard for their programs!

"Relocation?". Can you explain that to me?
On the TI85, you can't predict where a program is in memory, therefore, you need some way to get the addresses of functions, etc. inside programs. In ZShell/CShell/OS-85,..., this was done on the other hand by using special shell functions, which weren't only slow, but also uncomfortable to use, and on the other hand, by adding (PROGRAM_ADDR) to data values. Relocation solves that problem by anchoring a table to the program, which allows the OS to clearly identify addresses inside a program.

Where can I learn programming for Usgard?
Please check the Z80 programming page, which contains a few links.

I want to program for Usgard. What do I need?
Basically, everything is included in the Usgard ZIP. You just have to ensure that you decompress the file with directories, i.e. using the -d switch with PKUNZIP. Next, you'll need a text editor, some knowledge of asm and a link program. That's all.

How do you use relocation now?
Given you have a data byte in your program, called "Hiscore". To access it, you'd just write: ld A, (&Hiscore). Note the ampersand (&) character, which tells Usgard to automatically add the absolute program address to the relative offset of Hiscore.

After writing the .ASM file, what do I have to do next?
Compile it by typing "C myname" at the command prompt, where "myname" stands for the name of your ASM file without the extension! After compiling it, you should get a .85S file you can send to your calc.

I get lots of errors when compiling? What should I do?
At first, you should ensure that you have a blank line after the ".end" of the ASM file. Then, it's best to look at the lines told to you by the compiler and compare the instructions you wrote with a Z80 instruction reference.

How can I transfer Usgard/a program to my calculator?
To start with, you need a link cable. There are two types of those: serial and parallel. Serial ones can be purchased directly from TI (Graph-Link), or you can also try yourself at building one on your own (see the $4 link schematics). There were even some people who built cables for a very low price. Parallel cables are only available as homemade ones. Next, you need a program to send/receive variables from/to the calculator. In case you purchased the Graph-Link, you'll receive a transmitting program with it, otherwise, you may want to get one from the ticalc.org Archive. After choosing the platform you should easily find some transmitting program.

How do I include a picture?
A simple picture can be displayed the following way round:

  1. the Usgard ZIP contains GCP.EXE, a program to convert PCX files to ASM code
  2. convert your 256 color picture to ASM by typing: GCP myfile.PCX g2
  3. paste the asm file you get before the .end in your program, and add a lable to it
  4. at the place where you want to display the picture, enter:

ld HL, &label    ;(the one you previously defined)
ld DE, VIDEO_MEM ;DE=destination, LCD memory
ld BC, 1024      ;screensize=128x64, 1 byte=8 pixels->16x64=1024
ldir             ;copy BC bytes from HL to DE

And what about sprites?
Nearly as simple as that. Take an 8x8 image, convert it, paste it, as described above, and then:

ld HL, &label    ;your sprite
ld B, 10         ;x coordinate
ld C, 10         ;y coordinate
#fncall PSPR_NR  ;put the sprite!

You store the image like that:

.db %11111111
.db %11000011
.db %10100101
.db %10011001
.db %10011001
.db %10100101
.db %11000011
.db %11111111

0 being white and 1 black.

How can one find out the length of a variable?
Given that HL contains the name, you could do the following, after that, DE will contain the actual string length, NOT containing the length word (+ 2 bytes) and the length of the VAT entry (+5 + [length of name] bytes).

call VAR_GET
dec HL
dec HL
ld E, (HL)
inc HL
ld D, (HL)

What's the easiest way to check whether to objects intersect?
The simplest way to do is by just checking whether the condition (abs(x1-x2)<tilesize+1)and(abs(y1-y2)<tilesize+1) is true. If so, the two objects intersect. Here's a code snippet from XC-1701:

 ld    A, B		;compute absolute amount of overlap
 sub   H
 bit   7, A
 jr    z, GoOnTesting
 cp    9   		;test X-Overlap
 jr    nc, NoColl1
 ;X-Test succeeded, but what about Y?
 ld    A, C
 sub   L
 bit   7, A
 jr    z, GoOnTesting1
 cp    9
 ret   c
 or    A 		;clear carry flag

Whenever I take a battery out, the calculator restores its defaults??
Actually, the calculator should only restore the original contrast, because he "thinks" that you've changed batteries. However, if you pressed the ON key while some batteries are taken out, the memory will be reset.

How do I use the Textviewer?
To use the textview program that comes with Usgard, you first need to convert any .TXT file to a .85S using TEXTCONV.EXE / STRING85.EXE, which both can be found in the Usgard ZIP. Furthermore, you'll need textview, qview and the plus version of CoolShell (available in the Z80 section). After transfering all these programs to your calc, you just need to press '*' in CoolShell to show all files available. Selecting the textfile will start textview automatically.

I have troubles using WinShell with Usgard 1.5. What's wrong?
Unfortunately, WinShell doesn't work at all with Usgard 1.5 or above versions for some obscure reason. We tried fixing the problem quite a few times, but without success. Perhaps we may find the bug sometime, but until then, you have to bear with the other shells, like CoolShell. Sorry for the inconvenience.

How can I display snapshots taken using usgcap on my PC?
Using GCP, which is available in the PC section. The program allows you to convert .85S-image files to PCX files viewable by nearly every painting program.

I've finished a game/program. Is there a place where I can upload it?
For sure! Go to ticalc.org and upload it there! It's always good to see new programs for the calculator!!

If you want to add a new question mail to Andreas Ess.

How do I make one of those small plus signs bounce around the screen?
The following code just explains how to move a bitmap across the screen. You can use a plus sign as bitmap, or use M_CHARPUT to display the character instead.
The following code uses B and C as position of the sign, D and E as movement vectors. Further you should have a bitmap called PlusSign.

 ld    BC, 0
 ld    DE, $0101
 ld    A, B
 add   A, D
 ld    B, A
 cp    127-8
 jr    c, NoChangeX
 ld    A, D
 ld    D, A
 ld    A, C
 add   A, E
 ld    C, A
 cp    63-8
 jr    c, NoChangeY
 ld    A, E
 ld    E, A
 ld    HL, PlusSign
 push  DE
 #fncall PSPR_NR
 pop   DE
 jr    Loop

I know x and y coordinates for basic, but in ASM?
When programming in assembler, the screen consists of 128 pixels in horizontal direction and 64 in vertical. The upper left corner has the x/y coordinate (0/0), the lower right (127/63). Therefore, to move an object down the screen, you would increase its Y coordinate - not as you are used to do from standard basic programming!

How can I search for levels inside a program?
In many games like Sqrxz, Plainjump or Vertigo, the user can select between various level files. These level files are strings with a special two byte header. Check the file header data file to get your free header. To find all the level files for your game, you can take advantage of the Usgard function SEARCH_VAT to search for all strings at first, and then use a simple CP command to sort out the string you really need:

 ld    HL, VAT_Start-10  ;Skip the first entry, the Usgard string itself
 ld    A, $12            ;$0C = strings
 call  SEARCH_VAT        ;search the Variable Allocation Table for strings
 jr    c, TypeNotFound   ;If carry flag is set, no more strings exist
 push  HL                ;save HL = pointer to current VAT entry
 ld    A, (DE)           ;DE points to current string itself
 and   A                 ;normally, the first byte is zero
 jr    nz, SearchStr     ;if not, then skip the string and search for another one
 inc   DE                ;check second byte
 ld    A, (DE)           ;get it
 cp    $xx               ;insert your second file header byte here
 jr    nz, SearchStr     ;if not equal, it's not a string for your proggy
 ...                     ;here you could store the data in VAT_Name in a table
 pop   HL                ;restore HL again
 jr    SearchStr         ;search for next string
TypeNotFound:            ;done searching

Page last updated on Fri Mar 12 18:52:30 1999 E-mail us!Top of page