Skip to content

blanknut/turtle41

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HP-41 Turtle Graphics

Introduction

This project implements an HP‑41 Turtle Graphics program inspired by Marcel Sutter's Programmieren mit hochauflösender Grafik [1]. Jens Kirchhoff adapted the idea in C [2], and Peter Hess ported it to the HP‑41 with interactive parameter prompts. This implementation builds on Hess's version with an updated user interface and roughly 1.5× faster execution.

Sutter converted Logo examples into BASIC; the Logo routine used here is, for example:

TO GRAPHICS :COUNT :SIDE :ANGLE :GAIN
  REPEAT :COUNT [
    FORWARD :SIDE LEFT :ANGLE
    MAKE 'SIDE SUM :SIDE :GAIN
  ]
END

Run the example in JSLogo and add these lines to demo it:

CLEARSCREEN
GRAPHICS 200 30 119 3

Requirements

To use this program on an HP‑41, you need either:

  • A real plotter (for example, an HP‑7470A Option 003 with an HP‑IL interface) or
  • A PIL‑Box and the pyILPER application.

A compatible HP‑IL module (HP 82160A) is also required. In principle, the program should work with plotters using HP‑IB or RS‑232‑C interfaces; these configurations were not tested due to unavailable interface modules (82169A and 82164A).

If you have a Systemyde 41CL calculator, the program runs reasonably fast in TURBO50 mode. On other Series‑41 calculators, expect slower performance.

Usage

These instructions assume pyILPER with a PIL‑Box.

  1. Mount the LIF image bin/turtle.dat in pyILPER.
  2. Load the program into your HP‑41 calculator: "TURTLE" XEQ "READP"
  3. Select your plotter as the default output device (e.g., 3 XEQ "SELECT").
  4. Initialize parameters and settings: XEQ "TURTLE".
  5. Switch to USER mode and ensure the top row of keys has no conflicting assignments.
  6. Press the LN key (XEQ E) to plot the default graphic.
  7. Enter the number of lines (e.g., 200) and press [R/S]. If no number is entered, the default is used.
  8. After the drawing completes, change parameters L0, dL, PHI0, dPHI with XEQ A–D. Enter a value and press [R/S] to apply it; if no value is entered, the parameter remains unchanged.
  9. Return to step 6.

Turtle program - magnetic card

Examples

Changing parameters — especially dPHI — produces many variations. Example parameter sets:

  • L0=400 (default), dL=20 (default), dPHI=123, #Lines=300
    Graphics #1

  • L0=400, dL=20, dPHI=72.5, #Lines=200
    Graphics #2

  • L0=400, dL=20, dPHI=87, #Lines=250
    Graphics #3

  • L0=400, dL=50, dPHI=157, #Lines=150
    Graphics #4

  • L0=50, dL=2, dPHI=9, #Lines=250
    Graphics #5

  • L0=1000, dL=60, PHI0=90, dPHI=117, #Lines=80 (red pen)
    L0=1050, dL=60, PHI0=85, dPHI=117, #Lines=80 (blue pen)
    Graphics #6

Remarks

Two main optimizations were applied to improve speed over Hess's original:

  1. Use P-R to convert polar to rectangular coordinates.
  2. Use DSE to control the drawing loop.

Note about DSE: the decrement register is typically formatted as _iiiii.fffcc_, where iiii is the current counter, fff is the test value, and cc is the increment/decrement. If you decrement an integer (with fff and cc equal to zero), DSE still decrements the register by 1 — allowing a simple countdown.

References

  1. Sutter, Marcel (1984). Programmieren mit hochauflösender Grafik. Mikro+Kleincomputer, Informa Verlag.
  2. Kirchhoff, Jens. "Stiftplot‑Kunstfigur HP7550", YouTube (uploaded by jenskirchhoff8139), Oct 10, 2021. https://youtu.be/at0Kr-1IIGc

About

HP-41 Turtle Graphics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published