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

  1. ; A simple program to print a message using DOS INT 21h AH=9.
  2.  
  3.         .386p
  4. code32  segment para public use32
  5.         assume cs:code32, ds:code32
  6.  
  7. include pmode.inc
  8.  
  9. public  _main
  10.  
  11. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  12. ; DATA
  13. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  14.  
  15. message         db      'Hello World.$'
  16.  
  17. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  18. ; CODE
  19. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  20.  
  21. ;═════════════════════════════════════════════════════════════════════════════
  22. _main:
  23.         sti
  24.  
  25.         mov eax,offset message  ; get offset of message in protected mode
  26.         add eax,_code32a        ; adjust to an absolute address
  27.         shld ebx,eax,28         ; shift bits 4-31 of EAX into 0-28 of EBX
  28.                                 ;  though we only care for bits 4-19 of EAX
  29.                                 ;  that is the segment from the absolute addx
  30.         and eax,0fh             ; and off the segment from EAX
  31.                                 ;  now BX:AX is the seg:off of the message
  32.         mov v86r_ds,bx          ; put segment into virtual reg for real mode
  33.         mov v86r_dx,ax          ; put offset into virtual reg for real mode
  34.         mov v86r_ah,9           ; AH=9 for call to real mode INT 21h
  35.         mov al,21h              ; interrupt number to call
  36.         int 33h                 ; do real mode INT AL
  37.  
  38.         jmp _exit
  39.  
  40. code32  ends
  41.         end
  42.  
  43.