http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

Wise2Food



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Delay problem



Hi,
For a delay routine, just let the CPU do something that doesn't affect your main program, such as push & pop register or registers.

Eg: delay:   pshx
             ldy#$????(need calculation)
    repeat:  dex
             bne repeat
             pulx
             rts

For the calculation, you need to check the time that each instruction take. These are obtainable from the data booklet of the controller(HC6811 or 6811..)                      

If the your delay is more than FFFFh using the above-mentioned method, do add in extra code to push or pop other registers or even nested loop.   

Sorry, i can't help you with the calculation, as my data booklet is no where to be found.

Hope i had gave you some clues.

cheers
On Wed, 02 January 1980, Lionel Pinkhard wrote:

> 
> Hey guys/gals,
> 
> I'm having a little problem with some Macro Assembly coding, I'm trying to
> write a hardware detection routine, but for that I will need to create an
> 80 microsecond delay between two test routines, how would I do this in
> Assembly? Basically, this would be the same as 'usleep(80)' in C/C++, but
> I have never tried this in Assembly, sorry. My detection routine involves
> a timer, so this will have to be accurate. Otherwise, I would have been
> able to do this myself :-).
> 
> My code goes something like this:
> 
> code segment byte public
> 
> assume cs:code, ds:code, es:code
> 
>     org    100h
> 
> _detect:
> 
>     ; first test code
> 
>     ; here I want the 80ms delay
> 
>     ; second test code
> 
>     ; check hardware and return output
> 
>     mov    ax, 4c00h
>     int    21h
> 
> stat1    db    ? ; first test results
> stat2    db    ? ; second test results
> ; messages for output
> 
> code ends
> 
> end _detect
> 
> Well, I hope this is enough detail, I wouldn't want to elaborate too much,
> and waste bandwith! Basically, I just need the Asm equivalent of the
> 'usleep()' function.
> 
> I really hope somebody can help me out!
> 
> Ciao,
> 
> Lionel
> 
> 
> =================================================================
> The GameProgrammer.Com mailing list is for the open discussion
> of any topic related to the art, science, and business of
> programming games. This list is especially tolerant of beginners.
> We were all beginners once
> 
> To SUBSCRIBE or UNSUBSCRIBE please visit:
> http://gameprogrammer.com/mailinglist.html

_________________________________________________
FindLaw - Free Case Law, Jobs, Library, Community
http:///www.FindLaw.com
Get your FREE @JUSTICE.COM email!
http://mail.Justice.com
=================================================================
The GameProgrammer.Com mailing list is for the open discussion
of any topic related to the art, science, and business of
programming games. This list is especially tolerant of beginners.
We were all beginners once

To SUBSCRIBE or UNSUBSCRIBE please visit:
http://gameprogrammer.com/mailinglist.html