Examples for First 1/3 of Semester


 

; 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         

; CODE
; ----
    mov al, bl
    mov al, 128
    mov al, x

    mov ah, bl
    mov ah, 128
    mov ah, x

    mov ax, bx
    mov ax, 0ff00h
    mov ax, y

    mov ch, 255
    mov ch, -1
    mov ch, 0ffh
    mov ch, 11111111b
    mov ch, 377o
    
    call mysub
    call print_num_uns    
ret

PROC mysub
   mov ah, 1
   mov al, 0
   ret
ENDP mysub

; DATA
; ----                
   x db 100
   y dw 256
   z dd 0ff00ff00h

; 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