[A89] Hiding those uggly 2nd, shift, etc.


[Prev][Next][Index][Thread]

[A89] Hiding those uggly 2nd, shift, etc.




Hi.
I got annoyed today about all programs out there that uses the standard rom 
functions for reading keys.
Nothing wrong with that, except thoose _uggly_ 2nd, shift, alpha-markers 
that pop up.
So I hacked together this little AutoInt1-wrap that hides thoose markers, 
but still allows you to use the standard rom-functions.
Made a C header with a nice interface to it also, I hope people will use it.
It will ofcourse be a slight slowdown, but I think that is close to nothing 
compared to the rest of autoint1, and if one uses the standard rom 
keyreading functions, one probably don't have a speed issue either.
Oh, one more thing. If anyone could tell me how to avoid the "Assignment 
from incompatible pointer type" when implementing interrupt routines in 
external asm files, please tell me.
You will get this error with these files, but you can safely ignore it.
A future version might be compatible with changing the screen adress too...
This works as long as they are in their original position relative to 
0x4c00 (screen buffer)
oh, it isn't testen on HW2 either, please do and report back to me :)

Lots of if:s and but:s, but please try it out and say what you like about it:

I put it like this, since I don't know how the list handles attachments. 
And it isn't long, just cut'n'paste :)

///Olle

-------- file: hidekstat.h              --------
-------- The header file, #include this --------
// Hides the 2nd, shift, etc-stats so you can use the
// rom keyreading functions (ngetchx() et. al.)
// without the uggly side effects.
// Never run ShowKeyStats() before you have run HideKeyStats(), will result 
in crash.
//
// Author: Olle Hedman, oh@hem.passagen.se
//
// Use as much as you like, but please send a mail if you are going to 
release anything
// with it, just so I know if anyone actually uses this :)

#ifndef _HIDEKSTAT_H_
#define	_HIDEKSTAT_H_

extern void Int1wrap(void);
extern INT_HANDLER OldInt1;

#define HideKeyStats() \
	OldInt1 = GetIntVec(AUTO_INT_1); \
	SetIntVec(AUTO_INT_1,Int1wrap);

#define ShowKeyStats() \
	SetIntVec(AUTO_INT_1,OldInt1);

#endif
-------- end of file: hidekstat.h       --------

-------- file: hidekstat.s                              --------
-------- The Gnu assembly implementation, just add this --------
-------- to your project.                               --------
| The new interrupt handler wrap for HideKeyStats()
|
| Author: Olle Hedman, oh@hem.passagen.se

	.global	Int1wrap
	.global OldInt1
	.data
Int1wrap:
	movem.l	%d0/%a0,-(%SP)
	lea	0x4c00+99*30+4,%a0
	move.w	#5,%d0
loop02:
	move.l	(%a0),-(%SP)
	sub.l	#30,%a0
	dbra	%d0,loop02	

	lea	ReturnP(%PC),%a0
	move.l	%a0,-(%SP)
	move.w	%SR,-(%SP)
	move.l	OldInt1(%PC),%a0
	jmp	(%a0)

ReturnP:
	lea.l	0x4c00+94*30+4,%a0
	move.w	#5,%d0
loop01:
	move.l	(%SP)+,(%a0)
	add.l	#30,%a0
	dbra	%d0,loop01
	
	movem.l	(%SP)+,%d0/%a0
	rte

OldInt1:	
	.long	0
-------- end of file: hidekstat.s --------




Follow-Ups: