;; PutHex--display the contents of ax as 4 hex digits at on the CRT ;; ;; Inputs: ;; ax = the number to be displayed ;; ;; Outputs: ;; None ;; ;; Errors: None ;; ;; Library source text from "Assembly Language for the IBM PC Family" by ;; William B. Jones, (c) Copyright 1992, 1997, Scott/Jones Inc. ;; INCLUDE PCMAC.INC .MODEL SMALL .DATA HexDigs DB '0123456789ABCDEF' .CODE PUBLIC PutHex PutHex PROC push ds push bx push cx push dx push si mov bx, @data mov ds, bx ASSUME ds: @data mov cx, 0404h ; Count and rotate amount mov bx, ax ; DOS call will destroy ax HexLoop: rol bx, cl mov si, bx ; need si for an index and si, 000fh ; extract last digit _PutCh HexDigs[si] dec ch jnz HexLoop pop si pop dx pop cx pop bx pop ds ret PutHex ENDP END