dMZX Forums: ANSI -> MZX -> ANSI Conversion - dMZX Forums

Jump to content

If you are new to DMZX, please take the time to look over the FAQ pinned in General before asking a question.

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

ANSI -> MZX -> ANSI Conversion Is there ANSI conversion software?

#1 User is offline   hseiken 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 29
  • Joined: 05-March 20
  • Gender:Not Telling
  • Location:Earf

Posted 20 December 2020 - 03:47 PM

I was curious if there's any software that converts an exported MZX board to ANSI/XBIN/ASC file and also, hopefully, back to an MZX board? I understand there's a lot more going on in an MZX character set, so I wouldn't expect an ANSI to be created if the MZX board uses custom edited character set, but having it export color data and character number would still be possible.

So did I miss a tool that does this in the tools section? Thanks for any fingers pointing in the right direction.
There is no Data, only Zuul.
1

#2 User is offline   Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,904
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 21 December 2020 - 11:33 AM

DOS versions of MZX had options for importing/exporting ANS files but support for it was dropped from the port due to improvements to the MZM format and (probably) general lack of interest.

If it's something you'd find useful an MZM<->ANS converter should be possible. If there's enough interest it could be bundled with MZX like ccv/png2smzx/checkres/etc (though I think this is the first time it's ever been brought up since Exo dropped ANS support).
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository
1

#3 User is offline   smilymzx 

  • Those Goodie-Goodies!
  • PipPipPip
  • Group: Members
  • Posts: 349
  • Joined: 25-October 03
  • Gender:Male
  • Location:I.M.MEEN's book

Posted 22 December 2020 - 05:57 AM

View PostLachesis, on 21 December 2020 - 03:33 AM, said:

DOS versions of MZX had options for importing/exporting ANS files but support for it was dropped from the port due to improvements to the MZM format and (probably) general lack of interest.

If it's something you'd find useful an MZM<->ANS converter should be possible. If there's enough interest it could be bundled with MZX like ccv/png2smzx/checkres/etc (though I think this is the first time it's ever been brought up since Exo dropped ANS support).


This sounds like a good idea to add a ANSi <-> MZM format converter to the list of tools, It helps me very much too.

This post has been edited by smilymzx: 22 December 2020 - 05:59 AM

SmilyMZX, A.K.A. Hamtaro126 (A.K.A. AtariHacker)

I am at:

Z2 - ZZT forums, NESDEV Forums, SMW Central (Super Mario World)

Other interests:

Museum of ZZT, NESDEV Wiki, Wiki of Weavers (ZZT-related!)
0

#4 User is offline   Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,904
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 23 December 2020 - 03:33 AM

I gave the implementation from 2.70 a look and it would probably be trivial to just restore the old code. I'd drop the "full board" version and make it placement import/block export like MZM—there's not much of a point to the full board version and it'd clutter up the import/export selection with duplicate options for a feature that TBH I still consider very niche (besides, ANSi does not store anything remotely close to the amount of data a board requires).

Digging through the old ANSi import functionality also reminded me of something that's been missing for a while, which is a layer-format MZM type selection menu (ANSi import had this but it was not copied over to MZM2 import for some reason).
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository
0

#5 User is offline   Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,904
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 27 December 2020 - 06:42 AM

My progress on reimplementing this is here. I just took the DOS ANSi import/export code and (heavily) refactored it. Everything that was overtly wrong with it should be fixed but I've only tested this on a limited number of existing ANSi art files. I also added limited SAUCE support and a prescan to get the correct width/height before importing. Once again, import with Alt+I and export by selecting a block (Alt+B). Most of what's missing at this point should be edge case (or unsupportable) escape codes. It could also really use some input file validation (nothing I've tried so far causes any breakage but you can e.g. load an MZX world as an ANSi file...).

Windows x86 test build.
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository
0

#6 User is offline   hseiken 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 29
  • Joined: 05-March 20
  • Gender:Not Telling
  • Location:Earf

Posted 27 December 2020 - 11:34 PM

View PostLachesis, on 27 December 2020 - 01:42 AM, said:

My progress on reimplementing this is here. I just took the DOS ANSi import/export code and (heavily) refactored it. Everything that was overtly wrong with it should be fixed but I've only tested this on a limited number of existing ANSi art files. I also added limited SAUCE support and a prescan to get the correct width/height before importing. Once again, import with Alt+I and export by selecting a block (Alt+B). Most of what's missing at this point should be edge case (or unsupportable) escape codes. It could also really use some input file validation (nothing I've tried so far causes any breakage but you can e.g. load an MZX world as an ANSi file...).

Windows x86 test build.


Import has worked for me on this test build, but I don't see export option. Is there a different menu other than ALT+X?

EDIT: I see it's in the block menu. Cool.

This post has been edited by hseiken: 27 December 2020 - 11:35 PM

There is no Data, only Zuul.
1

#7 User is offline   hseiken 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 29
  • Joined: 05-March 20
  • Gender:Not Telling
  • Location:Earf

Posted 27 December 2020 - 11:47 PM

It almost works I think, but there's a caveat...PabloDraw doesn't always decode ANSI proper either, so I am unsure if this is PabloDraw pooping it's pants or the export not quite handling what to do at the last column. This is an 80x25 ANSI style image made in MZX.

I tried to also attach the exported file, but no dice. Instead, attached is an MZX world I've been doodling BBS/ANSI art in which might be useful for testing and where the pablowdraw image came from.

As far as I recall, it doesn't have any background color usage into the blinking ones, so if testing bg color 8 and above, nothing in this mzx will be useful. I hope this file will be of some use in the efforts of ASNI import/export bug squashing.

Attached File(s)


There is no Data, only Zuul.
1

#8 User is offline   Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,904
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 28 December 2020 - 12:06 AM

I suspect what's happening there is MZX unconditionally inserts line ends at the end of the ANSi lines and that program is wrapping and then skipping another line due to the line ends (this might be why the DOS implementation of ANSi export limited the image to 78 or 79 characters wide...). Any suggestions on how to address this without removing the ability to export ANSi >80 chars wide (e.g. a SAUCE flag I missed)?

edit: something that might help as long as the SAUCE record stays intact on exported ANSi files is width >=80 exports could just drop the line ends altogether (and if the SAUCE record is removed... that's what the 'force wrap' option is for :)).

This post has been edited by Lachesis: 28 December 2020 - 12:17 AM

"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository
0

#9 User is offline   hseiken 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 29
  • Joined: 05-March 20
  • Gender:Not Telling
  • Location:Earf

Posted 28 December 2020 - 12:32 AM

I think if sauce tells the viewer it's 80 columns, then ignoring line break export is probably the best way to go. I don't know what was popular/acceptable in the technical side of things, but if it works, it works. I personally aren't looking for super duper accurate import export, but something that mostly gets the job done. I could easily edit the line breaks myself, but if I'm exporting something that's 200+ lines, that might be more hassle than it's worth.

I leave it up to the guru's to make decisions like this. Hopefully SmilyMZX can chime in if they have input on the matter or are more technically inclined in this matter. Thanks for looking into this, btw.
There is no Data, only Zuul.
0

#10 User is offline   hseiken 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 29
  • Joined: 05-March 20
  • Gender:Not Telling
  • Location:Earf

Posted 28 December 2020 - 12:42 AM

I did a couple more export tests from boards in that world i posted, some are losing color data. So far, none of lost character data or positioning (other than the line break issue pointed out).
There is no Data, only Zuul.
0

#11 User is offline   Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,904
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 29 December 2020 - 09:15 AM

The bug is because when a SGR reset is issued the temporary copy of the current color wasn't getting reset, so if e.g. bold was cleared but the color went from light blue to dark blue then it would accidentally be left as grey in the exported ANSi file. I've fixed that bug and will upload an updated build when I get a chance.
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository
0

#12 User is offline   Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,904
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 29 December 2020 - 11:34 PM

Here's an updated build (all it fixes is the reset bug, the line wrapping hasn't been changed...): mzxgit-x86.zip.
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository
0

#13 User is offline   hseiken 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 29
  • Joined: 05-March 20
  • Gender:Not Telling
  • Location:Earf

Posted 30 December 2020 - 12:57 AM

Speaking of line wrapping, I did an export testing 79 columns (left the right most column deselected) and it still inserted an extra line. I was thinking about it from ANSI point of view in that CR I think is a character, but I might be wrong about that. Is that something that, say, could be 'injected' at the end of a selection block? i.e. block width is 60, so it's 61 when exported with the 61st column being a carriage return? I'm not sure if that's the best solution here, nor do I know if it just will introduce more problems...



EDIT: Tested some exports and the colors seem to be correctly exported now. Sweet!

This post has been edited by hseiken: 30 December 2020 - 01:02 AM

There is no Data, only Zuul.
1

#14 User is offline   Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,904
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 30 December 2020 - 01:31 AM

I've done some experimenting and it looks like the vast majority of test ANSi files I have with widths >=80 expect wrapping to occur automatically as soon as the cursor reaches the SAUCE width with no line ends. I don't have very many test files with SAUCE widths <80 though (just one right now and it doesn't force wrap). I'll adjust both the import and export functions to account for this once I've found some more smaller ANSi files to test.

edit: I had this tab open for a while and didn't see your reply. I think adding 1 to the SAUCE columns value of the exported ANSi would be a valid workaround (the scan would have to differentiate between the SAUCE width and the actual observed image size to make sure it clears the correct area but that isn't a big deal).

This post has been edited by Lachesis: 30 December 2020 - 01:35 AM

"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository
0

#15 User is offline   Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,904
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 30 December 2020 - 03:21 AM

Okay, after finding some FILE_ID.ANS files that use wrapping on 16colo.rs and RTFM for SAUCE (again) I've realized that the SAUCE width field is definitely supposed to be the terminal width, i.e. every ANSi file with that SAUCE field set should always wrap at that value. For now I've changed export to omit line ends for ANSi files (they should still be inserted in TXT exports). This means TYPE/iconv probably won't display these properly unless the terminal window is manually adjusted to the correct size but presumably that's really easy to patch with an ANSi editor.

Test build 3. (note: I left trace logging enabled for this build to hopefully give insight into the scan/wrapping operations MZX is performing in case something goes horribly wrong.)

This post has been edited by Lachesis: 30 December 2020 - 03:23 AM

"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository
0

#16 User is offline   Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,904
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 08 January 2021 - 05:43 AM

Hi, just checking in—does the most recent build fix the issues you were encountering? If so I can go ahead and finish merging this patch (and if not, I can try to fix things some more).
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository
0

#17 User is offline   hseiken 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 29
  • Joined: 05-March 20
  • Gender:Not Telling
  • Location:Earf

Posted 11 January 2021 - 09:28 AM

View PostLachesis, on 08 January 2021 - 12:43 AM, said:

Hi, just checking in—does the most recent build fix the issues you were encountering? If so I can go ahead and finish merging this patch (and if not, I can try to fix things some more).



It appears it's working fine, yes. Thanks!
There is no Data, only Zuul.
1

#18 User is offline   Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,904
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 13 January 2021 - 02:06 AM

I did find another bug related to line breaks in very old ANSi files created by MZX without SAUCE records. I fixed that and went ahead and merged ANSi support. If you run into more issues, please let me know.
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository
0

#19 User is offline   hseiken 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 29
  • Joined: 05-March 20
  • Gender:Not Telling
  • Location:Earf

Posted 13 January 2021 - 03:05 AM

View PostLachesis, on 12 January 2021 - 09:06 PM, said:

I did find another bug related to line breaks in very old ANSi files created by MZX without SAUCE records. I fixed that and went ahead and merged ANSi support. If you run into more issues, please let me know.


:)
There is no Data, only Zuul.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users