Yoga Breathing (Pranayama)
- Type
- Other
- Category
- Relaxation and breathing timer
- Author
- Len Dorfman and Jerry White
- Published in
- Antic, October 1985 (Vol. 4, No. 6)
- Year
- 1985
- Language
- Atari BASIC
- Requirements
- Any Atari 8-bit computer, any memory size, Atari BASIC, joystick in port 1; disk or cassette
- Tags
- antic, health, relaxation, timer, joystick, display-list, countdown-timer, jerry-white, 1985
About the program
"Your guru, the Atari," said Antic's headline in October 1985. Yoga Breathing is a timer for pranayama, the yoga breathing practices, and in particular slow, even diaphragmatic breathing for relaxation. The article spent most of its length on technique. Push the abdomen out to draw air into the lower lungs, where most of the blood flow is, rather than lifting the chest. Breathe through the nose, smoothly and without pauses. People with respiratory illnesses should check with a doctor first, and the slower ratios were for advanced students working with a qualified teacher. It recommended The Science of Breath by Swami Rama, R. Ballentine and A. Hymes for further reading.
Len Dorfman was a high-school teacher and a fast machine-language programmer who, the magazine said, "never really learned BASIC". He first sent the program in as a long assembler listing. Antic asked for a BASIC version, and the published program credits both Dorfman and Jerry White.
Typing it in
Most lines are plain text. A few screen strings contain inverse-video characters: {inv} … {/inv} means press the Atari (inverse) key before and after. Line 180 (GOTO 500+OFS) and line 200 use computed GOTOs, which Atari BASIC allows. Don't renumber the 500s and 600s, because each parameter's line number depends on its screen row. Antic printed TYPO II checksums beside each line of the magazine listing. They are not part of the program.
How to use it
The screen shows PRANAYAMA (the Sanskrit name) and five settings: SOUND, COUNT, INHALE, RETAIN and EXHALE. Push the stick up or down to choose a setting, and left or right to change it. The one you're editing grows to double height. Press the trigger to start.
The article's suggested first session: SOUND on, COUNT 10, INHALE 4, RETAIN 0, EXHALE 4. The program then shows INHALE for about four seconds, skips RETAIN, and shows EXHALE for four seconds, ten times over, which is about 80 seconds of practice. When that feels easy, set COUNT to 40, and gradually slow both phases towards ten seconds each.
How it works
- Seconds from the OS. The one-second routine (lines 40–80) POKEs 59 into location 540, one of the OS countdown timers, which decreases every 1/60 second. It loops until it reaches zero, so timing doesn't depend on how fast BASIC runs.
- Fading cues. In the last second of each phase, the timer's remaining value is POKEd into the text colour register (709), so the command word fades smoothly to black (lines 64–66).
- Double-height highlight. The program changes one display list byte from ANTIC mode 6 to mode 7 (
POKE DL+OFS,7, line 300). That row instantly becomes double height without anything being reprinted.
Listing
1 REM BREATHE
2 REM BY LEN DORFMAN AND JERRY WHITE
3 REM (c) 1985, ANTIC PUBLISHING
10 GOSUB 7000:GOTO 100
30 REM ONE SECOND SUBROUTINE
40 IF SFLG THEN SOUND 0,PITCH,2,8
50 POKE 709,15:POSITION 6,21:? #6;PHASE$:REM WHITE COMMAND DISPLAY
60 SOUND 0,0,0,0:FOR TICK=1 TO SECS:POKE 540,59:REM APPROX 1 SEC COUNTDOWN
62 IF TICK<>SECS THEN 70:REM NOT LAST SEC
64 WAIT=PEEK(540):IF WAIT>15 THEN 64
66 POKE 709,WAIT:IF WAIT THEN 64:REM FADE COMMAND COLOR
68 NEXT TICK:RETURN
70 IF PEEK(540) THEN 70:REM COUNTDOWN INCOMPLETE SO LOOP HERE
80 GOTO 68:REM DO IT AGAIN
95 REM RESET DISPLAY
100 OFS=10:OLD=10:POKE DL+10,7
102 REM RESET COLORS AND TURN ON SCREEN
105 POKE 712,160:POKE 710,156:POKE 709,160:POKE 708,28:POKE 711,188:POKE 559,34
108 REM JOYSTICK UPDATE
110 JS=STICK(0):IF NOT STRIG(0) THEN 800:REM TRIGGER PRESSED
115 IF JS=15 THEN 110:REM NOTHING TO DO
120 IF JS=13 THEN OLD=OFS:OFS=OFS+3:IF OFS=25 THEN OFS=10:REM STICK DOWN
140 IF JS=14 THEN OLD=OFS:OFS=OFS-3:IF OFS=7 THEN OFS=22:REM STICK UP
160 IF JS<>7 AND JS<>11 THEN 300:REM STICK NOT LEFT OR RIGHT
170 B$=" ":REM CLEAR WORK STRING
180 IF JS=7 THEN GOTO 500+OFS:REM STICK RIGHT
200 GOTO 600+OFS:REM JS=11 STICK LEFT
250 REM SCREEN UPDATE AND NOISE
300 POKE DL+OLD,6:POKE DL+OFS,7:REM OLD LINE SMALL, NEW LINE BIG
350 REM AUDIO FEEDBACK & DELAY
400 SOUND 0,OFS*2,10,8:JIF=20
405 POKE 540,JIF:SOUND 1,0,0,0:SOUND 0,0,0,0
410 IF PEEK(540) THEN 410
415 GOTO 110
420 REM ERROR NOISE
430 FOR VOL=15 TO 0 STEP -0.5:SOUND 0,102,12,VOL:SOUND 1,51,12,VOL:NEXT VOL
440 JIF=30:GOTO 405
500 REM VALIDITY CHECK & UPDATE
510 IF S$(12,14)=" ON" THEN 430
511 S$(12,14)=" ON":GOTO 700
513 IF COUNT=99 THEN 430
514 COUNT=COUNT+1:GOTO 713
516 IF INHALE=60 THEN 430
517 INHALE=INHALE+1:GOTO 716
519 IF RETAIN=60 THEN 430
520 RETAIN=RETAIN+1:GOTO 719
522 IF EXHALE=60 THEN 430
523 EXHALE=EXHALE+1:GOTO 722
610 IF S$(12,14)="OFF" THEN 430
611 S$(12,14)="OFF":GOTO 700
613 IF COUNT=1 THEN 430
614 COUNT=COUNT-1:GOTO 713
616 IF NOT INHALE THEN 430
617 INHALE=INHALE-1:GOTO 716
619 IF NOT RETAIN THEN 430
620 RETAIN=RETAIN-1:GOTO 719
622 IF NOT EXHALE THEN 430
623 EXHALE=EXHALE-1:GOTO 722
700 GOSUB 9000:GOTO 405
710 REM UPDATE SCREEN STRING S$
713 S$(73,74)=B$:B$=STR$(COUNT):LB=LEN(B$):S$(75-LB,74)=B$:GOTO 700
716 S$(133,134)=B$:B$=STR$(INHALE):LB=LEN(B$):S$(135-LB,134)=B$:GOTO 700
719 S$(193,194)=B$:B$=STR$(RETAIN):LB=LEN(B$):S$(195-LB,194)=B$:GOTO 700
722 S$(253,254)=B$:B$=STR$(EXHALE):LB=LEN(B$):S$(255-LB,254)=B$:GOTO 700
790 REM SETUP FOR BREATH CYCLE
800 POKE DL+OFS,6:REM MAKE LARGE LINE SMALL
801 SFLG=0:IF S$(13,14)="ON" THEN SFLG=1:REM SET SOUND FLAG
802 POKE 711,164:POKE 710,164:POKE 708,164:POKE 712,0:REM RESET COLORS
803 REM BREATH CYCLE LOOP
804 FOR TIME=1 TO COUNT:B$=STR$(COUNT-TIME+1):LB=LEN(B$)
805 REM UPDATE COUNT DISPLAY
806 POSITION 11,8:? #6;" ";:POSITION 14-LB,8:? #6;B$;
809 REM PHASE$=COMMAND
810 IF INHALE THEN PHASE$="inhale":SECS=INHALE:PITCH=0:GOSUB 40
820 IF RETAIN THEN PHASE$="retain":SECS=RETAIN:PITCH=1:GOSUB 40
830 IF EXHALE THEN PHASE$="exhale":SECS=EXHALE:PITCH=2:GOSUB 40
890 NEXT TIME:OFS=10
900 GOSUB 9000:GOTO 100:REM RESET SCREEN & START OVER
1000 REM INITIALIZATION
7000 GRAPHICS 17:POKE 559,0:? #6:? #6;" {inv}PRANAYAMA{/inv}"
7100 DL=PEEK(560)+PEEK(561)*256:REM DL=ADR OF DISPLAY LIST
7200 OFS=10:REM OFFSET TO DL LINE
7300 POKE DL+6,7:POKE DL+26,7:REM LARGE TEXT LINES
8000 DIM S$(254):S$=" ":S$(254)=" ":S$(2)=S$:REM SCREEN OPTION DISPLAY
8010 DIM PHASE$(6):PHASE$=" ":REM CURRENT PHASE OR COMMAND
8020 DIM B$(2):B$=" ":REM BLANK WORK STRING
8100 S$(6,14)="{inv}sound{/inv} ON"
8110 S$(66,74)="{inv}count{/inv} 1":COUNT=1
8120 S$(126,134)="{inv}inhale{/inv} 1":INHALE=1
8130 S$(186,194)="{inv}retain{/inv} 0":RETAIN=0
8140 S$(246,254)="{inv}exhale{/inv} 1":EXHALE=1
8900 REM DISPLAY/SOUND SUBROUTINE
9000 SOUND 0,(OFS-10)/3,2,1:POSITION 0,5:? #6;S$;:SOUND 0,0,0,0:JIF=0:RETURN
Download
The original program from the Antic disk, to LOAD or ENTER instead of typing it: BREATHE.BAS.
Credits
- Program listing: Yoga Breathing (Pranayama) — program listing (Antic, October 1985 (Vol. 4, No. 6)) — Len Dorfman and Jerry White
- Picture: The settings screen. The parameter being changed is shown in double-height text. — Len Dorfman and Jerry White (program); screenshot by the site
- Antic, October 1985 - Vol. 4 No. 6: scan of the printed magazine, PDF pages 44-45 (article) — Internet Archive, 1985
- Antic disk, October 1985 - Vol. 4 No. 6: BREATHE.BAS (detokenized listing) — Len Dorfman and Jerry White, 1985
