head	1.2;
access;
symbols;
locks
	yap:1.2; strict;
comment	@;; @;


1.2
date	97.11.11.19.58.33;	author yap;	state Exp;
branches;
next	1.1;

1.1
date	97.10.29.18.23.19;	author yap;	state Exp;
branches;
next	;


desc
@@


1.2
log
@*** empty log message ***
@
text
@comment+
        This has a procedure OUTHEX which
	prints the hex value of register BH.  
	It is basically Q9 of midterm.
	The main procedure is used to test OUTHEX.
        +
title TEST OUTHEX
.model small
.stack 100h
.data
; PUT ANY VALUE YOU LIKE FOR VAR.  E.g., var=91 (= 5Bh)
var db 91
.code
MAIN proc
 ; init
 mov ax,@@data
 mov ds,ax
 ;
 mov bh,var	; set up the argument for OUTHEX
 call OUTHEX
 ; dos exit
 mov ah,4ch
 int 21h
MAIN endp

OUTHEX proc
; input: bh contains byte
; output: print hex value of byte
 push ax
 push bx
 push cx
 push dx
 ;
 mov dl,bh
 mov cl,4
 shr dl,cl      ; look at the low order 4 bits
 mov cx,2       ; loop twice
 AGAIN:
  cmp dl,10
  ja BIG
  add dl,30h
  jmp PRINT
  BIG: add dl,41h 
  PRINT: mov ah,2
  int 21h
  ;
  mov dl,bh
  and dl,0Fh    ; clear the high order 4 bits
  loop AGAIN               
 ;
 pop dx
 pop cx
 pop bx
 pop ax
 ret 
OUTHEX endp

end main
@


1.1
log
@Initial revision
@
text
@d5 1
d7 1
a7 1
title OUTHEX
@
