17 June 2013, 22:26 | #1 |
AMOS Extensions Developer
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
|
Creating Macros
Hi,
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: Code:
Print "text" I tried doing the following, but it seems to just end up pointing the address registers to nothing! Code:
Print MACRO move.l /1,a1 ENDM Is it possible to do this in DevPac 3.18? |
17 June 2013, 23:13 | #2 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
One way of doing it (you may have to change the syntax for DevPac):
Code:
Print macro lea .text\@, a0 ... bra .done\@ .text\@ dc.b \1 even .done\@ endm |
18 June 2013, 08:54 | #3 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
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. Code:
Print macro section texts,code .text\@ dc.b \1 dc.b 0 code lea .text\@(pc),a0 bsr print_function endm Code:
SECTIONS { . = 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) } } |
18 June 2013, 22:12 | #4 |
AMOS Extensions Developer
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
|
Thanks for the help guys
|
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 | Keir | project.SPS (was CAPS) | 939 | 14 April 2024 03:42 |
Creating a Self-Booting CD32 CD (Here we go again...) | Heavy Stylus | support.Hardware | 69 | 14 August 2008 19:08 |
Keyboard Input Options > macros/key combinations ? | Konrad | support.WinUAE | 3 | 23 May 2007 17:22 |
Creating Adf | Retro1234 | support.Other | 0 | 17 July 2006 16:25 |
|
|