[Coco] OS9 HEX to DECIMAL conversion.
coco at jechar.ca
coco at jechar.ca
Sat Jun 2 15:31:49 EDT 2018
I have created the Final Version.
All features implemented, let me know If there are any
issues I have overlooked.
10 ON ERROR GOTO 1000
20 IF a="-?" THEN
IF af="=" THEN
IF al=0 THEN
REM Data Verification
IF al>=4 THEN
FOR i=1 TO al
IF ((ad<"0") OR (ad>"9")) THEN
ON ERROR GOTO 139
INPUT #fp1," Reading Zero Drive Base Offset Data ... ",zb
PRINT "Alternate Base Extended Offset is ",zb
REM If a alternate offset base is loaded skip the standard base.
REM Standard Cloud9 CF card offset to HBD Drive 0.
ON ERROR GOTO 300
OPEN #fp2, cfile:UPDATE
REM If it does not exist create it.
REM Write a default value if the file is empty.
PRINT #fp2 USING "S,H3,H3",hs,yhi,yli
PRINT "WPC = ",wpc
PRINT "OFS = ",ofs
SHELL "dmode /ih wpc="+wpc+" ofs="+ofs
PRINT "/ih setup for drive #",a
REM - Show Directory
500 ON ERROR GOTO 502
501 GOTO 503
503 REM Process Second Parameter
IF b="-d" THEN
IF b="-r" THEN
510 ON ERROR GOTO 520
SHELL "dir /ih"
REM - Directory Listing Failed
IF b<>"-d" THEN
PRINT "OS9 Directory Listing Failed."
530 INPUT "Do you want to try RSDOS (y/N) ?",ta
IF ta="y" THEN
540 REM GOSUB - Display RSDOS directtory.
SHELL "shell x load /dd/util/rsdos"
SHELL "shell x rsdos -dir /ih"
IF er=56 THEN
1010 PRINT " Ih WPC & Ofs Prameter Calculator v2.3"
PRINT " Default Drive Zero Offset=$52DDC"
PRINT " Alternate Drive Zero Offset may be set in /dd/sys/ihbase"
PRINT " SYNTAX:(*Commands shown in UPPER but should be typed in lower
PRINT " IH_DRV -? This help message."
PRINT " IH_DRV N Where n is the number that sets the dmode of /ih"
PRINT " for drive number n."
PRINT " IH_DRV =N .. "
PRINT " IH_DRV N -D .. and also lists 'OS9' directory."
PRINT " IH_DRV N -R .. and also lists 'RSDOS' directory."
PRINT " (c) CC - GNU Special Thanks to Curtis & Wanye "
1020 PRINT ">> n must be 0 to 999 ."
This Ends this Thread.
On 2018-05-28 08:46, coco at jechar.ca wrote:
> On 2018-05-27 12:05, L. Curtis Boyle wrote:
>> On May 26, 2018, at 6:46 PM, coco at jechar.ca wrote:
>>> Well I have a version that solves my original problem although
>>> I would like to add a few more features yet.
>>> I put this in the file ih_drv.b09 and when I load
>>> it I get an error.
>>> ERROR #110
>> If you are trying to run it by typing 'BASIC09 lh_drv.b09’, you will
>> get errors like that. You need to pack it (which you mentioned that
>> you have already done), and then run it with either ‘runb lh_drv’ (if
>> you are using the stock SHELL), or just ‘lh_drv’ (if you are running
>> Shellplus). It’s easier to pass parameters with Shellplus as well, as
>> has been mentioned before; you don’t need to surround the parameters
>> in quotes.
>> (If you want to avoid that error when loading BASIC09 source, just
>> launch BASIC09 by itself ‘basic09’, and then LOAD ih_drv.b09 at the B:
>> I mucked with your code for a bit, and for some strange reason, if I
>> did ON ERROR to trap a parameter error (#56) to check if no parameters
>> were sent, it would go to the routine properly, but when I tried to
>> shut ON ERROR off and then GOTO where you were printing the help
>> message, it would then exit with the error anyways. I changed the help
>> message to be a subroutine instead (both from the error 56 ON ERROR,
>> and from passing it ‘-?’, and now that works (using shellplus). I did
>> try moving PARAM to after the DIM statements (the examples in the
>> BASIC09 manual show this), but that made no difference (and I tried a
>> couple of other things that are still in this listing that follow, but
>> you can clean those up if you wish). I had to change your creating of
>> /dd/sys/cihxofs to use CREATE instead of SHELL “ECHO”; otherwise, you
>> didn’t have a path to the file to write to. I also have it write a
>> default value so it has something to read (you may need to change that
>> PROCEDURE Ih_drv
>> DIM hs:STRING
>> DIM drv:INTEGER
>> DIM dno:REAL
>> DIM yh:REAL
>> DIM yl:REAL
>> DIM y:REAL
>> DIM yhi:INTEGER
>> DIM yhp:REAL
>> DIM ylr:REAL
>> DIM yli:INTEGER
>> DIM bfile:STRING
>> DIM cfile:STRING
>> DIM current:STRING
>> DIM fp1:BYTE
>> DIM fp2:BYTE
>> DIM er:INTEGER
>> DIM wpc:STRING
>> DIM ofs:STRING
>> PARAM a:STRING;b:STRING
>> 10 ON ERROR GOTO 1000
>> 20 IF a="-?" THEN
>> GOSUB 5000
>> ON ERROR GOTO 139
>> OPEN #fp1,bfile:READ
>> PRINT "Alternate Base Extended Offsets"
>> PRINT "To be Supported in Future Versions"
>> GOTO 139
>> REM Untill we suport alternate base offsets.
>> GOTO 200
>> REM If a alternate offset base is loaded skip the standard base.
>> 139 er:=ERR
>> REM Standard Cloud9 CF card offset to HBD Drive 0.
>> 200 REM
>> ON ERROR GOTO 300
>> OPEN #fp2, cfile:UPDATE
>> GOTO 400
>> 300 er:=ERR
>> REM If it does not exist create it.
>> CREATE #fp2,cfile:UPDATE
>> REM Write a default value if the file is empty.
>> REM Change this if needed.
>> WRITE #fp2,current
>> SEEK #fp2,0
>> 400 REM
>> PRINT USING "S,H3,H3",hs,yhi,yli
>> PRINT #fp2 USING "S,H3,H3",hs,yhi,yli
>> SEEK #fp2,0
>> READ #fp2,current
>> PRINT "WPC = ",wpc
>> PRINT "OFS = ",ofs
>> SHELL "dmode /ih wpc="+wpc+" ofs="+ofs
>> PRINT "/ih setup for drive #",a
>> REM - Future enhancement b= -d SHELL "dir /ih"
>> 1000 er=ERR
>> ON ERROR
>> PRINT "Error #";er;" trapped"
>> IF er=56 THEN
>> PRINT "At least 1 parameter is required"
>> PRINT " use 'ih_drv -?' for help"
>> GOSUB 5000
>> 5000 PRINT "Ih WPC & Ofs Prameter Calculator"
>> PRINT "Assumes Drive Zero Offset=$52DDC"
>> PRINT "SYNTAX:"
>> PRINT "ih_drv -? This help message."
>> PRINT "ih_drv n Where n is a number sets the dmode"
>> PRINT " of /ih for drive number n."
>> PRINT "(c) CC - GNU"
> Thanks for the code improvements, I will look them over in a few days,
> very busy with gardening now, and try out your version.
> P.S. Yes it's shell plus I am using.
>>> Ignored the error and Packed it anyway and the program
>>> works fine.
>>> To all who have helped so far Wayne,Curtis,James ect. Thank You
>>> the program is very useful to me.
>>> However I would like to add 3 features yet more for general benefit
>>> then my own.
>>> 1. I would like just typing ih_drv to give help just like
>>> ih_drv -?
>>> 2. I would like ih_drv n -d
>>> to display the directory of drive n by spawning dir or
>>> rsdos as appropriate.
>>> 3. For me the Hard coded address of drive zero is ok but people
>>> with other IDE systems may not have there drive zero at address
>>> $052DDC as I do. I would like to have the program read it's
>>> drive base address from a file called /dd/SYS/ihbase
>>> Any suggestions would be appreciated, I have attemped 1. and 2. and
>>> ran into problems.
>>> Coco mailing list
>>> Coco at maltedmedia.com
More information about the Coco