Question…
How do I share a basic program here without using an external site?…Brian
Question…
How do I share a basic program here without using an external site?…Brian
You can always paste the source code in a comment, between a line containing just three backticks in a row and another line containing the same, like this:
: hello ( -- ) cr ." Hello, world!" ;
Attached is a HexDump program I’ve been working on. It reads any file and displays it in Hex format. Useful to analyze binary files. Someday I’d like to expand it to a HexEditor.
It originally was created by AI. I fixed the code to work on PicoCalc, then enhanced it.
Enjoy….brian
' =========================================================
' HEXDUMP.BAS - Display a file in hexadecimal format
' Works on PicoMite MMBasic
'
' Created by AI
' Converted & enhanced by Brian Osborne
' =========================================================
Option Explicit
Begin:
Font 1
DIM filename$ = ""
Print "Enter file name to display in hex: "
Input filename$
' Check if file exists
IF NOT mm.info(Exists File filename$) THEN
PRINT "Error: File not found."
END
END IF
OPEN filename$ FOR INPUT AS #1
DIM buffer%(15) ' 16-byte buffer
DIM byteCount%, addr%, rowNum%, myFont%
DIM bytesInRow%, a$, i%
Print "Select desired font size."
Print "Normal, Small or Tiny"
Print "N, S, T ";
myFont%=0
DO
a$=Inkey$
Select Case Asc(a$)
Case 110,78 ' N
myFont%=1
bytesInRow%=8
Case 115, 83 ' S
myFont%=7
bytesInRow%=8
Case 116, 84 ' T
myFont%=8
bytesInRow%=16
End Select
Loop Until myFont%>0
Font myFont% 'Set desired font
Top:
addr% = 0
rowNum%=0
CLS
Select Case myFont%
Case 1, 7 'Normal or Small
Print "FSet Hex Bytes" String$(16," ")"ASCII"
Print String$(4,"-") " " String$(23,"-") " " String$(8,"-")
Case 8 'Tiny
Print "FSet Hex Bytes" String$(41," ") "ASCII"
Print String$(4,"-") " " String$(23,"-") " " String$(23,"-") " " String$(16,"-")
End Select
DO WHILE NOT EOF(#1)
' Start a new row of bytes
byteCount% = 0
' Read a row of bytes into buffer
FOR i% = 0 TO (bytesInRow%-1)
IF EOF(#1) THEN EXIT FOR
buffer%(i%) = ASC(INPUT$(1, #1))
Inc byteCount%
NEXT i%
' Print off-set
PRINT Format$(addr%,"%04g");
PRINT " ";
' Print hex bytes
FOR i% = 0 TO (bytesInRow%-1)
IF i% < byteCount% THEN
If i%=8 And myFont%=8 Then
Print " ";
EndIf
Print Hex$(buffer%(i%),2);
ELSE
PRINT " "; 'blanks if no data
END IF
' 1 blank between each hex pair
PRINT " ";
NEXT i%
' Print ASCII representation
PRINT " ";
FOR i% = 0 TO byteCount% - 1
IF buffer%(i%) >= 32 AND buffer%(i%) <= 126 THEN
PRINT CHR$(buffer%(i%));
ELSE
PRINT ".";
END IF
NEXT i%
' determine if screen is full
' if yes, wait for Enter or Esc
' Enter = start a new screen
' Esc = exit
rowNum% = MM.VPOS / MM.FontHeight
If rowNum% >= (MM.Height-3) Then
?@(0,(320-MM.FontHeight)) "Esc=EXIT Enter=Next Top Switch File";
Do
a$=Inkey$
Select Case Asc(a$)
Case 27 ' Esc=Exit
' ?@(0,0);
END
Case 115, 83 ' Switch File
Close #1
Clear 'All vars
CLS
GoTo Begin
Case 116, 84 ' T
Close #1
OPEN filename$ FOR INPUT AS #1
GoTo Top
Case 13 ' Enter
Exit Do
End Select
Loop
' Display next screen
CLS
EndIf
PRINT ' Move to next row
addr% = addr% + byteCount%
LOOP ' Dump complete file
CLOSE #1
PRINT "End of File"
I have written a program that uses the new V6.02.00a software to display the altitude (height in degrees) and azimuth (angle clockwise from north) of the planets. A planet that is not currently visible has a red (negative) altitude. This makes it easy to find a planet if you know where north is.
You only have to insert your GPS Positin in degrees and your UTC difference in head of the code.
It’s a work in progress.
'Solar System Object Finder
'V1.0 11.02.2026
'Peter Doerwald
'need V6.02.00
OPTION BASE 1
'GPS Koordinates degrees
Dim lat=50.19835 'negative if south
Dim long=7.85702 'negative if west
Dim zone=1 ' Timezone, here UTC+1
Dim utc$
Dim alt,az
Dim stunde%,minute%,sekunde%
Dim tag%,monat%,jahr%
Dim days%(12)=(31,28,31,30,31,30,31,31,30,31,30,31)
Dim solar$(9)=("SUN","MOON","MERCURY","VENUS","MARS","JUPITER","SATURN","URANUS","NEPTUNE")
Dim x%
CLS
Do
calcUTC
Location utc$,lat,long
Text MM.HRES/2, 6, "** Zachzig presents **", "CM", 7, 1, RGB(BLUE)
Text MM.HRES/2, 25, "Solar System Object Finder", "CM", 7, 2, RGB(CYAN)
if MM.INFO$(PLATFORM)="PicoCalc" Then
Text MM.HRES/2, 50, "UTC:"+utc$+" Bat:"+str$(MM.Info(Battery))+"% ", "CM", 1, 1, RGB(GREEN)
else
Text MM.HRES/2, 50, "UTC:"+utc$+" Bat:", "CM", 1, 1, RGB(GREEN)
endif
line 0,90,319,90,1,RGB(yellow)
Text 95, 89,"Altitude", "LB", 2, 1, RGB(WHITE)
Text 210, 89,"Azimuth", "LB", 2, 1, RGB(WHITE)
for x%=1 to 9
Text 0, x%*25+88,solar$(x%), "LB", 2, 1, RGB(YELLOW)
line 0,90+(x%*25),319,90+(x%*25),1,RGB(yellow)
Execute "Astro "+solar$(x%)+" alt,az"
if alt<0 Then
Text 95, x%*25+88,str$(alt,3,4), "LB", 2, 1, RGB(RED)
else
Text 95, x%*25+88,str$(alt,3,4), "LB", 2, 1, RGB(GREEN)
endif
Text 210, x%*25+88,str$(az,3,4), "LB", 2, 1, RGB(GREEN)
next x%
pause 1000
Loop
sub calcUTC
Local stNew%
stunde%=VAL(FIELD$(time$,1,":"))
minute%=VAL(FIELD$(time$,2,":"))
sekunde%=VAL(FIELD$(time$,3,":"))
tag%=VAL(FIELD$(date$,1,"-"))
monat%=VAL(FIELD$(date$,2,"-"))
jahr%=VAL(FIELD$(date$,3,"-"))
stNew%=stunde%-zone
'Korrektur negativ
if (stNew%<0) Then
stNew%=24+stNew%
'korrigiere Datum
tag%=tag%-1
if(tag%<1) Then
monat%=monat%-1
if (monat%<1) Then
monat%=12
jahr%=jahr%-1
endif
' Tage im Vormonat setzen (vereinfacht)
tag%=days%(monat%)
endif
endif
'Korrektur overflow
if (stNew%>23) Then
stNew%=stNew%-24
'korrigiere Datum
tag%=tag%+1
if (tag%>days%(monat%) Then
tag%=1
monat%=monat%+1
if monat$>12 then
monat%=1
jahr%=jahr%+1
endif
endif
endif
utc$=str$(tag%,2,0,"0")+"-"+str$(monat%,2,0,"0")+"-"+str$(jahr%,2,0,"0")
utc$=utc$+" "+str$(stNew%,2,0,"0")+":"+str$(minute%,2,0,"0")+":"+str$(sekunde%,2,0,"0")
END SUB
Nice Tool. I’ll try it asap