TFORTH and HRG-Grafik...

General Chit Chat about Sinclair Computers and their Clones
Post Reply
dh1pba
Posts: 7
Joined: Thu Nov 30, 2017 8:34 am

TFORTH and HRG-Grafik...

Post by dh1pba » Thu Nov 30, 2017 8:47 am

Hi good afternoon.
Now my TForth is running with the HRG graphic.

The translated commands (read HRG.PDF):
------------------------------------------
HROFF
HRON
HRBANK : Seite HRBANK

HRPIX : x y HRPIX
HRUNPIX
HRXPIX

HRLINE : x y x1 y1 HRLINE
HRUNLINE
HRXLINE

HRLINETO : x y HRLINETO
HRUNLINETO
HRXLINETO

HRCIRCLE : x y r HRCIRCLE
HRUNCIRCLE
HRXCIRCLE

HRBOX : x y x1 y1 HRBOX
HRUNBOX
HRXBOX

HRINVERT

HRHCOPY

HRCLR
----------------------------------------------

Have now brought together the zx81.rom with the hrg64.p as it was shown here in the forum.
HRGROM.ROM.

The hrgfth.fth file contains all the above HRG commands as inline code.
For EightyOne load as usual under "Load Memory Block" with address 32768 and read
(after TFORTH starts) with "32768 LOAD" who is not the finished HRGTFORTH.P
would like to use.

I do it like this:
- Insert HRGROM.ROM in the EightyOne
- Start
- SHIFT + S key, then appears on the screen HRG and then Return,
then Space and NEW (A key on the PC), the HRG is started.
- Start HRGTFORTH.P
and off you go with the graphic commands.

Here's a routine in TFORTH with sine / cosine to draw a star.
As usual invite the file GRAFIK.FTH to TFORTH (see above).

Start under TFORTH with: 4 HRBANK HRON HRCLR STAR and Return
With HRG64.p you can use Bank 4-7.

Greeting

Code: Select all

DECIMAL

CREATE SINTAB 
0000 ,  0175 ,  0349 ,  0523 ,  0698 ,  0872 ,  
1045 ,  1219 ,  1392 ,  1564 ,  1736 ,  1908 , 
2079 ,  2250 ,  2419 ,  2588 ,  2756 ,  2924 ,  
3090 ,  3256 ,  3420 ,  3584 ,  3746 ,  3907 ,  
4067 ,  4226 ,  4384 ,  4540 ,  4695 ,  4848 ,  
5000 ,  5150 ,  5299 ,  5446 ,  5592 ,  5736 ,  
5878 ,  6018 ,  6157 ,  6293 ,  6428 ,  6561 ,  
6691 ,  6820 ,  6947 ,  7071 ,  7193 ,  7314 ,  
7431 ,  7547 ,  7660 ,  7771 ,  7880 ,  7986 ,  
8090 ,  8192 ,  8290 ,  8387 ,  8480 ,  8572 ,  
8660 ,  8746 ,  8829 ,  8910 ,  8988 ,  9063 ,  
9135 ,  9205 ,  9272 ,  9336 ,  9397 ,  9455 ,  
9511 ,  9563 ,  9613 ,  9659 ,  9703 ,  9744 , 
9781 ,  9816 ,  9848 ,  9877 ,  9903 ,  9925 ,  
9945 ,  9962 ,  9976 ,  9986 ,  9994 ,  9998 ,  
10000 , 

: NIP  ( x1 x2 -- x2)            
  SWAP DROP ;
  
: REVEAL  ( -- )
   LATEST DUP C@ 127 AND SWAP C!
;

: MOD  ( N1 N2 -- N3 )
   /MOD DROP
;

: */MOD  ( N1 N2 N3 -- N4 N5 )
   ROT >R R@ ABS ROT DUP R> XOR >R ABS UM* 
   BRANCH [ ' /MOD 15 + ,          
   REVEAL                         

: */  ( N1 N2 N3 -- N4 )
   */MOD NIP
;

: SINUS@        2 * SINTAB + @ ;
: SIN       
                DUP 0< >R ABS
                360 MOD 
                DUP 180 > 
				IF 180 - 1 >R 
				ELSE 0 >R THEN 
                DUP  90 > 
				IF 180 SWAP - THEN  
                SINUS@  
                R> IF NEGATE THEN 
                R> IF NEGATE THEN ;
: COS           90 + SIN ;

: STERN 360 0 DO 128 100 HRPIX I SIN 50 10000 */
  128 + I COS 50 10000 */ 100 + HRLINETO LOOP  ;
Attachments
alleprogramme.zip
(18.14 KiB) Downloaded 19 times
Bild2.jpg
(89.67 KiB) Downloaded 227 times

Post Reply