Can someone suggest a code that accepts (hh:mm:ss) and counts down until all variables reach 00

Recommended Answers

All 6 Replies

Aside from the question of whether we will give you code for this outright (we won't), we would need to know what type of computer this is for, what operating system it runs, and what assembler you need to use. Every assembly language is different, and different assemblers for the same CPU type will vary in their syntax. Without knowing which one you need, we could not begin to guess what would need to be done.

Finally, direct access to the real-time clock is generally controlled by the operating system. Unless you are running an embedded system, or a minimal OS such as MS-DOS, you would probably have to rely on a system call for the timing.

Also, we don't do your homework for you. If this is job, not school related, then Schol-R-Lea's response is 100% correct. FWIW, in Linux systems, there are timer functions that will help you do this very easily. I have frequently used them in the past. Most are POSIX functions, so should work with Windoze as well.

x86 Assembly Language is what I was hoping to know. I use TASM AND TLINK for assembling the program

OK, then. I assume by TASM you mean Turbo Assembler (there's more than one TASM around), probably the DOS version, correct? What version of Windows (I'm assuming it is Windows, but that's hardly going out on a ledge) are you running, and do you know if the assembler even runs (if it is Windows Vista or later, is probably won't)? Are you using something like DOSBox to run it? Are you meaning to write DOS programs, or Windows programs?

Do you need to use Turbo for the project, or can you use a modern assembler such as NASM?

Also, what have you managed to do so far yourself? Do you have any code you can show us so far? What is the final goal of the program?

My question was a bit too vague so let me explain more.
1. I can only use turbo assembly
2. I'm using Turbo assembler DOS version for windows 7 32-bit.Yes, the assembler runs properly. I'm aiming for a DOS program.
3. What I also thought rather than having to access the real time clock (not entirely sure if its possible) that I was aiming for just a continuous subtraction per second until the value becomes 00:00:00.
4. I have managed so far is to complete the algorith of the countdown and general printing of the initial input time. What I'm looking for is more of how to do a delay function wherein a user can press the spacebar at any time to "pause" the countdown. Also, If there is an easier way to do the countdown than the continuous subtraction?
5. The algorithm I have in mind goes like this: Input = 00:01:00, what would happen is that the ss(seconds) will be loaded with 59 and subtract 1 from the mm(minutes) then subtract 1 from 59 until it reaches 00.

It definatly sounds like (bad) homework. Else you wound't be stuck using terrible 20 year old Turbo-tools.

What I'm looking for is more of how to do a delay function.

Your teacher didn't tell you? Well, back in the day, IBM-compatable computers provides int 0x15 AH=0x86 "wait" through the BIOS, which is usable from DOS. I have no idea if it's emulated in Windows 7 though. If you can't use BIOS interrupts, then you should go through your notes and figure out what you're allowed to use.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.