16 bit Assembly
Using Register Addressing
Instructions and Op Codes
Overview of my Compiler
16 bit Date Extraction
FAT12 Floppy Disk Access
32 bit to 16 bit File Size
Finding Free Disk Space
16bit Memory Routines
Mouse Callback
Floppy Disk Parameters
Registers
The Root Directory
Using the Stack
Creating a Boot Disk
Direct To Screen Output
16 bit Time Extraction
Basic Display Code
Using registers to directly access data in memory
16 bit assembly code can be used to access and manipulate memory addresses. These can be used for direct data access, counters and mathematics.
In 16 bit assembly the use of addressable registers is limited to the following :
[BX+SI], [BX+DI], [BP+SI], [BP+DI], [SI], [DI], [BP], [BX]
In 32 bit assembly and above all registers can be used.Addressing [SI], [DI] or [BX] only applies to data is the DS Segment (data).
Addressing [BP] only applies to data is the SS Segment (stack).However if you are only using one Segment for both the code and the stack, then any of these 4 registers can be used.
In this way it is possible to access data from different segments without a lot of register re-assignment.
To use addressing you must first give the register a start address. Data can accessed by increasing the offset value by adding [BX+2] or subtracting [BX-2] offsets in multiples of 2.
We use 2 because each 16 bit register has 2 bytes. You cannot access single bytes individually, but you can increment the offsets 1 byte at a time if required.Examples:
MOV BX, 0x0004 ; Set BX to a memory address MOV AX, [BX] ; Read the value from the memory address pointed to by BX
; in to AXMOV [BX+2], AX ; Writes the value in AX to the memory address pointed
; to by BX+2.
Commands that can use addressing
ADD, AND, CALL, CMP, DEC, DIV, INC, JMP, MOV, MUL, NEG, NOT, OR, POP, PUSH, SCAS, SUB, XOR, XCHG.