Re: Joystick status
>> I've been using this routine blindly for some time and it works, but I'd >> like to know exactly the electrical reasons behind the process. > >**sigh** okay I'll explain... > >By the way, the AND and ORs you say belong to port 2 belong to port 1. You >accidentally (I hope?)swapped them. I'm aware. This listing is pasted "as is" from the Portar docs. >Well, bit 6 is used as port select for register 14. (1=port 2, 0=port 1) >Bit 0, 1 and 4 correspond to pins 6, 7 and 8 of port 1 >Bit 2, 3 and 5 correspond to pins 6, 7 and 8 of port 2 > >Well, here are the reasons why they are set: officially, the joystick only >works when pin 8 is 0. So the joystick-routines set the pin to 0. Further, >pins 6 and 7 only give input as long as the output is 1. So in order to read >pins 6 and 7 they first set them. Aaaah. That's neither explained on Portar nor The Red Book. > Ofcourse this won't have to be done >everytime, but if they for example don't set bits 6 and 7 then if some nerdo >changes bits 6 and 7 into 0 the buttons can't be read anymore until the next >reset. Nice. >Well that's the reason. Thanks. >By the way, the joystickroutines on the interrupt also (re)set those pins, >unfortunatly. And that is stupid because therefor JoyNet can't function with >the normal interrupt enabled. Something to do with touchpad handshaking, perhaps? MARK 2 MSX Mailinglist. To unsubscribe, send an email to [EMAIL PROTECTED] and put in the body (not subject) "unsubscribe msx [EMAIL PROTECTED]" (without the quotes :-) Problems? contact [EMAIL PROTECTED] (www.stack.nl/~wiebe/mailinglist/)
Re: Joystick status
> >I still don't understand the AND/OR values for reading joystick status from > >the Portar documentation ?!?!???!?!??? ? ?!?!?!? ?!??!?!?: > > > >This rotine will read joystick 1 or 2: > >F3di > >3E 0F ld a,0fh Write this for Write this for > >D3 A0 out (0a0h),a Joystick port 1:Joystick port 2: > >DB A2 in a,(0a2h) > >E6 DF / E6 AF and 1101b; 0DFh and 1010b; 0AFh > >F6 4C / F6 03 or 01001100b; 04Ch or 0011b; 003h > >D3 A1 out (0a1h),a > >3E 0E ld a,0eh > >D3 A0 out (0a0h),a > >DB A2 in a,(0a2h) > > I lost the reply someone (Laurens?) did to my message. It was stated the > utility of AND/OR againt multiple BIT/SET instead of the actual meaning of > the bit salad regarding joystick reading. > > I of course know the AND/OR vs BIT/SET! I was poking Z80 opcodes right in > 1984 when the rest of the classroom was learning "present continuous"! 8:D You seem normal once again! > I wanted to know the reason of these values. According to the Portar doc it > should be enough to toggle the joystick select line. The lower bits seem to > be for touchpad handshaking and all 4 should be "1". The AND instruction > also wipes another bit apart from joystick select. > > I've been using this routine blindly for some time and it works, but I'd > like to know exactly the electrical reasons behind the process. **sigh** okay I'll explain... By the way, the AND and ORs you say belong to port 2 belong to port 1. You accidentally (I hope?)swapped them. Well, bit 6 is used as port select for register 14. (1=port 2, 0=port 1) Bit 0, 1 and 4 correspond to pins 6, 7 and 8 of port 1 Bit 2, 3 and 5 correspond to pins 6, 7 and 8 of port 2 Well, here are the reasons why they are set: officially, the joystick only works when pin 8 is 0. So the joystick-routines set the pin to 0. Further, pins 6 and 7 only give input as long as the output is 1. So in order to read pins 6 and 7 they first set them. Ofcourse this won't have to be done everytime, but if they for example don't set bits 6 and 7 then if some nerdo changes bits 6 and 7 into 0 the buttons can't be read anymore until the next reset. Well that's the reason. By the way, the joystickroutines on the interrupt also (re)set those pins, unfortunatly. And that is stupid because therefor JoyNet can't function with the normal interrupt enabled. ~Grauw -- >>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<< email me: [EMAIL PROTECTED] or ICQ: 10196372 visit the Datax homepage at http://datax.cjb.net/ MSX fair Bussum / MSX Marathon homepage: http://msxfair.cjb.net/ >>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<< MSX Mailinglist. To unsubscribe, send an email to [EMAIL PROTECTED] and put in the body (not subject) "unsubscribe msx [EMAIL PROTECTED]" (without the quotes :-) Problems? contact [EMAIL PROTECTED] (www.stack.nl/~wiebe/mailinglist/)
Re: Joystick status
>I still don't understand the AND/OR values for reading joystick status from >the Portar documentation ?!?!???!?!??? ? ?!?!?!? ?!??!?!?: > >This rotine will read joystick 1 or 2: >F3di >3E 0F ld a,0fh Write this for Write this for >D3 A0 out (0a0h),a Joystick port 1:Joystick port 2: >DB A2 in a,(0a2h) >E6 DF / E6 AF and 1101b; 0DFh and 1010b; 0AFh >F6 4C / F6 03 or 01001100b; 04Ch or 0011b; 003h >D3 A1 out (0a1h),a >3E 0E ld a,0eh >D3 A0 out (0a0h),a >DB A2 in a,(0a2h) I lost the reply someone (Laurens?) did to my message. It was stated the utility of AND/OR againt multiple BIT/SET instead of the actual meaning of the bit salad regarding joystick reading. I of course know the AND/OR vs BIT/SET! I was poking Z80 opcodes right in 1984 when the rest of the classroom was learning "present continuous"! 8:D I wanted to know the reason of these values. According to the Portar doc it should be enough to toggle the joystick select line. The lower bits seem to be for touchpad handshaking and all 4 should be "1". The AND instruction also wipes another bit apart from joystick select. I've been using this routine blindly for some time and it works, but I'd like to know exactly the electrical reasons behind the process. Kiss you. MK2 MSX Mailinglist. To unsubscribe, send an email to [EMAIL PROTECTED] and put in the body (not subject) "unsubscribe msx [EMAIL PROTECTED]" (without the quotes :-) Problems? contact [EMAIL PROTECTED] (www.stack.nl/~wiebe/mailinglist/)
Re: Joystick status
> I still don't understand the AND/OR values for reading joystick status from > the Portar documentation ?!?!???!?!??? ? ?!?!?!? ?!??!?!?: > > This rotine will read joystick 1 or 2: > F3di > 3E 0F ld a,0fh Write this for Write this for > D3 A0 out (0a0h),a Joystick port 1:Joystick port 2: > DB A2 in a,(0a2h) > E6 DF / E6 AF and 1101b; 0DFh and 1010b; 0AFh > F6 4C / F6 03 or 01001100b; 04Ch or 0011b; 003h > D3 A1 out (0a1h),a > 3E 0E ld a,0eh > D3 A0 out (0a0h),a > DB A2 in a,(0a2h) Well, I'll explain. If you want to set-reset certain bits then you can use the SET and RES-instructions. But if you want to (re)set multiple bits, then those are very slow. In that case it's easier to use AND and OR. AND %1101 resets bit 5 OR %01001100 sets bits 6, 2 and 3 AND %1010 resets bit 6 and 4 OR %0011 sets bits 0 and 1. If you check out some joystickport-docs (about PSG-registers 14-15) then you will find that these indeed are the correct values which have to be written. Didn't you know 'bout this use of OR and AND yet??? ~Grauw -- >>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<< email me: [EMAIL PROTECTED] or ICQ: 10196372 visit the Datax homepage at http://datax.cjb.net/ MSX fair Bussum / MSX Marathon homepage: http://msxfair.cjb.net/ >>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<< MSX Mailinglist. To unsubscribe, send an email to [EMAIL PROTECTED] and put in the body (not subject) "unsubscribe msx [EMAIL PROTECTED]" (without the quotes :-) Problems? contact [EMAIL PROTECTED] (www.stack.nl/~wiebe/mailinglist/)
Joystick status
I still don't understand the AND/OR values for reading joystick status from the Portar documentation ?!?!???!?!??? ? ?!?!?!? ?!??!?!?: This rotine will read joystick 1 or 2: F3di 3E 0F ld a,0fh Write this for Write this for D3 A0 out (0a0h),a Joystick port 1:Joystick port 2: DB A2 in a,(0a2h) E6 DF / E6 AF and 1101b; 0DFh and 1010b; 0AFh F6 4C / F6 03 or 01001100b; 04Ch or 0011b; 003h D3 A1 out (0a1h),a 3E 0E ld a,0eh D3 A0 out (0a0h),a DB A2 in a,(0a2h) MSX Mailinglist. To unsubscribe, send an email to [EMAIL PROTECTED] and put in the body (not subject) "unsubscribe msx [EMAIL PROTECTED]" (without the quotes :-) Problems? contact [EMAIL PROTECTED] (www.stack.nl/~wiebe/mailinglist/)