Difference between revisions of "Wnk.asm"
(→Functions Provided) |
|||
Line 4: | Line 4: | ||
<CENTER><TABLE BORDER><TR><TH>Entry point</TH><TH>Function provided</TH><TH>Notes</TH></TR> | <CENTER><TABLE BORDER><TR><TH>Entry point</TH><TH>Function provided</TH><TH>Notes</TH></TR> | ||
− | <TR><TD>WAITKEY</TD><TD>Waits for a tap on either controller</TD><TD>Specifically, waits for there to be no input on either controller, | + | <TR><TD>WAITKEY</TD><TD>Waits for a tap on either controller</TD><TD>Specifically, waits for there to be no input on either controller, followed by an input from either controller, and then no input again. Debounces the input to avoid glitches.</TD></TR> |
<TR><TD>WAITNOKEY</TD><TD>Waits for there to be no input on either controller.</TD><TD>Debounced to avoid glitches.</TD></TR></TABLE></CENTER> | <TR><TD>WAITNOKEY</TD><TD>Waits for there to be no input on either controller.</TD><TD>Debounced to avoid glitches.</TD></TR></TABLE></CENTER> | ||
<br /><br /> | <br /><br /> |
Revision as of 03:40, 12 September 2008
Functions Provided
Entry point | Function provided | Notes |
---|---|---|
WAITKEY | Waits for a tap on either controller | Specifically, waits for there to be no input on either controller, followed by an input from either controller, and then no input again. Debounces the input to avoid glitches. |
WAITNOKEY | Waits for there to be no input on either controller. | Debounced to avoid glitches. |
See source code below for calling convention.
Examples
(todo... please contribute!)
Notes
Source Code
;* ======================================================================== *; ;* These routines are placed into the public domain by their author. All *; ;* copyright rights are hereby relinquished on the routines and data in *; ;* this file. -- Joseph Zbiciak, 2008 *; ;* ======================================================================== *; ;; ======================================================================== ;; ;; WAITKEY Wait for release/press/release ;; ;; WAITNOKEY Wait for key release ;; ;; ======================================================================== ;; WAITKEY PROC PSHR R5 @@1: CALL WAITNOKEY ; Wait for release-press-release @@wk MVI $1FE, R0 XOR $1FF, R0 BEQ @@wk INCR PC ; skip PSHR R5 WAITNOKEY PSHR R5 @@waitnokey MVII #200, R1 ; Debounce counter @@stillnk MVI $1FE, R0 XOR $1FF, R0 BNEQ @@waitnokey DECR R1 ; Avoid glitches: Make sure it's good and gone BPL @@stillnk PULR PC ENDP ;; ======================================================================== ;; ;; End of File: wnk.asm ;; ;; ======================================================================== ;;