Jump to content
Gury

Mad-Assembler (MADS)

Recommended Posts

 

.cb +$80 "Hello"*

 

Wratchild win ;)

Edited by tebe

Share this post


Link to post
Share on other sites

Yep, thanks. looks like I'll have to be doing that.

 

On another note, is .align supposed to work to exact bytes rather than just pages? Not that it turns out to be that useful for padding out to 128 byte sectors, but when I was experimenting it seems to behave peculiarity with things like ".align $7f"?

.align N[,fill_value]

 

how it works:

 

  if N > 0 then
   i := (CURRENT_ADDRESS div N)* N
  else
   i := CURRENT_ADDRESS;

  if i <> CURRENT_ADDRESS then inc(i, N);

  CURRENT_ADDRESS := i;
Edited by tebe
  • Like 1

Share this post


Link to post
Share on other sites

.align N[,fill_value]

 

how it works:

 

  if N > 0 then
   i := (CURRENT_ADDRESS div N)* N
  else
   i := CURRENT_ADDRESS;

  if i <> CURRENT_ADDRESS then inc(i, N);

  CURRENT_ADDRESS := i;
	opt h- f+
	
	org $2000
	
	.byte 1,2,3
	
	.align $7f,0
	
	.byte $ff
01 02 03 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF

only 64?

change to ".align $7e,0"

01 02 03 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 FF

?

Share this post


Link to post
Share on other sites

:) Not really, does same as

.cb "Hello"

no good for screen display unless custom charset

 

Haha, of course it doesn't, it adding $80 to each char and EOR that with $80 :)

 

I understand now that there is no equivalent for the .cb function for ATASCII output of .sb as the latter doesn't have the same behaviour of .cb which inverts the last character.

Share this post


Link to post
Share on other sites
	opt h- f+
	org $2000
	.byte 1,2,3
	.align $7f,0
	.byte $ff

only 64?

 

You are requesting alignment to the nearest 127 byte boundary. ceil($2000 / $7F)*$7F = $203F.

  • Like 2

Share this post


Link to post
Share on other sites

Hi, I'm having another dilema.

 

I have one file which contains data for 5 levels.

Each level data is let's say 64 bytes long.

My goal is to generate 5 binary files which will eventually be deflated and unrolled to actual level data buffer during gameplay.

 

Are there any mads directives that could I use for this?

I was thinking of .SAV, but I'm dont know how to fill the buffer with .PUT.

 

All that i need is some command similar to what .writemem in altirra does, but instead of writing data that are in the emulator ram, I would need to write part of data within some datablock.

 

data could look like this:

org $3000
level1
:64 dta 1
level2
:64 dta 2
level3
:64 dta 3
level4
:64 dta 4
level5
:64 dta 5

and what I would like to do is something like:

savetofile level1, level2-level1, "level1.bin"
savetofile level2, level2-level1, "level2.bin"
... and so on

(start address, length, filename)

so the result will be 5 files level1.bin ... level5.bin each 64byte long containing the data (just repeated level numbers in this example)

 

is it possible to get this?

Share this post


Link to post
Share on other sites

@matosimi I was just wondering why you want MADS to do this? To me this seems like something that your local machine should be doing on the command line or with Perl / Python etc? Then you'd just load those files into your program to show with the Atari.

Share this post


Link to post
Share on other sites

I don't think mads is the right thing for what you want unless I'm misunderstanding. Get and put are done at assembly time, not runtime?

Something like the exomizer compressor might be worth looking at. There is a level compressor which can stream to a circular buffer, although the example decrunch code is not up to date and it looks quite daunting to me.

Share this post


Link to post
Share on other sites

@matosimi I was just wondering why you want MADS to do this? To me this seems like something that your local machine should be doing on the command line or with Perl / Python etc? Then you'd just load those files into your program to show with the Atari.

I'm using php for some data file conversions, I like python but there is a reason why I used php.

I'm working on one game conversion and the original game itself is disk-based and the data are incompatible, so I need to rewrite all loading routines and at the same time I have to retain all the data packed in the memory and unroll only those parts that are needed at the specific level.

 

all leveldata are in 4 assembly files each of which which consists of 5 data blocks of same size. I'm looking for some ellegant way to build the data (several DTA lines) w/o need to split each datablock source in 1 single file which would eventually result in 20 source files where each would need to be assembled to get 20 obx files and then strip the atari data block header and get 20 "bin" files.

I thought I would be able to do this with single MADS source file.

I want to avoid manual actions when building the game, I would like to get some batch file that could execute all actions which will finally end up in single obx(xex) file.

 

 

I don't think mads is the right thing for what you want unless I'm misunderstanding. Get and put are done at assembly time, not runtime?

Something like the exomizer compressor might be worth looking at. There is a level compressor which can stream to a circular buffer, although the example decrunch code is not up to date and it looks quite daunting to me.

 

.get, .put, .sav are handled at assembly time.

You can load binary file using .get, then you can perform some data transformation with .get/.put in .rept loop and afterwards you can materialize (insert) the final data to your binary output using .sav.

 

...

It seems the correct workaround will be to put all 20 data blocks in one asm source file and assemble it to single obx file... which will then be beheaded :) and cut into 20 pieces by php/python script.

 

Edited by matosimi

Share this post


Link to post
Share on other sites

@matosimi I was just wondering why you want MADS to do this? To me this seems like something that your local machine should be doing on the command line or with Perl / Python etc? Then you'd just load those files into your program to show with the Atari.

Exactly. For all my Jaguar-related work, I always keep a Visual Studio open and use .NET for all the conversions and parsing and exports into the format that the assembler accepts.

 

I found that Python sucks when it comes to debugging (honestly, anything does, when compared with VS debugger), so the time I gain by writing the script in command line is more than just lost the moment I need to figure out what the hell is going on.

 

Also, in case of a crash, you automatically get a nice full stack trace (totally beats the Python trace), so you see it right there, what happened, without even having to debug it most of the time.

 

 

While Python is OK I that regard, I personally can't recommend Perl, as I find Perl to be write-only code, whereas C# is instantly readable even after a year.

  • Like 1

Share this post


Link to post
Share on other sites

mads 2.0.8

 

http://mads.atari8.info

- .LONGA ON|OFF, .LONGI ON|OFF (65816)
- '-FV:VALUE', fill value for 'OPT F+'
-  lda #'AB' (65816) ; mwa #'XY' $80 (6502, 65816)

example (FPU - Marco Granati)

 

fpu_x65816 - Avocet X65816 (original)

fpu_mads (conversion)

fpu_mads.asm

fpu_x65816.asm

Edited by tebe
  • Like 3

Share this post


Link to post
Share on other sites
 '-FV:VALUE', fill value for 'OPT F+

 

Rulez!

Share this post


Link to post
Share on other sites

,,,then strip the atari data block header and get 20 "bin" files.

 

..It seems the correct workaround will be to put all 20 data blocks in one asm source file and assemble it to single obx file... which will then be beheaded :) and cut into 20 pieces by php/python script.

 

I want to avoid manual actions when building the game, I would like to get some batch file that could execute all actions which will finally end up in single obx(xex) file.

 

I don't really understand why you would want 20 separate files (maybe for separate compression), but you can deactivate the header in any case with "OPT h-", so you don't need to strip it. I and always have the cygwin tools installed, so I can use a command like "split.exe" in the batch file. I use batch files makefiles for all more complex projects and I also use multiple MADS stages, DIR2ATR and AtariRomMaker, often.

echo Creating disk image.
set ATR=%RELEASE%.atr
atr\hias\dir2atr.exe -d -m -b MyDos4534 %ATR% atr\files
if ERRORLEVEL 1 goto :dir2atr_error
echo Done.

:make
cd asm
echo Compiling menu.
set EXECUTABLE=..\atr\files\%1
if exist %EXECUTABLE% del %EXECUTABLE% 
%MADS% -s SillyMenu.asm -o:SillyMenu.xex %2 %3
if ERRORLEVEL 1 goto :mads_error
echo Packing menu.
%EXOMIZER% sfx $2000 SillyMenu.xex -t 168 -o SillyMenu-Packed.xex -q
echo Compiling loader.
%MADS% -s SillyMenu-Loader.asm -l -o:%EXECUTABLE% %2 %3
if ERRORLEVEL 1 goto :mads_error
dir SillyMenu.xex %EXECUTABLE% 
  • Like 1

Share this post


Link to post
Share on other sites

Hi tebe,

 

small feature request: Can you please output the expected maximum and the actual value in the "Value out of range" messages?

 

Best regards, Peter.

 

Value-out-of-range.png

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, tebe said:

https://github.com/tebe6502/Mad-Assembler/tree/patch-01

 

Value out of range (VALUE must be between X and Y)

 

Excellent, thank you!

"Description    Resource    Path    Location    Type
Value out of range (299 must be between 0 and 255)    TheMenu-XEX-Starter.asm    /Test/Productions/com.wudsn.productions.atari800.thecartstudio/asm/thecart-menu/xex    line 49    Problem"

 

  • Like 1

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