From c5cda9f48462236f2becd1e6b15b348dcfa31677 Mon Sep 17 00:00:00 2001 From: Carsten Strotmann Date: Wed, 15 Jul 2020 08:29:26 +0200 Subject: [PATCH] Atari Math Routines: file extension and file access changes --- 6502/Apple1/{mkhex.fs => mkhex.fth} | 0 6502/Atari8bit/math/FLOAT.fs~ | 118 ------------------ 6502/Atari8bit/math/{FLOAT.fs => FLOAT.fth} | 15 ++- .../math/{MATH100.fs => MATH100.fth} | 3 +- 6502/Atari8bit/math/SQRT.fs~ | 1 - 6502/Atari8bit/math/{SQRT.fs => SQRT.fth} | 4 +- 6502/Atari8bit/math/{TRIG.fs => TRIG.fth} | 3 +- 6502/Atari8bit/math/fmath.atr | Bin 6502/Atari8bit/math/fmath.zip | Bin 9 files changed, 11 insertions(+), 133 deletions(-) rename 6502/Apple1/{mkhex.fs => mkhex.fth} (100%) delete mode 100755 6502/Atari8bit/math/FLOAT.fs~ rename 6502/Atari8bit/math/{FLOAT.fs => FLOAT.fth} (88%) mode change 100755 => 100644 rename 6502/Atari8bit/math/{MATH100.fs => MATH100.fth} (88%) mode change 100755 => 100644 delete mode 100755 6502/Atari8bit/math/SQRT.fs~ rename 6502/Atari8bit/math/{SQRT.fs => SQRT.fth} (94%) mode change 100755 => 100644 rename 6502/Atari8bit/math/{TRIG.fs => TRIG.fth} (92%) mode change 100755 => 100644 mode change 100755 => 100644 6502/Atari8bit/math/fmath.atr mode change 100755 => 100644 6502/Atari8bit/math/fmath.zip diff --git a/6502/Apple1/mkhex.fs b/6502/Apple1/mkhex.fth similarity index 100% rename from 6502/Apple1/mkhex.fs rename to 6502/Apple1/mkhex.fth diff --git a/6502/Atari8bit/math/FLOAT.fs~ b/6502/Atari8bit/math/FLOAT.fs~ deleted file mode 100755 index 1a32a9c..0000000 --- a/6502/Atari8bit/math/FLOAT.fs~ +++ /dev/null @@ -1,118 +0,0 @@ -\ Floating Point Extension -\ using Atari 8bit ROM FP Routines -\ based on FIG Forth APX20029 - -\needs CALL INCLUDE" D:CALL.FS" - -CR .( loading Floating Point ext. ) - -VOCABULARY FMATH -FMATH ALSO DEFINITIONS - -$D4 CONSTANT FR0 -$E0 CONSTANT FR1 -$FC CONSTANT FLPTR -$F3 CONSTANT INBUF -$F2 CONSTANT CIX - -| : XCALL CALL DROP ; - -| : AFP $D800 XCALL ; -| : FASC $D8E6 XCALL ; -| : IFP $D9AA XCALL ; -| : FPI $D9D2 XCALL ; -| : FADD $DA66 XCALL ; -| : FSUB $DA60 XCALL ; -| : FMUL $DADB XCALL ; -| : FDIV $DB28 XCALL ; -| : FLG $DECD XCALL ; -| : FLG10 $DED1 XCALL ; -| : FEX $DDC0 XCALL ; -| : FEX10 $DDCC XCALL ; -| : FPOLY $DD40 XCALL ; - -: F@ ( -- fp ) - >R R@ @ R@ 2+ @ R> 4 + @ ; - -: F! ( fp addr -- ) - >R R@ 4 + ! R@ 2+ ! R> ! ; - -: F.TY ( -- ) - BEGIN - INBUF @ C@ DUP $7F AND EMIT - 1 INBUF +! - $80 > UNTIL ; - -: FSWAP ( fp1 fp2 -- fp2 fp1 ) - 5 ROLL 5 ROLL 5 ROLL ; - -: FDROP ( fp -- ) - 2DROP DROP ; - -: FDUP ( fp -- fp fp ) - 2 PICK 2 PICK 2 PICK ; - -: FOVER ( fp1 fp2 -- fp1 fp2 fp1 ) - 5 PICK 5 PICK 5 PICK ; - -: F. ( fp -- ) - FR0 F@ FSWAP FR0 F! - FASC F.TY SPACE - FR0 F! ; - -: F? ( fp -- ) - F@ F. ; - -: ( -- fp1 ) - FR0 F@ ; - -: FS ( fp -- ) - FR0 F! ; - -: F+ ; -: F- ; -: F* ; -: F/ ; - -: FLOAT ( n -- fp ) - FR0 ! IFP F> ; - -: FIX ( fp -- n ) - FS FPI FR0 @ ; - -: FLOG FS FLG F> ; -: FLOG10 FS FLG10 F> ; -: FEXP FS FEX F> ; -: FEXP10 FS FEX10 F> ; - -: ASCF ( addr -- fp ) - INBUF ! 0 CIX C! AFP F> ; - -: F0= OR OR 0= ; -: F= F- F0= ; -: F< F- 2DROP $80 AND 0 > ; - -: F, ( fp -- ) - ROT , SWAP , , ; - -: FCONSTANT - CREATE F, DOES> F@ ; -: FVARIABLE - CREATE 6 ALLOT DOES> ; - -| : FLIT - R> DUP 6 + >R F@ ; -: FLITERAL - COMPILE FLIT F, ; -: FLOATING - BL WORD 1+ - ASCF FLITERAL ; IMMEDIATE -: [FLOATING] [COMPILE] FLOATING ; IMMEDIATE - -CR .( Floating Point ext. loaded. ) CR - -ONLYFORTH - diff --git a/6502/Atari8bit/math/FLOAT.fs b/6502/Atari8bit/math/FLOAT.fth old mode 100755 new mode 100644 similarity index 88% rename from 6502/Atari8bit/math/FLOAT.fs rename to 6502/Atari8bit/math/FLOAT.fth index 80230bb..fe8202f --- a/6502/Atari8bit/math/FLOAT.fs +++ b/6502/Atari8bit/math/FLOAT.fth @@ -2,7 +2,7 @@ \ using Atari 8bit ROM FP Routines \ based on FIG Forth APX20029 -\needs CALL INCLUDE" D:CALL.FS" +\needs CALL INCLUDE" D:CALL.FTH" CR .( loading Floating Point ext. ) @@ -63,7 +63,7 @@ $F2 CONSTANT CIX : F? ( addr -- ) F@ F. ; -: ( -- fp1 ) @@ -77,7 +77,7 @@ $F2 CONSTANT CIX : F* ; : F/ ; -: FLOAT ( n -- fp ) +: FLOAT ( n -- fp ) FR0 ! IFP F> ; : FIX ( fp -- n ) @@ -100,19 +100,18 @@ $F2 CONSTANT CIX : FCONSTANT CREATE F, DOES> F@ ; -: FVARIABLE +: FVARIABLE CREATE 6 ALLOT DOES> ; | : FLIT R> DUP 6 + >R F@ ; : FLITERAL COMPILE FLIT F, ; -: FLOATING - BL WORD 1+ +: FLOATING + BL WORD 1+ ASCF FLITERAL ; IMMEDIATE : [FLOATING] [COMPILE] FLOATING ; IMMEDIATE CR .( Floating Point ext. loaded. ) CR - -ONLYFORTH +ONLYFORTH diff --git a/6502/Atari8bit/math/MATH100.fs b/6502/Atari8bit/math/MATH100.fth old mode 100755 new mode 100644 similarity index 88% rename from 6502/Atari8bit/math/MATH100.fs rename to 6502/Atari8bit/math/MATH100.fth index 1e8471b..a25d7c5 --- a/6502/Atari8bit/math/MATH100.fs +++ b/6502/Atari8bit/math/MATH100.fth @@ -1,6 +1,6 @@ \ 100* 100U/ -\needs code INCLUDE" D:TAS65.FS +\needs code INCLUDE" D:TAS65.FTH" CODE 100* ( N1 - N2) SP X) LDA @@ -86,4 +86,3 @@ CODE 100U/ ( U - N) N 4 + ROR 4/+ JSR NEXT JMP END-CODE - diff --git a/6502/Atari8bit/math/SQRT.fs~ b/6502/Atari8bit/math/SQRT.fs~ deleted file mode 100755 index ea462d4..0000000 --- a/6502/Atari8bit/math/SQRT.fs~ +++ /dev/null @@ -1 +0,0 @@ -\ SQRT  \needs code INCLUDE" D:TAS65.FS"  CODE D2* ( D1 - D2) 2 # LDA SETUP JSR N 2+ ASL N 3 + ROL N ROL N 1+ ROL SP 2DEC N 3 + LDA SP )Y STA N 2+ LDA SP X) STA SP 2DEC N 1+ LDA SP )Y STA N LDA SP X) STA NEXT JMP END-CODE  : DU< &32768 + ROT &32768 + ROT ROT D< ;  | : EASY-BITS ( N1 -- N2) 0 DO >R D2* D2* R@ - DUP 0< IF R@ + R> 2* 1- ELSE R> 2* 3 + THEN  LOOP ;  | : 2'S-BIT >R D2* DUP 0< IF D2* R@ - R> 1+ ELSE D2* R@ 2DUP U< IF DROP R> 1- ELSE - R> 1+ THEN THEN ;  | : 1'S-BIT >R DUP 0< IF 2DROP R> 1+ ELSE D2* &32768 R@ DU< 0= NEGATE R> + THEN ;  : SQRT ( UD1 - U2) 0 1 8 EASY-BITS ROT DROP 6 EASY-BITS 2'S-BIT 1'S-BIT ;  \ Test \ \ : XX  \ &16 * &62500 UM* \ SQRT 0 <# # # # ASCII . HOLD #S #> \ TYPE SPACE ;  \ No newline at end of file diff --git a/6502/Atari8bit/math/SQRT.fs b/6502/Atari8bit/math/SQRT.fth old mode 100755 new mode 100644 similarity index 94% rename from 6502/Atari8bit/math/SQRT.fs rename to 6502/Atari8bit/math/SQRT.fth index 08a5e87..f46c6f6 --- a/6502/Atari8bit/math/SQRT.fs +++ b/6502/Atari8bit/math/SQRT.fth @@ -1,6 +1,6 @@ \ SQRT -\needs code INCLUDE" D:TAS65.FS" +\needs code INCLUDE" D:TAS65.FTH" CODE D2* ( D1 - D2) 2 # LDA SETUP JSR @@ -42,7 +42,7 @@ NEXT JMP END-CODE \ Test \ -\ : XX +\ : XX \ &16 * &62500 UM* \ SQRT 0 <# # # # ASCII . HOLD #S #> \ TYPE SPACE ; diff --git a/6502/Atari8bit/math/TRIG.fs b/6502/Atari8bit/math/TRIG.fth old mode 100755 new mode 100644 similarity index 92% rename from 6502/Atari8bit/math/TRIG.fs rename to 6502/Atari8bit/math/TRIG.fth index 9e64505..93bff2c --- a/6502/Atari8bit/math/TRIG.fs +++ b/6502/Atari8bit/math/TRIG.fth @@ -1,7 +1,7 @@ \ A SINUS-TABLE 20OCT87RE \ SINUS-TABLE FROM FD Vol IV/1 -\needs code INCLUDE" D:TAS65.FS" +\needs code INCLUDE" D:TAS65.FTH" | : TABLE ( VALUES N -) CREATE 0 DO , LOOP @@ -47,4 +47,3 @@ BASE ! : TAN ( DEG -- TAN*10000) DUP SIN SWAP COS ?DUP IF &100 SWAP */ ELSE 3 * THEN ; - diff --git a/6502/Atari8bit/math/fmath.atr b/6502/Atari8bit/math/fmath.atr old mode 100755 new mode 100644 diff --git a/6502/Atari8bit/math/fmath.zip b/6502/Atari8bit/math/fmath.zip old mode 100755 new mode 100644