EASy68K  
It is currently Mon Dec 18, 2017 3:24 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu Nov 23, 2017 6:27 pm 
Offline

Joined: Tue Nov 21, 2017 8:37 pm
Posts: 2
Forgive me if this is a silly question, but I'm not too sure why this code doesn't work.
Basically, I want to have a small time delay at the start of my code, then after the user presses Enter or Space, have another time delay before moving onto another section of code. The problem is that the first delay call works correctly, but when the second is called it just completely freezes the program. If I trace into the code or pause and unpause when it is frozen it will continue on with the code correctly, but running it normally will just completely freeze it.

The code in question is below.

Code:
    ORG    $1000
   
DELAY    MACRO
    MOVE    #23,            D0     
    MOVE    #\1,            D1     
    TRAP    #15                 
    ENDM
   
START:                 
    DELAY    10
    LEA     INPUT,          A1     
    MOVE.B  #14,            D0
    TRAP    #15                 
    repeat
        MOVE.L  #$0D200000, D1
        MOVE.B  #19,        D0
        TRAP    #15           
    until.l D1 <ne> #0 do       
    MOVE.B  #11,        D0     
    MOVE.W  #$FF00,     D1
    TRAP    #15
   DELAY    10
    LEA     OUTPUT,         A1     
    MOVE.B  #14,            D0
    TRAP    #15                 
    SIMHALT             

INPUT    DC.B    'Press Enter or Space.',0   
OUTPUT   DC.B    'Done.',0

    END    START       


Top
 Profile  
 
PostPosted: Thu Nov 23, 2017 7:38 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1056
When DELAY 10 is called the second time register D1.L contains data in the upper word that is not being cleared by the macro. This results in a very long delay time (The delay traps task uses all 32 bits of D1 as the delay value.)

Change the DELAY macro to store 32 bit data to D1.
Code:
DELAY    MACRO
    MOVE    #23,            D0     
    MOVE.L  #\1,            D1     
    TRAP    #15                 
    ENDM

_________________
Prof. Kelly


Top
 Profile  
 
PostPosted: Thu Nov 23, 2017 7:56 pm 
Offline

Joined: Tue Nov 21, 2017 8:37 pm
Posts: 2
Works perfectly, thank you very much!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 3 guests


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

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group