--- title: "Tech-Draw 2.1" id: 50569 type: "computer_media" slug: "tech-draw-2-1" url: "http://localhost/computer_media/tech-draw-2-1/" markdown_url: "http://localhost/computer_media/tech-draw-2-1.md" published_at: "2023-06-18T17:35:33+00:00" modified_at: "2026-03-31T22:38:16+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2023/06/SCR-20260331-qgvf.png" excerpt: "High resolution black and white drawing utility inspired by MacPaint for the Apple Macintosh computer. For use with the Zebra Graphics Interface and Graphics Tablet." 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/" - name: "Zebra Systems" slug: "zebra-systems" taxonomy: "post_tag" url: "http://localhost/tag/zebra-systems/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" genre: - name: "Graphics" slug: "graphics" taxonomy: "genre" url: "http://localhost/type/graphics/" media_type: "Program" download_url: "https://archive.org/download/timex-sinclair-software-archive/Tech-Draw%202.1%20%281985%29%28Zebra%20Systems%29%28US%29%28TS2068%29%28Program%29.zip" mediadate: "198x" producer_company: - id: 11469 title: "Zebra Systems, Inc." type: "company" url: "http://localhost/company/zebra-systems/" images: - url: "http://localhost/wp-content/uploads/2023/06/SCR-20260331-qgvf.png" - url: "http://localhost/wp-content/uploads/2023/06/Tech-Draw-2.1.jpg" related_products: - id: 24683 title: "Tech-Draw" type: "product" url: "http://localhost/product/tech-draw/" media_type_tags: "Graphics" --- *** ## Program Analysis ### Program Structure The program is organized into several functional blocks: 1. **Lines 10–44:** Initialization and device detection; loads the machine code drawing engine (`dcode`) from the previously selected storage device. 2. **Lines 52–64:** Storage device selection menu, allowing the user to choose cassette, A&J Microdrive, or Zebra disk drive. 3. **Lines 70–99:** Main menu offering Run, Customize Printer, or Customized Backup options. 4. **Lines 202–240:** Printer model selection (80-column printers). 5. **Lines 300–396:** Centronics interface selection and linefeed configuration. 6. **Lines 400–920:** Printer-specific machine code dispatch stubs, each calling a RANDOMIZE USR address before jumping to the interface menu at line 300. 7. **Lines 9910–9932:** Customized backup routine, saving both the BASIC loader and CODE block to the active device. ### Device Detection and Persistence A clever technique is used to persist the selected device number across a LOAD operation: `POKE 65535,dev` writes the device code to the last byte of the 64 KB address space before loading, and `LET dev=PEEK 65535` immediately reads it back after the program restarts. This works because a CODE load does not clear that memory location. On first run, `dev` is uninitialized (defaults to 0), so the PEEK simply recovers whatever was previously written or zero. ### Machine Code Usage The program makes extensive use of `RANDOMIZE USR` to call machine code routines for several purposes: - **Line 99:**`RANDOMIZE USR 50556` — launches the main drawing engine loaded at address 30036. - **Lines 61–63:** Addresses 55265, 55242, 55298 — configure I/O for A&J Microdrive, Zebra disk, and cassette respectively. - **Lines 382–389:** Addresses 63012–63042 — configure the active Centronics interface (Aerco, Tasman-b, Tasman-c, A&J, FDD-RS232). - **Lines 410–910:** Addresses 63024–63039 — configure the printer model (Epson, Gemini, Panasonic, Seikosha, Prowriter). The CODE block loaded as `dcode` occupies addresses 30036 through 65435 (35400 bytes), encompassing all the printer driver and drawing engine machine code. ### Printer Configuration Architecture Configuration is a two-level dispatch: the user selects a printer model first (lines 202–240), which calls a USR routine to set printer-specific parameters and then falls through to the interface menu (line 300). The interface selection (lines 382–389) then calls a second USR routine to set interface-specific parameters. This two-call design allows any printer to be paired with any supported interface, with the machine code routines handling the combination. ### FDD-RS232 Special Handling The FDD-RS232 interface option (line 389) requires additional setup beyond a simple USR call. It uses `INVERSE 1` to display a header, manipulates channel 3 with `POKE 23729,255`, `CLOSE #*3`, `POKE 23729,0`, then uses `FORMAT *":ch_a"` and `OPEN #*3;":ch_a";o` to establish the RS-232 channel — syntax consistent with a disk-based I/O extension. ### Key BASIC Idioms - **Input validation via CODE INKEY$:** Lines 57–58 read a keypress as its character code and compare against ASCII values 49, 50, 51 (‘1’, ‘2’, ‘3’), looping until a valid key is pressed. - **Case normalization:** Line 82 converts lowercase to uppercase by subtracting 32 when `i>90`, allowing either case for the main menu keys. - **Polling loop:** Line 80 uses `IF i=0 THEN GO TO 80` to busy-wait for a keypress, a standard INKEY$ polling idiom. - **Comma-only PRINT for spacing:** Lines 206 and 330 use multiple commas to advance print position without explicit AT coordinates. ### Backup Routine Lines 9910–9931 save both the BASIC program (with `LINE 10` auto-run) and the CODE block (30036, 35400) using whichever device was selected. The `dev` variable gates which SAVE syntax is used — `SAVE *` for disk, `SAVE "@..."` for Microdrive, and plain `SAVE` for tape. Note that line 9900 is referenced by the main menu (line 90: `GO TO 9900`) but is absent from the listing; execution falls through to line 9910, which is the intended behavior for the backup branch.