Jump to content
IGNORED

Mad-Assembler (MADS)


Gury

Recommended Posts

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
Link to comment
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

?

Link to comment
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.

Link to comment
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?

Link to comment
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.

Link to comment
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
Link to comment
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
Link to comment
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
Link to comment
Share on other sites

  • 9 months later...
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
Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...

Hi tebe,

 

Minor thing: Using labels/locals in expressions with ".len" is not counted as usage and results in a warning:

 

text_size = .len intro_text
Unused label INTRO_TEXT    
 

Best regards, Peter.

Link to comment
Share on other sites

On 11/18/2019 at 11:32 AM, tebe said:

http://mads.atari8.info/

https://github.com/tebe6502/Mad-Assembler

 

mads 2.1.0

 


- new warning message 'Buggy indirect jump' for JMP(ABS)
- new directve .FILEEXISTS('filename') , TRUE (1) if file exist, FALSE (0) if not
- extended error message 'Value out of range (VALUE must be between X and Y)'

 

Any chance, that there will be a mads.macosx-intel version of this? There seems to be a windows exe only and I don´t know how to use the PAS-source.

Link to comment
Share on other sites

47 minutes ago, skr said:

Any chance, that there will be a mads.macosx-intel version of this?

Just compiled this on Catalina:

 

mads-macos-x64.zip

 

Quickest way to get the thing compiled on Catalina appears to be to install Lazarus since FPC release installer is broken with the latest macOS. Once you have that and XCode command line tools installed, you need just type this in terminal:

 

fpc -Mdelphi -v mads.pas

 

If it would be useful to maintain macOS builds of MADS with each update, it can be done.

  • Thanks 1
Link to comment
Share on other sites

Does anyone knows how to fix fpc? I have a linking problem. I had latest fpc installed before Catalina came out.

 

Assembling (pipe) mp.s
Linking mp
ld: file not found: /usr/lib/crt1.10.5.o
An error occurred while linking
mp.pas(31057) Error: Error while linking
mp.pas(31057) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/local/bin/ppcx64 returned an error exitcode

Link to comment
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...