English Amiga Board

Go Back   English Amiga Board > Coders > Coders. General > Coders. Tutorials

Thread Tools
Old 17 June 2013, 23:26   #1
AMOS Extensions Developer
Lonewolf10's Avatar
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 39
Posts: 1,919
Creating Macros


I have already created some macros for use in my own ASM code, but I am wondering if it is possible to create a macro to print text that follows it, for example:

    Print "text"
I could dump all the text strings together and select them by number, but that is time consuming and these text strings are only going to be for debugging.
I tried doing the following, but it seems to just end up pointing the address registers to nothing!

    Print    MACRO
             move.l    /1,a1

Is it possible to do this in DevPac 3.18?
Lonewolf10 is offline  
Old 18 June 2013, 00:13   #2
Join Date: Jul 2008
Location: Sweden
Posts: 2,201
One way of doing it (you may have to change the syntax for DevPac):
Print    macro
         lea   .text\@, a0
         bra   .done\@

.text\@  dc.b  \1
Leffmann is offline  
Old 18 June 2013, 09:54   #3

phx's Avatar
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,225
You can get rid of the branch instruction when you put the strings into another section (e.g. "data"). Or put them into a second code section and rely on the linker to merge it with your main code section, due to PC-relative references (or force the merge with some small-code option).

A separate section for strings also has the advantage that you don't need to align the address after each definition.

Print   macro
        section texts,code
.text\@ dc.b    \1
        dc.b    0

        lea     .text\@(pc),a0
        bsr     print_function
If you want to create absolute output instead of an AmigaDOS executable you can still use sections, but define the layout in memory using a linker script. For example:
        . = 0x10000;
        .text: { *(CODE code) *(texts) }
        . = ALIGN(2);
        .data: { *(DATA data) }
        . = ALIGN(2);
        .sdata: {
                _LinkerDB = . + 0x7ffe;
                _SDA_BASE_ = . + 0x7ffe;
                *(.sdata __MERGED)
        . = ALIGN(2);
        .bss: { *(BSS bss) }
phx is offline  
Old 18 June 2013, 23:12   #4
AMOS Extensions Developer
Lonewolf10's Avatar
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 39
Posts: 1,919
Thanks for the help guys
Lonewolf10 is offline  

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating your own IPFs kaffer project.SPS (was CAPS) 95 30 May 2018 13:26
Creating a Self-Booting CD32 CD (Here we go again...) Heavy Stylus support.Hardware 69 14 August 2008 20:08
Keyboard Input Options > macros/key combinations ? Konrad support.WinUAE 3 23 May 2007 18:22
Creating Adf Retro1234 support.Other 0 17 July 2006 17:25

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 00:16.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
Page generated in 0.06590 seconds with 15 queries