Post Reply 
(HP71B) ASM question
12-10-2024, 01:44 PM
Post: #32
RE: (HP71B) ASM question
(09-25-2024 07:18 AM)J-F Garnier Wrote:  
(09-24-2024 12:00 PM)floppy Wrote:  AND: an overtaking of the GAMMA function of the Math module is currently analyzed: however, the BASIC ASM function I got from JF Garnier seems to use stack mechanisms I could not reconduct on Forth/ASM (for sure, the Forth has stack mechanisms). So, the idea is to have a GAMMA Forth/ASM (low prio); however the path to it is still not found. Any hints are welcomed.

The gamma asm code from the Math ROM (the dogam subroutine) should be useable in a Forth primitive, rewriting only the wrapper code to interface with the Forth environment.

The code is referring to a "math scratch stack", like:
Code:
     GOSUB  =stscr+   store it to math scratch stack
     GOSUB  =rcscr+   recall from math scratch stack

The HP naming is confusing, because there is also a "Math stack", specific to BASIC, to hold parameters and results during BASIC expression evaluation.
The "math scratch stack" is different, it's a reserved fixed place in the system memory implementing a 4-level stack to hold temporary extended precision values during numeric calculations.
So I believe it's perfectly useable in Forth too.

J-F
+1
it looks like there are several RAM scratch area which could be usefull in case ASM code is getting short in CPU registers.

comments/remarks are welcome.

Code:
2F599 =MTHSTK    5Nibs address of [b]math stack. Or called AVMEME see v3p3086. Available RAM depending of ROM or RAM modules in the ports[/b]
manipulation with following entry points
Code:
    0BD8D    MPOP1N    entry: D1 to Math Stack
                    uMODES before POP1N+ v3p1366
    0BD1C     POP1N    entry: D1 to Math Stack
                    Put number from stack into A v3p1362
    0BD91     POP1N+    entry: D1 to Math Stack
                    to POP1N v3p1366
    0BC8C    POP2N    entry: D1 to Math Stack
                    Put 2x number from stack into A and C v3p1360
    (0E8FD    POP1R    entry: D1 to Math Stack
                    Same as POP1N, v3p1605)    
    0E8F7        pop2n+    v3p1604
    0BD58        POP2N+    entry: D1 to Math Stack
                    to POP2N v3p1365
    0BD54        MPOP2N    entry: D1 to Math Stack
                    uMODES .. before POP2N v3p1365
    0E25B     pshstk         entry: D1 to current top of Math Stack
                    push math stack by 16nibs v3 p1558 
                    (NOT like PSHSTK stack pointer, 
                    preserve math stack, v3 p1078)
                    exit: new D1

    (13DB3    STK16?    Check free space for 16nibs v3 p2095)
    (13DB6    CHKSTK)      ??

    13E21        D1MST+          Set D1 to MTHSTK and clear all ST, set S8?.. v3 p2096
    145FC        D1mstk    link to D1MSTK v3p2120
    1954E        D1MSTK       Set D1 to MTHSTK (AVMEME)  v2p226  v3p2503
    1953C        MSTKD1         Set MTHSTK to D1 v3p2503, use p2494

    1B3DB    POPMTH       skip item on MTHSTK (for counting/finding MTHSTK items)

    18BB8        =AVE=D1     v3p2457
    18BBB    =AVE=C     C(A) new value for AVMEME v3p2457
    10489        =C=RAME    read in RAMEND v3p1788
    18651        =D1=AVE    set D1 at AVMEME v3p2436
    18658        D1=@D1    v3p2436
    1864D        GETAVM    reads (AVMEME) into C(A)&D1 
                        and (AVMEMS) into D(A) v3p2435    
    1A476        =D=AVME    v3p2552 read AVMEME into D(A)
    1A460        =D=AVMS    v3p2552 read AVMEMS into D(A)
    1A46A        D=@D1    v3p2552 keep carry

other reserved RAM area..
Code:
2F871     STMTR0     16Nibs (*4 = 64bits) like A or B or C or D
Code:
    2F871        S-R0-0        5nibs
    2F876        .. -1        5
    2F87B        .. -2        5
    2F880        .. -3        1
words
Code:
    0E04F        D0=SR0    D0 linked to S-R0-0 v3p1539
    07F7D        D1=SR0          D1 linked to S-R0-0 .. D1(5) = STMTRO  v3p989
    0E05F        D1=SR1    D1 linked to S-R0-1 v3p1539

another area..
Code:
2F881    STMTR1     16Nibs
    2F881        S-R1-0        5Nibs
    2F886        .. -1        5
    2F88B        .. -2        5
    2F890        .. -3        1
words
Code:
    none identified for immediate use in Forth ASM

Code:
2F891    STMTD0     5Nibs (20bits) like D0 or D1
words
Code:
    1129D        RESTD0    restore D0 from STMTD0

another area..
Code:
2F896    STMTD1     5Nibs

another big area..
Code:
2F8C5    TRFMBF     60Nibs (16+16+16+12) see page v3p2281 p2306

another area..
Code:
2F89B FUNCR0    16Nibs
    2F89B        F-R0-0        5Nibs
    2F8A0        .. -1        5
    2F8A5        .. -2        5
    2F8AA    .. -3        1
words for manipulation
Code:

    1C587        SAVD0    save D0 in address stored in F-R0-0 v3p2820    
    1C578        SAVD1    .. in F-R0-1
    1C596        RSTD1            v3p2821    D1 from address in F-R0-1
        08C44        rstd1        GOVLNG  RSTD1
    06832        RSTD0    restore D0 from F-R0-0     v3p822

another area..
Code:
2F8AB     FUNCR1    16Nibs
    2F8AB        F-R1-0        5Nibs
    2F8B0        .. -1        5
    2F8B5        .. -2        5
    2F8BA        .. -3        1
2F8BB     FUNCD0    5Nibs (20bits) which has same size like D0 or D1
2F8C0    FUNCD1    5Nibs

the scratsch area from the gamma word..
Code:
2F901 SCRTCH with entry points for storing/recovering 4* A/B-data in it
    the first 4x16 Nibs are OK for storing data.
    The next Nibs have area for exponent storage and could interfer with other scratch area for 
    timer or display or .. see below, if the area are not selected carefully
words to manipulate
Code:
    (2F901        SCRSTO)
    0E954        RCSCR     pops 15form from math scratch stack into (C,D)  
                        v3p1608 (call GSCPTR,..) uses C(A), P, D0
    0E24D        stscr         GOTO STSCR, v3p1557
    0E92C        STSCR    push 15form (A,B)  into math scratch stack  (call GSCPTR,..) 
                        v3p1607, update data pointer
    0E251        rclw1+        save D0 in R3 and exit with RCLW1 v3p1557
    0E257        rclw1        GOTO RCLW1, v3p1557
    0E981        RCLW1     move A/B to C/D and math stack entry into A/B v3p1557
                    uses A,B,C,D, P, D0
    0E9B2        RCLW2          ..
    0E9C4        RCLW3          ..
    0E983        RCL*         (P=0 RCL* == RCLW1.. P=3 RCL* == RCLW4)
    12AAC    ST01          save R0 R1 in RAM SCRTCH v3p1988 SCRTCH(0-15)=R0, 
                        ..(16-31) = R1
    12AC6        RC01        restore v3p1989
    1AF5D    STRALL    save A-D D0 D1,mode,P,SB in SCRTCH v3p2610
    1AFBF    RCLALL    rcl .. v3p2612

and perhaps more here..
Code:
2F986 RESERV    48*2    „HP-71B Resource Allocations“ = 6*16 = 3* (double float)
            define a new word STO2 for save R2 R3 in RESERV ? Or in .. ?

HP71B 4TH/ASM/Multimod, HP41CV/X/Y & Nov64d, PILBOX, HP-IL 821.62A & 64A & 66A, Deb11 64b-PC & PI2 3 4 w/ ILPER, VIDEO80, V41 & EMU71, DM41X
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(HP71B) ASM question - floppy - 07-15-2024, 04:50 PM
RE: (HP71B) ASM question - ThomasF - 07-16-2024, 06:05 AM
RE: (HP71B) ASM question - floppy - 07-16-2024, 07:22 AM
RE: (HP71B) ASM question - rprosperi - 07-16-2024, 12:07 PM
RE: (HP71B) ASM question - ThomasF - 07-16-2024, 07:00 AM
RE: (HP71B) ASM question - floppy - 07-23-2024, 05:54 PM
RE: (HP71B) ASM question - rprosperi - 07-23-2024, 06:10 PM
RE: (HP71B) ASM question - floppy - 07-29-2024, 09:25 AM
RE: (HP71B) ASM question - brouhaha - 07-30-2024, 06:47 AM
RE: (HP71B) ASM question - J-F Garnier - 07-30-2024, 07:54 AM
RE: (HP71B) ASM question - KeithB - 08-03-2024, 10:56 PM
RE: (HP71B) ASM question - brouhaha - 08-05-2024, 04:21 AM
RE: (HP71B) ASM question - J-F Garnier - 08-05-2024, 02:12 PM
RE: (HP71B) ASM question - J-F Garnier - 07-30-2024, 07:28 AM
RE: (HP71B) ASM question - brouhaha - 07-30-2024, 06:51 AM
RE: (HP71B) ASM question - floppy - 08-03-2024, 04:47 PM
RE: (HP71B) ASM question - rprosperi - 08-03-2024, 05:06 PM
RE: (HP71B) ASM question - floppy - 08-03-2024, 05:40 PM
RE: (HP71B) ASM question - floppy - 08-04-2024, 11:45 AM
RE: (HP71B) ASM question - rprosperi - 08-05-2024, 11:50 AM
RE: (HP71B) ASM question - floppy - 08-17-2024, 08:46 AM
RE: (HP71B) ASM question - floppy - 08-17-2024, 01:40 PM
RE: (HP71B) ASM question - floppy - 08-22-2024, 09:32 AM
RE: (HP71B) ASM question - floppy - 08-23-2024, 07:37 AM
RE: (HP71B) ASM question - floppy - 09-03-2024, 03:36 PM
RE: (HP71B) ASM question - floppy - 09-24-2024, 12:00 PM
RE: (HP71B) ASM question - J-F Garnier - 09-25-2024, 07:18 AM
RE: (HP71B) ASM question - floppy - 12-10-2024 01:44 PM
RE: (HP71B) ASM question - floppy - 10-07-2024, 11:24 AM
RE: (HP71B) ASM question - floppy - 10-16-2024, 10:00 AM
RE: (HP71B) ASM question - floppy - 10-18-2024, 08:55 AM



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