Grafpad II

From CPCWiki - THE Amstrad CPC encyclopedia!
Jump to: navigation, search
The Grafpad II

The Hegotron Grafpad II is a graphic tablet from British Micro - A Hegotron Group Company, marketed by Grafsales Ltd. It was produced for the Amstrad CPC, Joyce PCW and the IBM PC.

Not much is known about here please add!

This device is supported by FutureOS. The resolution of about 1500 * 1000 points is used.

Pictures

Commercials

Reviews

The Grafpad II is reviewed in Amstradbladet 1987, Issue 4, page 24 (Danish)


Source Code


The following routines and descriptions are a part of FutureOS. All rights remain by Dr. Stefan W. Stumpferl. 
Free for non-commercial / private use.

If you want to use this routines or parts of them, then give credits to TFM of FutureSoft!

The original Hegotron software uses other port addresses and routines.

This solution is faster and compatible to all other tested hardware expansions, 
which is not the case for the original routines from Hegotron.

Version: 24.09.2010 - TFM of FutureSoft aka Dr. Stefan W. Stumpferl

Questions? Mail me: FutureSoft@gmx.de


;TEST IF HEGOTRON GRAFPAD 2 IS CONNECTED
;
;Parameters given back
;
;A = (&00 and) Z-Flag is set ---> no GP2 connected
;  = (&01-05,) Z-Flag cleared --> GP2 is connected
;
;Manipulated AF, BC

T_GP2 LD A,&02:LD BC,&F9F7:OUT (C),A:LD C,&FF:OUT (C),C:LD C,&F7:IN A,(C):INC A:RET


TEST IF HEGOTRON GRAFPAD 2 IS CONNECTED
=======================================

Short description: Test if the Hegotron Grafpad 2 is connected.

Jump in conditions: -

Jump out conditions:  The  Z80  register  A  reports  if  the Hegotron
Grafpad 2 is connected to the CPC or not.
A = &00 and zero flag is set ------> NO GP2 connected.
A = &01-05 and zero flag cleared --> the GP2 IS connected.

Manipulated: AF and BC.

Description: This routine tests  if  the  Grafpad  2  from Hegotron is
connected to the CPC.  You  call  the  routine without any parameters.
After the return of T_GP2 the Z80  register A and the zero flag report
about the existence of the Grafpad 2.
If the routine returns with the value &00 in register A and with a set
zero flag, then the Grafpad  2  can't  be  found.  Else if the routine
returns with A unqual to &00  and  with  a cleared zero flag, then the
Grafpad 2 is connected.

Example:

 CALL T_GP2;test if Grafpad 2 is connected.
 JR   Z,NO_GP2  ;NO GP 2 connected!

GP2 ...    ;the GP2 IS connected!
...
...



;SCANNING OF THE HEGOTRON GRAFPAD 2
;
;Parameters given back
;
;DE = Y coordinate &0000-&04FF (&001B-&0484)
;HL = X coordinate &0000-&05FF (&0020-&05DF) + Buttons E (7.Bit H), S (6.Bit H)
;Bit 7/6(H) = 0 --> key pressed, Bit = 1 --> NO key pressed
;
;Manipulated AF, BC, DE, HL, BC'

G_GP2 XOR A,A:LD BC,&F9F7:OUT (C),A ;OUT &F9F7,&00

 EXX:LD BC,&F9FF:OUT (C),C:EXX ;OUT &F9FF,&FF

 IN E,(C) ;yl=INP(&F9F7)

 INC A:OUT (C),A:EXX:OUT (C),C:EXX:IN L,(C) ;xl
 INC A:OUT (C),A:EXX:OUT (C),C:EXX:IN D,(C) ;yh
 INC A:OUT (C),A:EXX:OUT (C),C:EXX:IN H,(C) ;xh
 RET


SCANNING OF THE HEGOTRON GRAFPAD 2
==================================

Short description: Scanning  of  the  X-,  the  Y-coordinates and both
buttons (E and S) of the Hegotron Grafpad 2.

Jump in conditions: -

Jump out conditions: The registers DE  and  HL report about the X- and
the Y-coordinates and the buttons E and S.
DE = Y-coordinate, theoretical: &0000-&04FF, in real: &001B-&0484
HL = X-coordinate, theoretical: &0000-&05FF, in real: &0020-&05DF
And register H contains the state of  the  buttons E (bit 7, MSB of H)
and S (bit 6 of H).  For  both  buttons  is  valid, that a cleared bit
reports a pressed key. If a bit is set, the key is NOT pressed.

Manipulated: AF, BC, DE, HL and BC'

Description: If the CPC is  connected  to  the Hegotron Grafpad 2 (you
MUST test this before!), then you  can  use this routine G_GP2 to scan
the actual coordinates of the graphic table  pen and the status of the
buttons. When the routine returns DE  contains the Y-coordinate of the
pen. Theoretically that can be a value between &0000 and &04FF. But in
reality the graphic  tablet  covers  values  between  &001B and &0484.
(There can be differences  between  different  units). Little Y values
are located at the bottom,  near  the  user.  Big Y values are located
upwards, away from the  user.  The  register  HL  reports  about the X
coordinate (bits 0-10) and the status of the buttons. The X coordinate
theoretical spans over values from &0000  up  to &05FF. In reality the
values lie between &0020 and &05DF.  Little X values are located left,
big X values are located right on the graphic tablet. Further the most
upper bits of register H (7 and  6) contain the status of both buttons
of the GP2. H encodes the buttons E (bit 7) and S (bit 6):
- If bit 7 is cleared to 0, the key E (Entry, Exit) IS pressed now.
  If bit 7 is set to 1, the key E is actually NOT pressed.
- If bit 6 is cleared to 0, the key S (Select) IS pressed now.
  If bit 6 is set to 1, the key S is actually NOT pressed.

Example:

 CALL G_GP2 ;get Grafpad 2 coordinates and buttons.

 LD  (GP2_X_Koordinate),DE ;save X-coordinate into RAM

 LD  A,H
 AND A,&C0   ;isolate bits 7 and 6 (= keys E and S),
 LD  (KEYS_E_AND_S),A) ;and save key status (??00 0000) to RAM

 RES 7,H
 RES 6,H
 LD  (GP2_Y_Koordinate),HL ;save Y-coordinate into RAM
...

Attention: Use this routine ONLY if you are sure that the Grafpad 2 IS
connected to the CPC. Use T_GP2 to test this (look before).



;SCANNING OF THE BUTTONS E AND S OF THE HEGOTRON GRAFPAD 2
;
;Parameters given back
;
;A (Bit 7) = button E  / valid is...
;A (Bit 6) = button S / Bit = 0 --> key pressed, Bit = 1 --> NO key pressed
;
;Manipulated AF, BC

K_GP2 LD A,&03:LD BC,&F9F7:OUT (C),A:LD C,&FF:OUT (C),C:LD C,&F7:IN A,(C) ;yh

 INC A:RET


SCANNING OF THE BUTTONS E AND S OF THE HEGOTRON GRAFPAD 2
=========================================================

Short description: Keys E and S of the Hegotron Grafpad 2 are scanned.

Label: K_GP2

ROM-number: D

Start address: &E73E

Jump in conditions: -

Jump out conditions: The register A reports  if one of the two buttons
E (Entry, Exit) and / or S (Select) is pressed.
Register A bit 7 corresponds to key E.
Register A bit 6 corresponds to key S.
A cleared bit (0) symbolizes  a  pressed  key,  whereas  a set bit (1)
symbolizes that the key is NOT pressed.

Manipulated: AF and BC.

Description: If the CPC is  connected  to  the Hegotron Grafpad 2 (you
must test this before!), you can use this routine K_GP2 to investigate
the status of both keys.
After the return of the routine the  status  of the keys is encoded in
the two upper bits of register A; key E (bit 7) and key S (bit 6):

- If bit 7 is cleared to 0, the key E (Entry, Exit) IS pressed now.
  If bit 7 is set to 1, the key E is actually NOT pressed.
- If bit 6 is cleared to 0, the key S (Select) IS pressed now.
  If bit 6 is set to 1, the key S is actually NOT pressed.

Example:

 CALL K_GP2 ;scan Grafpad 2 keys

 AND A,&C0   ;isloate bits 7 and 6 (??00 0000)
 LD  (KEYS_E_AND_S),A) ;and save status of keys to RAM

...

Attention: Use this routine ONLY if you are sure that the Grafpad 2 IS
connected to the CPC. Use T_GP2 to test this (look before).

Manual

Downloads

The System Software can be found here: