Word Unperfect
public
Read
Owner: themaster
Branch: main
Commits: 0
Git CLI clone URL
git clone https://www.xt-emporium.com/git/word-unperfect.git
Fullscreen desktop URL
Code
Commits
History
Branches
Bug Reports
Discussions
Compare
Settings
word-unperfect
/
rev
/
wp_compact_text.h
File editor
#ifndef WP_COMPACT_TEXT_H #define WP_COMPACT_TEXT_H #include <stdbool.h> #include <stddef.h> #include <stdint.h> /* Host-port helpers for compact text/token streams observed in the * decompiled DOS source. These are deliberately small, deterministic * translations of the byte-walk behavior in: * - firmware_io_compact_transfer_step @ 3000:05ad * - firmware_io_no_op_return/firmware_io_flag_merge @ 3000:05bd/05c5 * - shell_expand_c0_escape_tokens_into_bx_buffer @ 4000:23ef */ typedef struct WpCompactStats { size_t input_bytes_consumed; size_t tokens_written; size_t bytes_written; size_t c0_word_tokens; size_t ff_tilde_escapes; size_t tilde_markers; bool hit_terminator; bool input_truncated; bool output_truncated; } WpCompactStats; void wp_compact_stats_clear(WpCompactStats *stats); /* Decode a null-terminated compact byte stream into 16-bit host tokens. * Normal bytes become their unsigned value; 0xFF becomes literal '~'; * 0x7E becomes 0xFC3A; and 0xC0 reads the following little-endian word and * advances over the four-byte C0 token envelope. The terminating zero is not * counted in *out_count, but it is written as an extra zero token when there is * capacity, mirroring the decompiled *DI = 0 tail store. */ bool wp_compact_decode_token_stream(const uint8_t *src, size_t src_len, uint16_t *out, size_t out_capacity, size_t *out_count, WpCompactStats *stats); /* Expand/canonicalize C0 escaped tokens in a byte stream. When a source byte * is 0xC0, the two-byte word at source+1 is copied and a canonical trailing * 0xC0 is emitted, then the input advances by four bytes. Non-C0 bytes copy * unchanged until the terminating zero is copied. */ bool wp_compact_expand_c0_escape_tokens(const uint8_t *src, size_t src_len, uint8_t *out, size_t out_capacity, size_t *out_len, WpCompactStats *stats); #endif
Commit message
This repository is read-only for this account.
Repository snapshot
Current branch
main
Visibility
public
Your access
Read
Remote
None
File activity
View file history