Jump to content

Danjovic

Members
  • Content Count

    325
  • Joined

  • Last visited

Everything posted by Danjovic

  1. Full solution: lda byte1 eor byte2 sta temp lda #0 ldy #8 loop: rol temp adc #0 ; a = a + 0 + carry dey bne loop at the end a holds bit count.
  2. You can take out the MCP42100 from its socket and insert a 100k resistor between pins 9 and 10 and check the X axis reading (pins 5 and 6 for Y axis) If the reading reaches the maximum value then you either have a problem with your digipots or with the code driving it. On the other hand, if the value remains low, triple check the capacitors (measure them if possible). Check also the voltage value at pin 9 of the db-15 connector (potC).
  3. Check the timing capacitor values.
  4. Finally assembled the DIY keyboard controller I have proposed some posts ago (link). I would like to rectify the schematics as the membrane keyboard that I have acquired have a different wiring than the one I have planned to use.
  5. DIY Atari Keypad Controller built with off the shelf components (link) Schematics
  6. Danjovic

    The Wolf

    Cut the box to fit the board. It demanded a lot of handiwork, which is OK for a DIY project, but may render a serialization unworkable. In that case two options should b considered Machine a COTS box on a CNC. Custom 3D print (that nowadays can be ordered online)
  7. Q-Suco (and later Ki-Suco), was a very popular drink in Brasil. The translated brand name can be interpreted as "What a Juice". Do not remember a video game related campaign, though.
  8. Danjovic

    7800 Keyboard

    Thanks @Tempest, I have elaborated some questions: - So far we could understand that the communnication between the host and the keyboard peripheral is done 3 bits at a time (swcha.2..0), lsbits first, flipping the strobe signal (swcha.3) and waiting for the keyboard to ack by flipping the fire (inpt5) line. Can you confirm that? - We found a routine that writes a lot of data bits in 1.1.1 ended with a write with 0.0.0. is this a sync routine? - How do you manage to get in sync in short term? Or it is always necessary to repeat the long sync routine ? - how do the keyboard peripheral differentiate a read from a write? - Do the communnication between the keyboard peripheral and the host is or was intended to be bidirectional? (paced by swcha.3 strobe signal from host to keyboard an by inpt5 from keyboard to host?) - How should the host address the SIO port and the cassette port? Is there any document or specification of a higher level protocol? Did such protocol resembles the sio standard?
  9. Danjovic

    7800 Keyboard

    I keep wondering how the keyboard would differentiate a read from a write. Maybe the keyboard latches the data lines during strobe change, then it publishes its data before the ack rise, but that would require the 7800 to write 1.1.1 to the data lines after sensing the ack signal flip, and only then it would read the keyboard data. In other words a biditectional protocol with wired or data lines....
  10. Danjovic

    7800 Keyboard

    One thing that's intriguing me a timeout checking that references the address $bc. Unless there is some code running on interrupts or a hardware timer mapped at such address, it makes no sense use this address to check for a timeout. ;/// write data bits along with strobe signal and wait for ack LF966: JSR LF999 ;/// write strobe signal LF969: LDA $BC ; // what is at $bc?? BEQ LF979 ; if contents of $bc is zero, clear carry and return LDA INPT5 AND #$80 ; isolate fire button CMP $C1 ; flipped? BEQ LF969 ; no, try again (maybe something decreases the contents of $bc like a timer interrupt? STA $C1 ; yes, save state SEC ; and set carry to indicate success RTS LF979: CLC RTS
  11. Danjovic

    7800 Keyboard

    From Curt's answer to the 7800 basic Thread.. I came acress such code on the light module. It writes a long series (140+256+256) of 1.1.1 (looping at $F900) and finally writes a 0.0.0. This subroutine returns with A=0 and carry set on success. In case of a timeout due to keyboard not respond it returns with A=$ff and carry clear. LF8E5: LDY #$8C LDA #$0F STA SWCHA STA SWACNT LDA #$00 STA $C0 STA SWBCNT LDA INPT5 AND #$80 STA $C1 LDA #$03 STA $C2 LF900: LDA #$07 ; data = 1.1.1 STA $C3 JSR LF999 ;/// write data bits JSR LF9A7 ;/// wait for ack, return with carry clear on timeout BCC LF91C DEY BNE LF900 DEC $C2 BNE LF900 LDA #$00 ; data = 0.0.0 JSR LF966 ;/// write data bits along with strobe signal and wait for ack LDA #$00 SEC RTS LF91C: LDA #$FF RTS
  12. Danjovic

    7800 Keyboard

    Indeed, the code looks more polished. The clear flag is used to indicate failure by timeout. Some code simply decrement a variable as a countermeasure to timeout, but other subroutines use a value at $bc that I suppose it is decremented by a timer. Nevertheless I did some annotation on the code for the light module. lightmodule.asm
  13. Danjovic

    7800 Keyboard

    At this point I think it is safe to tell the pinout of the keyboard. The data lines are visible wired or, which means that they can float or they can be held at zero, which makes plain sense given the datasheet of the pic microcontroller used on the keyboard. Pin Name Direction (keyboard centric) 1 Data0 bidirectional 2 Data1 bidirectional 3 Data2 bidirectional 4 Strobe 7800->Keyboard (input) 5 n.c. 6 Ack Keyboard->7800 (output) 7 Vcc 8 Gnd 9 n.c.
  14. Danjovic

    7800 Keyboard

    Speaking of dead code I think I found some too on the star typer. What I am missing is some kind of sync on the protocol, to make sure that we have the right bits every call of the $dff6 subroutine. I think I found one place where bits are being written to the port but I have to confess that the code is getting way above my knowledge of 6502 assembly. LDE21: a9 0f 8d 80 02 8d 81 02 A9 E0 20 1E DE24 A9 0F LDA #$0F DE26 8D 80 02 STA SWCHA DE29 8D 81 02 STA SWACNT DE2C A9 E0 LDA #$E0 LDE22: 0f 8d 80 02 8d 81 02 A9 E0 20 1E DE22 0F ??? DE23 8D 80 02 STA $0280 DE26 8D 81 02 STA $0281 DE29 A9 E0 LDA #$E0 LDE24: 80 02 8D 81 02 A9 E0 20 1E DE24 80 ??? DE25 02 ??? DE26 8D 81 02 STA SWACNT DE29 A9 E0 LDA #$E0 LDE21: ; not referenced Dead code? LDA #$0F LDE23: STA SWCHA STA SWACNT LDA #$E0 JSR LE01E BCC LDE18 ; -> sample current trigger state, save on #91, return with DEY BNE LDE24 ; ? makes no sense DEC $69 BNE LDE22 ; ? makes no sense LDA #$00 JMP LDFE7 ; write 3 bits then return ; sync ? LDE3C: LDA #$00 JSR LDFE7 ; write 3 bits in 0 then flip bit 3 JSR LDFB8 ; read a byte BCC LDE5E ; return if carry clear - should never happen STA $93 ; save byte read LDA $95 ; BNE LDE5F ; ?? LDX $93 ; BEQ LDE5E ; return if zero LDA LDEA0,X ; table index ? BCC LDE5E ; return if carry clear LDE55: STA $94 ; table return (scan code translation ?) JSR LDE8D LDA #$1E STA $95 LDE5E: RTS LDE5F: ??
  15. Danjovic

    7800 Keyboard

    Indeed! After the rotates the bit 2 of the last read remains on carry!! Well noticed!!!
  16. Danjovic

    7800 Keyboard

    Some more code snippets. I think I figured out the protocol at a lower level. Most of it at least !! It really looks like the sequence for reading the keys is write saved value of line 'up' ($90) on bit 3 flip and save bit 3 line 'up' on ($90) wait until keyboard acks by flipping the line 'fire' read 3 bits [CBA] write saved value of line 'up' ($90) on bit 3 flip and save bit 3 line 'up' on ($90) wait until keyboard acks by flipping the line 'fire' read 3 bits [FED] combine bits read into a byte at $93 [00FEDCBA] write saved value of line 'up' ($90) on bit 3 flip and save bit 3 line 'up' on ($90) wait until keyboard acks by flipping the line 'fire' read 3 bits again (and return with carry set) [IHG] rotate bits right 3 times so you have after return and mask upper bits and add to the remaining bits to have the final 2 bits. [HG][FED][CBA] LDFB8: LDA #$08 ; bit 3 (right U) as output, bits 210 (right DLR) as inputs STA SWACNT JSR LDFF6 ; Read bits 210 BCC LDFE6 ; ret if bit clear - should never happen STA $93 ; save JSR LDFF6 ; Read bits 543 BCC LDFE6 ; ret if bit clear - should never happen ASL ASL ASL ORA $93 ; $93 = 6 bits read [543][210] STA $93 JSR LDFF6 ; read 3 bits more [876] BCC LDFE6 ; ret if bit clear - should never happen ROR ROR ROR AND #$C0 ; 76xxxxxx ORA $93 ; 76543210 -> completed a byte received STA $93 LDA #$0F BCC LE006 STA $93 .byte $93 ;.SHA SEC LDFE6: RTS LDFF6: LDA $90 ; get last value LDFF8: STA SWCHA ; write on joystick port EOR #$08 ; toggle bit 3 (right UP) STA $90 ; save for next round LDFFF: LDA INPT5 ; read fire AND #$80 CMP $91 ; compare with last BEQ LDFFF ; repeat until fire button signal flipped STA $91 ; save this state (of fire button) LDA SWCHA ; read value from joystick port AND #$07 ; clear unneccesary bits SEC ; set carry flag RTS return
  17. Danjovic

    7800 Keyboard

    I was more happy with option -kad7 Seven references to SWCHA, either to read and write. I start to suspect that SWCHA bits 0,1,2 are being used for data while bits 3 is being used for signaling along with INPT5 (ack?) styper-kad7c.asm
  18. Danjovic

    7800 Keyboard

    Well, I am not familiar enough with the 7800 software to be able to tell that, lol!! I was trying to track the accesses to the SWCHA and INPTx to try to understand the protocol, but the dissassembled code still have many blocks marked as data but still with relevant code for instance: LDFB8: .byte $A9,$08,$8D,$81,$02,$20,$F6,$DF,$90,$24,$85,$93,$20,$F6,$DF,$90 .byte $1D,$0A,$0A,$0A,$05,$93,$85,$93,$20,$F6,$DF,$90,$11,$6A,$6A,$6A .byte $29,$C0,$05,$93,$85,$93,$A9,$0F,$90,$24,$85,$93,$93,$38,$60 * = $0000 DFB8 A9 08 LDA #$08 DFBA 8D 81 02 STA $0281 -> SWACNT DFBD 20 F6 DF JSR $DFF6 DFC0 90 24 BCC LDFE6 DFC2 85 93 STA $93 DFC4 20 F6 DF JSR $DFF6 DFC7 90 1D BCC LDFE6 DFC9 0A ASL A DFCA 0A ASL A DFCB 0A ASL A DFCC 05 93 ORA $93 DFCE 85 93 STA $93 DFD0 20 F6 DF JSR $DFF6 DFD3 90 11 BCC LDFE6 DFD5 6A ROR A DFD6 6A ROR A DFD7 6A ROR A DFD8 29 C0 AND #$C0 DFDA 05 93 ORA $93 DFDC 85 93 STA $93 DFDE A9 0F LDA #$0F DFE0 90 24 BCC $E006 DFE2 85 93 STA $93 DFE4 93 ??? DFE5 38 SEC DFE6 60 LDFE6 RTS and furthermore, I did not understand why the dissassembler haven't decoded the LDA $90. Maybe I am using the wrong option (-pafs7) ? LDFF6: .byte $A5,$90 -> LDA $90 LDFF8: STA SWCHA ;4 EOR #$08 ;2 STA $90 ;3 LDFFF: LDA INPT5 ;3 AND #$80 ;2 CMP $91 ;3 BEQ LDFFF ;2 STA $91 ;3 LDA SWCHA ;4 AND #$07 ;2 SEC ;2 RTS ;6
  19. Danjovic

    7800 Keyboard

    Disassembled the rom using distella to check for the accesses to the joystick ports. Haven't figured out the protocol but it seems that this part performs an initialization LDE01: LDA #$0F ;2 STA SWCHA ;4 STA SWACNT ;4 LDA #$00 ;2 STA $90 ;3 STA SWBCNT ;4 STA $68 ;3 STA $67 ;3 STA $94 ;3 STA $95 ;3 LDA INPT5 ;3 AND #$80 ;2 STA $91 ;3 LDA #$03 ;2 RTS ;6 Right joystick pin is changed to be outputs (SWACNT = 0x0f). It points to the connection of the keyboard on right joystick, and that the protocol may use the directionals as outputs Maybe I was wrong in both my initial guesses, lol! Well, no hurry, another part of the code looks to be waiting for a toggle in the fire button pin, but sure is on the right controller LDFEA: LDA INPT5 ;3 AND #$80 ;2 CMP $91 ;3 BEQ LDFEA ;2 STA $91 ;3 SEC ;2 RTS ;6
  20. Danjovic

    7800 Keyboard

    Is it just me or did the message on the screens suggests that the keyboard should be connected on the left port (1) ?
  21. Danjovic

    7800 Keyboard

    Many usb keyboards can fallback into ps/2 mode, which simplifies the option for a microcontroller.
  22. Danjovic

    The Wolf

    It is a plain system 2600 . A clone though!
  23. Danjovic

    7800 Keyboard

    So the P2 is an SIO port...!!
  24. Danjovic

    7800 Keyboard

    Thanks. I see the keyboard provided a Tape in and Tape out ports! It looks like the connection with the console was done through P1, while P3 would connect with the keyboard membrane. It may be a long shot, but I guess that the protocol uses the UDRL lines to transfer nibbles and the fire button as a clock line. Have anyone disassembled the binaries to check? I could not figure out the function of P2. Maybe a connector to other Atari peripherals? The microcontroller is an early PIC micro, probably an OTP device. Found one picture on the internet. Link to datasheet family (https://en.wikichip.org/w/images/8/89/PIC_series_microcomputer_data_manual_(1983).pdf)
×
×
  • Create New...