;ACME 0.96.4 !ifdef lib_cbm_c64_cia1_a !eof lib_cbm_c64_cia1_a = 1 !source ; chip stuff (same for both cias) ; stuff for cia 1 only: !addr cia1_base = $dc00 ; both port A and port B are connected to the keyboard matrix. ; in addition to that, they are used for: cia1_pra = cia1_base + cia_port_a ; %7....... writing 0 selects paddles at port 1 ; %.6...... writing 0 selects paddles at port 2 ; %...4.... reading 0 means JOY2_BUTTON ; %....3... reading 0 means JOY2_RIGHT ; %.....2.. reading 0 means JOY2_LEFT ; %......1. reading 0 means JOY2_DOWN ; %.......0 reading 0 means JOY2_UP ; kernal's keyboard scanner writes values where a single bit is cleared, going from lsb to msb. ; so most of the time, the last value written will be $7f. cia1_prb = cia1_base + cia_port_b ; %...4.... reading 0 means JOY1_BUTTON ; %....3... reading 0 means JOY1_RIGHT ; %.....2.. reading 0 means JOY1_LEFT ; %......1. reading 0 means JOY1_DOWN ; %.......0 reading 0 means JOY1_UP cia1_ddra = cia1_base + cia_data_direction_a ; kernal writes $ff to set to output for keyboard scanner cia1_ddrb = cia1_base + cia_data_direction_b ; kernal writes $00 to set to input for keyboard scanner cia1_ta_lo = cia1_base + cia_timer_a_low cia1_ta_hi = cia1_base + cia_timer_a_high cia1_tb_lo = cia1_base + cia_timer_b_low cia1_tb_hi = cia1_base + cia_timer_b_high cia1_tod10ths = cia1_base + cia_timeofday_10ths cia1_todsec = cia1_base + cia_timeofday_seconds cia1_todmin = cia1_base + cia_timeofday_minutes cia1_todhr = cia1_base + cia_timeofday_hours cia1_sdr = cia1_base + cia_serial_data cia1_icr = cia1_base + cia_interrupt_control cia1_cra = cia1_base + cia_control_a cia1_crb = cia1_base + cia_control_b ; the interrupt output is connected to CPU's /IRQ input ; in the C128, the shift register is used for the fast serial port (burst mode)