From: izydorst Date: Fri, 15 Aug 2003 23:17:11 +0000 (+0000) Subject: system vector interception fixes X-Git-Tag: V2.12.0~1398 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fa084ef30438e78d824b4fdc81cb9e1a50bd5437;p=cc65 system vector interception fixes git-svn-id: svn://svn.cc65.org/cc65/trunk@2339 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/doc/geos.sgml b/doc/geos.sgml index 0539e490b..14acb7d48 100644 --- a/doc/geos.sgml +++ b/doc/geos.sgml @@ -1607,7 +1607,7 @@ void example = {

It is possible to intercept and hook in the GEOS Kernal using vectors. Here is a little example: -void (*oldVector)(void); +void_func oldVector; void NewVectorHandler(void) { // do something and at the end call the old vector routine diff --git a/samples/geos/vector-demo.c b/samples/geos/vector-demo.c index a558e1f2a..cddb943d2 100644 --- a/samples/geos/vector-demo.c +++ b/samples/geos/vector-demo.c @@ -5,8 +5,7 @@ unsigned char x,y; -void (*oldMouseVector)(); -void (*oldKeyVector)(); +void_func oldMouseVector, oldKeyVector; void foo1 (void) { // do something on mouse press/release @@ -28,15 +27,15 @@ void foo2 (void) { void hook_into_system(void) { // hook into system vectors - preserve old value - oldMouseVector = (void (*)())mouseVector; - mouseVector = (int)foo1; - oldKeyVector = (void (*)())keyVector; - keyVector = (int)foo2; + oldMouseVector = mouseVector; + mouseVector = foo1; + oldKeyVector = keyVector; + keyVector = foo2; } void remove_hooks(void) { - mouseVector = (int)oldMouseVector; - keyVector = (int)oldKeyVector; + mouseVector = oldMouseVector; + keyVector = oldKeyVector; } int main(void) {