Post Reply 
HP97 The journey begins
11-22-2021, 05:12 AM (This post was last modified: 11-22-2021 09:52 AM by teenix.)
Post: #521
RE: HP97 The journey begins
(11-22-2021 02:18 AM)Paul Dale Wrote:  As for sending lumps of data, that should be fine. The printer does some buffering.
Pauli

Hi Pauli,

Yes that is correct. It has a 200 print column data buffer (166 for graphics). The 97 will only need 120 of those for a full buffer of its data, unless I double space the characters to make them more readable, and then it will require 140.

The problem lies in the way the 97 processes the print data. The PIK chip has different commands than can be sent for character access and the 97 uses just two of them.

If anyone is interested, this is the way it works.

The PIK character ROM has 64 characters available and to address them all, a 6 bit ROM address must be sent to the PIK. (6 bits give 0 - 63) This is one of the commands.

The second command for the 97 tells the PIK to treat the incoming data as a 4 bit address. When it receives this command the 4 bits become the high order of the 6 bits and bits 1 and 0 are both set to 1. Thus inside the PIK, it still ends up with a 6 bit address. These characters are more likely to be printed and are... 0..9, DP, -, +, *, Space or End Of Line.

For the normal 97, there is up to 20 characters per print line and there are 6 bits per print character, so up to 6 x 20 = 120 bits of information for a full line. However, the C register, where the data originates from before it is sent to the PIK chip, has only has 56 bits available. (14 x 4 bit nibbles)

If the Microcode is to print " 0.00 *** "

It could output it as Command #2 as (HEX)...

Reg C = (Nibb 13) 00 FF F0 A0 0E ED DD (Nibb 0)

This is sent to the printer from regC as 56 bits, Nibb 0 bit 0 -> Nibb 13 bit 3


or it could send it as Command #2
However, in this case 6 bit digits will be expected by the PIK, represented here as binary.

* * * Spc Spc 0 0 . 0 EOL
110111 110111 110111 111011 111011 000011 000011 101011 000011 111111

If put into 4 bit nibble form for regC it becomes
1101 1111 0111 1101 1111 1011 1110 1100 0011 0000 1110 1011 0000 1111 1111

This is 15 nibbles or 60 bits of data and is bigger than regC can hold.

The 97 Microcode will split the print data into two separate commands.

4 bit command #2 for ***SpcSpc
regC = FFFFFFFFFEEDDD

and

4 bit command #2 for 00.0EOL
regC = FFFFFFFFFE0A00 (Note: the microcode added a space before the EOL)

The print lines are all terminated with EOL characters. However when regC is sent to the PIK, which is exactly the same hardware functioning as writing regC to RAM, the PIK will immediately start printing. It keeps a pointer to the character being printed and in the example above, before that index has time to get to the EOL, the second regC transfer will take place. This overwrites the EOL in the buffer (with char 0) in this case, and the only EOL for the print line now follows the last space to be printed. Thus the print carriage will start returning at the second EOL that was sent.

You may see a problem here, in that if no EOL was in the data, the carriage will bang into the printer frame at the other end and the motor will keep pushing it, probably stripping the soft idler gear on the printer mechanism, which is why I think it was made this way. My 97 CPU board will always insert a last EOL whether needed or not and keeps track of how many characters are being sent.

The problem for the 97S IR printer is that even though the print lines are all terminated with EOL characters, you don't know if it is the last packet of data to be sent for that print line. For example, printing a line of a program will take 3 packets of data, but for an outside observer, the packet count is not known.

Further to this, there might be multiple print lines coming all with varying packet sizes. An example would be printing the result of a calculation in Trace mode, or printing 224 steps of a program.

cheers

Tony
Find all posts by this user
Quote this message in a reply
11-23-2021, 11:55 AM (This post was last modified: 11-23-2021 11:56 AM by teenix.)
Post: #522
RE: HP97 The journey begins
Hi all,

Today I got the HP82440B to print a program line under the control of the HP Microcode.

I put in some menu items to select the internal printer or the IR printer as the operational printer. The print data can also be sent to the PC via the Bluetooth link for a simulated HP82440 style printer.

Too late for anymore today, so I'll try to do more testing tomorrow to make sure it can print multiple lines like printing the stack etc.

cheers

Tony


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
11-23-2021, 12:09 PM
Post: #523
RE: HP97 The journey begins
Excellent Progress!!!

TomC
Find all posts by this user
Quote this message in a reply
11-24-2021, 02:37 AM (This post was last modified: 11-24-2021 02:39 AM by teenix.)
Post: #524
RE: HP97 The journey begins
Hi all,

More progress :-)

The HP2240B now seems to be accepting all the print commands under the control of the HP-97 microcode. There were no changes to the original microcode, so from its point of view it is still connected to the 97 printer. It is a bit slower than the original 97 printer which is to be expected.

I had to delve into the 97 microcode to find a way of knowing when the last of a print line has been compiled. This was a bit of a task because there is more than one path for the print code to execute, but in the end the solution was "fairly" simple.

Once the end of the print line is detected, the characters originally for the PIK character ROM need to be re-formatted for the HP2240 printer and sent over the IR link. A full graphical print line needs to be sent and this takes a bit of time. As the HP2240B does not have handshaking, the PIC has to wait until it thinks the IR printer had finished its job before sending other lines if required. This can be up to 1.8 seconds according to the manual.

There is one last task I may as well do while I am in the guts of the project which is to create the notes mode. This is where the 97 can display and print stored messages either from certain keypress combinations, or from a running program similar to the 65/67 CPU boards.

However, as I found out with the 97 emulator, making this work with the 97 printer is quite a difficult task.

cheers

Tony


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
11-24-2021, 03:04 AM
Post: #525
RE: HP97 The journey begins
More great work! Well done.

The 34S keeps a count of how many characters have been sent and how long they've been pending and slows things once the printer's buffer starts to fill.

Probably not worth the effort here since the 97 has a print. It might make sense on the 67.

Pauli
Find all posts by this user
Quote this message in a reply
11-24-2021, 06:51 AM
Post: #526
RE: HP97 The journey begins
(11-24-2021 02:37 AM)teenix Wrote:  More progress :-)

You never stop to amaze me, Tony.

My two boards, please! ;)

Greetings,
    Massimo

-+×÷ ↔ left is right and right is wrong
Visit this user's website Find all posts by this user
Quote this message in a reply
11-29-2021, 04:26 AM (This post was last modified: 11-29-2021 04:30 AM by teenix.)
Post: #527
RE: HP97 The journey begins
Hi all,

Getting there slowly. I've put together the code to access any of the 100 notes stored in memory and enabled each of the three available printers (97, 82240 and PC sim) to print a selected message.

These notes were displayed on LED displays for the 65 and 67 CPU boards, but they will only be printed on the 97. This is because the 97 printer has many more characters than can be displayed in 7 segment LED format, and because of the complexity of the 97 printer firmware/hardware, the 97 will halt operations while printing a note, then continue.

The notes are accessed in a similar way as the 65/67 CPU boards but you have to press [f][f] then either [A] or [B] to get the message to print.

If you press [f][f][A], the printer will print the current date/time from the battery backed clock.
If you press [f][f][B], the note number (0-99) is printed determined by the value in the C register. Afterwards, the C register is incremented by 1.

The key sequence [f][f][A or B] can be stored in program memory and onto magnetic cards and are compatible with the 67 CPU board, but if the 67 reads these from a 97 card, it will print the selected note on the LED display and either execute an R/S or a PAUSE.

If the 97 is operating in 97S mode, you can perhaps do the run from [A] feature, and this program might print the date/time then a text line, something like...'Weight in KG' then the value returned from the 97S interface.

I still have to get the code working that is responsible for monitoring the HP CPU code flow to intercept and process the messages.

cheers

Tony


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
11-30-2021, 06:31 PM
Post: #528
RE: HP97 The journey begins
Wow! You really are "DA MAN". Keep it up. There's many of us, worldwide, following this saga!

Good luck - but usually, luck has nothing to do with it.

Best Regards,

Dave
Visit this user's website Find all posts by this user
Quote this message in a reply
12-04-2021, 01:48 AM
Post: #529
RE: HP97 The journey begins
Hi all,

As expected the notes code that has to intercept the 97 microcode execution during printing and other functions was difficult.

I have now written it all and just need to do some testing. It works in the 97 emulator so it should work in the PIC as long as the translation was correct. One good thing while playing around with this, is that I found a simpler way to do it.

Once this is completed, then that's about it. I'll have to do a full test with card read, printing, PC communications and update the help file.

I've had the clock running on its battery and normal power for a week or so while updating code etc and it seems to be keeping good time.

cheers

Tony
Find all posts by this user
Quote this message in a reply
12-04-2021, 01:54 AM
Post: #530
RE: HP97 The journey begins
It's absolutely wild to me that you did this pretty much the hardest way possible. I'd have just emulated the behavior of the buttons on the PIC and called it a day. It's amazing that you're actually writing new microcode for the HP97!!

(or perhaps I'm misreading that... either away, incredible work)
Find all posts by this user
Quote this message in a reply
12-04-2021, 02:18 AM
Post: #531
RE: HP97 The journey begins
The 97 code is still original.

The PIC code is monitoring what it is doing and intercepting it at various points to make some minor data changes to deal with printing stuff that the 97 wasn't designed to do. As far as the 97 goes, it is just running as normal.

I did write the HP-10 emulator code in Woodstock format. That was a bit of a head scratcher Smile

cheers

Tony
Find all posts by this user
Quote this message in a reply
12-04-2021, 02:22 AM
Post: #532
RE: HP97 The journey begins
That's amazing.

I have the pleasure of living in Corvallis, OR (on Circle Pl, which intersects Circle Blvd; that should be familiar). Anyway, I was talking to a friend of mine about the HP97, and it turns out he plays bridge with one of the HP engineers that's old enough to have worked on a lot of these calculators. My friend didn't remember which calculator model he worked on, but he did say that they don't have any of the original source code for any of the microcode on these, and that the newer units literally emulate the old systems, and that they just use the original microcode.
Find all posts by this user
Quote this message in a reply
12-05-2021, 09:47 AM
Post: #533
RE: HP97 The journey begins
Hi all,

The 97 seems to be able to print sequential messages now. The message index comes from the value in the C register and as soon as that is printed, the C register is auto incremented by one and so can process the next note in a programmed loop if required.

There is still a bit to go as the time date printing is playing up.

cheers

Tony


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
12-07-2021, 03:41 AM (This post was last modified: 12-07-2021 03:42 AM by teenix.)
Post: #534
RE: HP97 The journey begins
Hi all,

After much hair pulling, the notes printing code seems ok now.

That just leaves a full system test and updating the help file.

Smile

cheers

Tony
Find all posts by this user
Quote this message in a reply
12-07-2021, 03:46 AM
Post: #535
RE: HP97 The journey begins
That's incredible.

The global chip shortage is going to keep us from getting them any time soon, isn't it?
Find all posts by this user
Quote this message in a reply
12-07-2021, 04:18 AM (This post was last modified: 12-07-2021 04:19 AM by teenix.)
Post: #536
RE: HP97 The journey begins
(12-07-2021 03:46 AM)hpux735 Wrote:  That's incredible.

The global chip shortage is going to keep us from getting them any time soon, isn't it?

Unfortunately, yes.

Stocks of the particular PIC processor won't be available until 2023, which is crazy. Same with any form of alternative.

I have some spares (5 I think) stashed in my parts draw, so I can make that many, but after that it is a waiting game.

cheers

Tony
Find all posts by this user
Quote this message in a reply
12-07-2021, 06:42 AM (This post was last modified: 12-07-2021 06:42 AM by Massimo Gnerucci.)
Post: #537
RE: HP97 The journey begins
(12-07-2021 04:18 AM)teenix Wrote:  
(12-07-2021 03:46 AM)hpux735 Wrote:  That's incredible.

The global chip shortage is going to keep us from getting them any time soon, isn't it?

Unfortunately, yes.

Stocks of the particular PIC processor won't be available until 2023, which is crazy. Same with any form of alternative.

I have some spares (5 I think) stashed in my parts draw, so I can make that many, but after that it is a waiting game.

cheers

Tony

Noooooooooooooooooooooooo!
So near and still so far away...
:'(

Greetings,
    Massimo

-+×÷ ↔ left is right and right is wrong
Visit this user's website Find all posts by this user
Quote this message in a reply
12-07-2021, 07:32 AM
Post: #538
RE: HP97 The journey begins
Just need to redo it using an STM32 ? 8-)
Find all posts by this user
Quote this message in a reply
12-07-2021, 07:04 PM
Post: #539
RE: HP97 The journey begins
(12-07-2021 07:32 AM)Chr Yoko Wrote:  Just need to redo it using an STM32 ? 8-)

I think those are also made of unobtainium at the moment. :-)

— Ian Abbott
Find all posts by this user
Quote this message in a reply
12-07-2021, 08:47 PM (This post was last modified: 12-07-2021 08:50 PM by teenix.)
Post: #540
RE: HP97 The journey begins
Hi all,

Just for info, the processor that I am using for the HP-97 project is a PIC18F66K40 as it does all I need and before the chip shortage was quite cheap.

Except for a possible bug that is eluding me at the moment, the substance of the code has been completed. The source code is written in raw assembler (as I don't know C) and the used ROM in the PIC is about 58% of the 64KB available.

As such there is room to possibly add the microcode and PIK character ROM for the HP-91. The keyboard layout would need some thinking about as the left side is a lot different to the 97, no card reader and it has a DEG RAD GRD switch instead of PGM RUN. The left side keyboard would probably use a 4 x 4 key pattern in the lower left of the 97 keyboard.

The menu options accessible from the calculator or PC program so far are:

Show Model at switch on Yes/No
Card Read/Write/Delete/Find Blank
Write Protect Override On/Off
Notes Mode On/Off
Bluetooth On/Off
Constant Memory On/Off
HP97S Mode On/Off
Key Debounce Normal/Long
Print Speed +/-
Print Intensity +/-
Printer Select HP/IR
Beeper On/Off
Time adjust
Date adjust
Alarm On/Off/Adjust

cheers

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




User(s) browsing this thread: 1 Guest(s)