[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PEEKs and POKEs for IIgs's



In article 
<jonINTERNETrelayCHAT-0801001050310001@nn-157-22-181-143.napanet.net>, 
jonINTERNETrelayCHAT@napaVALLEYnet.CLARInet (Jon Bettencourt) wrote:

> I've tried something like this (for a simple terminal program):
> 
> 10 GET A$:PR#2:PRINT A$;:PR#0:IN#0:PRINT A$;:IN#2
> 20 IF A$ = CHR$(4) THEN END
> 30 GOTO 10

the problem with this program is that after the first GET, it never 
accesses the keyboard anymore. Remove the last IN#2 in line 10.
Another problem is that you can't check if a character is available on 
the serial port when used in this way: there is no port-2-equivalence of 
PEEK(49152).
If there were, the program could look something like this:

10 IF PEEK(49152)>127 THEN GET A$: PR#2: PRINT A$;: PR#0
20 IN#2: IF (there is input available) THEN GET A$: IN#0: PRINT A$;
30 IN#0: GOTO 10

Then the question about the mouse: the interface to BASIC is well 
defined and described in the IIgs Firmware Reference.
In it there's this listing of a program called Mouse.Move:

10 HOME
20 PRINT "MOUSE.MOVE DEMO"
30 PRINT CHR$(4);"PR#4": PRINT CHR$(1)
40 PRINT CHR$(4);"PR#0"
50 PRINT CHR$(4);"IN#4"
60 INPUT "";X,Y,S
70 VTAB 10: PRINT X;"  "Y"  "S"  "
80 IF S>0 THEN 60
90 PRINT CHR$(4);"IN#0"
100 PRINT CHR$(4);"PR#4": PRINT CHR$(0)
110 PRINT CHR$(4);"PR#0"

Using the SHR screen from BASIC requires an interface to QD. There is a 
little utility that uses & commands; I'll see if I can find my copy of 
it and ask the author if he would release it as freeware...

-- 
Groetjes, Pim

Same excuse every time