Shop OBEX P1 Docs P2 Docs Learn Events
BS1 Pocket Watch with a new trick — Parallax Forums

BS1 Pocket Watch with a new trick

TimCTimC Posts: 77
edited 2021-10-13 00:27 in BASIC Stamp

Cleaning out the Attic this weekend I found an old BS1. Wanted to see if it still worked so I attached a Pocket Watch B and success! Changed some old demo code and discovered the BS1 can do Debug formatting

First Declare the Missing Constants BS2, BS2pe, BS2px, BS2p24 and others have:
SYMBOL CursorHome=1 'Move cursor Home, Don't Clear
SYMBOL MoveToXY=2 'Followed by Column #, Line #
SYMBOL CursorLeft=3 'Move cursor one character Left
SYMBOL CursorRight=4 'Move cursor one character Right
SYMBOL CursorUp=5 'Move cursor one character Up
SYMBOL CursorDown=6 'Move cursor one character down
SYMBOL Bell=7 'Make a Sound on the Terminal
SYMBOL BackSpace=08 'Back up cursor to left one space
SYMBOL CursorTab=9 'Tab
SYMBOL LineFeed=10 'LF
SYMBOL ClearToRight=11 'Clear line contents to the right of cursor
SYMBOL ClearDown=12 'Clear screen contents below cursor
SYMBOL MoveToCol=14 'Followed by Col #
SYMBOL MoveToLine=15 'Followed by Line #

Next Declare Variables to hold the constants:
SYMBOL FmtA=B10 ' For debug formatting
SYMBOL FmtB=B11 ' More debug formatting

Last Assign as needed:
LET FmtA = CursorTab ' alignment
LET FmtB = Bell ' windows Bell sound

Three Code snippets pulled from SimpleClock.bs1 below:
LET FmtA = BackSpace ' used to remove space after DurH
DEBUG "Alarm Type:",#Type,"Dur:",#DurH,#@FmtA,":",#DurL,CR
'-------------------------------------------------------
PrintTimeDate:
LET FmtA = BackSpace ' used for formatting
DEBUG #hh,#@FmtA
IF mm > 9 THEN BigMin
DEBUG ":0",#mm,#@FmtA
GOTO ResumeMin
BigMin:
DEBUG ":",#mm,#@FmtA
ResumeMin:
'-------------------------------------------------------
Column0:
LET FmtA = MoveToCol ' reset to col 0
FmtB = 0
DEBUG #@FmtA,#@FmtB
RETURN
'-------------------------------------------------------

Regards
Tim

Edit: Added examples, No digging through the program

Comments

Sign In or Register to comment.