EASy68K  
It is currently Tue May 30, 2017 7:22 am

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: restore SECTION status?
PostPosted: Sat Mar 11, 2006 2:21 am 
Offline

Joined: Tue Nov 15, 2005 7:58 am
Posts: 128
Location: Oregon, USA
Is there any reasonably transparent way to write a macro that can change SECTIONS internally as required, then restore the original SECTION?
Or should I just assume macros are only used within "CODE" sections (which would be a problem if you had more than one code section ... :( )


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 12, 2006 5:00 am 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1036
You can change sections within a macro but I'm not sure how the macro would know what the original section was.

_________________
Prof. Kelly


Last edited by profkelly on Sun Mar 12, 2006 2:21 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 12, 2006 2:15 pm 
Offline

Joined: Tue Nov 15, 2005 7:58 am
Posts: 128
Location: Oregon, USA
Does anyone here have access to a real Motorola M68K assembler, perhaps on an old Motorola development system?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 30, 2006 4:13 pm 
Offline

Joined: Mon Jun 20, 2005 4:55 pm
Posts: 14
No, but I used to. I purchased a Motorola VME-10 on eBay. I though I had hit paydirt. I was trying to figure out how to back up the hard drive, but after a week and about a dozen power cycles, the hard drive died. Naturally, I figured out a way to back it up a few days later.

Around the same time I found a message online asking for help with VersaDOS, the Motorola operating system also used on the VME-10. I eventually sent him a full set of scanned manuals I created, along with a few extra paper manuals. In return, he sent me hex dumps of the Motorola assembler and linker.

By the way, the Motorola assembler was written in Pascal. I have been trying for years to find someone with the source code, but no luck.

I want to get the assembler and linker to work under EASy68K, but that involves understanding more about the innards of VersaDOS and the Pascal run-time library than I really wanted to know. Without a working system to compare to, it will be difficult.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 31, 2006 10:47 am 
Offline

Joined: Tue Nov 15, 2005 7:58 am
Posts: 128
Location: Oregon, USA
profkelly wrote:
You can change sections within a macro but I'm not sure how the macro would know what the original section was.

I figure the assembler would need to use a LIFO to keep track during the macro expansion.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 02, 2007 10:41 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1036
Edit68K v3.6 beta 15 allows a label on the SECTION DIRECTIVE. The label is set to the section number 0-15. If no section number is specified the label is set to the current section. This will allow a macro to change sections and then restore the previous section as shown in this example:

Code:
DATA    EQU     0
CODE    EQU     1

MAC1    MACRO
SECT\@  SECTION
        SECTION DATA
        DC.B    'Hello World.'
        SECTION SECT\@
        ENDM


It is also possible to write a macro that modifies its behavior using conditional assembly based upon the section it is in when invoked as shown in this example:

Code:
MAC2    MACRO
SECT\@  SECTION
        IFEQ SECT\@-CODE
          NOP
        ENDC
        IFEQ SECT\@-DATA
          DC.B  'Greetings'
        ENDC
        ENDM

_________________
Prof. Kelly


Top
 Profile  
 
 Post subject: Restore SECTION status
PostPosted: Thu Mar 15, 2007 10:06 pm 
Offline

Joined: Tue Nov 15, 2005 7:58 am
Posts: 128
Location: Oregon, USA
profkelly wrote:
Edit68K v3.6 beta 15 allows a label on the SECTION DIRECTIVE. The label is set to the section number 0-15. If no section number is specified the label is set to the current section. This will allow a macro to change sections and then restore the previous section ...


Looks good to me. Thanks! Is there a way to make it work in a nested macro, both levels of which may have changed SECTIONs?


Top
 Profile  
 
PostPosted: Fri Mar 16, 2007 12:49 am 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1036
gtippery wrote:
Is there a way to make it work in a nested macro, both levels of which may have changed SECTIONs?


Nested macros work. Just make sure to use labels with \@ when saving the section number.

_________________
Prof. Kelly


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


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