@wpafb-aamrl.arpa:WQUEENER@falcon (WQUEENER) (01/30/89)
Hey, about writing those interrupt servers...you guys have contributed
mucho information, well appreciated by me. I have it all stored away for my
use at a time very soon. You see, I myself need to write an interrupt server.
But I have another reason for not getting off the ground. It has to do with
my lack of familiarity with assembler, and the Lattice compiler which I am
TRYING to use (by the way, I have 4.01).
There are a couple of statements which I need to use (apparently),
having to do with sticking the assembler code with the C code. One is the
XDEF statement, the other is the CSECT statement. Currently, these two are
driving me nuts, as I can't determine where to place them, or what arguments
to give them.
Right now, I'm trying to compile and successfully run some code
straight from the ROM KERNEL I manual, page 1-57 an 1-58. If I could have
some explanation more clear than the documentation I have, it would certainly
make life at the keyboard more enjoyable right now. The code I have written
is included below. This thing is supposed to count vertical blank interrupts.
**************THE C CODE ***********************
/* I call this file vdk:Vertb.c */
#include "exec/types.h"
#include "exec/nodes.h"
#inlcude "exec/lists.h"
#include "exec/interrupts.h"
#inlcude "exec/memory.h"
#include "exec/ports.h"
#include "exec/tasks.h"
#include "exec/libraries.h"
#include "exec/devices.h"
#include "exec/io.h"
#include "hardware/intbits.h"
#include "stdio.h"
struct Interrupt *VertBIntr;
long count;
main()
{
extern void VertBServer();
/* allocate an Interrupt node structure: */
VertBIntr=AllocMem(sizeof(struct Interrupt *), MEMF_PUBLIC);
if(VertBIntr==0){
printf("not enough memory for interrupt server");
exit(100);
}
/* initialize the Interrupt node: */
VertBIntr->is_Node.ln_Type=NT_INTERRUPT;
VertBIntr->is_Node.ln_pri=-60;
VertBIntr->is_Node.ln_Name="VertB-example";
VertBIntr->is_Data=&count;
VertBIntr->is_Code=VertBServer;
/* put the new interrupt server into action: */
AddIntServer(INTB_VERTB,VertBIntr);
while(getchar()!='q'); /* wait for user to type 'q' */
RemIntServer(INTB_VERTB,VertBIntr);
printf("%ld vertical blanks occurred",count);
FreeMem(VertBIntr,sizeof(struct Interrupt *));
}
*************here is the assembler code *****************
* I call this file vdk:vertbserver.a
XDEF _VertBServer
_VertBServer:
CSECT _VertBServer
MOVE.L (A1),A0 get address of count
ADDQ.L #1,(A0) bump value of count
MOVEQ.L #0,D0 continue server chain
RTS
****** HERE ARE THE COMPILE COMMANDS I USE *********
assign lib: Lattice_C_4.01.2:lib
assign disk: Lattice_C_4.01.2:compacth
cd vdk:
lc -idisk: -s -v vertb
asm vertbserver
***HERE IS THE WITH FILE FOR LINKING, CALLED VDK:VERTB.WITH ***************
FROM *
lib:c.o,*
vdk:vert.o,*
vdk:vertbserver.o
TO *
vdk:vertb
LIBRARY *
lib:lc.lib,*
lib:amiga.lib,*
*** AND, OF COURSE THE BLINK COMMAND **************
blink with vdk:vert.with
WHERE DO YOU THINK MY PROBLEM LIES???
@wpafb-aamrl.arpa:WQUEENER@falcon (WQUEENER) (01/30/89)
Hey, about writing those interrupt servers...you guys have contributed
mucho information, well appreciated by me. I have it all stored away for my
use at a time very soon. You see, I myself need to write an interrupt server.
But I have another reason for not getting off the ground. It has to do with
my lack of familiarity with assembler, and the Lattice compiler which I am
TRYING to use (by the way, I have 4.01).
There are a couple of statements which I need to use (apparently),
having to do with sticking the assembler code with the C code. One is the
XDEF statement, the other is the CSECT statement. Currently, these two are
driving me nuts, as I can't determine where to place them, or what arguments
to give them.
Right now, I'm trying to compile and successfully run some code
straight from the ROM KERNEL I manual, page 1-57 an 1-58. If I could have
some explanation more clear than the documentation I have, it would certainly
make life at the keyboard more enjoyable right now. The code I have written
is included below. This thing is supposed to count vertical blank interrupts.
**************THE C CODE ***********************
/* I call this file vdk:Vertb.c */
#include "exec/types.h"
#include "exec/nodes.h"
#inlcude "exec/lists.h"
#include "exec/interrupts.h"
#inlcude "exec/memory.h"
#include "exec/ports.h"
#include "exec/tasks.h"
#include "exec/libraries.h"
#include "exec/devices.h"
#include "exec/io.h"
#include "hardware/intbits.h"
#include "stdio.h"
struct Interrupt *VertBIntr;
long count;
main()
{
extern void VertBServer();
/* allocate an Interrupt node structure: */
VertBIntr=AllocMem(sizeof(struct Interrupt *), MEMF_PUBLIC);
if(VertBIntr==0){
printf("not enough memory for interrupt server");
exit(100);
}
/* initialize the Interrupt node: */
VertBIntr->is_Node.ln_Type=NT_INTERRUPT;
VertBIntr->is_Node.ln_pri=-60;
VertBIntr->is_Node.ln_Name="VertB-example";
VertBIntr->is_Data=&count;
VertBIntr->is_Code=VertBServer;
/* put the new interrupt server into action: */
AddIntServer(INTB_VERTB,VertBIntr);
while(getchar()!='q'); /* wait for user to type 'q' */
RemIntServer(INTB_VERTB,VertBIntr);
printf("%ld vertical blanks occurred",count);
FreeMem(VertBIntr,sizeof(struct Interrupt *));
}
*************here is the assembler code *****************
* I call this file vdk:vertbserver.a
XDEF _VertBServer
_VertBServer:
CSECT _VertBServer
MOVE.L (A1),A0 get address of count
ADDQ.L #1,(A0) bump value of count
MOVEQ.L #0,D0 continue server chain
RTS
****** HERE ARE THE COMPILE COMMANDS I USE *********
assign lib: Lattice_C_4.01.2:lib
assign disk: Lattice_C_4.01.2:compacth
cd vdk:
lc -idisk: -s -v vertb
asm vertbserver
***HERE IS THE WITH FILE FOR LINKING, CALLED VDK:VERTB.WITH ***************
FROM *
lib:c.o,*
vdk:vert.o,*
vdk:vertbserver.o
TO *
vdk:vertb
LIBRARY *
lib:lc.lib,*
lib:amiga.lib,*
*** AND, OF COURSE THE BLINK COMMAND **************
blink with vdk:vert.with
WHERE DO YOU THINK MY PROBLEM LIES???
---------------------------------------------------------------------------
BILL QUEENER, DISGUISED AS A CIVILIAN EMPLOYEE FOR THE AIR FORCE, WHO IS IN
REALITY---MR Q OF Q1 PRODUCTIONS
Of COURSE, they're my own opinions. Why would I want to give you someone
elses?
----------------------------------------------------------------------------