Skip to navigation


Keyboard: scan_fire

[Elite-A, I/O processor]

Name: scan_fire [Show more] Type: Subroutine Category: Keyboard Summary: Implement the scan_fire command (scan the joystick's fire button)
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * tube_table calls scan_fire

This routine is run when the parasite sends a scan_fire command. It checks the joystick's fire button and returns a value to the parasite with bit 4 clear if the joystick's fire button is being pressed, or bit 4 set if it isn't.
.scan_fire LDA #&51 \ Set 6522 User VIA output register ORB (SHEILA &60) to STA VIA+&60 \ the Delta 14B joystick button in the middle column \ (high nibble &5) and top row (low nibble &1), which \ corresponds to the fire button LDA VIA+&40 \ Read 6522 System VIA input register IRB (SHEILA &40) AND #%00010000 \ Bit 4 of IRB (PB4) is clear if joystick 1's fire \ button is pressed, otherwise it is set, so AND'ing \ the value of IRB with %10000 extracts this bit JMP tube_put \ Send A back to the parasite and return from the \ subroutine using a tail call