Brass - 1.0.5.3 update [06/02/2014]

One suite to code them all. An complete IDE and assembler for all your z80 projects!

Moderators: benryves, kv83

Post Reply
User avatar
Dwedit
Maxcoderz Staff
Posts: 579
Joined: Wed 15 Dec, 2004 6:06 am
Location: Chicago!
Contact:

Post by Dwedit »

Feature request: Support for forward references
You know your hexadecimal output routine is broken when it displays the character 'G'.
Kozak
Maxcoderz Staff
Posts: 791
Joined: Fri 17 Dec, 2004 5:33 pm
Location: On the dark side of the moon.
Contact:

Post by Kozak »

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.
"They say that sea was created by a man named Maarten Zwartbol, a long time ago...." - Duck, an old Corbin version
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

Kozak 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.
I don't really understand what you mean... You can already do things like

Code: Select all

   #define setRegTo1(reg) ld reg,1
It'll just search and replace in the code before compiling, so when you call that macro with setRegTo1(a) for example it'll work as expected.
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
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

Dwedit wrote:Feature request: Support for forward references
I guess this is one problem with this project, I don't understand a word of most of these requests. :oops:

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
...in which case, Brass is a two-pass assembler and already handles that case.

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)
doesn't work in TASM ("label x not found"). Works fine in Brass... What am I missing about the way TASM's macros work?

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.
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

benryves wrote:
Dwedit wrote:Feature request: Support for forward references
I guess this is one problem with this project, I don't understand a word of most of these requests. :oops:
I think what he means is that

Code: Select all

   ld (buffer),hl
   .equ buffer $2384
gives an error because buffer refers to a value that hasn't been equated yet at that line.
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
That'll work, labels are a different story :)
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)
doesn't work in TASM ("label x not found"). Works fine in Brass... What am I missing about the way TASM's macros work?
Try this:

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)
TASM doesn't like spaces ;)
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
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

Timendus wrote:I think what he means is that

Code: Select all

   ld (buffer),hl
   .equ buffer $2384
Is that valid code? :|
This will work;

Code: Select all

    ld (buffer),hl
buffer .equ $2384
...as buffer is treated as a label; so it will first be assigned the value of the IC then the .equ will override it to have a value of $2384. All handled in the first pass, so the second pass picks up the value correctly.
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

Hey, you're right :P 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:

Code: Select all

#DEFINE put_string(str) ld hl,str
#DEFCONT \ call put_string
#DEFCONT \ #DEFINE use_put_string
is not the same as

Code: Select all

#DEFINE put_string(str) #DEFINE use_put_string
#DEFCONT \ ld hl,str
#DEFCONT \ call put_string
(because TASM can't keep both define's apart here anymore)
but also not the same as

Code: Select all

#DEFINE put_string(str) ld hl,str
#DEFCONT \ call put_string
#DEFINE use_put_string
(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.
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
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

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...

Code: Select all

#define a b
#define + -
#define #define .end
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...
User avatar
Jim e
Calc King
Posts: 2457
Joined: Sun 26 Dec, 2004 5:27 am
Location: SXIOPO = Infinite lives for both players
Contact:

Post by Jim e »

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
Image
threefingeredguy
Calc King
Posts: 2195
Joined: Sun 27 Mar, 2005 4:06 am
Location: sleeping
Contact:

Post by threefingeredguy »

You had 3 typos :shock: :shock: :shock:

Anywho, will there be Macintosh support :D, please? :yes:
Image
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

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
Apart from the spelling mistakes ;) that'll work in Brass. = is an alias for .equ, and all labels are indexed in the initial pass.
threefingeredguy wrote:Anywho, will there be Macintosh support :D, please? :yes:
If you can get Mono to run, I can't see why not (it's a .NET app).
User avatar
Jim e
Calc King
Posts: 2457
Joined: Sun 26 Dec, 2004 5:27 am
Location: SXIOPO = Infinite lives for both players
Contact:

Post by Jim e »

Sorry, I was in a rush. :oops:

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.
Image
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

Jim e wrote:Sorry, I was in a rush. :oops:

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.
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?
User avatar
Dwedit
Maxcoderz Staff
Posts: 579
Joined: Wed 15 Dec, 2004 6:06 am
Location: Chicago!
Contact:

Post by Dwedit »

Resetting the origin address for a block of code, then setting it back? That feature would make it easier to make a block of code run from a specific memory address.
You know your hexadecimal output routine is broken when it displays the character 'G'.
gangsta
Sir Posts-A-Lot
Posts: 171
Joined: Wed 12 Oct, 2005 10:46 pm

Post by gangsta »

benryves wrote: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...
Mebbe scan for macros, defines and such first, then assemble code?
Post Reply