The picture on screen, the packed frame used by the document, and the undo ring are separate pieces of editor state. Changing one does not update the others automatically. The original transform workers make this distinction: they mark the current frame's packed copy out of date before changing pixels, then finish a history operation after the change. They do not write a PPM at the point of the edit. [1]
When a frame is packed
Page navigation and save preparation check the packed-frame flag. If it is clear, they encode the current image before continuing. The flag belongs to the document state, not to the undo ring. In the four studied builds it even sits at a different offset, so an offset taken from the American V2 release does not identify the same byte in Japanese V1. [1]
| Studio release | Mark frame unpacked | Ensure frame encoded |
|---|---|---|
| Japanese V1 | 02007D90 | 02008348 |
| Japanese V2 | 02008520 | 02008C90 |
| American V2 | 0200862C | 02008D9C |
| European V2 | 020084FC | 02008C6C |
The packer reads two bits from each working pixel and writes two 256 × 192 one-bit planes. Each plane is 6,144 bytes. Its byte layout was compared with the original ARM routine on a full-screen mixed-pixel fixture in each build. That comparison establishes the plane layout; it does not prove that a complete save and reload has been tested. [1]
Within each 32-byte row, pixel X goes to byte X >> 3 and bit X & 7. The first plane takes bit 0x80 from each working pixel; the second takes 0x40. The packer ignores the other six bits. Encoding a changed frame can also rebuild the following delta frame and update its thumbnail. [1]
Undo records
The V2 history commit compares a packed image with the current snapshot. An unchanged image does not add a duplicate entry. After undo, a new edit adjusts the 18-entry ring before recording the frame number and image. Japanese V1 carries its history work inside a different release routine; the V2 direct-commit entry point cannot simply be transferred to that build. [1]
An undo commit does not itself clear the packed-frame flag. A picture can therefore appear changed and even enter undo history while the later save path still sees an older encoded frame. The original input path marks the packed copy stale while drawing, then commits history at suitable stroke boundaries, including pen release. [1]
Display buffers
The American V2 current-pixels getter can return either the live indexed destination or a soft image waiting to be presented. The presentation routine copies the pending image and commits its palette. Writing only to the live destination while a soft image is pending can lose the change on the next presentation. This buffer choice has been traced in the original code; a full edit, undo, save and reload remains a separate integration test. [1]
History record layout
American V2 history state at 02183114 holds a separate state word, pending redo distance at +4, cursor at +8 and count at +12. The cursor wraps modulo eighteen. Eighteen halfword frame IDs begin at 02183124; their buffer pointers at 02183148; packed scratch at 02183190. Each snapshot is 12,288 bytes, containing two 6,144-byte ink planes. Lightbox, draft and preview flags do not participate in snapshot equality. [2]
Committing after undo
Writer 0200FBCC first sets the checkpoint/dirty byte through 02066608. It reconciles pending redo distance by adding that distance to the count, advancing the cursor modulo eighteen and clearing the pending distance. It searches backwards for the current frame ID with 0200F9E0, then compares all 3,072 packed words if that frame has an earlier record. Unchanged ink adds no record; another frame with identical ink still gets its own record. [2]
A changed or previously unrecorded frame advances the cursor, packs its ink, records the frame ID and increases count up to eighteen. A same-frame distance of seventeen performs an additional advance. The checked sequence of twenty distinct frame IDs followed by a change at that boundary confirms the saturated count, wrap and two-slot advance. [2]
Pending redo buffers are not simply erased. In the checked original sequence, the writer returns to the newest stored record before appending and retains intervening snapshots. Undo 0200FD30 uses the frame-aware backwards search at 0200F8E4; Redo 0200FDFC has a separate forward search. A sequence with records for frame ten, eleven and ten makes Undo skip two slots to the previous frame-ten record. The actual unpacker restores ink while preserving the current lower working flags. [2]
The executions cover complete buffers, frame IDs and cursor/count/pending state. They do not establish every stylus checkpoint boundary, complete Redo after the new sequence, or history reindexing during page insertion/deletion. European V2 writer/search addresses are 0200FB6C/0200F980; Japanese V2 uses 0200FB50/0200F964. Those mappings were checked separately from the American execution sequences. [2]
Closing the drawing menu
The drawing-menu Back control queues Close1, not Exit. American Close1 at 02063D98 calls CloseMenu(1) at 02025A84. When menu byte three equals one, it sets bytes zero and one and plays sequence fifty-six; it always clears byte three. If the editor is active it also calls CaptureStop(1), including when the menu byte was already clear. [3]
With capture active and its feature enabled, the capture controller waits, writes 0x80310010 to 04000064 and waits for bit thirty-one to clear. It starts display mode (6, 0, 1) when necessary, sets a 224-tick counter, clears its target and active flag, and preserves the separate page-slide bytes. With the feature disabled it only clears the active flag. The next-menu update can request scene six while the counter still equals 224; it does not wait for that counter to expire. [3]
Leaving without saving
The Quit toolbar path tests whether the document is dirty. A dirty image queues the unsaved-changes confirmation; a clean one leaves directly. A nonzero confirmation result retains the editor and refreshes the menu; zero leaves. Leaving is not itself a file-save operation. An empty document is treated as unchanged. In V2, a nonempty uncached image is immediately changed; a cached image is packaged for a 144-byte checkpoint comparison. Japanese V1 takes that queued comparison route for all nonempty images, without the V2 uncached shortcut. Returning to the drawing menu neither saves the file nor resets the comparison baseline. [3]
| Release | Dirty predicate |
|---|---|
| JP V1 | 02006FE8 |
| JP V2 | 020074C0 |
| US V2 | 020075F0 |
| EU V2 | 020074BC |
The queued comparison pumps/yields at checkpoint seven. These checks establish the relevant flags, branches and original comparison; they do not make every menu, capture and storage action one indivisible transaction. [3]
Redo across other pages' records
American V2 Redo 0200FDFC searches forward for a record owned by the current page. Its span may cross entries belonging to other pages. Moving the cursor by that span reduces pending forward history and increases available backward history up to the eighteen-slot capacity, then unpacks the selected image and resets rendering. Unavailable Redo returns zero instead of loading another page's pixels. A new checkpoint after Undo cancels Redo admission without requiring all old storage bytes to be erased. [4]
The original writer, packer, frame searches, Undo, Redo and unpacker were joined for repeated reversals, interleaved page ownership, a new edit after Undo and twenty-four writes through ring wrap. Every restored 49,152-byte plane was checked, including retained non-ink flags. This extends the earlier write/Undo evidence to actual forward replay. [4]
Page edits must update history ownership
Insertion reaches 0200F7A4; deletion reaches 0200F730. They visit available plus pending spans, clamped to eighteen ownership entries. Insertion changes an invalid marker to the inserted page and increments owners at or above that position. Deletion invalidates the removed page's owners and decrements later ones. Front, middle and end transactions compare all eighteen halfwords, including untouched tail entries. A complete insert, serialised checkpoint and subsequent Undo/Redo sequence remains unverified; ownership remapping alone does not establish that whole lifecycle. [4]
