Jump to content
flashjazzcat

MADS Knowledge-Base

Recommended Posts

Just stumbled across this one:

 

mva #0 Ds1[0].ReturnCode

This puts $00 into the proper element of struct Ds1.

 

mva #0 Ds1 [0].ReturnCode

However, the second example (note space between struct name and array index) always stores $00 in the first byte of the struct.

 

 

fixed

 

MADS 1.9.8 build 5
The following code crashes.
65 92E2 A5 8E C9 B7 B0 03 + #if .byte PLAYER0X > #GAME_RIGHT_BORDER
66 92F0 A5 C8 C9 03 D0 05 #if .byte ROOM_X = #WORLD_WIDTH-1
67 92F6 C6 8E DEC PLAYER0X
68 92F8 4C 05 93 #else
69 92FB E6 C8 INC ROOM_X
70 92FD A9 01 85 A0 MVA #1 SCREEN_COMPLETE
71 9301 A9 40 LDA #GAME_LEFT_BORDER
72 9303 85 8E STA PLAYER0X
73 9305 #end
74 ;#else ; Leave this else in, even if it does nothing as the game crashes without it
75 9305 #end

 

for me, works OK

 

try this

mads_198b44.zip

Edited by tebe

Share this post


Link to post
Share on other sites

for me, works OK

 

 

It works for me in some parts of my code, but not in every place. Is it because I am crossing a page?

 

I will test your new MADS now, thank you Tebe.

Share this post


Link to post
Share on other sites

Fantastic, the problem has gone...!

 

With total respect for your FANTASTIC compiler, did you update something, or is it because I've amended my code (but not that section of code)?

 

Either way, it works! Thanks Tebe!

Share this post


Link to post
Share on other sites

2 questions

 

1) sin generator... how can I build sintables with more than 1 period?

2) XASM related...

 

what does the "+" after the JSR do? I know the post inc/decrement (inserting inx,dex f.e.) but this? can not find in any docu what the +,- after standard commands do (and I have not checked the disassebling).

Share this post


Link to post
Share on other sites

There seems to be an issue with low/high address byte relocations in .RELOC blocks. MADS supports split address relocations, but this doesn't seem to work for the following common case:

 

 

.reloc .word

 foo:
    ldx    #<foo
    ldy    #>foo

 

For this, MADS hardcodes $00 and $01 without relocations. It works if I use zero-page addressing instead of immediate, or if I replace the sequence with MWA.

Share this post


Link to post
Share on other sites

Thanks, that does seem to work... but it's non-standard syntax. How do you encode LDA zp instructions with those addresses in a .RELOC block, then?

Share this post


Link to post
Share on other sites

Hello tebe,

 

First thanks for mads. It is a powerful tool and it has proved very useful for me.

I have a small feature request: could you please increase the pass_max value (to 32 for example) in the next release? I have had some complex sources which required more passes than the standard 16 and that causes some very strange errors.

 

greetings,

tzeb

Share this post


Link to post
Share on other sites

How about some way to reference the compile date/time in the source? i.e.:

 

.byte _SYS_DAY,_SYS_MONTH,_SYS_YEAR

 

I had something like this in the assembler I wrote years ago and it was pretty handy.

  • Like 2

Share this post


Link to post
Share on other sites

.endr without matching .rept n results in compiler aborting with "0,stop" error, instead of something more informative like ".ENDR without matching .REPT". ;)

Share this post


Link to post
Share on other sites

>How about some way to reference the compile date/time in the source? i.e.:

Would love that too! Good idead might be date()/time() functions similar to SIN().
  • Like 1

Share this post


Link to post
Share on other sites

And it would be nice if the date could either be in byte values or as a string. The string would need to be locali(s/z)ed though.

Share this post


Link to post
Share on other sites

 

don't use # if you want low, high

   ldx <foo
   ldy >foo

 

Really? This is very non-standard and ambiguous, surely. LDX <$680 should load the content of $80. Not that such an operation is much practical use, but still...

 

And it would be nice if the date could either be in byte values or as a string. The string would need to be locali(s/z)ed though.

 

Yes indeed. The reason I wanted this was simply to populate six bytes in an executable with the date and time of compilation.

Share this post


Link to post
Share on other sites

 

Yes indeed. The reason I wanted this was simply to populate six bytes in an executable with the date and time of compilation.

 

That would be very useful. In my case, I'd like to have a string which I can load into the screen memory so that it can be seen (though I could use the byte values, I work in automation and like things done for me). It would be a lazy build/release information system.

 

Other ideas:

compiler_version()

compilation_directory()

Edited by snicklin

Share this post


Link to post
Share on other sites

Yeah - the other values would be useful too. Bytes are useful to me solely because I use a small printf library (including sprintf) so I can format stuff how I want.

Share this post


Link to post
Share on other sites

How about some way to reference the compile date/time in the source? i.e.:

 

.byte _SYS_DAY,_SYS_MONTH,_SYS_YEAR

 

I had something like this in the assembler I wrote years ago and it was pretty handy.

 

time+date needs SYSUTILS, mads is minimalistic, uses only SYSTEM

 

for time and date i use BUILD http://www.madteam.atari8.info/uzytki/build.7z

i use it with Pang, Mads

 

BAT file

 

mads.exe %1 -tpli:"d:\!atari\macro\"
@echo off
if exist %~n1.inf build %~n1.obx

 

INF file, from Pang

 

BUILD
#73
3.5
153

 

string "BUILD" is marker in executable file, it's begining of memory space for change with BUILD

#73 is code for EOL (end of line)

string "3.5" is actual version

"153" is build number, increases with every start of the BUILD program

Share this post


Link to post
Share on other sites

Hello tebe,

 

First thanks for mads. It is a powerful tool and it has proved very useful for me.

I have a small feature request: could you please increase the pass_max value (to 32 for example) in the next release? I have had some complex sources which required more passes than the standard 16 and that causes some very strange errors.

 

greetings,

tzeb

 

change this

 

  pass_max = 16;        // maksymalna mozliwa liczba przebiegow asemblacji

 

compile with FPC

// Free Pascal Compiler http://www.freepascal.org/

// Compile: fpc -Mdelphi -vh -O3 mads.pas

 

but 32 passes is strange

 

example, how hang mads (16 passes, 32 passes, 1000000000000000000000000000000 passes)

 

    org $2000

    ift label<$2080
    mwa #$4080 $80
    els
    mva #$40 $80
    eif

    :123 brk
label

WARNING: Infinite loop by label LABEL

Share this post


Link to post
Share on other sites

Hi,

 

@tzeb

 

regarding the 32 passes I also think restructuring the program would be a better idea, also in terms of compilation speed/time.

 

@teba

Build is nice for it's purpose but as for the Date/Time functions build does not address what I mean.

I'd really like to have the data & time values and also build.exe will not help the MacOX/Linux guys.

I'm not so deep into Pascal: What's the deal with SYSUTIL? Size of resulting .EXE?

Share this post


Link to post
Share on other sites

 

>How about some way to reference the compile date/time in the source? i.e.:

Would love that too! Good idead might be date()/time() functions similar to SIN().

 

SIN is pseudo code. like ORG, OPT, IFT etc. (3 chars)

 

for TIME/DATE pseudo code TIM or directive .TIME

 

TIM(format)

format: y-ear, m-onth, d-ay, t-ime

 

dta tim(y) ; 2014

dta tim(m:d) ; 1:11

dta tim(y-mmm-ddd) ; 2014-001-011

 

or directive: .YEAR, .MONTH, .DAY, .HOUR, .MINUTE, .SECOND

 

.echo .year,'/',.month,'/',.day

dta a(.year)

 

with PRINTF

jsr printf

dta c'date: %-%-%, time: %:%:%',$9b,0

dta a(.year)

dta a(.month)

dta a(.day)

dta a(.hour)

dta a(.minute)

dta a(.second)

 

 

which version is better :) ?

  • Like 1

Share this post


Link to post
Share on other sites

Both are fine. My preference would be the TIM() function as it keeps the number of directives low and is easyier to extend if we want different output formats.

Share this post


Link to post
Share on other sites

Let the coder format the data. Raw bytes can be styled any which way... it's much harder to do the reverse on some already formatted string. :)

  • Like 1

Share this post


Link to post
Share on other sites

Hello,

@tebe

Thanks for your reaction concerning my pass_max question. I did figure out how to change it, but I must not forget to patch MADS each time a new version is being released.
Perhaps you could consider increasing it in the released code? The number 32 is just an example. The maximum number of passes I have encountered is 18. (I do not know what is supposed to be a 'normal' number of passes?)

@JAC!

I really don't know how to restructure the program to reduce the number of passes. I use a few .REPT, lots of .LOCAL and lots and lots of @ labels. And the program source is large (>200KB, but the largest part is DTA digital data)

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.

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