100
K
A
DAK
AMX Semaphore Manager
EXTRN AAINT:FAR ;enter ISP
EXTRN AAINX:FAR ;leave ISP
EXTRN AASMSIG:FAR ;signal to a semaphore
EXTRN _SYNCISP:WORD ;ISP synchronization semaphore id
;
;
DVC_CODE SEGMENT BYTE 'CODE'
;ASSUME CS:DVC_CODE
;
;
DVCISP PROC FAR
CALL AAINT ;tell AMX
:
Clear interrupt source
Check for event
:
MOV BX,_SYNCISP ;BX = semaphore id
CALL AASMSIG ;signal to semaphore
:
:
CALL AAINX ;tell AMX
IRET ;end of interrupt
;
DVCISP ENDP
;
DVC_CODE ENDS
In this example, we have mixed C and assembly language for illustration purposes.
Notice the use of the underscore character in the assembler code reference to variable
_SYNCISP. In C, the variable is named syncisp. The underscore is required because we
have assumed that the C compiler actually assigns the symbol name _syncisp to the
variable. Also note that we have assumed that the program linker can ignore upper/lower
case differences in symbols. Your C compiler and linker may behave differently.
Refer to the AMX 86 Tool Guide for a more complete description of C, assembler and
linking requirements when using AMX with a particular toolset.