| | |
What is wrong with my program?
![]() |
•
•
Join Date: Apr 2007
Posts: 16
Reputation:
Solved Threads: 0
Hi..
This is my fist time, I need your help guys to figure out what is the problem with my code. My program is to show time in this format " TIME:Hours : minute : seconds : Hunderthseconds" , but , the problem is that it didn't show correct numbers, it shows me just charachers I don't understand. As far as I know function AH = 2CH INT 21H, returns ASCII code for time " CH=hour, CL = minutes, DH = seconds, DL = 5/100 seconds"
... So, could you please figure out what is wrong with this code,
Thank you very much.
This is my fist time, I need your help guys to figure out what is the problem with my code. My program is to show time in this format " TIME:Hours : minute : seconds : Hunderthseconds" , but , the problem is that it didn't show correct numbers, it shows me just charachers I don't understand. As far as I know function AH = 2CH INT 21H, returns ASCII code for time " CH=hour, CL = minutes, DH = seconds, DL = 5/100 seconds"
... So, could you please figure out what is wrong with this code,
Thank you very much.
Assembly Syntax (Toggle Plain Text)
TITLE " Project " .MODEL SMALL .STACK 200 .DATA MSG1 DB 'TIME:$' MSG2 DB ?,'$' .CODE MAIN PROC MOV AX, @DATA ; get the address of the data segment MOV DS, AX ; and store it n register DS MOV AH, 9 ; display string function LEA SI, MSG1 ; get memory location of first message MOV DX, SI ; and store it in the DX register INT 21H MOV AH, 2CH ; Get time function 2CH interrupt 21H INT 21H LEA DI, MSG2 ; Get MSG2 address MOV BH, 3AH ; Copy the ASCII code for : MOV [DI], CH ; Copy hours into MSG2 CALL WRITING ; call function Writing to write it on the standard output "screen" MOV [DI], BH ; Copy minutes CALL WRITING ; call function writing MOV [DI], CL CALL WRITING MOV [DI], BH CALL WRITING MOV [DI], DH CALL WRITING MOV [DI], BH CALL WRITING MOV [DI], DL CALL WRITING MOV AH, 07 INT 21H MOV AX,4C00H ; Exit to DOS function INT 21H MAIN ENDP WRITING PROC PUSH DX ; Save value of DX MOV AH, 02 ; Function 02 of interrput 21H to write character to stander output MOV DL, MSG2 ; Copy content of MSG2 into DL INT 21H POP DX ; get the original value of DX again. RET WRITING ENDP END MAIN
Last edited by eeeraser; Apr 28th, 2007 at 6:31 am.
![]() |
Similar Threads
- Is it wrong to have a very long program if i did not find another way? (C++)
- Need Help. "Macro" program (C)
- cheeky java program (Java)
- wrong output in c program (C++)
- Running a program (C++)
Other Threads in the Assembly Forum
- Previous Thread: Please check my code
- Next Thread: HELP prime factors
| Thread Tools | Search this Thread |







