Very Basic Tutorial


I....... Wait for the user to press a key
II...... Clear the screen
III..... Font functions
IV...... Get the address of a handle
V....... Set/Get the APD value

I. Wait for user to press a key

When you want to wait for a key from the user, just use the following function :

jsr api92::WaitKey

It returns in d0 the internal code of the key pressed. Only this register is modified.

Notice that it support the APD (Auto Power Down), and that it won't work if interruptions are disabled.

II. Clear the screen

Two functions can be used to clear the screen :

  • jsr api92::ClearScreen
    It clear the screen, and redraw the status bar

  • jsr api92::ZapScreen
    The screen is completly cleared, totally blank

III. Font functions

  • Font values
    0 = small font
    1 = medium font
    2 = large font

  • Set the font
    To set the current font used, you have the function
    moveq.w #0,d0
    jsr api92::SetFont

You put in d0 the font to set ( 0, 1 or 2), and then you call the function. It changes no register.

  • Get the font
    To get the font, just use the function :
    jsr api92::GetFont

    It returns in d0 the current font used (0, 1 or 2), and changes no other register.

IV. Get the address of a handle

To get the address of a handle, you have two possibilities : You can use the macro giving with your compilator ( Fargo2,
DoorsOS, Teos...), but it takes quite a lot of memory.

That's why Api92 provides a function that you should use for size optimization : it gets the address of the handle d0 and puts it in a0 :

jsr api92::DEREFd0a0

V. Set/Get the APD value

The APD is the Auto Power Down. It is the timer after which the calculator will automatically turn off.

  • Set the APD:
    The function :
    jsr api92::util_SetAPD

Set the APD value to tha value of d0. Notice that d0 is in tick. To convert seconds in ticks, you have to multiply your seconds by 20 approximatively.

  • Get the APD :
    The function :
    jsr api92::util_GetAPD

get the current value of the APD. The returned value is put in d0 (in tick). To convert this value to seconds, you have to divide by 20 approximatively.