All pastes #10087 Raw Edit

aKa

public text v1 · immutable
#10087 ·published 2005-04-22 16:02 UTC
rendered paste body
title Print String Test
; This program Print A String
.model small,stdcall
.stack 4096
.386

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Print String ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.data
; String Output
echoNumOne	db "Number 1:"		
enoCount	= ($ - echoNumOne)	; Calculate echoNumOne length
echoNumTwo	db "Number 2:"		
entCount	= ($ - echoNumTwo)	; Calculate echoTwoOne length

.code
main proc
	; STEP 1) Take In First Number And Save To numOne
	;mov		dl,13	; Set
	;mov		ah,2h	
	mov		cx,enoCount				; Set Counter For Srrint Print
	mov		si,offset echoNumOne	; Set What String To Print
	call	printStr				; Call Print String Proc

	NOP
    mov ah, 4Ch		; Set DOS Function To Terminate
	int 21h			; Call DOS Interupt

main endp

;;; Print String ;;;
printStr PROC
			push eax		; Save Register To Stack
			push ebx		; "
			push ecx		; "
			push edx		; "
			L1:
				mov	ah,2		; Set DOS Function To Display
				mov dl,[si]		; Get Character
				int 21			; Call DOS Interupt
				inc	si			; point to next character
				LOOP L1			; decrement CX, repeat until 0 (No More CHaracters in string)
			pop	edx			; Restore Registers From Stack
			pop	ecx			; "
			pop	ebx			; "
			pop	eax			; "									
			ret				; return			
printStr ENDP

end main