Can anybody help?

I have modified an original Visual Basic project to convert from set of binary code into a readable format. I am unsure of the actual type of code that the data file ("Mazatrol.dat") contains.

I need to be able to convert it into a language, from binary, that I will be able to understand. I do know that it is a binary version of a CNC program for controlling a machine tool.

If anybody can help modify the code, in the attached file ("Binary.zip")
I would be very grateful.

Kind Regards

Darren Smith

Dani AI

Generated

Short, practical guidance for working out what a Mazatrol.dat file actually contains and how to approach converting it.

The crucial point (echoing ) is that the on-disk structure must be known: which fields are bytes/words/longs, where text runs occur, whether values are little-endian, and whether records include checksums. ’s caution about “looks like text but might be a bitmap or mixed format” is useful—many CNC transfer files mix ASCII tokens with packed binary numbers, so neither assumption should be taken for granted.

A recommended triage:

  • Inspect the file in a hex editor (HxD, 010 Editor) and run simple tools like strings or hexdump to expose printable runs.
  • Look at the first 64–128 bytes for signatures or headers and scan for recurring fixed-length records (lots of repeating 0x00 bytes often means fixed fields).
  • Produce two small programs on the machine that differ by one parameter, capture their .dat files and diff them to find which bytes change for which logical field. That makes mapping fields to semantics much faster than blind guessing.
  • Search for trailing checksums, record separators or consistent byte offsets (those are signs of structured binary records rather than plain text G/M code).

A small VB6 utility pattern to dump printable runs and load the file into a byte array:

Dim fh As Integer, data() As Byte
fh = FreeFile
Open "Mazatrol.dat" For Binary As #fh
ReDim data(0 To LOF(fh) - 1) As Byte
Get #fh, , data
Close #fh

Dim i As Long, s As String
s = ""
For i = 0 To UBound(data)
  If data(i) >= 32 And data(i) <= 126 Then
    s = s & Chr$(data(i))
  Else
    If Len(s) >= 4 Then Debug.Print s
    s = ""
  End If
Next i

For multi-byte numeric decoding, assume Intel little-endian for PC-generated files; swap bytes if values look wrong. Build small reader functions (ushort/ulong) that assemble bytes into numbers and log offsets, raw hex, interpreted value and any ASCII nearby. Validate any reconstructed CNC text on a simulator or in the machine editor before running real hardware. As noted, community DNC/conversion tools and vendor docs sometimes exist; if the format proves proprietary, vendor documentation or an official export utility may be the only safe route.

Recommended Answers

All 3 Replies

You need to know what the format of the data file is (.dat is for data file, I assume saying it's a program is just to throw us off ;))

IOW, you need to know how each byte is defined, whether it's a byte, word, long, character, float, etc, in order to translate it. This is defined in a specification somewhere, based on the program that wrote the file.

Mazatrol.dat is not a binary file but a text file that contains probably some bitmapped representation of the data that needs to be sent to the machine tool. In order for Mazatrol.dat to be useful to you, you will have to find out what all those numbers mean, one way to find out is to read the machine's programmers' manual and find out how it is controlled. But that may be the manufacturer's prepritory (secret) information.

That was too easy !!!!

I googled CMT numeric control data file and found the source of that file:

tc

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.