R32V2020 Pushbutton Switches

From Land Boards Wiki
Jump to navigation Jump to search

Sample Code

  • d0-d2 are the pushbutton switches (inverted)
    • Pushbutton switches are debounced
  • d3-10 are the DIP switches (not inverted and not debounced)
;
; readSws
; switches value returned in r8
; switches are high when pressed
; Switches d0-d2 are the pushbutton switches (inverted)
; 	Pushbutton switches are debounced
; Switches d3-10 are the DIP switches (not inverted and not debounced)
;

readSws:
	push	PAR
	push	r9
	lix		r9,0x7
	lix		PAR,0x2000	; Switches address
	lpl		r8			; Read switches into r9
	xor		r8,r8,r9
	pull	r9
	pull	PAR
	pull	PC