Brass - 1.0.5.3 update [06/02/2014]
I don't really understand what you mean... You can already do things likeKozak wrote:A cool feature would be using registers as input for macro's. That would really help in a cleaner code and greatly improve the function of macro's.
Code: Select all
#define setRegTo1(reg) ld reg,1
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
- benryves
- Maxcoderz Staff
- Posts: 3087
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
I guess this is one problem with this project, I don't understand a word of most of these requests.Dwedit wrote:Feature request: Support for forward references
EDIT: Wait, do you mean allowing something like this:
Code: Select all
ld a,(label) ; The "label:" has not been parsed yet, so how does it know what the address of 'label' is?
label:
.db 0
Anyway, I've been adding support for TASM's #define macros, and it works most of the time (there are still a few incidents where the replacement is not inserted, probably due to a bracket being chopped off when parsing the text or similar).
One thing I don't get is that
Code: Select all
#define put_string(x, y, text) ld a,x \ ld (curcol),a \ ld a,y \ ld (currow),a \ ld hl,text \ bcall(_puts)
All Z80 instructions now work; the reason I thought they didn't was that TASM wasn't assembling the undocumented instructions in the test file, so after a certain address all the rest of the binary was offset by a few bytes and my binary comparison script declared them all as being wrong. -x in the commandline and the two were identical.
I think what he means is thatbenryves wrote:I guess this is one problem with this project, I don't understand a word of most of these requests.Dwedit wrote:Feature request: Support for forward references
Code: Select all
ld (buffer),hl
.equ buffer $2384
That'll work, labels are a different storyEDIT: Wait, do you mean allowing something like this:
Code: Select all
ld a,(label) ; The "label:" has not been parsed yet, so how does it know what the address of 'label' is? label: .db 0
Try this:One thing I don't get is that
doesn't work in TASM ("label x not found"). Works fine in Brass... What am I missing about the way TASM's macros work?Code: Select all
#define put_string(x, y, text) ld a,x \ ld (curcol),a \ ld a,y \ ld (currow),a \ ld hl,text \ bcall(_puts)
Code: Select all
#define put_string(x,y,text) ld a,x \ ld (curcol),a \ ld a,y \ ld (currow),a \ ld hl,text \ bcall(_puts)
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
- benryves
- Maxcoderz Staff
- Posts: 3087
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Is that valid code?Timendus wrote:I think what he means is thatCode: Select all
ld (buffer),hl .equ buffer $2384
This will work;
Code: Select all
ld (buffer),hl
buffer .equ $2384
Hey, you're right Sorry about that
In that case I don't really understand the request either...
Edit: Maybe he meant forward referencing macro's..? That doesn't work in TASM.
Oh, one funny thing when it comes to macro's:
is not the same as
(because TASM can't keep both define's apart here anymore)
but also not the same as
(So the last define is definately part of the macro definition, you just have to put it at the end of the definition)
The API uses that trick to include the right routines when you invoke their macro's.
In that case I don't really understand the request either...
Edit: Maybe he meant forward referencing macro's..? That doesn't work in TASM.
Oh, one funny thing when it comes to macro's:
Code: Select all
#DEFINE put_string(str) ld hl,str
#DEFCONT \ call put_string
#DEFCONT \ #DEFINE use_put_string
Code: Select all
#DEFINE put_string(str) #DEFINE use_put_string
#DEFCONT \ ld hl,str
#DEFCONT \ call put_string
but also not the same as
Code: Select all
#DEFINE put_string(str) ld hl,str
#DEFCONT \ call put_string
#DEFINE use_put_string
The API uses that trick to include the right routines when you invoke their macro's.
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
- benryves
- Maxcoderz Staff
- Posts: 3087
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
I haven't even dared think about how I'm going to handle ye dreaded #defcont at the moment
My macro system is pretty open to abuse; for example, these are all valid...
I guess Brass works a little like TASM - you must declare a macro before using it. I can't see an easy way around this limitation...
My macro system is pretty open to abuse; for example, these are all valid...
Code: Select all
#define a b
#define + -
#define #define .end
- Jim e
- Calc King
- Posts: 2457
- Joined: Sun 26 Dec, 2004 5:27 am
- Location: SXIOPO = Infinite lives for both players
- Contact:
I've always had trouble wtih this kind of forward reference.
Code: Select all
defualt = string1
ld hl,defualt
bacll(_puts)
;stuff...
string1:
.db "lala",0
-
- Calc King
- Posts: 2195
- Joined: Sun 27 Mar, 2005 4:06 am
- Location: sleeping
- Contact:
- benryves
- Maxcoderz Staff
- Posts: 3087
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Apart from the spelling mistakes that'll work in Brass. = is an alias for .equ, and all labels are indexed in the initial pass.Jim e wrote:I've always had trouble wtih this kind of forward reference.
Code: Select all
defualt = string1 ld hl,defualt bacll(_puts) ;stuff... string1: .db "lala",0
If you can get Mono to run, I can't see why not (it's a .NET app).threefingeredguy wrote:Anywho, will there be Macintosh support , please?
- Jim e
- Calc King
- Posts: 2457
- Joined: Sun 26 Dec, 2004 5:27 am
- Location: SXIOPO = Infinite lives for both players
- Contact:
Sorry, I was in a rush.
But for multipage apps, I was hopeing for a more 83+ specific output. Things like directives that control current flash page, how big a bank is, if there should be an error if one page is overfilled or if it should continue on to the next page. Also labels that work across the pages.
But for multipage apps, I was hopeing for a more 83+ specific output. Things like directives that control current flash page, how big a bank is, if there should be an error if one page is overfilled or if it should continue on to the next page. Also labels that work across the pages.
- benryves
- Maxcoderz Staff
- Posts: 3087
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Any label without the current local label (_ by default) is globally accessible. A .page directive (coupled with .pagesize to set the page size) could be used to set page number, and if you used :label (eg ld a,:label) you could get the page a label sits on?Jim e wrote:Sorry, I was in a rush.
But for multipage apps, I was hopeing for a more 83+ specific output. Things like directives that control current flash page, how big a bank is, if there should be an error if one page is overfilled or if it should continue on to the next page. Also labels that work across the pages.