Assembly language

liunx

Guest
Rather than explain the project, I have listed the Link below.<br /><br /><a href="http://www.eecs.utoledo.edu/~jguernse/_pdf/project2.pdf" target="_blank">http://www.eecs.utoledo.edu/~jguernse/_pdf/project2.pdf</a><br /><br />I have started both the box program and the hex convert program but am having trouble completing the hex code. The box code works, however, I am going to have to link the hex convert file in the middle of the box program to meet the project requirements. If anyone could help me complete the hex convert program, (and possibly link it in the middle of the box program) I would really appreciate it. <br /><br />My codes are listed below.<br /><br />First listed is the Hex convert code:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><br />; Filename: puthex<br /><br />INCLUDE PCMAC.INC<br />.MODEL SMALL<br />.586<br />.STACK 100h<br /><br />        CR     EQU     10d<br />        LF     EQU     13d<br />.DATA<br />        ERR    DB    40h<br />        msg1    DB    'Enter 10 digits. At any time, type @ to exit.',CR, LF, '$'<br /><br />.CODE<br />PUBLIC PutHex<br />MAIN PROC<br />    _Begin<br />    _PutStr    msg1    ;displays the message store in msg1<br />    _GetCh         ;Gets character from the keyboard input<br />    mov    cl,ERR    ;moves value of ERR to cl register<br />    cmp    cl,al    ;compares the input value of al to cl (ERR)<br />    je    gotoend    ;jumps to end program    <br />    call    PutHex    ;calls subprogram PutHex<br /><br />gotoend:<br />    _Exit<br />MAIN ENDP<br /><br />PutHex PROC<br />push ax         ;Work Register (saved)<br />push bx         ;Used to save AX<br />push cx         ;Used for shift count<br />push dx         ;Used by _PutCh<br />mov cl, 12         ;Start of shift count<br />mov bx, ax         ;Preserve for later<br /><br /><br />HexLoop:<br />mov ax, bx         ;Recopy original<br />shr ax, cl         ;Shift (by 0 works)<br />and al, 000fh         ;Clear all but low 4<br />cmp al, 10         ;Compare for converts<br />jl DecDigit         ;If al < 10 (0-9 conv)<br />add al,         ;10=>鎵
 
Back
Top