Displaying Time in Assembly

前端 未结 3 1395
梦如初夏
梦如初夏 2020-12-02 02:32

Hello im trying to display the actual time hours/minutes/seconds this is my code sample:

MOV AH, 2Ch
INT 21h

MOV AH, 0Eh

MOV AL, CH
INT 10h

MOV AL, 3Ah
IN         


        
3条回答
  •  一整个雨季
    2020-12-02 02:49

    You are trying to display the values (time) in CH, CL and DH registers as aschi characters.

    Lets say your CH contains the value 15h.

    Now when you put this value in to AL and call int 10h, it displays the aschi character that matches the value 15h. If you want to show the decimal digits for 15h, then you will have to call a display routine which would break the value in the register and extracts the digits in it to display - not just the aschi representation in that value.

    Lets say you have decimal 85 in a register. Now you need to print on screen "8" and "5". So you have to convert value 85 in to to aschi-56("8") and aschii-53("5"). Then put them in registers one after another and call int 10 twice to display "85".

    hobbs answer shows how to do that.

    Here is another tutorial

提交回复
热议问题