Tech-Draw 2.1

Products: Tech-Draw
Date: 198x
Type: Program
Platform(s): TS 2068
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.

Content

Appears On

Related Products

High resolution black and white drawing utility inspired by MacPaint for the Apple Macintosh computer. For use with the Zebra...

Related Articles

Related Content

Image Gallery

Tech-Draw 2.1

Source Code

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top