It is currently Wed Jan 22, 2020 6:31 am

 All times are UTC

 Page 1 of 1 [ 2 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: The usage of Repeat-untilPosted: Wed Oct 06, 2010 2:57 pm

Joined: Wed Oct 06, 2010 2:48 pm
Posts: 1
Location: Malaysia
i am not sure about the function of repeat- until used in the below code i found in the example of clockDigital program.
i have try to run the code without this using repeat yet i found that the program is still run smoothly.

Code:
loop
move.l  a4,a2
repeat
move.b  #8,d0
trap    #15

if.l d1 <hs> #NOON then.s
sub.l #NOON,d1  time = time - NOON
endi
*       Calculate total minutes (D5), minutes this hour (D6), seconds (D7)
divu    #100,d1     convert to seconds
move.l  d1,d4       save fractional seconds
divu    #60,d1      convert to minutes
move.l  d1,d7
move.l  #16,d0
lsr.l   d0,d7       d7 = seconds
andi.l  #\$0000ffff,d1   discard seconds from d1
move.l  d1,d5       d5 = total minutes
divu    #60,d1      convert to hours
move.l  d1,d6
move.l  #16,d0
lsr.l   d0,d6       minutes this hour to d6
swap    d4          display fractional seconds on LEDs
move.b  d4,(a3)
until.w d7 <ne> seconds     until a second has elapsed

Top

 Post subject: Posted: Wed Oct 06, 2010 3:21 pm

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1115
The repeat/until section of this code is waiting for the next second to elapse before continuing with the rest of the code. If repeat/until is removed this program still works. It just means the rest of the code runs when it really doesn't need to. In some applications you might not want the rest of the code to run until a certain amount of time had elapsed.

_________________
Prof. Kelly

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 2 posts ]

 All times are UTC

#### Who is online

Users browsing this forum: No registered users and 2 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ EASy68K Forum    FAQ    Latest Features    EASy68K Questions    68000 Programming Questions    Wish List    Wishes Granted    Undocumented Features    Documented Features    General Discussion    EASy68K Projects