A86: calc-Off, fonts, user interrupt routine
[Prev][Next][Index][Thread]
A86: calc-Off, fonts, user interrupt routine
Warning - long technical post...
I was going through the rom today (I have complete rom dumps and assembly
listings of my calc's rom - version 1.2) and I discovered three neat things.
First of all, 0C29 is the address of the calc's timeout routine - i.e. if
you leave your calc on, after a while it calls 0C29 to shut the calc down.
So those of you who have been asking for a calc shutdown routine, here it
is. It does NOT return when the calc turns back on, so it may not be good
for some uses, but if you install an interrupt routine, you should be able
to pick up again when the calc comes back on.
Second - and I think this is probably documented already, but I'll explain
it anyway. Bit 0 of (iy+35) is the user font bit. If set, three bytes at
d2ed are used as a pointer to the user font table.
Format for the user font table is:
$6f Font table signature byte.
1 byte count of characters in the user table - you can define as few or
as many characters as you want, the rest will be printed in the
default font.
this is followed by a list of characters that look like this:
1 byte ASCII code of character
7 bytes Character data, i.e.
.db 00001110b
.db 00010001b
.db 00010001b
.db 00011111b
.db 00010001b
.db 00010001b
.db 00010001b
for A. Characters are 5 bits wide. Actually, a space is 6 bits wide, but
if you make your characters 6 bits wide, they will touch each other.
NOTE: The user fonts are MUCH slower than the default fonts, as they have a
couple of page changes.
Third, you can have a user interrupt routine without using interrupt mode 2
and a 256 byte table. There is a 200 byte area in ram page 0, at addresses
D2FE-D3C5. If you set it up properly, rst 38h will call it BEFORE it does
anything else. To set it up you do three things:
1. Copy your program to the area, starting at D2FE.
2. the byte at D2FD is a checksum of sorts, set it to:
(D2FE)+(D325)+(D34D)+(D375)+(D39D)+(D3C5)
3. set 2,(iy+35)
NOTE: You could probably return from a user interrupt routine without
letting rst 38h finish running. Just do this:
----code fragment----
pop hl ;get the return address out of the way so you can use the real one
ex af,'af
exx
reti
----end of code fragment----
I haven't tested this, but it should work. It looks like rst 38h also sends
$b to port 3 before returning, but I don't think that should make a
difference.
Who's in charge of updating the include files? I think we should add a
couple of lines to the flags section:
userflags EQU 35 ;IY OFFSET VALUE
userFont EQU 0
userInt EQU 2
Anyway, thought I'd share this, hope it's helpful...
--Joshua
Follow-Ups: