Metropoli BBS
VIEWER: example0.asm MODE: TEXT (CP437)
; A simple program to print a message using DOS INT 21h AH=9.

        .386p
code32  segment para public use32
        assume cs:code32, ds:code32

include pmode.inc

public  _main

;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
; DATA
;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒

message         db      'Hello World.$'

;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
; CODE
;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒

;═════════════════════════════════════════════════════════════════════════════
_main:
        sti

        mov eax,offset message  ; get offset of message in protected mode
        add eax,_code32a        ; adjust to an absolute address
        shld ebx,eax,28         ; shift bits 4-31 of EAX into 0-28 of EBX
                                ;  though we only care for bits 4-19 of EAX
                                ;  that is the segment from the absolute addx
        and eax,0fh             ; and off the segment from EAX
                                ;  now BX:AX is the seg:off of the message
        mov v86r_ds,bx          ; put segment into virtual reg for real mode
        mov v86r_dx,ax          ; put offset into virtual reg for real mode
        mov v86r_ah,9           ; AH=9 for call to real mode INT 21h
        mov al,21h              ; interrupt number to call
        int 33h                 ; do real mode INT AL

        jmp _exit

code32  ends
        end

[ RETURN TO DIRECTORY ]