Hardware Reference
In-Depth Information
interrupt acknowledgement generated by the CPU. This byte gives the interrupt
type and the 8086 loads its Code Segment and Instruction Pointer registers with
the words stored at the appropriate locations in the Interrupt Pointer Table and
then commences execution of the interrupt service routine.
The following code fragment shows how the Interrupt Pointer Table can be
initialized to cope with three interrupt service routines:
; Initialise Interrupt Pointer Table
MOV
AX,0
; Point to start
MOV
DS,AX
; of memory.
MOV
AX,CS
; Get code segment.
; Type 32
MOV
80H,dev1
; Offset for device #1 ISR
MOV
82H,AX
; and segment address
; Type 33
MOV
84H,dev2
; Offset for device #2 ISR
MOV
86H,AX
; and segment address
; Type 255
MOV
3FCH,dev3
; Offset for device #3 ISR
MOV
3FEH,AX
; and segment address
MASM32
If you plan to make extensive use of assembly language programs it is worth
moving to a modern 32-bit macro assembler and a full Integrated Develop-
ment Environment (IDE). One of the most comprehensive packages is currently
provided by MASM32 which is a complete freeware assembly language
development environment. MASM32 has its roots in the original Microsoft
MASM assembler but it is combined with elements of the Microsoft Win-
dows DDK/SDK and it enjoys the support of an excellent Editor and IDE (see
Figure 5.4).
For anyone contemplating using assembly language as the main vehicle for
software development the current version of MASM32 assembler (together with
its IDE and support tools) can be very highly recommended. Indeed, 32-bit
assembler is both clearer and simpler than the DOS and 16-bit Windows code
and is not cursed with the complexity of segment arithmetic. You no longer
have to deal with using pairs of registers for long integers and there is no 64 KB
boundary imposed by the segmented structure of 16-bit software.
The complexity of writing 32 bit Windows software is related to the structure
of Windows and the sheer range of functions in the Attachment Packet Interface
(API) set. It differs from DOS code only in so far as the parameters are passed
on the stack rather than in registers as in the DOS interrupts. While the sheer
range of functions in Window can be a bit intimidating, it also puts in the hands
of the assembler language programmer, a massive set of capacities that were
never available in DOS.
One of the advantages of writing in assembler is that it comfortably handles
the C-code format of the Windows APIs with no difficulty. Zero-terminated
strings, structures, pointers, data sizes, etc., are all part of writing assembler.
The following code fragment (see also page 153) shows how a simple message
box can be produced using just a few lines of assembly code:
.386
.model flat, stdcall
option casemap:none
Search WWH ::




Custom Search