MORAGUES%CCV.MFENET@CCC.NERSC.GOV (08/09/90)
Hi everyone - A while back I was trying to do some work with the 16-pin game port connector on my //GS. I was trying to use the four digital outputs. To do this, memory locations must be referenced in order to toggle the states. My problem is that referencing one location usually created a 16-bit read that referenced the following location which usually toggled the next signal. This makes it dificult to keep a steady state if the signals all are pulsating. I was wondering if there is a way to make the GS only do an 8-bit reference while in native mode. I would appreciate sample code in TML pascal if possible, ORCA Assembler or Pascal would also be appreciated. I don't have the exact memory locations with me now, but if you want them, I can post it. Thanks in advance for your help Bob Moragues MORAGUES@CCC.NERSC.GOV
toddpw@tybalt.caltech.edu (Todd P. Whitesel) (08/09/90)
Weelll... in assembly it's a joke -- I don't know how the compilers handle it but in C you should be able to declare a char variable at a fixed address and the compiler will figure out that you want to do some byte-wide I/O. I don't know how you do this in APW/ORCA -- YET -- because I am fighting the impulse to order it as the official release of 1.1 approaches... Todd Whitesel toddpw @ tybalt.caltech.edu
MQUINN@UTCVM.BITNET (08/09/90)
>I was wondering if there is a way to make the GS only do an 8-bit reference >while in native mode. Well, taking the GS's CPU out of 16-bit mode intl 8-bit mode is HOW you take it out of native mode, so it's impossible to be in 8-bit mode and native mode at the same time, although you can still keep the speed at 2.75Mhz while you're doing it. You COULD switch to 8-bit mode before the read, then switch back to 16-bit mode right afterwords, but I don't know if that's what you really want to do. Anyway, I -think- this will switch from 16-bit to 8-bit: SEC XCE I can't remember if this takes it FROM 8-bit or puts it IN 8-bit mode, but I'm sure it does one of them. The opposite of this would be: CLC XCE I'm sure someone else will post the correct way, if this is wrong. BTW, just in case you didn't know, this is in assembly, although I'm sure you did :)
dlyons@Apple.COM (David A. Lyons) (08/09/90)
In article <9008082141.AA25062@apple.com> MQUINN@UTCVM.BITNET writes: >[...] >Well, taking the GS's CPU out of 16-bit mode intl 8-bit mode is HOW you >take it out of native mode, so it's impossible to be in 8-bit mode and >native mode at the same time [...] This is incorrect. The 65816 can be in Native mode or Emulation mode (that is, "65C02 emulation" mode). When it's in Native mode, the A register can be either 8 bits or 16 bits, and then X and Y registers can be either 8 or 16 bits. The instruction SEP #$30 ("set processory status bits 5 and 4") gives you 8-bit regisers but leaves you in native mode (so your stack can still be anywhere in bank 0, not just in the $01xx area that emulation mode is limited to). >[...] >SEC >XCE >[...] SEC XCE switches you into emulation mode--that's not what you want to do just to get 8-bit memory accesses. (To switch into emulation mode, first you have to make sure your stack is already in page 1 & be able to switch it back later, and you have to be executing in bank 0 *or* disable interrupts, because emulation-mode interrupts only work right when your program counter is in bank 0--the bank you were in isn't saved, so there would be no way to return from the interrupt!). -- David A. Lyons, Apple Computer, Inc. | DAL Systems Apple II Developer Technical Support | P.O. Box 875 America Online: Dave Lyons | Cupertino, CA 95015-0875 GEnie: D.LYONS2 or DAVE.LYONS CompuServe: 72177,3233 Internet/BITNET: dlyons@apple.com UUCP: ...!ames!apple!dlyons My opinions are my own, not Apple's.
toddpw@tybalt.caltech.edu (Todd P. Whitesel) (08/09/90)
MQUINN@UTCVM.BITNET writes: >Well, taking the GS's CPU out of 16-bit mode intl 8-bit mode is HOW you >take it out of native mode, so it's impossible to be in 8-bit mode and >native mode at the same time, although you can still keep the speed at Augh! Check before you post, please. You _can_ change the register sizes in native mode -- in fact, you have to, because reset puts the CPU in emulation mode and switching from emulation to native (CLC; XCE) doesn't change the register sizes at all; either you or the O/S has to do it. Once you are in native mode you can pick the accumulator size and the index registers size independently of each other (handy for I/O programming, when you have an 8 bit accumulator and 16 bit X and Y). Going back to emulation mode (SEC; XCE) forces the registers back to 8 bits each (as it should). Todd Whitesel toddpw @ tybalt.caltech.edu
gwyn@smoke.BRL.MIL (Doug Gwyn) (08/09/90)
In article <900808130731.2020095d@CCC.NERSC.GOV> MORAGUES%CCV.MFENET@CCC.NERSC.GOV writes: >I was wondering if there is a way to make the GS only do an 8-bit reference >while in native mode. So-called "native mode" actually consists of several submodes, one of which enables 16-bit memory accesses. Simply change the processor status to 8-bit access temporarily, do the LDA or STA, then change back to 16-bit access. (Do this in assembler.)
RXBROWN@UALR.BITNET ("MR.FANTASTIC") (08/10/90)
Todd Whitesel writes....
>I don't know how you do this in APW/ORCA -- YET -- because I am fighting the
impulse to order it as the official release of 1.1 approaches...
I ordered Design Master from Byte Works, and they sent me my 1.1 update of
ORCA/C..
Robert Brown
RXBROWN@UALR
The power of the ][!
gwyn@smoke.BRL.MIL (Doug Gwyn) (08/10/90)
In article <1990Aug8.202707.29249@laguna.ccsf.caltech.edu> toddpw@tybalt.caltech.edu (Todd P. Whitesel) writes: >Weelll... in assembly it's a joke -- I don't know how the compilers handle it >but in C you should be able to declare a char variable at a fixed address and >the compiler will figure out that you want to do some byte-wide I/O. C implementations are allowed to use wider access paths than logically necessary to pick up the precise amount of data. For example, a 16-bit word could be loaded and the unwanted 8 bits masked off. I don't know what code existing Apple IIGS compilers actually generate for this. >I don't know how you do this in APW/ORCA -- YET -- because I am fighting the >impulse to order it as the official release of 1.1 approaches... ORCA/C 1.1 has already been released.
gerardo@island.seas.ucla.edu (Gerardo Chaves) (08/23/90)
In article <900808130731.2020095d@CCC.NERSC.GOV> MORAGUES%CCV.MFENET@CCC.NERSC.GOV writes: <.... stuff deleted> > >I was wondering if there is a way to make the GS only do an 8-bit reference >while in native mode. I would appreciate sample code in TML pascal if >possible, ORCA Assembler or Pascal would also be appreciated. I don't have >the exact memory locations with me now, but if you want them, I can post it. > >Thanks in advance for your help > >Bob Moragues >MORAGUES@CCC.NERSC.GOV I'm not sure if this is what you need, but here is some source code in TML Pascal II, (should work with v 1.5 as well) that does just an 8 bit read in order to find out if the a button on the paddles has been pressed (the locations belong to the game port I believe)..: function butn(n:integer):boolean; {PROCEDURE TO CHECK FOR BUTTONS/APPLE KEYS} var p:ptr; i:integer; begin butn:=false; if (n>-1) and (n<4) then begin case n of 0:p:=pointer($C061); 1:p:=pointer($C062); 2:p:=pointer($C063); 3:p:=pointer($C060); end; i:=p^[1]; {this assignment alone does the access to only 8 bits} if (i<0) then butn:=true; end; end; Hopefully this will work for you. Vince Cooper helped me with that p^[1] deal. Gerardo Chaves Programmer, U.C.L.A. Intervention Program gerardo@island.seas.ucla.edu