View Single Post
Old 07 September 2011, 10:45   #12
Asman
68k
 
Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 828
Hi

@h0ffman

I guess that you can set PORTS int ($68) in proper way If not then give me a sign. Then int routine which I used for example to fix RollingThunder keyboard is

Code:
IntLvlTwoPorts:
		movem.l	d0-d1/a0-a2,-(a7)
	
		lea	_custom,a0
		move.w	intreqr(a0),d0
		btst	#INTB_PORTS,d0
		beq	.end
		
		lea	_ciaa,a1
		btst	#CIAICRB_SP,ciaicr(a1)
		beq	.end

	;read key and store him
		move.b	ciasdr(a1),d0
		or.b	#CIACRAF_SPMODE,ciacra(a1)
		not.b	d0
		ror.b	#1,d0
		spl	d1
		and.w	#$7f,d0
		lea	keys(pc),a2
		move.b	d1,(a2,d0.w)

	;handshake
		moveq	#3-1,d1
.wait1		move.b	vhposr(a0),d0
.wait2		cmp.b	vhposr(a0),d0
		beq	.wait2
		dbf	d1,.wait1

	;set input mode
		and.b	#~(CIACRAF_SPMODE),ciacra(a1)

.end		move.w	#INTF_PORTS,intreq(a0)
		tst.w	intreqr(a0)
		movem.l	(a7)+,d0-d1/a0-a2
		rte

keys: 		dcb.b $80,0
and then you can check key 'ESC' in following manner

Code:
KEY_ESC = $45
CheckKeyESC:
		lea	keys(pc),a0
		tst.b	KEY_ESC(a0)		;on 68020+ you can do tst.b keys+KEY_ESC(pc) instead of lea and tst
		beq	.exit
		;
		;key 'ESC' was pressed, insert some code here
		;
.exit		rts
For more details, please check WHDLoad dev package and look into keyboard.s file.

Regards

Last edited by Asman; 07 September 2011 at 10:49. Reason: change comment a bit (68020 --> 68020+ )
Asman is offline  
 
Page generated in 0.04892 seconds with 11 queries