EASy68K  
It is currently Wed Sep 18, 2019 10:06 am

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: FOUR FUNCTION CALCULATOR
PostPosted: Sat Apr 23, 2011 7:51 pm 
Offline

Joined: Thu Apr 21, 2011 4:26 pm
Posts: 9
Location: BRIGHTON
.@

_________________
ANIKET
BRIGHTON,UK


Last edited by lokmanwar on Sun Apr 24, 2011 5:10 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 23, 2011 8:09 pm 
Offline

Joined: Thu Apr 21, 2011 4:26 pm
Posts: 9
Location: BRIGHTON
TRIED USING NOT TO PUSH THE USERS CHOICE INTO THE STACK BUT STILL NOT ABLE TO PERFORM ANY ARITHMETIC OPERATION

_________________
ANIKET
BRIGHTON,UK


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 23, 2011 8:26 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1102
Try placing breakpoints in your code and tracing it to see what it does. Refer to the help for more on using breakpoints and tracing.

_________________
Prof. Kelly


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 23, 2011 11:01 pm 
Offline

Joined: Mon Jul 26, 2010 11:43 pm
Posts: 198
Location: Aurora, IL
Please try not typing in ALL CAPS, it's quite annoying.

You really want to look at your flow control here because it's really not going to work this way.

The BEQ's need to be used after checking/comparing something so it can actually make some kind of choice.

The code branches off, or not, but won't come back to the output code, and the application doesn't stop/halt in a controlled manner. Branches (except BSR), do not call subroutines, so won't return.

I could fix this, but you need to review your course notes and textbook to study compares, branches, subroutines, to get a better grasp of the topic.

Try reviewing some of the example projects that come with EASy68k and posted on this site.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 24, 2011 3:01 pm 
Offline

Joined: Thu Apr 21, 2011 4:26 pm
Posts: 9
Location: BRIGHTON
.@

_________________
ANIKET
BRIGHTON,UK


Last edited by lokmanwar on Sun Apr 24, 2011 5:10 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 24, 2011 4:19 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1102
Test for each operation and branch to the corresponding code. Something like this:

Code:
    CMP #1,D2
    BEQ add         ; if D2 = 1 goto add
   
    CMP #2,D2
    BEQ subtract    ; if D2 = 2 goto subtract

*///// Put Halt at end of program code \\\\\
halt   
    MOVE.B  #9,D0
    TRAP    #15     ; halt simulator

add   
    ADD.W   (SP)+,D1
    MOVE.B  #3,D0   ; show the result of addition
    TRAP    #15
    BRA     LOOP
   
subtract   
    SUB.W   (SP)+,D1
    MOVE.B  #3,D0   ; show the result of addition
    TRAP    #15
    BRA     LOOP


MSG     DC.B    'enter the first number',0
MSG2    DC.B    'enter the second number',0
MSG3    DC.B    'The output is',0
MSG4    DC.B    'Choose 1.Add 2.Sutract 3. Multiply 4.Divide',0

    END START

_________________
Prof. Kelly


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 24, 2011 5:11 pm 
Offline

Joined: Thu Apr 21, 2011 4:26 pm
Posts: 9
Location: BRIGHTON
thank you

_________________
ANIKET
BRIGHTON,UK


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

All times are UTC


Who is online

Users browsing this forum: No registered users 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:  
cron
Powered by phpBB® Forum Software © phpBB Group