EASy68K
http://www.easy68k.com/EASy68Kforum/

restore SECTION status?
http://www.easy68k.com/EASy68Kforum/viewtopic.php?f=9&t=213
Page 1 of 1

Author:  gtippery [ Sat Mar 11, 2006 2:21 am ]
Post subject:  restore SECTION status?

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 ... :( )

Author:  profkelly [ Sun Mar 12, 2006 5:00 am ]
Post subject: 

You can change sections within a macro but I'm not sure how the macro would know what the original section was.

Author:  gtippery [ Sun Mar 12, 2006 2:15 pm ]
Post subject: 

Does anyone here have access to a real Motorola M68K assembler, perhaps on an old Motorola development system?

Author:  paulrsm [ Thu Mar 30, 2006 4:13 pm ]
Post subject: 

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.

Author:  gtippery [ Fri Mar 31, 2006 10:47 am ]
Post subject: 

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.

Author:  profkelly [ Fri Mar 02, 2007 10:41 pm ]
Post subject: 

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

Author:  gtippery [ Thu Mar 15, 2007 10:06 pm ]
Post subject:  Restore SECTION status

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?

Author:  profkelly [ Fri Mar 16, 2007 12:49 am ]
Post subject:  Re: Restore SECTION status

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.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/