; ; CPASM01S.ASM ; written by Keith Fenske ; Saturday, 9 March 2002 ; Copyright (c) 2002 by Keith Fenske. All rights reserved. ; ; This Intel 80x86 assembly language program prints two lines of output with ; my name and my age. (The age is wishful thinking: a joke!) Both lines are ; written with a single string. The DOS function code 40h is used for the ; output and requires three parameters: ; ; BX register = 1 when writing to standard output ; CX register = number of bytes to write ; DX register = address of first byte to write ; [BITS 16] ; set 16-bit code generation [ORG 0100H] ; set address of first instruction in COM file CR EQU 0Dh ; carriage return character LF EQU 0Ah ; line feed character [SECTION .text] ; start code (instruction) section START: mov bx,1 ; DOS file handle 1 is standard output mov cx,length ; length of string in bytes mov dx,string ; address of first byte in string mov ah,40h ; DOS function code for write string int 21h ; call DOS mov ah,4Ch ; DOS function code to exit program mov al,0 ; pass this value back as ERRORLEVEL int 21h ; call DOS (does not return) [SECTION .data] ; start data section ; ; There is no termination character for the following string. The length of ; the string is calculated by the EQU statement. ; string db "My name is Keith Fenske.", CR, LF db "I am 21 years old (joke!).", CR, LF length equ $ - string ; ; End of CPASM01S.ASM ;