EASy68K  
It is currently Sun Apr 23, 2017 5:37 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Mon May 12, 2014 11:23 pm 
Offline

Joined: Wed May 07, 2014 11:16 pm
Posts: 5
Is there any intuitive manner for which the 68K can manage subroutine's within subroutines. The following code is an example of what I am trying to accomplish:

Code:
START 
        bsr     first       ;Branch to first
        bra     done
first   
        cmp     #0,D0       ;if (D0 == #0)
        beq     willBranch  ;then branch to willBranch
        bra     doneBranching   ;Else, branch to doneBranching
       
willBranch
        bsr     second      ;branch to subroutine second
       
doneBranching
       
        rts                 ;return to script (go back to start)

second  rts

done    move    #9,D0
        trap    #15


This however seems like a very indirect way of writing the code. Is there any way I can express a conditional subroutine branch?


Last edited by skiingxmoose on Sun May 18, 2014 7:57 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Tue May 13, 2014 2:07 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1036
Location: Monroe County Community College, Monroe Michigan, U.S.A.
Code:
    ORG     $1000
START 
        bsr     first       ;Branch to first

done    SIMHALT
       
* First subroutine       
first   
    if D0 <eq> #0 then.s
        bsr     second      ;branch to subroutine second
    endi
    rts                 ;return to script (go back to start)

* Second subroutine
second 
    nop             ; do stuff
    rts

    END     START
   

_________________
Prof. Kelly


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

All times are UTC


Who is online

Users browsing this forum: Bing [Bot], MSNbot Media and 2 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