Post Reply 
HP-71 Diagnostics
06-09-2020, 07:26 AM (This post was last modified: 06-09-2020 07:27 AM by KimH.)
Post: #17
RE: HP-71 Diagnostics
Thanks a lot J-F!

Gutsy to move modules in and out while CPU is on/active/running, but I have yet to have a HW failure in Modules or Mainframe whilst doing that, intentionally or not.

I'll clearly go for it.

Cool code, i learned a few things from it. Looking at a short working piece of code can often be the best inspiration!

/Kim


(06-08-2020 06:50 PM)J-F Garnier Wrote:  
(06-08-2020 06:22 PM)KimH Wrote:  It is the same - i did walk through all the lines, xxx46 is the Checksum.

But, don't let that hold you back, maybe there is some insight which can be applied elsewhere Smile

The problem with the Diag ROM is that it is a take-over ROM, disabling the internal system ROMs. And moreover, it generates a Module Pulled interrupt as soon as it is inserted, so you can't just have a loop in asm waiting for the insertion (I tried at the time).

The trick is that interrupt is masked IF the CPU is already servicing an interrupt. And there is an easy way: pressing a key generates an interrupt, as long as the CPU is in the keyboard servicing routine, it can't be interrupted again.
The interrupt code is in ROM, but there is a hook with the code to give a chance to an application to takeover the key processing. So the solution is to install a piece of code, redirect the hook to it, and press a key. The CPU is now in our code with interrupt masked. The diag module can be inserted, it will disable the system ROM but will not take over, and our piece of code can copy the diag rom to a safe place (I used a IRAM port) where it will survive the next memory lost that will happen when the diag rom will be removed.

Here is the piece of code:
Code:

       LEX 'CATCH'
       ID #5C
       MSG 0
       POLL 0
       ENTRY CATCH
       CHAR #F
       KEY 'CTCH'
       TOKEN 1
       ENDTXT

FNRTN1 EQU #0F216


* how to use the Catch LEX:
* plug a 32k memory module and the Forth/Ass module
* FREE PORT(x): 32k memory module as IRAM at D0000
* assemble CATCH
* HP71 OFF/ON to chain the new LEX
* CTCH
* press a key (quickly), a display pattern should indicate that the HP71 is in the HOOK loop with INTR disabled
* plug the Service ROM (no MP interrupt should happen, since INTR are disabled)
* press a key, the copy should be done
* the HP71 exists in the Service ROM.
* Remove the Service ROM
* if all worked well, the IRAM is still there, and a copy of the Service ROM is in D0040-DFFFF




       NIBHEX 00
CATCH  
* some delay
* copy DiagRom to iRam at D0040
* wait for key

* install intr handler
       GOSUB IHOOK 
HOOK   
       D0=(5) #2E104  * display
       C=0 S
       C=C+1 S
       OUT=CS
H1     C=C+1 A
       DAT0=C A   * makes a pattern on the display
       A=IN
       ?A=0 B     * wait for a key press
       GOYES H1

* copy ROM
       D0=(5) #00000
       D1=(5) #D0040
       C=DAT1 W
       ?C#0 W
       GOYES CR2   if already copied, don't do it again
       C=0 A
       P= 0
       LCHEX FFC   copy ffc0 nibbles from 0-ffbf to d0040-dffff
       A=C A
CR     C=DAT0 W
       DAT1=C W
       D0=D0+ 16
       D1=D1+ 16
       A=A-1 A
       ?A#0 A
       GOYES CR
CR2
       D0=(5) #2F43C  VECTOR
       C=0 A
       DAT0=C A
* memory lost
       C=0 A
       RSTK=C
       RTI
       
IHOOK  C=RSTK
       D0=(5) #2F43C  VECTOR
       DAT0=C A

* wait for intr (key)
WFI    GOTO WFI

* return to Basic (never happens...)
       C=0 W
       GOVLNG FNRTN1
       
       END

J-F
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP-71 Diagnostics - KimH - 06-06-2020, 11:07 AM
RE: HP-71 Diagnostics - Dave Frederickson - 06-06-2020, 01:28 PM
RE: HP-71 Diagnostics - rprosperi - 06-06-2020, 01:32 PM
RE: HP-71 Diagnostics - Dave Frederickson - 06-06-2020, 01:39 PM
RE: HP-71 Diagnostics - Dave Frederickson - 06-06-2020, 05:14 PM
RE: HP-71 Diagnostics - KimH - 06-06-2020, 06:32 PM
RE: HP-71 Diagnostics - Dave Frederickson - 06-06-2020, 10:54 PM
RE: HP-71 Diagnostics - KimH - 06-06-2020, 04:07 PM
RE: HP-71 Diagnostics - KimH - 06-08-2020, 02:34 PM
RE: HP-71 Diagnostics - Dave Frederickson - 06-08-2020, 03:32 PM
RE: HP-71 Diagnostics - J-F Garnier - 06-08-2020, 04:19 PM
RE: HP-71 Diagnostics - Dave Frederickson - 06-08-2020, 05:40 PM
RE: HP-71 Diagnostics - KimH - 06-08-2020, 06:22 PM
RE: HP-71 Diagnostics - J-F Garnier - 06-08-2020, 06:50 PM
RE: HP-71 Diagnostics - Dave Frederickson - 06-08-2020, 07:00 PM
RE: HP-71 Diagnostics - KimH - 06-09-2020 07:26 AM



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