mirror of
https://github.com/RevCurtisP/C02.git
synced 2024-11-28 10:51:14 +00:00
22 lines
721 B
Plaintext
22 lines
721 B
Plaintext
;Lightpen Assembly Language Module for Atari 400 & 800
|
|
|
|
LGTPNS EQU #$FF ;Light Pen Status (Supported)
|
|
|
|
;Read Light Pen
|
|
;Returns: A = X Position / 2
|
|
; Y = Y Position
|
|
; X = Trigger Status ($FF = Pressed)
|
|
LGTPEN: LDX #0 ;Initialize X to FALSE (0)
|
|
LDA $0284 ;Check Joystick Button
|
|
EOR #$FF ;Invert and
|
|
AND #$01 ;Mask Bits
|
|
BEQ LGTPET ;If Trigger Pulled, Set X to $FF
|
|
LDA $0278 ;Read Joystick Switches
|
|
EOR #$FF ;Invert and
|
|
AND #$0F ;Mask Bits
|
|
BEQ LGTPEP ;If Trigger Pulled
|
|
LGTPET: DEX ; Set X to TRUE ($FF)
|
|
LGTPEP: LDY $0234 ;Read Y Position into Y
|
|
LDA $0235 ;Read X Position into A
|
|
RTS
|