Xref: utzoo comp.sys.amiga.programmer:4322 comp.sys.amiga.hardware:9986 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!cbmvax!carolyn From: carolyn@cbmvax.commodore.com (Carolyn Scheppner - CATS) Newsgroups: comp.sys.amiga.programmer,comp.sys.amiga.hardware Subject: Re: I *STILL* need help with the POTGO resource! Message-ID: <22264@cbmvax.commodore.com> Date: 8 Jun 91 00:34:10 GMT References: <-J#-M6C@engin.umich.edu> Reply-To: carolyn@cbmvax.commodore.com (Carolyn Scheppner - CATS) Organization: Commodore, West Chester, PA Lines: 122 In article <-J#-M6C@engin.umich.edu> chymes@uri.csmil.umich.edu (Charles Hymes) writes: >I use basically the following lines to set up the POTGO resource. >[] >I tried other code as well, but the values at pot1dat never change no >matter what I do at the gameport. If I connect pins 5 or 9 to (the X >and Y pot pins) to pins 7 or 8 (+5 volts and Ground respectively) >Nothing changes at pot1dat. >Potinp changes the way you would expect it to, but I don't want on/off >values, I want the 8-bit values one expects from the Pots. > >The (old white A1000) Hardware manual says that Potgo needs to be >reset each vertical blank, but it also says that that is taken care of >by the OS. Is this shut off when I use the POTGO resource? I think the HW manual says you have to EITHER read it during vertical blank OR read it twice. Meanwhile, here's an old piece of Phil Lindsay code that does use vertical blank (little piece of asm at end) potgo.c /* potgo.c - read right port's x, y pots * Remember to use options +lcd for MANX Aztec C (longs & A4 dependency) */ #include #include #include #include #include #include /* macro functions to grab pot x and y from pot1dat */ #define POTX(x) ((x) & 0x00ff) #define POTY(y) ((y) >> 8) /* hard addresses for potgo and pot1dat */ #define POTGO 0xdff034 #define POT1DAT 0xdff014 /* vertical blank interrupt server priority */ #define MYINTPRI 10L /* my priority is 10 higher than gamedev intr */ #define START_B 0 /* bit number defines for potgo ... */ #define DATRX_B 12 #define DATRY_B 14 #define START_F (1L << START_B) /* masks ... */ #define DATRX_F (1L << DATRX_B) #define DATRY_F (1L << DATRY_B) #define RPOTXY (START_F | DATRX_F | DATRY_F) long PotgoBase; /* resource base */ UWORD potxy; /* global for pot1dat storage */ extern void getpot(); /* vert. blank interrupt routine */ main() { long alloc; struct Interrupt myintr; PotgoBase = (long) OpenResource(POTGONAME); alloc = (long) AllocPotBits(RPOTXY); printf("Allocated: %lx\n",alloc); if(alloc != RPOTXY) { puts("Couldn't get potgo bits."); FreePotBits(alloc); exit(TRUE); } /* intialize interrupt structure */ setmem(&myintr,(long)sizeof(myintr),0L); myintr.is_Node.ln_Pri = MYINTPRI; myintr.is_Data = POT1DAT; myintr.is_Code = getpot; AddIntServer(INTB_VERTB,&myintr); /* loop while !ctrl-c */ while(! (((ULONG)SetSignal(NULL,NULL)) & SIGBREAKF_CTRL_C) ) printf("x=%ld, y=%ld\n",(long)POTX(potxy),(long)POTY(potxy)); RemIntServer(INTB_VERTB,&myintr); FreePotBits(alloc); } /* eof */ ****************************************************************************** potgoint.asm * Vertical Blank Interrupt Server code. xref _PotgoBase * get potgo resource base xref _potxy * global storage for pot1dat xref _LVOWritePotgo * resource routine to write potgo xdef _getpot _getpot: move.w (a1),_potxy * a1 points to pot1dat move.l _PotgoBase,a6 * move resource base into a6 move.l #1,d0 * potgo start bit = 1 move.l d0,d1 * our mask is 1 jsr _LVOWritePotgo(a6) * call write potgo move.l #0,d0 * cont interrupt chain rts * gone... end * EOF -- ========================================================================== Carolyn Scheppner -- Tech. Mgr. CATS - Commodore Amiga Technical Support PHONE 215-431-9180 {uunet,rutgers}!cbmvax!carolyn carolyn@commodore.com Integer math - it's all so pointless. ==========================================================================