View Single Post
Old 15 October 2019, 18:28   #1520
ross
Per aspera ad astra

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 49
Posts: 2,241
Two-buttons low-latency multi-pad reading

I've implemented a two-buttons low-latency multi-pad reading based on latest thread discussion.

It use an 'innovative' Copper/IRQ5 approach, using double time-spaced read in every single frame.

Buttons status are available in time for your VBI/IRQ3 main handler.

Attached an ADF that do the black/red/cyan/white video report.
Retro-Nerd made some test with his pads and all is working properly.

Source code:
Code:
start	
potgo	        movea.l	$4.w,a6
		lea	pot(pc),a1
		jsr	-498(a6)	;OpenResource()
		tst.l	d0
		beq.b	.ex
		movea.l	d0,a6
		moveq	#-1,d0
		move.w	#$ff00,d1
		jsr	-18(a6)		;WritePotgo()

.ex		lea	$dff000,a6
		move.w	#$7fff,d0
		move.w	d0,$9a(a6)
		move.w	d0,$9c(a6)
		move.w	d0,$96(a6)
		lea	$400.w,a0
		lea	copperend(pc),a1
		moveq	#(copperend-copper)/4-1,d0
.cl		move.l	-(a1),-(a0)
		dbf	d0,.cl
		move.l	a0,$80(a6)
		move.w	d0,$88(a6)
.wv		moveq	#$20,d0
		and.w	$1e(a6),d0
		beq.b	.wv
		move.w	#$8280,$96(a6)
		lea	irq5(pc),a0
		move.l	a0,$74.w
		move.w	#$d800,$9a(a6)
.lol	        bra.b	.lol


irq5	        movem.l	d0/a5-a6,-(sp)
		lea	$dff000,a6
		lea	.2nd(pc),a5

.rbtn	        moveq	#0,d0
		btst	#7,$bfe001
		seq	d0
		lsl.w	#4,d0
		btst	#14-8,$16(a6)
		seq	d0

		btst	#12-8,$1e(a6)
		beq.b	.rbf

.syn	        move.w	d0,(a5)
		move.w	#$5f00,d0
		bra.b	.set

.rbf	        or.w	(a5),d0
		move.w	d0,($400-(copperend-copper)+6).w
		move.w	#$ff00,d0

.set	        move.w	d0,$34(a6)
		
		move.w	#$1800,$9c(a6)
		move.w	#$8400,$96(a6)
		movem.l	(sp)+,d0/a5-a6
		rte

.2nd	       ds.w	1
		
pot	       dc.b	'potgo.resource',0


copper	dc.l	$1807fffe
		dc.l	$01800000
		dc.l	$ffe1fffe
		dc.l	$1801ff00
		dc.l	$00960400
		dc.l	$009c9000
		dc.l	$3701ff00
		dc.l	$00960400
		dc.l	$009c8800
		dc.l	$fffffffe
copperend
Was designed primarily for the needs and use of Rygar's IRQs /copperlist but can be applied with minor modifications in other situations.
Attached Files
File Type: zip lowlatency.zip (1.3 KB, 11 views)
ross is offline  
 
Page generated in 0.04218 seconds with 12 queries