Hi all,
Unlike the HP48G/GX, the HP-50g does print GROBs very slowly on the infrared printer. I have compared the system RPL command "PrintGrob" on both machines, but apart from different addresses, they are exactly the same. That's why I made my own program to make the printing of GROBs a lot faster (see listing below). The GROB itself prints properly, but the problem with this program is that it produces noise a few pixels below the bottom of the printed GROB. By noise, I mean random pixels that are printed but do not occur in the GROB, and I cannot find the cause of this. Maybe someone can give me a good tip or hint to neutralize this effect. The program places the GROB to be printed in the graphics display, after which that display is scanned, and the data is stored in a string, which is then printed. If the GROB becomes too wide to print horizontally, the assembly programs tilt the GROB so that it is printed vertically. All in all, partly because of these assembly programs, it has become quite a listing. I hope someone can help me to fix this problem. Sincerely, Karel.
Code:
::
CK1
DUPTYPEGROB? // GROB on stack?
NcaseTYPEERR
BINT4
ClrSysFlag
DUPGROBDIM //Check GROB not too large
# A0
#>
SWAP
# A0
#>
ANDcase
:: // If so, generate a fault message
DROP
"Object too large for printing!"
xMSGBOX
;
DUP
GROBDIMw // Check if GROB is too wide
# A0
#>
IT // IF so, tilt the GROB
::
BINT4
SetSysFlag // Signal GROB is tilted
FREEINTEMP?_
?SKIP
TOTEMPOB
CODE
GOSBVL =SAVPTR
GOSBVL =DisableIntr
C=DAT1 A
C=C+CON A,5
D0=C
A=DAT0 A
A=A+C A
C=C-CON A,16
GONC LD98B3
GOTO LD993B
LD98B3 D0=D0+ 5
C=DAT0 A
?C=0 A
GOYES LD993B
D=C A
D0=D0+ 5
C=DAT0 A
GOYES LD993B
C=C+CON A,7
CSRB.F A
CSRB.F A
CBIT=0 0
A=A-C A
D1=A
D0=D0+ 5
A=C A
ASRB.F A
A=A-1 A
R1=A.F A
C=C+C A
R0=C.F A
DSRB.F A
D=D-1 A
GOC LD993B
LD9909 C=R1.F A
B=C A
LD9911 A=DAT0 B
C=DAT1 B
DAT0=C B
DAT1=A B
D1=D1+ 2
D0=D0+ 2
B=B-1 A
GONC LD9911
A=R0.F A
CD1EX
C=C-A A
D1=C
D=D-1 A
GONC LD9909
LD9903B GOSBVL =AllowIntr
GOVLNG =GETPTRLOOP
ENDCODE
CODE
GOSBVL =SAVPTR
GOSBVL =DisableIntr
C=DAT1 A
D0=C
D1=C
D1=D1+ 5
C=DAT1 A
B=C A
D0=D0+ 10
D1=D1+ 10
C=DAT0 A
A=DAT1 A
?C=0 A
GOYES LD957B
?A=0 A
GOYES LD957B
B=B-CON A,16
GONC LD9585
LD957B DAT0=A A
DAT1=C A
GOTO LD977E
LD9585 R0=C.F A
R1=A.F A
A=A+CON A,7
ASRB.F A
ASRB.F A
ABIT=0 0
R4=A.F A
GOSUBVL =makegrob
CD0EX
C=C-CON A,16
C=C-CON A,4
B=C A
GOSBVL =D1=DSKTOP
A=DAT1 A
C=B A
DAT1=C A
A=A+CON A,16
A=A+CON A,4
R2=A.F A
D0=C
D0=D0+ 10
A=DAT0 A
C=R4.F A
B=C A
C=C+C A
C=C+C A
C=C-A A
P=C 0
C=P 15
ST=0 0
P= 15
LA(1) 4
?C<A S
GOYES LD961A
C=C-A S
ST=1 0
LD961A C=A-C S
C=C-1 S
D0=D0+ 5
C=DAT0 A
D0=D0+ 5
AD0EX
AR3EX.F A
C=C+CON A.7
CSRB.F A
CSRB.F A
A=C A
CBIT=0 0
D=C A
?ABIT=1 0
GOYES LD9654
C=C-1 A
LD9654 C=C-1 A
A=0 A
LD9658 RSTK=C
C=R2.F A
R0=C.F A
C=R3.F A
R1=C.F A
C=B A
?ST=0 0
GOYES LD967B
C=C-1 A
LD967B C=C-CON A,2
GOC LD96F9
LD9684 RSTK=C
C=R0.F A
D0=C
C=R1.F A
D1=C
P= 3
A=DAT0 P
P= 2
LD96A0 AD0EX
A=A+B A
AD0EX
A=DAT0 P
P=P-1
GONC LD96A0
P= 0
GOSUB LD978C
P= 3
DAT1=C P
P= 2
LD96BF CD1EX
C=C+D A
CD1EX
DAT1=C P
P=P-1
GONC LD96BF
CR0EX.F A
C=C+1 A
CR0EX.F A
AR1EX.F A
C=D A
C=C+C A
C=C+C A
A=A+C A
AR1EX.F A
C=RSTK
C=C-1 A
GONC LD9684
LD96F9 C=R0.F A
D0=C
C=R1.F A
D1=C
P= 3
A=DAT0 P
P= 2
LD9713 AD0EX
A=A+B A
AD0EX
A=DAT0 P
P=P-1
GONC LD9713
P= 0
GOSUB LD978C
A=C S
P= 3
DAT1=C P
A=A-1 S
GOC LD974F
P= 2
LD973B CD1EX
C=C+D A
CD1EX
DAT1=C P
P=P-1
A=A-1 S
GONC LD973B
LD974F CR3EX.F A
C=C+1 A
CR3EX.F A
AR2EX.F A
C=B A
C=C+C A
C=C+C A
A=A+C A
AR2EX.F A
C=RSTK
C=C-1 A
GOC LD9658
LD977C P= 0
LD977E GOSBVL =AllowIntr
GOVLNG =GETPTRLOOP
LD978C C=0 A
?A=0 A
RTNYES
LC(4) #1248
C=C&A A
ABIT=0 0
GOYES LD7A9
CBIT=1 15
LD97A9 ?ABIT=0 1
GOYES LD97B5
CBIT=1 11
LD97B5 ?ABIT=0 2
GOYES LD97C1
CBIT=1 7
LD97C1 ?ABIT=0 4
GOYES LD97CD
CBIT=1 14
LD97CD ?ABIT=0 5
GOYES LD97D9
CBIT=1 10
LD97D9 ?ABIT=0 7
GOYES LD97E5
CBIT=1 2
LD97E5 ?ABIT=0 8
GOYES LD97F1
CBIT=1 13
LD97F1 ?ABIT=0 10
GOYES LD97FD
CBIT=1 5
LD97FD ?ABIT=0 11
GOYES LD9809
CBIT=1 1
LD9809 ?ABIT=0 13
GOYES LD9815
CBIT=1 8
LD9815 ?ABIT=0 14
GOYES LD9821
CBIT=1 4
LD9821 ?ABIT=0 15
RTNYES
CBIT=1 0
RTNSC
ENDCODE // End of tilting
;
BINT0
ZEROZERO
GBUFF // Safe old graphic picture
TOTEMPOB
{
NULLLAM
NULLLAM
NULLLAM
NULLLAM
}
BIND // Create local variables
DOERASE
DUPGROBDIM
3PUTLAM
2PUTLAM
GROB>GDISP // Put the GROB to print in the graphics screen
2GETLAM
ZERO_DO
INDEX@
4PUTLAM
"*" // Pay attention!!! Character is 27 CHR!!!
BINT4
TestSysFlag
ITE // Test if GROB has tilt
::
# A0 // Put the GROB in the middle of the paper
3GETLAM
#-#2/
"\00\00\00\00..." //80 x 0 CHR!!!
BINT1
ROT
SUB$
DUPLEN$
3GETLAM
#+
#>CHR
&$
;
:: // If no tilt, add GROB width to string
3GETLAM
#>CHR
>T$
;
3GETLAM // Begin to scan the graphic picture
ZERO_DO
BINT0
BINT8
ZERO_DO
::
JINDEX@
4GETLAM
INDEX@
#+DUP
2GETLAM
#=
case2DROP
PIXON3?
NOT?SEMI
{ // Calculate character ASCII code
BINT1
BINT2
BINT4
BINT8
BINT16
BINT32
SIXTYFOUR
BINT128
}
INDEX@
#1+
NTHCOMPDROP
#+
;
LOOP
#>CHR
>T$ // Add character to string
LOOP
PTR 2F127 // Print string to IR printer
DROP
BINT8
+LOOP
DOCR
DOCR
1GETABND // Get saved graphic picture
BINT4
ClrSysFlag
DUPGROBDIM
ZEROSWAP
BINT0
#=
XYZ>ZXY
#=
OR // Test saved picture is not empty
ITE
::
DROP
DOERASE
;
GROB>GDISP // If not empty, store picture in graphic screen
GARBAGE // Clean up the mess
;
@