home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_GEN / PMODE24.ZIP / EXAMPLES.ZIP / EX_PM2.ASM < prev    next >
Assembly Source File  |  1994-02-04  |  2KB  |  54 lines

  1. ; This program demonstrates three methods of accessing absolute addresses.
  2. ;  It just writes some characters to the video text mode buffer at B800:0000.
  3.  
  4.         .386p
  5. code32  segment para public use32
  6.         assume cs:code32, ds:code32
  7.  
  8. include pmode.inc
  9.  
  10. public  _main
  11.  
  12. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  13. ; CODE
  14. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  15.  
  16. ;═════════════════════════════════════════════════════════════════════════════
  17. _main:
  18.         sti
  19.  
  20.         mov edi,_lomembase      ; fill all low memory with 0s
  21.         mov ecx,_lomemtop
  22.         sub ecx,edi
  23.         xor al,al
  24.         rep stosb
  25.  
  26.         call _getselector       ; allocate a selector
  27.         mov edx,0b8000h         ; point selector to base of video text buffer
  28.         call _setselector
  29.         mov es,ax               ; load ES with selector
  30.  
  31.         mov byte ptr es:[160*24+2*79],'0'
  32.                                 ; put '0' on text screen at X=79, Y=24
  33.                                 ;  ES points to the text screen
  34.  
  35.         mov byte ptr gs:[0b8000h+160*24+2*78],'1'
  36.                                 ; put '1' on text screen at X=78, Y=24
  37.                                 ;  GS points, by default, to absolute 0
  38.  
  39.         mov eax,0b8000h
  40.         sub eax,_code32a
  41.         mov byte ptr ds:[eax+160*24+2*77],'2'
  42.                                 ; put '2' on text screen at X=77, Y=24
  43.  
  44.         mov ax,es               ; free selector allocated before, you do not
  45.         call _freeselector      ;  really have to do this before exiting
  46.  
  47.         mov es,_seldata         ; restore ES to _seldata for exit
  48.  
  49.         jmp _exit
  50.  
  51. code32  ends
  52.         end
  53.  
  54.