srec_ascii_hex(5)
💖 srec_ascii_hex — the Ascii‐Hex file format, bestie edition 💖
Okay so real talk, this is the manual page for srec_ascii_hex from section 5 of the File Formats Manual — and it's genuinely a fun one. Buckle up 🎀
✨ NAME ✨
srec_ascii_hex — the Ascii‐Hex file format. That's it, that's the name, slay 💅
🌸 DESCRIPTION 🌸
So this format also goes by Ascii‐Space‐Hex or Ascii‐Hex‐Space — same vibe, different nickname, iykyk. And honestly? Nobody knows who invented it. The original author literally asks: if you know who invented this format, please let me know. And if you've got a better or more complete description? They'd like to know that, too 🫶
The file starts with a start‐of‐text character — that's STX, aka Control-B, aka 0x02. Everything before the STX is ignored, so anything vibing in front of it? Doesn't matter, not our problem 💀
Each data byte gets represented as 2 hexadecimal characters, followed by an "execution character". The default execution character is a space — but heads up, many programs which write this format omit the space character immediately preceding end‐of‐line. So like, don't come for them, it's a whole thing 😭
The address for data bytes is set by using a sequence of $Annnn, characters, where nnnn is the 4‐character ascii representation of the address. The comma is required — do not skip the comma, bestie, it's load-bearing fr fr. There's no need for an address record unless there are gaps. And implicitly, the file starts a address 0 if no address is set before the first data byte — cute little default, no notes ✨
The file ends with an end‐of‐text character — ETX, aka Control-C, aka 0x03. Everything following the ETX is ignored. Bye 👋 not reading that.
It's also possible to specify a running 16‐bit checksum using a sequence of $Snnnn, characters — although this usually appears after the ETX character and is thus often ignored 🙈 like, it's there, but nobody's looking at it.
🦋 Variant Forms 🦋
Okay so besides a space character, the execution character can also be:
- percent (
%) — called the "ascii‐hex‐percent" format - apostrophe (
'), or - comma (
,) — called the "ascii‐hex‐comma" format
The file must use the same execution character throughout. No mixing, no switching mid-file, pick a lane and commit 🎯
And here's the plot twist: if the execution character is a comma, the address and checksum commands are terminated by a dot (.) rather than a comma (,). The comma is not the comma in that timeline, okay?? Different universe, different separator 💫
⭐ Size Multiplier ⭐
In general, binary data will expand in sized by approximately 3.0 times when represented with this format. (Yes, the original says "expand in sized by" — we're keeping it, it's iconic in its own way. Not me fixing it. Periodt.) 💀
🔥 EXAMPLE 🔥
Here's an example ascii‐hex file, freshly served 🍓 It contains the data “Hello, World[rq]” to be loaded at address 0x1000.
^B $A1000,
48 65 6C 6C 6F 2C 20 57 6F 72 6C 64 0A ^C
Look at that. ^B to open, ^C to close, data in the middle, absolute main character energy 👑 (and yes, the leading spaces on those lines are part of the look, we're not touching them 🎀)
💜 COPYRIGHT 💜
srec_cat version 1.65 Copyright (C) 1998... Peter Miller
⚠️ Thesrec_catprogram comes with ABSOLUTELY NO WARRANTY — for details use the'srec_cat -VERSion License'command. This is free software and you are welcome to redistribute it under certain conditions — for details use the'srec_cat -VERSion License'command. (Same command both times, yes, it's giving efficient 🌈)
🧚 MAINTAINER 🧚
- Scott Finneran — E‐Mail:
scottfinneran@yahoo.com.au - Peter Miller — E‐Mail:
pmiller@opensource.org.au
And that's the whole page, bestie — sign-off time ✨
This little gem lives in the Reference Manual, it's part of SRecord, and it's filed as srec_ascii_hex(5). Go forth and parse some hex, you absolute legend 🫶💖🎀
📦 where this page comes from
- opensuse-leap 16.0: srecord 1.65.0-bp160.1.12 · GPL-3.0-or-later
- opensuse-leap 16.0: srecord 1.65.0-bp160.1.12 · GPL-3.0-or-later
- opensuse-leap 16.0: srecord 1.65.0-bp160.1.12 · GPL-3.0-or-later
- opensuse-leap 16.0: srecord 1.65.0-bp160.1.12 · GPL-3.0-or-later
- Copyright (C) 2000, 2001, 2003, 2006-2009, 2011 Peter Miller
- Copyright (C) 1998, 2006-2009, 2014 Peter Miller
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms