Jump to content
Gury

Mad-Assembler (MADS)

Recommended Posts

But opt h- has to be in data file. It's not a problem, just wondered if there was a way without having to do that.

Share this post


Link to post
Share on other sites

if you want to build different targets, e.g. ROM + XEX, the easiest wat is to have two root source files, put the compile flags, opt + org there and then ICL "MAIN.ASM".

The create a batch script that runs mads for both variants at once.

Share this post


Link to post
Share on other sites

Yes, for something serious that makes sense, thanks.

 

It's more my poor workflow than anything to do with Mads. I only noticed its absence as I sometimes do a quick and dirty assemble of data to see what size it is when using atasm. I can subtract 6 or stick in an opt line temporarily etc. I figured there could be more useful cases other than that. Sounds like probably there is not then, which is good 😀

Share this post


Link to post
Share on other sites

what is the cleanest / simplest way of interweaving code and reserved blocks of memory?

I'm thinking along the lines of reserving beginnings of subsequent pages, say 160 bytes per page, and using left overs for code. Is there a semi-automatic way of placing the code in the holes?

Share this post


Link to post
Share on other sites

Is it possible to change the value of a global label (temporary or not) from inside a macro?

When I try to do things like:

?GLOBAL_LABEL = 1

GLOBAL_LABEL2 = 10

	org $1000
	
	.macro M_test1
?GLOBAL_LABEL = 2
//:?GLOBAL_LABEL = 3

	.print ?GLOBAL_LABEL
	.print :?GLOBAL_LABEL

GLOBAL_LABEL2 set 20
//:GLOBAL_LABEL2 set 30

	.print GLOBAL_LABEL2
	.print :GLOBAL_LABEL2
	
	lda #0
	
	.endm
	
	
	M_test1
	

The ?GLOBAL_LABEL and GLOBAL_LABEL2 inside the macro are just different labels.

And the commented lines both throw different errors..

 

Share this post


Link to post
Share on other sites

Thanks!

 

It works perfectly for the temporary label:

?GLOBAL_LABEL = 1

	org $1000
	
	.macro M_test1
?GLOBAL_LABEL = 2
.def :?GLOBAL_LABEL = 3

	.print ?GLOBAL_LABEL
	.print :?GLOBAL_LABEL

	lda #0
	
	.endm
	
	
	M_test1

Share this post


Link to post
Share on other sites

Another MADS 'bug' I hit while converting some old source code.

    ORG $600
    CMP #-16 ; ok
BWDSPD = -16
    CMP #BWDSPD ; ERROR: Value out of range

In general, MADS doesn't truncate expression to 8-bits automatically, which sometimes is nice and catches a bug, but in this case I'd argue it's not desirable. If it accepts signed 8-bit constants, it should accept signed 8-bit expressions.

  • Like 1

Share this post


Link to post
Share on other sites

As far as I can see

INS "filename"*

inverses the highest bit in bytes, like

dta c'invers'*

For inserting gfx it would be great to have a possibility to inverse all bits, e.g. this way:

INS 'filename'! 

Share this post


Link to post
Share on other sites

 

As far as I can see

INS "filename"*

inverses the highest bit in bytes, like

dta c'invers'*

For inserting gfx it would be great to have a possibility to inverse all bits, e.g. this way:

INS 'filename'! 

 

 

.get 'gfx.dat'
.byte .get[#]^$FF
???

Share this post


Link to post
Share on other sites

 

As far as I can see

INS "filename"*

inverses the highest bit in bytes, like

dta c'invers'*

For inserting gfx it would be great to have a possibility to inverse all bits, e.g. this way:

INS 'filename'! 

 

only '+', '-'

 ins 'filename'+128
.get 'filename'
:.filesize('filename') dta .get[#]^$FF
Edited by tebe
  • Like 1

Share this post


Link to post
Share on other sites

Perfect! Works 100% under Linux and looking at the fix I'm sure it'll work under Mac OS X, too. Will try that once my Mac setup is up and running. Thanks, tebe!

 

Is this version (source code) already published? I could only find 2.07 on http://mads.atari8.info/ and want to compile the latest version for mac os x.

Edited by patjomki

Share this post


Link to post
Share on other sites

Hi tebe, a minor nit. I noticed that .BYTE doesn't implement additive modifiers like in MAC/65.

     1         ORG $600
     2 FFFF> 0600-0607> EA     NOP
     3 0601 C1 C2 C3      .BY +$80,'ABC'
     4 0604 80 41 42 43      .BYTE +$80,'ABC'

Fortunately .BY does, but perhaps .BYTE and .SBYTE should pick up this feature as well.

 

 

use .BY, .SB

 

.BYTE, .WORD, .LONG, .DWORD have a special meaning for other directives

  • Like 1

Share this post


Link to post
Share on other sites

Hi tebe,

 

I am frequently porting stuff from other assemblers and do binary comparision of the results to see if I made mistakes.

There I found that basically all other assemblers use $00 as fill byte for ".ds", but MADS uses $ff if OPT F+ is active.

Could you add an option to specify the fill byte somehow?

 

Best regards, Peter.

  • Like 2

Share this post


Link to post
Share on other sites

Minor error in documentation:

 

 

A ':' specifies the number of times to repeat the line (in the case of a macro, this specifies a macro parameter by number if it is in decimal). The repeat count should be in the range <0..2147483647>. When repeating a line with ':repeat', it is possible to use the loop counter in the repeated line using a hash sign ('#') or the parameter :1.

 

repeat count is only 16-bit using ":" <0..65535>

but it's true for .rept (thankfully!)

 

  • Like 1

Share this post


Link to post
Share on other sites

Hi all,

 

thanks tebe for creating MADS, I really like this assembler.

Now I was doing a demo, I do not know if you can invert bytes easily. :?

since

.byte %00000001
.byte %00000011
.byte %00000111

to

.byte %10000000
.byte %11000000
.byte %11100000

Well the idea is to design a player and be able to invert it so that it looks left or right just using a sprite :D

regards

Share this post


Link to post
Share on other sites

Hi all,

 

thanks tebe for creating MADS, I really like this assembler.

Now I was doing a demo, I do not know if you can invert bytes easily. :?

since

.byte %00000001
.byte %00000011
.byte %00000111

to

.byte %10000000
.byte %11000000
.byte %11100000

Well the idea is to design a player and be able to invert it so that it looks left or right just using a sprite :D

regards

 

Unary operators:

+ Plus (does nothing)

- Minus (changes sign)

~ Bitwise not (complements all bits)

! Logical not (changes true to false and vice versa)

< Low (extracts low byte)

> High (extracts high byte)

^ High 24bit (extracts high byte)

= Extracts memory bank

: Extracts global variable value

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...