EASy68K  
It is currently Fri Oct 18, 2019 12:10 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue Jun 02, 2009 8:07 am 
Offline

Joined: Tue Jun 02, 2009 8:00 am
Posts: 6
Location: malaysia
move.l #$7ffe,sp

move.b #5,d0
trap #15

cmp.b #'0',d0
blt no_digit
cmp.b #'9',d0
bgt no_digit

move.b #6,d0
trap #15

MOVE.B #9,D0
TRAP #15

why i still got 2 error for this??
can help?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 02, 2009 1:36 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1102
Trap task 5 returns the number entered in register d1, your code was checking register d0.
There was no label called no_digit. I have added a no_digit label to your code to make the program loop if a non digit character is entered.

Code:
   ORG   $1000
START:            ; first instruction of program
    move.l #$7ffe,sp

no_digit
    move.b #5,d0
    trap #15

    cmp.b #'0',d1
    blt no_digit
    cmp.b #'9',d1
    bgt no_digit

    move.b #6,d0
    trap #15

   MOVE.B   #9,D0
   TRAP   #15      ; halt simulator

   END   START      ; last line of source

_________________
Prof. Kelly


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 03, 2009 6:33 am 
Offline

Joined: Tue Jun 02, 2009 8:00 am
Posts: 6
Location: malaysia
thanks... i got it now... :P


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: No registered users and 4 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