--- title: "MCEDIT" id: 54533 type: "computer_media" slug: "mcedit" url: "http://localhost/computer_media/mcedit/" markdown_url: "http://localhost/computer_media/mcedit.md" published_at: "2024-06-02T16:34:27+00:00" modified_at: "2026-03-31T21:39:30+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/06/mcedit.png" excerpt: "A compact memory editor lets you walk through RAM byte by byte, inspecting and patching machine code values interactively from the keyboard." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" genre: - name: "Programming" slug: "programming" taxonomy: "genre" url: "http://localhost/type/programming/" media_contents: - id: 51213 title: "CATS Library Tape 3" type: "computer_media" url: "http://localhost/computer_media/cats-library-tape-3/" - id: 64711 title: "Long Island Sinclair Timex (LIST) User Group Library Tape #2.2" type: "computer_media" url: "http://localhost/computer_media/long-island-sinclair-timex-list-user-group-library-tape-2-2/" media_type: "Program" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2024/06/mcedit.png" media_type_tags: "Programming" --- # MCEDIT MCEDIT is a simple machine code editor that allows the user to inspect and modify memory contents one byte at a time, starting from a user-specified address up to address 65367. For each address, it displays the current byte value and prompts the user to enter a new value or press Enter to leave it unchanged. If a new value is entered, it is converted with VAL and POKEd into memory, then the same address is redisplayed so the change can be confirmed before advancing. The upper bound of 65367 is likely chosen to stay within the usable RAM area below system variables or the display file on the target system. *** ## Program Analysis ### Program Structure The program is a minimal five-line utility with a straightforward linear flow. It collects a starting address, then iterates through memory from that address to a fixed upper limit, displaying and optionally modifying each byte. | Line | Purpose | | --- | --- | | `2–4` | REM header comments identifying the program as MCEDIT | | `10` | Prompts the user for the starting address, stored in `A` | | `20` | Begins a `FOR` loop from `A` to 65367 | | `30` | Displays the current address `I` and its byte value via `PEEK I` | | `40` | Prompts for a replacement value; POKEs if non-empty, then re-displays | | `50` | Advances to the next address | ### Key BASIC Idioms - `IF C$<>"" THEN POKE I,VAL C$: GO TO 30` — A single-line conditional that handles the edit-or-skip decision. An empty Enter press causes execution to fall through to `NEXT I`, advancing to the next address. - The `GO TO 30` after a successful POKE causes the same address to be redisplayed, providing immediate confirmation of the written value before moving on. - `VAL C$` converts the user’s string input to a numeric byte value, supporting decimal entry. - `TAB 7` in the PRINT statement provides simple column alignment between the address and byte value. ### Notable Techniques The upper loop bound of 65367 is a specific value rather than 65535, suggesting it was chosen deliberately to avoid overwriting critical system areas near the top of the 64K address space. The editor is non-destructive by default: pressing Enter without typing anything skips the current byte entirely, making it safe to browse memory without accidental modification. ### Bugs and Anomalies - No input validation is performed on `C$`. Entering a value greater than 255 or a non-numeric string will cause a BASIC error when `VAL C$` or `POKE` is evaluated. - The starting address `A` is not validated, so entering a value greater than 65367 will cause the `FOR` loop to execute zero iterations and the program will terminate immediately. - There is no way to move backwards to a previous address; the editor is strictly forward-only. ## Source Code ``` 2 REM ************************** 3 REM MCEDIT 4 REM ************************** 10 INPUT "ENTER START ADDR OF CHNGS: ";A 20 FOR I=A TO 65367 30 PRINT I;TAB 7;PEEK I 40 INPUT "ENTER CHANGE ELSE C/R";C$: IF C$<>"" THEN POKE I,VAL C$: GO TO 30 50 NEXT I ```