D-Bug & Automation Forum
General >> Random Access >> Hello
http://d-bug.mooo.com/dbugforums/cgi-bin/yabb2/YaBB.pl?num=1234397529

Message started by techie_alison on 12.02.09 at 00:12:09

Title: Re: Hello
Post by techie_alison on 14.02.09 at 02:13:00
The 4-bytes, yes.  I'm used to viewing data like this when working with a scope.

God no, I'm not complaining.  You know I once used to and was really volatile, but you just kind of reach a point where it achieves nothing.  Far far easier and less stressful to just get on with everyone and fit in. :)

The attached file, ...when I find it...  The first one is of the Atari joystick interface itself, with the first top 4 being the directions, and the remaining 2 being the fire buttons.  Where they start oscillating is the autofire.  The traces at the very bottom are detailed in the next paragraph.

The 2nd one is the PSX packet itself.  It's a slight variation of the duplex SPI method.  D0 is CSEL, D1 is clock, D2 is CMD, D3 is DATA, D4 is ACK.  There's enough clocks there for 5-bytes.  Which is a single PSX digital packet, taking about 600uS where JeST is concerned.

All totally irrelevant stuff, but hey I like looking at them.  That thing cost me £500!!!!   :)

JeST sits in the middle of those two running at about 1MIPS dependent on instructions and jumps.  Some of the decision making is a bit cumbersome as with only 35 RISC instructions there's no branching commands like IF.  It's all done with the overflow flags and shifting bits left and right and checking them.

All bit banged.

[code]
;------------------------------------------------------------------------------
;Subroutine : PSX_RW_BYTE
;------------------------------------------------------------------------------
;Passed : W contains byte to be transmitted
;Valid : N/A
;Uses : psx_tx_byte_ , psx_rx_byte_ , loop1_
;Returns : Byte received in W and psx_rx_byte_
;Error Code : N/A
;Error Trapping : N/A
;Outline : SPI style byte transfer
;------------------------------------------------------------------------------
PSX_RW_BYTE
   MOVWF   psx_tx_byte_

   MOVLW   8d                                                          ;we will be transferring 8 bits

   MOVWF   loop1_
Psx_rw_byte_next_bit:
   BCF     PORTB,   PSX_CLK_PORTB_O_                                     ;bring clock low

   RRF     psx_tx_byte_, F                                             ;put transmitted data on bus

   BTFSS   STATUS, C
   BCF     PORTB, PSX_CMD_PORTB_O_        
   BTFSC   STATUS, C
   BSF     PORTB, PSX_CMD_PORTB_O_

   BSF     PORTB, PSX_CLK_PORTB_O_                                     ;bring clock high

   BCF     STATUS, C
   BTFSC   PORTB, PSX_DAT_PORTB_I_                                     ;get received data from bus

   BSF     STATUS, C
   RRF     psx_rx_byte_, F

   DECFSZ  loop1_, F
   GOTO    Psx_rw_byte_next_bit                                        ;next bit

   BSF     PORTB, PSX_CMD_PORTB_O_                                     ;set COMMAND high        

   MOVF    psx_rx_byte_, W                                             ;value returned to caller

   RETURN
[/code]
autofire.png ( 5 KB | Downloads )
packet5c.png ( 7 KB | Downloads )

D-Bug & Automation Forum » Powered by YaBB 2.6.0!
YaBB Forum Software © 2000-2024. All Rights Reserved.