********************************************************************************************************************
AUTHOR: ANUEBUNWA VICTOR OGECHUKWU
PROCEDURE TO DISPLAY CHARACTERS IN MEMORY
Procedure DISPLAY displays characters in memory starting from a given address till it encounters CARRIAGE-RETURN.
............................................HOW TO USE..........................................................
(1) Load the starting address of the memory into SI register.
(2) Call DISPLAY.
;********************************************************************************************************************
; SAMPLE PROGRAM
.MODEL SMALL
.STACK
.DATA
AVON DB ?
.CODE
START: MOV AX, @DATA
MOV DS, AX
MOV AH, 3FH ;Input string function
LEA DX, AVON
INT 21H
LEA SI, AVON
CALL DISPLAY
MOV AH, 4CH
INT 21H
;;Procedure DISPLAY
DISPLAY PROC
PUSH AX
PUSH DX
PUSH SI
PUSHF
MOV AH, 02H
DLOOP1: MOV DL, [SI] ;Moves character at current address to DL
CMP DL, 13
JE XDLOOP1 ;Exits loop if DL contains CARRIAGE-RETURN
INT 21H ;Else, displays character
INC SI ;Moves to next address
JMP DLOOP1 ;Continues loop
XDLOOP1: POPF
POP SI
POP DX
POP AX
RET
DISPLAY ENDP
;End of procedure DISPLAY
END START
view in pastebin
No comments:
Post a Comment