home *** CD-ROM | disk | FTP | other *** search
/ Groovy Bytes: Behind the Moon / groovybytes.iso / GROOVY / SND_TOOL / FUNK108A.ZIP / DOS32V30.ZIP / EXAMPLES / VIDEO.ASM < prev    next >
Encoding:
Assembly Source File  |  1995-05-16  |  1.5 KB  |  65 lines

  1. ;
  2. ;       Examples showing how to access physical memory located
  3. ;       in the lowwer 1Mb.
  4. ;
  5. ;
  6.  
  7. .386
  8. .model flat
  9. .stack
  10. .code
  11.  
  12. start:
  13.         Mov     Ax,0EE02h               ; GET DOS32 ADDRESS INFORMATION
  14.         Int     31h
  15.  
  16.    ; This DOS32 call returns EBX with base address of the program segment. 
  17.    ; An offset address may be calulated so that it points to a linear 
  18.    ; address anywhere in memory by the expresion below. 
  19.    ;
  20.    ;             Linear address = segment base address + offset in segment
  21.    ;
  22.    ; Thus       offset in segment = Linear address - segment base address
  23.    ;
  24.    ;   However the first 1024Kb of Linear Address is maped directly
  25.    ;   to the first 1024Kb of physical memory.
  26.    ;
  27.    ; therfore:     offset = phisical address wanted - EBX
  28.    ;
  29.  
  30.  
  31.  
  32.    ; How to plot the character 'A' on the screen.  Lets make EDI equal an
  33.    ; offset so that it will point to physical location 0B8000h.
  34.  
  35.         MOV     EDI,0B8000h
  36.         SUB     EDI,EBX
  37.         MOV     BYTE PTR [EDI],'A'
  38.  
  39.  
  40.    ;
  41.    ; filling the screen with blue '' characters
  42.    ;
  43.         MOV     EDI,0B8000h
  44.         SUB     EDI,EBX
  45.         MOV     AX,0101h
  46.         MOV     ECX,2000
  47.         REP     STOSW
  48.  
  49.  
  50.    ;
  51.    ; Reading the BIOS data area to find the base port address of LPT1
  52.    ;
  53.  
  54.         MOV     EDI,0000
  55.         SUB     EDI,EBX
  56.         MOV     AX,[EDI+405h]           ; AX = LPT1 base port
  57.  
  58.  
  59.  
  60.         MOV     AX,4C00h                ; Terminate with error code 0
  61.         INT     21h
  62.  
  63.  
  64. end start
  65.