Page 1 of 1

[Hardware] Pachinko controller

Posted: Mon Apr 18, 2016 11:42 am
by MooZ
Here are some images of the pachinko controller guts. Although it was sold by Coconuts Japan, the PCB seems to have been designed by Hori.

ImageImageImage
ImageImageImage
ImageImageImage

Re: [Hardware] Pachinko controller

Posted: Sun May 07, 2017 5:49 pm
by MooZ
Image
  1. MC74HC157N (JJAP9102B)
  2. MC74HC574AN (JJAC9104B)
  3. MC14024BCP (FJEI9031)
  4. MC14013BCP (ZSJBS9044C)
  5. µPC393 (N MALAYSIA C393C) (9033K77)

Re: [Hardware] Pachinko controller

Posted: Fri May 12, 2017 1:13 pm
by MooZ
Here are some infos about the Famicom version http://problemkaputt.de/everynes.htm#c ... rspachinko.

Re: [Hardware] Pachinko controller

Posted: Sat May 13, 2017 3:49 pm
by MooZ
As far as I know "Pachio-kun - Juuban Shoubu" is the only HuCard game using the pachinko controler.
At the moment, I only found 1 place where the joypad port is read. The next step will be to make a small ROM to test it.

Code: Select all

	.code
	.bank 0
	.org $edd3
joyread:
          CLY     
          LDA     #$01
          STA     joyport
          LDA     #$03
          STA     joyport
ledde_00:
          LDA     #$01
          STA     joyport
          PHA     
          PLA     
          NOP     
          LDA     $286b, Y
          STA     $2866, Y
          LDA     joyport
          ASL     A
          ASL     A
          ASL     A
          ASL     A
          STA     $286b, Y
          STZ     joyport
          PHA     
          PLA     
          NOP     
          LDA     joyport
          AND     #$0f
          ORA     $286b, Y
          EOR     #$ff
          STA     $286b, Y
          EOR     $2866, Y
          AND     $286b, Y
          STA     $2870, Y
          INY     
          CPY     #$05
          BCC     ledde_00
          CLY     
lee18_00:
          LDA     $2875
          AND     mask, Y
          BEQ     lee31_00
          LDA     $2870, Y
          CMP     #$04
          BNE     lee31_00
          LDA     $286b, Y
          CMP     #$0c
          BNE     lee31_00
          JMP     reset
lee31_00:
          INY     
          CPY     #$05
          BCC     lee18_00
          RTS     
mask:
    .db $01, $02, $04, $08, $10
(edit) I forgot the etripator config

Code: Select all

[joyread]
filename=joyread.asm
type=code
bank=0
org=edd3
size=64
and the label file

Code: Select all

[joyread]
logical=edd3
physical=000dd3

[ledde_00]
logical=edde
physical=000dde

[lee31_00]
logical=ee31
physical=000e31

[reset]
logical=e0f2
physical=0000f2

[lee18_00]
logical=ee18
physical=000e18

[joyport]
logical=1000
physical=001000

Re: [Hardware] Pachinko controller

Posted: Sat May 13, 2017 4:45 pm
by MooZ
Here's a small program (you'll need HuDK to compile it).
It looks like a standard 5 joypad read routine except for lee18_00 where given the value of $2875 the "reboot" (SEL+RUN) combo is checked.

Code: Select all

    .include "hudk.s"
    .include "bcd.s"
    
font_vram_base = $2000
joy_txt_x = 9
joy_txt_y = 12

    .code
main:
    ; load palette
    stw    #palette, <_si
    jsr    map_data
    cla
    ldy    #$01
    jsr    vce_load_palette

    ; load font data and select palette
    stw    #font_vram_base, <_di 
    lda    #.bank(font_8x8)
    sta    <_bl
    stw    #font_8x8, <_si
    stw    #(FONT_8x8_COUNT*8), <_cx
    jsr    font_load

    lda    #$00
    jsr    font_set_pal

    ; enable background display
    vdc_reg  #VDC_CR
    vdc_data #(VDC_CR_BG_ENABLE | VDC_CR_VBLANK_ENABLE)

    ; set vsync vec
    stz    <irq_m
    irq_on #INT_IRQ1
    irq_enable_vec #VSYNC
    irq_set_vec #VSYNC, #vsync_proc

    cli
    
.loop:
    jsr    joyread

    ldx    #joy_txt_x
    lda    #joy_txt_y
    jsr    vdc_calc_addr 
    jsr    vdc_set_write
    cly
.txt
    lda    $286b, Y
    jsr    print_hex_u8
    
    lda    #' '
    jsr    print_char
  
    iny
    cpy    #$05
    bne    .txt
    
    stz   irq_cnt
.wait:
    lda   irq_cnt
    bne   .wait

    bra   .loop
    rts

vsync_proc:
    timer_ack
    rts

; Pachio-kun - Juuban Shoubu joypad routine
joyread:
          CLY     
          LDA     #$01
          STA     joyport
          LDA     #$03
          STA     joyport
ledde_00:
          LDA     #$01
          STA     joyport
          PHA     
          PLA     
          NOP     
          LDA     $286b, Y
          STA     $2866, Y
          LDA     joyport
          ASL     A
          ASL     A
          ASL     A
          ASL     A
          STA     $286b, Y
          STZ     joyport
          PHA     
          PLA     
          NOP     
          LDA     joyport
          AND     #$0f
          ORA     $286b, Y
          EOR     #$ff
          STA     $286b, Y
          EOR     $2866, Y
          AND     $286b, Y
          STA     $2870, Y
          INY     
          CPY     #$05
          BCC     ledde_00
          CLY     
lee18_00:
          LDA     $2875
          AND     mask, Y
          BEQ     lee31_00
          LDA     $2870, Y
          CMP     #$04
          BNE     lee31_00
          LDA     $286b, Y
          CMP     #$0c
          BNE     lee31_00
          JMP     _reset
lee31_00:
          INY     
          CPY     #$05
          BCC     lee18_00
          RTS     
mask:
    .db $01, $02, $04, $08, $10

palette:
    .dw $0000, $01ff, $0000, $0000, $0000, $0000, $0000, $0000
    .dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000

    .include "font.inc"
So basically the behaviour of the pachinko controller is identical to the famicom one. The first byte returns the status of the pad and buttons just like a normal joypad. The second byte returns the value of the trigger. At boot it's set to $ff, but it ranges from $fb to $84. Depending on the quality of your controller, this values may vary. For example on my unit, I sometime $fc at rest and I move the trigger quickly and go back to the rest position, I'll get $f9.
It's not really stable :)
This may be caused by the aging potentiometer, the cheap plastic or the circuit.

Anyway, to make things short, if you want to use a pachinko controller in your game, read the joyport as if you had 2 joypad on a multitap. The 1st byte will contain standard joypad values whereas the 2nd will contain the value of the trigger where $fb will be the value at rest and $84 will be the value when the trigger is turn at its maximum.

Re: [Hardware] Pachinko controller

Posted: Sun May 14, 2017 12:44 pm
by MooZ
Also note that it will behave like a standard joypad when plugged on a multi-tap.

Re: [Hardware] Pachinko controller

Posted: Sun May 14, 2017 7:45 pm
by MooZ
If you look at the routine at $4ea4 in Pachio-kun Juuban Shoubu, you'll see that the trigger values are clamped between $9c and $ef.