.model small .data StringToPrint db "Hello CA296!! $" .stack 100h .code main: ;Start Main Body call InitSegs call PrintString call Exit ; ; ;Start of Procedures ;==== INITSEGS ==== Proc InitSegs ; Setup up the String Pointers in the Segments push ax ; SAVE AX to the stack mov ax, @data ; Get Address of .DATA segment mov ds,ax ; put it in DS (DataSegmnet Register) mov es,ax ; put it in ES (ExtraSegment Register) pop ax ; RESTORE AX from Stack RET EndP initsegs ;==== PRINTSTRING ==== PROC PrintString ; Print a $ Terminated String push ax dx ; Save AX and DX on Stack mov ah,09h ; function 9 of INT 21H is Print $ terminated String mov dx, OFFSET StringToPrint ;Pointer to the string INT 21h ; INT 21H API pop dx ax ; RESTORE Values to DX and AX RET ENDP PrintString ;==== EXIT ==== PROC Exit ; Exit back to DOS prompt push ax ; SAVE AX to Stack mov ah,4ch ; Setup Function 4ch of INT 21H API int 21h ; EXECUTE INTERRUPT pop ax ; RESTORE AX from Stack RET ENDP exit ;===== END OF PROCEDURES end main ; END OF MAIN PROGRAM