Print Hello in a Loop


 

; Wyatt, 11/11/2011
;
; EXPLAIN CODE PURPOSE AND ALGORITHM 
; ----------------------------------

; FILE WITH MACROS & PROCS
; ------------------------ 
include emu8086.inc       

; ADDRESS WHERE CODE WILL BE LOCATED
; ----------------------------------
org 100h  ; 256 decimal         
jmp CODE

; DATA
;------
reps  dw 5 ; why dw?
stuff db  0,1,2,3,4,5,6,7,8,9

CODE:
    mov cx, reps
    L1:
       PRINT "Hello #"
       mov ax, cx
       call PRINT_NUM
       PRINTN
    loop L1       
ret

; PROCEDURES (call)
; ----------
DEFINE_SCAN_NUM       ; reads signed number from keyboard into CX
DEFINE_PRINT_STRING   ; print 0 terminated string, address in DS:SI
DEFINE_PRINT_NUM      ; prints AX signed
DEFINE_PRINT_NUM_UNS  ; prints AX unsigned - required for print_num.
DEFINE_PTHIS	      ; print 0 terminated string, address on STACK
DEFINE_CLEAR_SCREEN
DEFINE_GET_STRING

; MACROS    
; ------
; PUTC char - prints out an ASCII char at current cursor position.
; GOTOXY col, row - sets cursor position.
; PRINT string - prints out a string.
; PRINTN string - prints out a string & adds "carriage return" at the end
; CURSOROFF - turns off the text cursor.
; CURSORON - turns on the text cursor.

END