home *** CD-ROM | disk | FTP | other *** search
- ;
- ; Examples showing how to access physical memory located
- ; in the lowwer 1Mb.
- ;
- ;
-
- .386
- .model flat
- .stack
- .code
-
- start:
- Mov Ax,0EE02h ; GET DOS32 ADDRESS INFORMATION
- Int 31h
-
- ; This DOS32 call returns EBX with base address of the program segment.
- ; An offset address may be calulated so that it points to a linear
- ; address anywhere in memory by the expresion below.
- ;
- ; Linear address = segment base address + offset in segment
- ;
- ; Thus offset in segment = Linear address - segment base address
- ;
- ; However the first 1024Kb of Linear Address is maped directly
- ; to the first 1024Kb of physical memory.
- ;
- ; therfore: offset = phisical address wanted - EBX
- ;
-
-
-
- ; How to plot the character 'A' on the screen. Lets make EDI equal an
- ; offset so that it will point to physical location 0B8000h.
-
- MOV EDI,0B8000h
- SUB EDI,EBX
- MOV BYTE PTR [EDI],'A'
-
-
- ;
- ; filling the screen with blue '' characters
- ;
- MOV EDI,0B8000h
- SUB EDI,EBX
- MOV AX,0101h
- MOV ECX,2000
- REP STOSW
-
-
- ;
- ; Reading the BIOS data area to find the base port address of LPT1
- ;
-
- MOV EDI,0000
- SUB EDI,EBX
- MOV AX,[EDI+405h] ; AX = LPT1 base port
-
-
-
- MOV AX,4C00h ; Terminate with error code 0
- INT 21h
-
-
- end start