; ONEPAGE.ASM
;
; This is a one-page, one-segment Intel assembler program in ".COM" form.
; Both the Code Segment (CS) and Data Segment (DS) are the same.
;
; Copy ONEPAGE.ASM to your disk and then assemble it to produce a
; ONEPAGE.OBJ file.  Then link ONEPAGE.OBJ to produce a ONEPAGE.COM file.
; Use these command lines (note the trailing semicolon on each):
;
;       C:\> asm /s onepage ;
;       C:\> val /co onepage ;
;
;  - Using a semicolon as an argument suppresses all the prompts
;    for output files and uses the defaults.  (See the documentation.)
;  - The /s option to ASM suppresses unnecessary verbosity.
;  - The /co option to VAL creates a ".COM" file (instead of a ".EXE")
;
; Type the name of the program to run it:
;
;       C:\> dir onepage.com
;       ONEPAGE  COM            57  11-13-09 10:00p ONEPAGE.COM
;       C:\> onepage
;       This is my first Intel Assembler program.
;
; The comments in this file are intended to teach students about the
; meaning of various assembler instructions.  They are NOT suitable
; for students documenting their own code, since they do not refer to
; any process or problem being solved.
;
; Students: Do NOT copy these teacher-style comments into your own code.
;
; -Ian! D. Allen - idallen@idallen.ca - www.idallen.com
;
; Both the Code Segment (CS) and Data Segment (DS) are the same.
OneP    segment                 ; label matches "OneP ends"  below
        assume  CS:OneP,DS:OneP ; tell the assember what will be in CS and DS
        org     100h            ; .COM format executable requires this

start:  mov     dx,offset msg   ; offset address of the message text
        mov     ah,09h          ; use BIOS code for "display ASCII$ string"
        int     21h             ; call BIOS service routine 21h
                                ; Note: don't forget the 'h' on 21h!

        mov     al,0h           ; load a successful return status
        mov     ah,4Ch          ; use BIOS code for "terminate program"
        int     21h             ; call BIOS service routine; remember the 'h'

msg     db      "This is my first Intel Assembler program."  ; define bytes
        db      0Dh,0Ah         ; Hex codes for CR, LF (note the 'h')
        db      "$"             ; marks the end of ASCII$ string

OneP    ends                    ; label matches "OneP segment" above
        end start               ; "start" is the label on the first instruction

