Beruflich Dokumente
Kultur Dokumente
http://physinfo.ulb.ac.be/cit_courseware/asm/asm_5.htm
Segment Directive
A typical 80x86 processor running in 32-bit protected mode can access a maximum
of four gigabytes (232) of memory. When running in protected mode, an operating
system like Windows may use the flat memory model to assign your application up
to 4GB of memory. Flat memory looks to your program as a linear array of bytes
with the first allocated byte beginning at zero (0) and going up to 4,294,967,295
(FFFFFFFFh).
Although the Windows operating system can assign your program up to 4GB of
memory, it does so by using a technique called paging whereby parts of your
allocated memory space are swapped in and out of memory to the hard drive in 4KB
chunks. Paging allows Windows, drivers, libraries, and every application running on
the computer to have 4GB of virtual memory. This means that although your
program may see 4GB of virtual memory, it certainly does not possess 4GB of
physical memory.
The assembler allows your code to define and reference specific memory segments
allocated to your program. Typically, program code is placed in the CODE section.
The DATA segment is divided into a section for initialized data and a section for
uninitialized data. NASM labels these sections TEXT for the code section, DATA for
the initialized data section, and BSS for the uninitialized data section.
The SEGMENT directive changes which section of the output file the code you write
is assembled into. Note that the SECTION directive is synonymous with using the
SEGMENT directive; both mean the same thing. Either one is used to tell the
assembler and linker how to set up your segments.
http://www.pmzone.org/chapter04.html
An interrupt is a signal to the processor emitted by hardware or software indicating an event that
needs immediate attention. Any interrupt is connected with a code to process the interrupt. The code
is called interrupt service routine (ISR). Also there is special place (table) in the computer memory
where the addresses of ISR are places. Each interrupt has unique place for its ISR address. So,
interrupt in assembly language or not-assembly language has the same meaning. And from an
assembly point of view to deal with an interrupt means that the programmer have to write ISR in the
assembly language and special code of initialization that writes the ISR address in the table. So,
program on the startup firstly writes the address in the table. And then (when the interrupt will
appear) the ISR code will be automatically executed by processor. That's all. NB: when you use
assembly language to code ISR you have to save the registers you use in ISR in the stack and
restore them before the IRET instruction.
http://www.researchgate.net/post/What_is_interrupt_in_assembly_language1
MEMORY VARIABLES
[variable-name]
define-directive
initial-value
[,initial-value]...
Where, variable-name is the identifier for each storage space. The assembler associates an offset value for each
variable name defined in the data segment.
There are five basic forms of the define directive:
Directive
Purpose
Storage Space
DB
Define Byte
allocates 1 byte
DW
Define Word
allocates 2 bytes
DD
Define Doubleword
allocates 4 bytes
DQ
Define Quadword
allocates 8 bytes
DT
allocates 10 bytes
choice
number
neg_number
big_number
real_number1
real_number2
DB
DW
DW
DQ
DD
DQ
'y'
12345
-12345
123456789
1.234
123.456
Each decimal value is automatically converted to its 16-bit binary equivalent and stored as a hexadecimal
number
Short and long floating-point numbers are represented using 32 or 64 bits, respectively