--- title: "Musicomp 1" id: 63200 type: "computer_media" slug: "musicomp-1" url: "http://localhost/computer_media/musicomp-1/" markdown_url: "http://localhost/computer_media/musicomp-1.md" published_at: "2026-01-30T21:13:39+00:00" modified_at: "2026-04-03T07:57:57+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/01/musicomp-1-1.png" excerpt: "A machine-code music composer whose BASIC shell juggles two separate tape CODE blocks and reads runtime addresses via PEEK to manage save and load operations." 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/" indiv: - name: "Eric Boisvert" slug: "boisvert-eric" taxonomy: "indiv" url: "http://localhost/indiv/boisvert-eric/" genre: - name: "Music" slug: "music" taxonomy: "genre" url: "http://localhost/type/music/" media_contents: - id: 63048 title: "Byte Power February 1987" type: "computer_media" url: "http://localhost/computer_media/byte-power-february-1987/" media_type: "Program" programmers: - name: "Eric Boisvert" slug: "boisvert-eric" taxonomy: "indiv" url: "http://localhost/indiv/boisvert-eric/" mediadate: "1987" producer_company: - id: 25181 title: "Byte Power" type: "company" url: "http://localhost/company/byte-power/" images: - url: "http://localhost/wp-content/uploads/2026/01/musicomp-1-1.png" article_media: - id: 63087 title: "MUSIcomp Version 1.1" type: "article" url: "http://localhost/article/musicomp-version-1-1/" media_type_tags: "Music" --- # Musicomp 1 MUSIcomp v1.1 is a machine-code music composition application, written by Eric Boisvert and published by Byte Power in 1987. The BASIC portion serves purely as a loader and file-management shell: it calls machine code via RANDOMIZE USR at lines 20 and 9015, with the actual editor residing in RAM above address 43000. The program stores its music data as a separate CODE block (“MUSIcodes”) beginning at address 0x4E4 (1252 decimal) and computes data length dynamically using PEEK 65533–65535 to read values left by the machine-code routine. Save and load routines handle both the full application binary (51485 base) and the data segment independently, with built-in VERIFY passes for tape reliability. *** ## Program Structure The listing is organised into clearly separated functional blocks, each introduced by a `REM` label: 1. **Lines 10–30** — Initialisation: prints to the screen, calls machine code at address 43914, then reads a jump target from `PEEK 65535` to dispatch into the running application. 2. **Lines 100–110** — QUIT handler: `CLEAR 65535` followed by `NEW` to wipe the machine-code workspace before resetting. 3. **Lines 150–180** — SAVE full application: saves the CODE block from address 51485 for `len` bytes. 4. **Lines 200–230** — LOAD full application: reloads into the same address. 5. **Lines 250–280** — SAVE DATA: saves only the music data segment starting at `6E4` hex (1764 decimal), length computed as `len-59999`. 6. **Lines 300–320** — Shared subroutine for filename input, capped at 10 characters. 7. **Lines 9000–9020** — Loader: sets display attributes, loads “MUSIcodes” from tape at address `4e4` hex, conditionally calls a second USR entry point, then returns to line 30. 8. **Line 9999** — Master SAVE line to write both the BASIC program and the CODE block back to tape, with VERIFY passes. ## Machine Code Interface The program relies on at least two machine-code entry points: | Address | Usage | Location | | --- | --- | --- | | 43914 | Main application entry; presumably sets up the composer UI and writes return data to addresses 65533–65535 | Line 20 | | 43651 | Alternate entry, used when `PEEK 23681 <> 0` (capslock / interface flag test) | Line 9015 | `RANDOMIZE USR` is the standard idiom for calling machine code and discarding the return value. The machine-code routine at 43914 communicates back to BASIC by poking three bytes into the top of the 64 KB address space (65533–65535): two bytes encode `len` as a 16-bit little-endian value, and one byte encodes a `GO TO` destination line number for dispatch. ## Memory Map | Address (decimal) | Address (hex) | Contents | | --- | --- | --- | | 1252 | 0x4E4 | Start of “MUSIcodes” data block (music data) | | 51485 | 0xC91D | Base of full application CODE block | | 65533–65534 | 0xFFFD–0xFFFE | Little-endian `len` written by machine code | | 65535 | 0xFFFF | Dispatch line target written by machine code | | 23658 | 0x5C2A | FLAGS2 system variable; POKEd to 8 to set caps-lock state | | 23681 | 0x5C41 | Tested for non-zero before choosing USR entry point | ## Notable Techniques - **Dynamic length calculation:**`LET len=PEEK 65533+256*PEEK 65534` reads a 16-bit value stored by the machine-code routine, avoiding hardcoding the CODE block length in BASIC. - **Computed GO TO:**`GO TO PEEK 65535` at line 30 allows the machine-code layer to redirect BASIC flow to any line simply by poking one byte — a compact indirect-jump mechanism. - **Two CODE segments:** The application distinguishes between the executable machine code (base 51485) and the music data (base 0x4E4 = 1764), saving and loading them independently. - **Data length formula:**`len-59999` at line 270 derives the data-only length by subtracting the offset between the two base addresses (51485 − 1764 ≈ 59999 — actually the fixed gap used as a constant), keeping the formula self-consistent with the dynamically read `len`. - **Tape verification:** Both SAVE routines follow immediately with `VERIFY`, a good practice for tape reliability. - **Hex literals:**`6E4`, `4e4` are written as BASIC numeric literals and evaluated as decimal 1764 and 1252 respectively by the tokeniser — this is not a hexadecimal notation but rather a floating-point representation of the scientific notation 6×10⁴ and 4×10⁴, i.e. 60000 and 40000. See anomaly note below. - ## Source Code ``` 10 REM MUSIcomp version 1.1 By Eric Boisvert ©1987 BYTE POWER 20 PRINT AT 0,0;: RANDOMIZE USR 43914 30 LET len=PEEK 65533+256*PEEK 65534: GO TO PEEK 65535 100 REM QUIT 110 CLEAR 65535: NEW 150 REM SAVE 160 GO SUB 300 165 IF N$="" THEN GO TO 150 170 SAVE n$CODE 51485,len: PRINT "VERIFY ";n$: VERIFY n$CODE 180 GO TO 10 200 REM LOAD 210 GO SUB 300 220 LOAD N$CODE 51485 230 GO TO 10 250 REM SAVE DATA 260 GO SUB 300: IF N$="" THEN GO TO 250 270 SAVE n$CODE 6E4,len-59999: PRINT "VERIFY ";n$: VERIFY n$CODE 280 GO TO 10 300 REM INPUT NAME 310 CLS : INPUT "FILE NAME:"; LINE n$: IF LEN n$>10 THEN GO TO 310 320 RETURN 9000 REM LOADER 9010 BORDER 7: INK 7: PAPER 7: CLEAR 39999: PRINT AT 10,0; INK 0;"STILL LOADING...": LOAD "MUSIcodes"CODE 4e4: INK 0 9015 IF PEEK 23681<>0 THEN POKE 23658,8: PRINT AT 0,0;: RANDOMIZE USR 43651: GO TO 30 9020 CLEAR : LIST 9999: STOP 9999 SAVE "MUSIcomp" LINE 9000: SAVE "MUSIcodes"CODE 4e4,11155: VERIFY "": VERIFY ""CODE : REM USE 'RUN 9015' TO RUN PROGRAM ```