Post Reply 
[go67/97 for Android] Creating .pck files in a text editor?
08-11-2015, 06:46 PM
Post: #21
RE: [go67/97 for Android] Creating .pck files in a text editor?
Here's the listing generated for the first program in the Standard Pack for HP-67"

Code:

H01 MOVING AVERAGE
H02 SD-01A
H03 x->'K',AVG
H04 W DATA
H05 ->VALUES
H06 ->AVG
H07 
H08 n
H09 P?
H10 
H11 
H12 
001 LBL b
002 CL REG
003 P<>S
004 CL REG
005 1
006 X>Y
007 GTO 2
008 CL X
009 2
010 2
011 X<>Y
012 X>Y
013 GTO 2
014 STO E
015 1
016 %
017 +
018 STO- 0
019 INT
020 RTN
021 LBL 2
022 RDN
023 LBL 5
024 PAUSE
025 GTO 5
026 LBL B
027 F? 0
028 SPACE
029 RCL E
030 1
031 +
032 F? 0
033 PRINT X
034 X<>Y
035 F? 0
036 PRINT X
037 RCL (i)
038 STO- 1
039 X<>Y
040 STO (i)
041 STO+ 1
042 RDN
043 X<>Y
044 STO I
045 RCL D
046 X<=Y
047 GSB 1
048 DSZ I
049 GTO 6
050 RCL I
051 1
052 0
053 1
054 X
055 STO- 0
056 LBL 6
057 RDN
058 RTN
059 LBL 1
060 X<>Y
061 F? 0
062 GTO 1
063 PAUSE
064 LBL 1
065 RCL 0
066 RCL D
067 /
068 ENTER
069 F? 0
070 PRINT X
071 RTN
072 LBL C
073 W/DATA
074 RTN
075 LBL c
076 F? 0
077 GTO 1
078 1
079 SF 0
080 RTN
081 LBL 1
082 0
083 CF 0
084 RTN
085 LBL D
086 SPACE
087 0
088 LBL 4
089 RCL D
090 X=Y
091 RTN
092 1
093 %
094 +
095 RCL I
096 X=Y
097 FRAC
098 STO- 0
099 ISZ I
100 RCL (i)
101 PRINT X
102 R^
103 1
104 +
105 GTO 4
106 LBL E
107 RCL 0
108 RCL E
109 RCL D
110 X<=Y
111 X<>Y
112 RDN
113 /
114 RTN
115 R/S
116 R/S
117 R/S
118 R/S
119 R/S
120 R/S
121 R/S
122 R/S
123 R/S
124 R/S
125 R/S
126 R/S
127 R/S
128 R/S
129 R/S
130 R/S
131 R/S
132 R/S
133 R/S
134 R/S
135 R/S
136 R/S
137 R/S
138 R/S
139 R/S
140 R/S
141 R/S
142 R/S
143 R/S
144 R/S
145 R/S
146 R/S
147 R/S
148 R/S
149 R/S
150 R/S
151 R/S
152 R/S
153 R/S
154 R/S
155 R/S
156 R/S
157 R/S
158 R/S
159 R/S
160 R/S
161 R/S
162 R/S
163 R/S
164 R/S
165 R/S
166 R/S
167 R/S
168 R/S
169 R/S
170 R/S
171 R/S
172 R/S
173 R/S
174 R/S
175 R/S
176 R/S
177 R/S
178 R/S
179 R/S
180 R/S
181 R/S
182 R/S
183 R/S
184 R/S
185 R/S
186 R/S
187 R/S
188 R/S
189 R/S
190 R/S
191 R/S
192 R/S
193 R/S
194 R/S
195 R/S
196 R/S
197 R/S
198 R/S
199 R/S
200 R/S
201 R/S
202 R/S
203 R/S
204 R/S
205 R/S
206 R/S
207 R/S
208 R/S
209 R/S
210 R/S
211 R/S
212 R/S
213 R/S
214 R/S
215 R/S
216 R/S
217 R/S
218 R/S
219 R/S
220 R/S
221 R/S
222 R/S
223 R/S
224 R/S

Attached is the translate table I am using. The first column is the hex code. The second would be used for searching for a hex code from a program step. I have removed the spaces and put everything in upper case with exception of lower case labels. The third column is how the code is printed when looked up from the hex code.

I can add variations of program codes to this table to allow for multiple variations for some steps.

I would appreciate any comments or suggestions.

Thanks,

Bill
Smithville, NJ


Attached File(s)
.txt  XLATE.TXT (Size: 4.89 KB / Downloads: 18)
Find all posts by this user
Quote this message in a reply
08-11-2015, 06:58 PM
Post: #22
RE: [go67/97 for Android] Creating .pck files in a text editor?
Bill, this is really awesome. I am really looking forward to the finished product.

I am surmising that going the other way--listings to pck files--is a bit more challenging, given the need to fully understand the information encoded in the header line and the computation of check sums. Also, I think the pck file structure is really fussy, with every bit of white space actually a placeholder for something.

Les
Find all posts by this user
Quote this message in a reply
08-12-2015, 12:49 AM (This post was last modified: 08-12-2015 01:06 PM by Bill (Smithville NJ).)
Post: #23
RE: [go67/97 for Android] Creating .pck files in a text editor?
Got most of the Header Card figured out.

Code:
Header Card Format
Example:  3000422
3        1=Side 1 Data
         2=Side 2 Data
         3=Side 1 Program
         4=Side 2 Program

0        1=One Side
         0=Two Side

0        Flags Set/Clear
         0 = All Flags Clear
         1 = Flag 3 Set
         2 = Flag 2 Set
         4 = Flag 1 Set
         8 = Flag 0 Set
         For combinations of Flags set, add them up
         Example:  All Flags set = 1+2+4+8=15 or F

0        Trig Mode:
         0 = DEG
         1 = RAD
         2 = GRAD

4        Display Format:  DSP 0..9

22      SCI, FIX or ENG
          00  SCI
          22  FIX
          40  ENG


EDIT: I have updated the last two digits to indicate SCI/FIX/ENG notation. But it looks a little odd, like some addition info is also being stored with it.


Now to find some time to work on the second utility to create a PCK file.

Bill
Smithville, NJ
Find all posts by this user
Quote this message in a reply
08-12-2015, 06:37 AM (This post was last modified: 08-12-2015 06:40 AM by lcwright1964.)
Post: #24
RE: [go67/97 for Android] Creating .pck files in a text editor?
(08-12-2015 12:49 AM)Bill (Smithville NJ) Wrote:  Got most of the Header Card figured out.


I'm not sure what the last two digits do, but at present I think have enough information. I'll just leave the last two digits at 22.

This is awesome.

I wonder if one of those two digits has something to do with FIX/SCI/ENG...

It is a shame that M. de Smet isn't replying to our queries are popping in on this thread. He could answer this header question in a jiffy. You have deciphered everything else.

Les
Find all posts by this user
Quote this message in a reply
08-12-2015, 12:57 PM
Post: #25
RE: [go67/97 for Android] Creating .pck files in a text editor?
(08-09-2015 08:43 AM)PANAMATIK Wrote:  According to the HP-67 manual the information in the header contains:
Quote:Besides the actual program memory step numbers and instructions,
the HP-67 also records the following information on a program card
on both the first pass and the second pass through the card reader:
1. The fact that a program (not data) is being recorded.
2. The fact that this is side 1 (or side 2).
3. Whether or not two passes are required.
4. Current status of flags FO, Fl, F2, and F3 within the calculator.
5. Current status of trigonometric mode (i.e., DEG, RAD, or
GRD) within the calculator.
6. Current display format of the calculator.
7. A checksum (a code to verify that the program is complete
when it is reloaded).

It should be possible to find the structure of the header by generating pck files with different settings.

I don't have the Go67 emulator, so I cannot test it.

Following the 7 digit header in line 0, 112 program steps are coded in lines 1-32
Every two lines represents a 7 byte register for 7 program steps. The 7 program steps are coded in reverse order in the two lines. The first program step is coded the last two digits in the second line.

For comparing the codes you can download the HP-67 table of program step codes

http://www.panamatik.de/ProgramCodes.pdf

Bernhard

Bernhard,

I wanted to say think you for the information you provided above.
It was a lot of help in helping me to decipher the layout and being able to create the crude program that I did to printout the program listings from the PCK file.

I think I now have the Header figured out. But not sure if any additional information is being stored in it or not. But for my purposes, I think I have enough.

Thanks,

Bill
Smithville, NJ
Find all posts by this user
Quote this message in a reply
08-12-2015, 01:08 PM
Post: #26
RE: [go67/97 for Android] Creating .pck files in a text editor?
(08-12-2015 06:37 AM)lcwright1964 Wrote:  This is awesome.

I wonder if one of those two digits has something to do with FIX/SCI/ENG...

It is a shame that M. de Smet isn't replying to our queries are popping in on this thread. He could answer this header question in a jiffy. You have deciphered everything else.

Les


Les, You are correct. I've updated the Header Listing to include SCI/FIX/ENG for the last two digits.

Thanks,

Bill
Smithville, NJ
Find all posts by this user
Quote this message in a reply
08-12-2015, 01:11 PM
Post: #27
RE: [go67/97 for Android] Creating .pck files in a text editor?
(08-12-2015 06:37 AM)lcwright1964 Wrote:  I wonder if one of those two digits has something to do with FIX/SCI/ENG...

Try 22=FIX 00=SCI 40=ENG

Bernhard

That's one small step for a man - one giant leap for mankind.
Find all posts by this user
Quote this message in a reply
08-12-2015, 01:39 PM
Post: #28
RE: [go67/97 for Android] Creating .pck files in a text editor?
(08-12-2015 01:11 PM)PANAMATIK Wrote:  
(08-12-2015 06:37 AM)lcwright1964 Wrote:  I wonder if one of those two digits has something to do with FIX/SCI/ENG...

Try 22=FIX 00=SCI 40=ENG

Bernhard

Hi Bernard,

Yep, that's what I figured out also. But the 22 for FIX seems funny. I would have thought 00/20/40 and then maybe the last digit is storing some other settings.

For the purpose of creating a header record for use in PCK file, I think we have what we need. But always curious about any oddities.

Bill
Smithville, NJ
Find all posts by this user
Quote this message in a reply
08-12-2015, 03:17 PM
Post: #29
RE: [go67/97 for Android] Creating .pck files in a text editor?
(08-12-2015 01:39 PM)Bill (Smithville NJ) Wrote:  
(08-12-2015 01:11 PM)PANAMATIK Wrote:  Try 22=FIX 00=SCI 40=ENG

Bernhard

Hi Bernard,

Yep, that's what I figured out also. But the 22 for FIX seems funny. I would have thought 00/20/40 and then maybe the last digit is storing some other settings.

For the purpose of creating a header record for use in PCK file, I think we have what we need. But always curious about any oddities.

Bill
Smithville, NJ

The HP-67 stores the display format in external RAM with these numbers and obviously they were copied partially to magnetic card. To understand why it is 22 you have to analyze the firmware. Often the HP engineers choose bit patterns as jump table offsets. So don't try to understand or guess logically. Smile

Bernhard

That's one small step for a man - one giant leap for mankind.
Find all posts by this user
Quote this message in a reply
08-12-2015, 04:53 PM
Post: #30
RE: [go67/97 for Android] Creating .pck files in a text editor?
(08-12-2015 03:17 PM)PANAMATIK Wrote:  To understand why it is 22 you have to analyze the firmware. Often the HP engineers choose bit patterns as jump table offsets. So don't try to understand or guess logically. Smile

No kidding! To use two digits to store such a simple three-way parameter strikes me as counterintuitive.

Thank you so much for answering questions on this. I am no programmer when it comes to scripts and utilities, so I am so tickled that, with help of you and others, Bill was inspired by my original query to revisit this project.

Les
Find all posts by this user
Quote this message in a reply
08-13-2015, 11:41 PM (This post was last modified: 08-17-2015 11:42 AM by Bill (Smithville NJ).)
Post: #31
RE: [go67/97 for Android] Creating .pck files in a text editor?
I cleaned up the PCK2TXT program that can generate files listing the individual programs in the PCK file.

I have also created the TXT2PCK program which can create a PCK file from a list of program files.

NOTE: I have modified the programs and the xlate table to correct for some errors. Please re-download the latest utilities.

I have attached HP67 PCK UTILITIES.ZIP which includes the following files:

PCK2TXT.PAS The Turbo Pascal Source Code
PCT2TXT.EXE The compiled program
TXT2PCK.PAS Pascal Source
TXT2PCK.EXE Compiled program
XLATE.TXT The translation table HEX to Program Step
STD.PCK PCK file of the Standard Pack
Various PCK files and support files.

{Attachment has been removed due to problems with it}
{Please refer to Later Message in this Thread for current }
{file attachment}

NOTE:

MSDOS Turbo Pascal TP6 was used. This means the EXE file will need to be run in a DOSBOX window and file names are limited to 8.3 format.

Run the PCK2TXT program with the PACK file name as a parameter.
For Example: PCK2TXT STD.PCK

Run the TXT2PCK file with a File as a parameter that has a list of the Program Listings to include.
For Example: TXT2PCK STANDARD
Where Standard contains the following list:

STANDARD PACK
15
SD-01A.001
SD-02A.002
SD-03A.003
SD-04A.004
SD-05A.005
SD-06A.006
SD-07A.007
SD-08A.008
SD-09A.009
SD-10A.010
SD-11B.011
SD-12B.012
SD-13A.013
SD-14A.014
SD-15C.015

I have also entered a couple of programs from the EE(LAB) and Games Pack. If you execute: TXT2PCK MISC, then you will generate a PCK files with two programs: "Wire Table" from the EE(LAB) pack and "Risk" from the Games Pack.

Make sure the XLATE.TXT file is in the same directory. It is read to generate the HEX to Program Step Translation Table.

The program will use the first 8 characters of the Second Title on the Cards with the card number as the extension.
In the Standard PCK, this would be SD-01A.001, SD-02A.002, etc.

There is virtually NO error checking, so it is very possible that it may not always work, especially if the PCK file has been modified.

One last item - Since Turbo Pascal expects the text files to have CR/LF, you may need to run the pack files through UNIX2DOS utility to add the CR to a unix pack file that only has LF's.

Like I said - it's crude, but works for my purposes.

The XLATE.TXT file can be expanded at the bottom to include other variations of Program Steps. For Example, I had added "Run Stop" as the last line. Thus, the program listing could use either R/S or Run Stop as a program step. DO NOT modify or delete the first 256 lines (down to FF), since these are the normal program steps that are used.

Appreciate comments/suggestions.

Also feel free to modify to your hearts content.

Bill
Smithville, NJ

(Edited August 16: Updated the File Attachment to include TXT2PCK and for updates to all files. Also edited text above to reflect changes.)
(Edited August 16 - Removed File Attachment.)
Find all posts by this user
Quote this message in a reply
08-14-2015, 12:13 AM
Post: #32
RE: [go67/97 for Android] Creating .pck files in a text editor?
Bill, that is gorgeous!

As a Mac user, I am delighted that it runs in DOSBox, for which there is an excellent OS X version which is easy to use and works beautifully.

Thank you for this.

Les
Find all posts by this user
Quote this message in a reply
08-17-2015, 12:38 AM (This post was last modified: 08-17-2015 12:39 AM by Bill (Smithville NJ).)
Post: #33
RE: [go67/97 for Android] Creating .pck files in a text editor?
I have updated the utilities and added TXT2PCK to create a PCK file from a list of programs. I found some errors in both the PCK2TXT program and the XLATE table. So please download the latest utilities.

Refer to my edited post above for new zip file.

Thanks,

Bill
Smithville, NJ
Find all posts by this user
Quote this message in a reply
08-17-2015, 03:50 AM
Post: #34
RE: [go67/97 for Android] Creating .pck files in a text editor?
(08-17-2015 12:38 AM)Bill (Smithville NJ) Wrote:  I have updated the utilities and added TXT2PCK to create a PCK file from a list of programs. I found some errors in both the PCK2TXT program and the XLATE table. So please download the latest utilities.

Refer to my edited post above for new zip file.

Bill, can you double check what's actually at that link? I am downloading a 33KB zip that doesn't have nearly all the stuff you say it should. As an alternative you can just email it to me too.

As an aside, I wonder what I can do to tweak you code to compile as a command line utility in an OS X in a Terminal window. I know a little Pascal and have Lazarus/Free Pascal, so I suspect it can be done. Of course, if there are DOS-Unix variances in text file reading and writing, I might get stuck...

Les
Find all posts by this user
Quote this message in a reply
08-17-2015, 11:43 AM
Post: #35
RE: [go67/97 for Android] Creating .pck files in a text editor?
(08-17-2015 03:50 AM)lcwright1964 Wrote:  Bill, can you double check what's actually at that link? I am downloading a 33KB zip that doesn't have nearly all the stuff you say it should. As an alternative you can just email it to me too.

As an aside, I wonder what I can do to tweak you code to compile as a command line utility in an OS X in a Terminal window. I know a little Pascal and have Lazarus/Free Pascal, so I suspect it can be done. Of course, if there are DOS-Unix variances in text file reading and writing, I might get stuck...

Les

Hi Les,

Not sure what's going on with the attachment. For some reason, I wasn't able to update it to the new file. I have removed it from the above post and will create a new post with the current files.

Bill
Smithville, NJ
Find all posts by this user
Quote this message in a reply
08-17-2015, 11:46 AM
Post: #36
RE: [go67/97 for Android] Creating .pck files in a text editor?
I had some problems with updating the file attachment in my earlier post. So I have removed that link.

Following is the latest set of files:


.zip  HP67 PCK UTILITIES.zip (Size: 38.35 KB / Downloads: 25)


Hopefully this will work.

Bill
Smithville, NJ
Find all posts by this user
Quote this message in a reply
08-17-2015, 08:29 PM
Post: #37
RE: [go67/97 for Android] Creating .pck files in a text editor?
Got it. Generated cards read fine in go67 and go97.

I am going to see if I can port to Free Pascal and compile executables to run in Mac terminal window. Failing that running a DOSBox is fine.

This is excellent work. Thank you!

Les
Find all posts by this user
Quote this message in a reply
08-19-2015, 09:00 AM
Post: #38
RE: [go67/97 for Android] Creating .pck files in a text editor?
(08-17-2015 08:29 PM)lcwright1964 Wrote:  I am going to see if I can port to Free Pascal and compile executables to run in Mac terminal window.

Actually, nix this. I did a little research and it seems that in such porting there are subtleties far beyond my amateur programmer abilities. It is easier for me to put all of my DOS calculator utilities, like this and hp41uc for compiling and decompiling hp41 RAW programs, into one folder, mount that as the C: drive for DOSBox, and go from there.

That said, I can see Linux/Unix nerds taking your Pascal source and getting a Perl script out of it, akin to the assembler/disassembler scripts that pack with WP34S.

One final question: What is the the interpretation of the 13th line of the text listings beginning with PC?

Les
Find all posts by this user
Quote this message in a reply
08-19-2015, 12:20 PM
Post: #39
RE: [go67/97 for Android] Creating .pck files in a text editor?
(08-19-2015 09:00 AM)lcwright1964 Wrote:  One final question: What is the the interpretation of the 13th line of the text listings beginning with PC?

Les

Hi Les,

The line PC: in the Program listings is the number of program steps. For Example, PC: 96 means that 96 lines of Program Steps follows.

I had given some thought to re-compiling in FreePas for windows. One big item is that FreePas would allow for long file names. But I am basically a MSDOS programmer, and am very comfortable in DosBox and, more importantly, a very lazy person. I'm just happy that it works. I'll leave it for others to make any improvement they may want.

Bill
Smithville, NJ
Find all posts by this user
Quote this message in a reply
08-19-2015, 03:15 PM
Post: #40
RE: [go67/97 for Android] Creating .pck files in a text editor?
(08-19-2015 12:20 PM)Bill (Smithville NJ) Wrote:  
(08-19-2015 09:00 AM)lcwright1964 Wrote:  One final question: What is the the interpretation of the 13th line of the text listings beginning with PC?

Les

The line PC: in the Program listings is the number of program steps. For Example, PC: 96 means that 96 lines of Program Steps follows.

Ah, it is obvious now.

So if one wants to get DSP, FIX/SCI/ENG, or DEG/(G)RAD info into a PCK listing, one needs to rewrite the virtual card in the emulator with those parameters set. Doesn't seem to be a means to put that info in a program listing--indeed I just notice that your code writes xx00222 as the first line of each card side by default (i.e., all flags clear, DEG mode, FIX 2). But a 67/97 programmer who needs this just so will know to rewrite his cards to adjust the header and checksum lines if other presets are needed for a program.

Les
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: