IQ-8B03 Scientific Computer Card - Programming Notes ==================================================== This file contains information obtained largely through trial and error. Much of this was derived from looking at the code for the built-in programs. None of the information came through 'official' sources. Use it at your own risk. As far as I can tell (I don't own an IQ-707) this card is identical to the IQ-707 except that it is enhanced for the IQ-8000 series (40 column screen, special key codes,...). CONTENTS Setting Display Symbols Alternate Character Sets Highlighting Text Maximum INPUT Length Undocumented BASIC Reserved Words Undocumented Disk Drives Clipboard Password Printer Detection Warm Reset Turning the Organiser Off Switching to Built-In Applications Miscellaneous Unknown SETTING DISPLAY SYMBOLS ======================= There are 13 display symbols. To alter, set: A=0 B=0:off,1:on C | Symbol ---+--------------------------- 0 | Up Arrow 2 | * (secret mark) 3 | CAPS 4 | SHIFT 5 | EDIT 6 | CARD 7 | Down Arrow 9 | Secret 10 | Left Arrow 11 | Right Arrow (C=1 or 8 generates an error) Then CALL &5FFE8. e.g. to turn on the EDIT symbol: ,----------select display symbol routine | ,------turn on | | ,--EDIT symbol v v v A=0:B=1:C=5:CALL &5FFE8 It is not known how to alter the 3 remaining symbols: Beep, Alarm and Low Battery. It may not be a good idea to be able to alter indicators like Low Battery! See lines 1070,1075 in F:AER.BAS and lines 750,800,990,1010,1850 in F:STAT.BAS. ALTERNATE CHARACTER SETS ======================== Bitmaps of 64 characters between A0-DF (hex) may be altered. Locations &1FD85(LSB),&1FD86 and &1FD87(MSB) contain the address of the new character shapes. e.g. characters at the address &58D11 would be set as 11 8D 05. Each character is 6 bytes and in the same format as GPRINT data. Locations &5FFD9 to &5FFDB contain the address of the character set used by the built-in statistical program. The address is &58D11. The default address is &0. Note that the default character data is NOT at &0. Character maps for the regular characters do NOT appear to be stored in addressable memory. See lines ####-#### in F:STAT.BAS. 10 GOSUB 1960 20 POKE &1FD85,&11,&85,&05 30 FOR X=0TO255:PRINT CHR$ X;:NEXT X 50 GOSUB 1970 60 CLEAR:END 1960 Z24=PEEK &1FD85:Z25=PEEK &1FD86:Z26=PEEK &1FD87:RETURN 1970 POKE &1FD85,Z24,Z25,Z26:RETURN NOTE: the characters generally match those found in IBM-PC compatibles, except for &00-&1F,&A9-&AA,&B0-&DF. See below for my approximations for GPRINT data for these missing IBM-PC characters. 8-Line : 6x 8 4-line : 8x16 Graphics: 240x64 IBM-PC Character Bitmaps: 00:"000000000000" 01:"7EA98D8DA97E" 02:"7ED7F3F3D77E" 03:"30783C783000" 04:"10387C381000" 05:"183A66663A18" 06:"103A7E7E3A10" 07:"00183C3C1800" 08:"FFE7C3C3E7FF" 09:"001824241800" 0A:"FFE7DBDBE7FF" 0B:"0C12526C7000" 0C:"00344E4E3400" 0D:"060E7C507000" 0E:"067E50567E00" 0F:"5438EE385400" 10:"FE7C38381000" 11:"1038387CFE00" 12:"00247E240000" 13:"007A007A0000" 14:"30487E407E00" 15:"44B2AA9A4400" 16:"060606060600" 17:"00257F250000" 18:"00207E200000" 19:"00047E040000" 1A:"101010381000" 1B:"103810101000" 1C:"1C1C04040400" 1D:"103810381000" 1E:"061E7E1E0600" 1F:"60787E786000" A9:"1C1C10101000" AA:"1010101C1C00" B0:"228822882288" B1:"55AA55AA55AA" B2:"DD77DD77DD77" B3:"000000FF0000" B4:"101010FF0000" B5:"505050FF0000" B6:"10FF00FF0000" B7:"101F101F0000" B8:"5050507F0000" B9:"50DF00FF0000" BA:"00FF00FF0000" BB:"505F007F0000" BC:"50D010F00000" BD:"10F010F00000" BE:"505050F00000" BF:"1010101F0000" C0:"000000F01010" C1:"101010F01010" C2:"1010101F1010" C3:"000000FF1010" C4:"101010101010" C5:"101010FF1010" C6:"000000FF5050" C7:"00FF00FF1010" C8:"00F010D05050" C9:"007F405F5050" CA:"50D010D05050" CB:"505F405F5050" CC:"00FF00DF5050" CD:"505050505050" CE:"50DF00DF5050" CF:"505050D05050" D0:"10F010F01010" D1:"5050505F5050" D2:"101F101F1010" D3:"00F010F01010" D4:"000000F05050" D5:"0000007F5050" D6:"001F101F1010" D7:"10FF00FF1010" D8:"505050DF5050" D9:"101010F00000" DA:"0000001F1010" DB:"FFFFFFFFFFFF" DC:"0F0F0F0F0F0F" DD:"FFFFFF000000" DE:"000000FFFFFF" DF:"F0F0F0F0F0F0" HIGHLIGHTING TEXT ================= To make a character already on the screen appear white on black, you need to draw a box over it. Given that C is the column between 0 and 39 and R is the row between 0 and 7 (both inclusive) the code to highlight the character at that row and column is: 10 LINE (6*C,8*R)-(6*C+5,8*R+7),X,BF The code can be shorted slightly by using temporary variables: 10 I=6*C:J=8*R:LINE (I,J)-(I+5,J+7),X,BF To highlight an area of characters within the area bordered by R1,C1 and R2,C2 the code is: 10 LINE (6*C1,8*R1)-(6*C2+5,8*R2+7),X,BF MAXIMUM INPUT LENGTH ==================== To set the maximum size of the INPUT string (including prompt string), set A=5 and B=n where n=maximum length desired (including prompt) - 1 then CALL &5FFE8. The default is B=255. UNDOCUMENTED BASIC RESERVED WORDS ================================= BTEXT$ - "S1:TEXT .BAS" BDATA$ - "S1:DATA .BAS" CALL n - Directly call machine code at location n. CONSOLE n - ? MEM$ - "S1" PEEK n - Read byte at memory location n (n=0..1048575). POKE n,d[,d]... - Write byte(s) starting at memory location n (n=0..1048575, d=0..255). RESERVED - ? - 0 NOTE: BTEXT$ changes to "S1:ENG .$$$" while in AER: F(X)=ASC(MID$(BTEXT$,X,1)) BASIC keywords are stored starting at about memory location &59328 to about &596C7. PEEK and POKE access the full range of organiser memory. As such you can access *all* your data directly (if you can find it!) - even secret data and your password (see below for password). You can also stuff it up (mis)using POKE quite easily. All RAMs and ROMs are in this range, unless the memory is bank-switched (like the Apple ][ series) or accessed via IN/OUT instructions (such as the CMOS RAM in PCs). UNDOCUMENTED DISK DRIVES ======================== S1:TEXT .BAS - BASIC program in memory S1:DATA .BAS - BASIC variables in memory S1:AER .DAT - AER expressions S1:RAMFILE . - E: user disk S2:RAMFILE . - F: IQ-8000 series (40-column) built-in software (AER,STAT) S3:RAMFILE . - G: IQ-7000 series (16-column) built-in software (AER,STAT) F:AER .BAS - Algebraic Expression Reserve program for IQ-8000 series F:STAT .BAS - Statistics program for IQ-8000 series G:AER .BAS - Algebraic Expression Reserve program for IQ-7000 series G:STAT .BAS - Statistics program for IQ-7000 series The files named "RAMFILE." on drives S1, S2 and S3 correspond to the drives E, F and G. i.e. the data in drive F is contained in the RAMFILE on drive S2. CLIPBOARD ========= 2048 characters stored between &1F35E and &1FB5E inclusive. How the end is determined, or where a length is stored is unknown. PASSWORD ======== 7 character, 0-terminated string (0-terminated if < 7 characters) stored between &BFE83 and &BFE89 inclusive. e.g. 10 FOR Z30=1TO7:Z31=PEEK(&BFE82+Z30):IF Z31=0 THEN Z30=7 ELSE PRINT CHR$(Z31); 20 NEXT Z30:CLEAR Z30,Z31 PRINTER DETECTION ================= IF PEEK &3FD8C = 0 THEN no printer (from built-in programs) Line 170 in F:STAT.BAS WARM RESET ========== CALL &5FFE0 or &5FFE4 or &5FFF4 Does not clear memory: has same effect as pressing OFF then ON. Calling &5FFF0 generates a Syntax Error. 5FFE0:03 35 D4 05 (&5D435) reset 5FFE4:03 83 8C 04 (&48C83) reset 5FFE8:03 93 9E 04 (&49E93) display symbols/general entry point 5FFF0:03 8F 03 04 (&4038F) syntax error 5FFF4:03 00 01 04 (&40100) reset TURNING THE ORGANISER OFF ========================= 10 KEY 0,CHR$0+CHR$32:END SWITCHING TO BUILT-IN APPLICATIONS ================================== Routines below are just frameworks. They will need expanding to work properly. Using INKEY$ ------------ This method allows processing during the idle time waiting for a keypress. It also returns only upper-case letters; it is impossible to change case using the hollow up arrow case shift key. 5 ' THIS VERSION IMPLEMENTED AS THE MAIN LOOP OF AN APPLICATION 10 I$=INKEY$ 1:IF I$="" THEN 10:'OR DO IDLE PROCESSING 20 IF (ASC I$ > &B7) AND (ASC I$ < &C4) THEN KEY 0,CHR$ 0+CHR$(ASC I$-&80)+CHR$ &D:INPUT " ",I$:GOTO 10:'HANDLE APP SWITCH 25 'HANDLE APPLICATION-SPECIFIC STUFF HERE 30 IF I$="Q" THEN END ELSE 10 5 ' THIS VERSION IMPLEMENTED AS A ROUTINE TO BE GOSUB'D OCCASIONALLY 10 I$=INKEY$ 1:IF I$="" THEN RETURN 20 IF (ASC I$ > &B7) AND (ASC I$ < &C4) THEN KEY 0,CHR$ 0+CHR$(ASC I$-&80)+CHR$ &D:INPUT " ",I$: RETURN:'APP SWITCH 30 KEY 0,I$: RETURN:'KEEP KEYSTROKES Using INPUT$() -------------- This method lets the organiser handle things like CAPS, SHIFT and the case shift (hollow up arrow). 10 I$=INPUT$(1):IF ASC I$=0 THEN I$=I$+INPUT$(1) 20 IF (ASC I$ = 0)AND(ASC RIGHT$(I$,1) > &37)AND(ASC RIGHT$(I$,1) < &44) THEN KEY 0,I$+CHR$ &D:INPUT " ",I$:GOTO 10:'HANDLE APP SWITCH 25 'HANDLE APPLICATION-SPECIFIC STUFF HERE 30 IF I$="Q" THEN END ELSE 10 MISCELLANEOUS ============= &C3AD4-&C4A35=location of cities for world times Bit 6 = .5hr V = time value (GMT=&93=147) H = (INT(V/16) AND 3) * 10 + (V AND 15) - 13 IF V AND 64 THEN H = H + 0.5 H = H * -1 TIME ZONE HEX ------------------------------ +12 81 +11 82 +10 83 10000011 + 9.5 C3 11000011 + 9 84 + 8 85 + 7 86 + 6.5 C6 + 6 87 + 5.5 C7 + 5 88 + 4.5 C8 + 4 89 + 3.5 C9 [8A,8B,8C,8D,8E,8F skipped] + 3 90 + 2 91 + 1 92 GMT 93 - 1 94 - 2 95 - 3 96 - 3.5 D6 - 4 97 - 5 98 - 6 99 [9A,9B,9C,9D,9E,9F skipped] - 7 A0 - 8 A1 - 9 A2 -10 A3 -11 A4 -12 A5 UNKNOWN ======= This section contains things that haven't been fully understood by me yet. It also contains things that I would like to know about. Locations &3FD19 and &3FD99 have something to do with the vertical location of the cursor. &3FD19 appears to be the current line # of the cursor. &3FD99 appears to be the line where the last INPUT occured. See: F:STAT.BAS line 1950 (ref'd 280,370,510,630,1250). 1950 Z9 = PEEK &3FD99 : Z15 = ( PEEK &3FD19 - Z9 ) * 40 - Z16 : RETURN Format of user data.