i wish to know
why org 100h doesn't generate machine code yet it can affect the value of string when we mov si, string1?
(by adding 100h to the address of string1?)
how org 100h works?
about org 100h
Re:about org 100h
This might be better in the General Programming board, but...jimson wrote: i wish to know
why org 100h doesn't generate machine code yet it can affect the value of string when we mov si, string1?
(by adding 100h to the address of string1?)
how org 100h works?
The ORG (origin) statement is an assembler directive that causes the the assembler to begin the assembly at the given segement offset. This means that, given the following code:
Code: Select all
[BITS 16] ; generate 16-bit real-mode machine code
[ORG 0x0100] ; .com files always begin at offset 100 hex
main:???
mov dx, hellomsg ; copy a pointer to the beginning of hellomsg into register dx
mov ah, 9 ; pass the number of the DOS function to use
int 0x021 ; call DOS using interrupt 21 hex
mov ax, 0x04C00 ; This DOS function exits the program
int 0x021 ; and returns control to DOS.
hellomsg db "Hello, World!", 0DH,0AH,'$'
; "Hello, World!" plus a carriage return and line feed
Code: Select all
address(in hex)? ?opcode??argument
---------------------------------
0000 BA 0C 00
mov dx, address of hellomsg - note that the bytes are reversed!
0003 B4 09
mov ah, 9 hex (same as 9 decimal, of course)
0005 CD 21
INT 21 hex
0007 B8 00 4C
mov AX, 4C00 hex - note that the bytes are reversed again
000A CD 21
INT 21 hex
address????? data
-----------------------
000C 48 65 6C 6C 6F 2C 20 57 6F 72 6C 64 21 0D 0A 24
H e l l o , W o r l d ! CR LF $