Jump to content

Photo

TI 99/4A interfacing


222 replies to this topic

#201 Lee Stewart OFFLINE  

Lee Stewart

    River Patroller

  • 3,870 posts
  • Location:Silver Run, Maryland

Posted Thu Nov 1, 2018 4:43 PM

I need to compare it to the Bresenham algorithm.  Although recursion is pretty cheap in Forth it ain't free.

 

Take a look at my fbForth 2.0 primitive for LINE in bitmap graphics mode, which uses an integer, no-divide version of the Bresenham line algorithm:

Spoiler

As I recall, I had a fair amount of help from Tursi on this.  There is a fair discussion somewhere in the fbForth thread (see below in my signature) at the time I was converting all of the graphics primitives from TI Forth to ALC for fbForth 2.0 before I first released the cartridge a few years ago.  You should have all of the source code.  The graphics primitives are in Bank 1 file, fbForth104_GraphicsPrimitives.a99.

 

...lee



#202 TheBF OFFLINE  

TheBF

    Dragonstomper

  • 853 posts
  • Location:The Great White North

Posted Thu Nov 1, 2018 5:49 PM

Wow!.  What a gold mine. I need to get into Graphics II mode as well to have a test platform for the plotter.

 

You are THE man.  

 

Thanks



#203 Lee Stewart OFFLINE  

Lee Stewart

    River Patroller

  • 3,870 posts
  • Location:Silver Run, Maryland

Posted Thu Nov 1, 2018 6:45 PM

Wow!.  What a gold mine. I need to get into Graphics II mode as well to have a test platform for the plotter.

 

You are THE man.  

 

Thanks

 

You are more than welcome.

 

Besides straight-up Graphics2 mode, fbForth 2.0 (and TI Forth before it) has two hybrid modes that have bitmap graphics for part of the screen and text for the remainder:

  • Split mode has bitmap graphics in the top 2/3 of the screen and 8 lines of text in the bottom 1/3.  This is used for the 64-column editor.
  • Split2 mode has 4 lines of text in the top 1/6 of the screen and bitmap graphics in the bottom 5/6.

The split modes are ideal for testing bitmap graphics coding.

 

...lee



#204 TheBF OFFLINE  

TheBF

    Dragonstomper

  • 853 posts
  • Location:The Great White North

Posted Thu Nov 1, 2018 7:47 PM

Yes I remember being very fond of the 64 column editor with the split screen.  It was a windowed environment on a TI-99!

 

I will look into those split modes.  For debugging it will be ideal for sure.

 

  I found my old binder with my BLOCK listings and I wrote an Indexer way back then so It even has the index at the beginning.  :)

 

I am going to use the Forth code as starting point see how far I get. These modes are foreign to me.  Bit of a learning curve.

When I look at your ALC for DOT it's not obvious yet what's going on. More staring required.



#205 FarmerPotato ONLINE  

FarmerPotato

    Chopper Commander

  • 212 posts
  • Location:Austin, TX

Posted Fri Nov 2, 2018 12:28 PM

this probably belongs on a separate thread...

 

 

You are more than welcome.

 

Besides straight-up Graphics2 mode, fbForth 2.0 (and TI Forth before it) has two hybrid modes that have bitmap graphics for part of the screen and text for the remainder:

  • Split mode has bitmap graphics in the top 2/3 of the screen and 8 lines of text in the bottom 1/3.  This is used for the 64-column editor.
  • Split2 mode has 4 lines of text in the top 1/6 of the screen and bitmap graphics in the bottom 5/6.

The split modes are ideal for testing bitmap graphics coding.

 

...lee

I don't remember split2! split was fascinating and caused me to ponder all the ways bitmap mode could be exploited.

 

I put a lot of effort into implementing a split mode with 18 rows of graphics and 6 rows of proportionally spaced bitmapped text (A/L library, not FORTH.) It squeezed about 42 characters on each line.

 

It computed a width table for patterns after loading CHARA1. It kept a 2 char (16 byte) working pattern buffer in ram, and each character to emit would be bit shifted and ORed with the buffer, which would be then be sent to VDP.  When the right bytes were touched, the buffer would move the right char into the left and refresh.

 

It will be in my bag o stuff to show at CHI Friday.



#206 TheBF OFFLINE  

TheBF

    Dragonstomper

  • 853 posts
  • Location:The Great White North

Posted Sat Nov 3, 2018 4:05 PM

I put together a test platform for myself for the Plotter control project and I realized that it could be a console for Vorticon's plotter control language.

It's not fancy but it let's me code some demos and get a solid platform upon which to build.

The sprite here will be simply following the progress of the plotter pen so it doesn't need to be too fast.

 

But even with this simple code the beauty of having a build-in interpreter can be demonstrated.

 

Here is the script that is interpreted as the BOXDEMO. 

\ interpreting drawing commands
 CLEAR
\ size  y  x
\ ----------------
   10  20 20  BOX
   20  20 20  BOX
   30  20 20  BOX
   40  20 20  BOX
   50  20 20  BOX
   60  20 20  BOX
   70  20 20  BOX
   80  20 20  BOX
   90  20 20  BOX
  100  20 20  BOX
  110  20 20  BOX
  120  20 20  BOX

And here are the user API commands so far. They could be enhanced with more error checking but this is a first cut.

 

The plan is to  get the turtle commands into the set as well.

 

And of course the commands will also need to have the plotter driver control added to them. That is not to tricky with concatenative languages.

: PEN-UP   ( -- )   1 CURSOR SP.COLOR ;
: PEN-DOWN ( -- ) RED CURSOR SP.COLOR ;
: MOVETO   ( y x -- ) PEN-UP   (X,Y) LINE .XY ;
: LINETO   ( y x -- ) PEN-DOWN (X,Y) LINE .XY ;
: HOME     ( -- ) 0 0 MOVETO ;
: RIGHT    ( n -- ) (X,Y)  >R +   0 255 CLIP  R>  LINETO ;
: LEFT     ( n -- ) NEGATE RIGHT ;
: DOWN     ( n -- ) (X,Y) ROT +  0 192 CLIP LINETO ;
: UP       ( n -- ) (X,Y) ROT -  0 192 CLIP LINETO ;

: BOX  ( size y x -- )
       DEPTH 3 < ABORT" BOX args"
       MOVETO
       DUP RIGHT
       DUP DOWN
       DUP LEFT
           UP
;

So when I have a something that I think can drive the plotter we can test the box demo as a first venture.

I have never done anything with graphics generation so I am in over my head but it's interesting.

Attached Files


Edited by TheBF, Sat Nov 3, 2018 10:00 PM.


#207 Vorticon OFFLINE  

Vorticon

    River Patroller

  • Topic Starter
  • 3,495 posts
  • Location:Eagan, MN, USA

Posted Sat Nov 3, 2018 6:33 PM

I put together a test platform for myself for the Plotter control project and I realized that it could be a console for Vorticon's plotter control language.

It's not fancy but it let's me code some demos and get a solid platform upon which to build.

The sprite here will be simply following the progress of the plotter pen so it doesn't need to be too fast.

 

But even with this simple code the beauty of having a build-in interpreter can be demonstrated.

 

Here is the script that is interpreted as the BOXDEMO. 

\ interpreting drawing commands
 CLEAR
\ size  y  x
\ ----------------
   10  20 20  BOX
   20  20 20  BOX
   30  20 20  BOX
   40  20 20  BOX
   50  20 20  BOX
   60  20 20  BOX
   70  20 20  BOX
   80  20 20  BOX
   90  20 20  BOX
  100  20 20  BOX
  110  20 20  BOX
  120  20 20  BOX

And here are the user API commands so far. They could be enhanced with more error checking but this is a first cut.

 

The plan is to  get the turtle commands into the set as well.

 

And of course the commands will also need to have the plotter driver control added to them. That is not to tricky with concatenative languages.

: PEN-UP   ( -- )   1 CURSOR SP.COLOR ;
: PEN-DOWN ( -- ) RED CURSOR SP.COLOR ;
: MOVETO   ( y x -- ) PEN-UP   (X,Y) LINE .XY ;
: LINETO   ( y x -- ) PEN-DOWN (X,Y) LINE .XY ;
: HOME     ( -- ) 0 0 MOVETO ;
: RIGHT    ( n -- ) (X,Y)  >R +   0 255 CLIP  R>  LINETO ;
: LEFT     ( n -- ) NEGATE RIGHT ;
: DOWN     ( n -- ) (X,Y) ROT +  0 192 CLIP LINETO ;
: UP       ( n -- ) (X,Y) ROT -  0 192 CLIP LINETO ;

: BOX  ( size y x -- )
       DEPTH 2 < ABORT" BOX args"
       MOVETO
       DUP RIGHT
       DUP DOWN
       DUP LEFT
           UP
;

So when I have a something that I think can drive the plotter we can test the box demo as a first venture.

I have never done anything with graphics generation so I am in over my head but it's interesting.

 

 

 

 

Nice! This is exactly what I was envisioning for the plotter control program in Forth. 



#208 Vorticon OFFLINE  

Vorticon

    River Patroller

  • Topic Starter
  • 3,495 posts
  • Location:Eagan, MN, USA

Posted Sat Nov 3, 2018 6:36 PM

Yes I remember being very fond of the 64 column editor with the split screen.  It was a windowed environment on a TI-99!

 

I will look into those split modes.  For debugging it will be ideal for sure.

 

  I found my old binder with my BLOCK listings and I wrote an Indexer way back then so It even has the index at the beginning.  :)

 

I am going to use the Forth code as starting point see how far I get. These modes are foreign to me.  Bit of a learning curve.

When I look at your ALC for DOT it's not obvious yet what's going on. More staring required.

 

I used this split mode when I programmed Core War in TI Forth, the granddaddy of FbForth :)

 



#209 TheBF OFFLINE  

TheBF

    Dragonstomper

  • 853 posts
  • Location:The Great White North

Posted Sun Nov 4, 2018 7:59 PM

I got the mini LOGO words working with a sprite so that give me the rest of the hi-level platform.

This was written in Forth for a tiny machine and it used single letter names for things. So this is pretty big re-write, but I was grateful for the head start.

You can see the author working here:  https://blogs.msdn.m...-the-fignition/

 

It has a 6 degree resolution for angles from what I can understand ie: 15 TURN changes by 90 degrees, but it will be fine for a test platform.

 

I put some place holders in the code where the plotter control will go.

The spoiler has the code.  The movie runs the demo.

 

1 step closer. I gotta stop for a while :-\

 

Spoiler

Attached Files


Edited by TheBF, Sun Nov 4, 2018 8:07 PM.


#210 Vorticon OFFLINE  

Vorticon

    River Patroller

  • Topic Starter
  • 3,495 posts
  • Location:Eagan, MN, USA

Posted Wed Nov 21, 2018 3:18 PM

This is an update of the image capture project I started 3 years ago, with much improved image processing in half-tone.

Details in my blog: http://atariage.com/...-994a-computer/

 



#211 TheBF OFFLINE  

TheBF

    Dragonstomper

  • 853 posts
  • Location:The Great White North

Posted Tue Dec 4, 2018 10:49 PM

So I started reverse engineering your new 1/2 step code to make a control lexicon in Forth for the plotter.

 

I get much of it but it's not 100% yet.

In the code below and in other places where you read the pointer variables like XPTR, why is it multiplied by 8? (SLA R2,3 )

 

Do you read the data in the tables from right to left  for each byte?  

* INITIALIZE X MOTOR ROUTINE
INITX  MOV  R11,@SUBRT3
       LI   R1,XPMDAT
       MOV  R1,@DATORG
       MOV  @XPTR,R2
       SLA  R2,3              * Why is the XPTR value multiplied by 8?
       A    R2,R1
       MOV  R1,@DATLOC
       LI   R1,>0400          SELECT X/Y CHIP
       MOV  R1,@SEL
       LI   R7,300            SET DELAY
       MOV  R7,@DELVAL
       MOV  @XPTR,R2
       MOV  @SUBRT3,R11
       B    *R11

To give you a taste of how this will work; to enable to the card, your label INITRS,  I have a word >PIO.

What you label SHTDN is called PIO-CLOSE.

 

Here are the definitions for those routines written using other words created for this job.

: >PIO   ( -- )
         RS232#1 CARD    \ select the card
         LED-ON         
         'PIO OFF ;      \ reset PIO port to zero

: PIO-CLOSE ( -- ) >PIO  CARD-OFF  LED-OFF ;

The goal is to make it easy to use.



#212 Vorticon OFFLINE  

Vorticon

    River Patroller

  • Topic Starter
  • 3,495 posts
  • Location:Eagan, MN, USA

Posted Wed Dec 5, 2018 11:34 AM

XPTR is a pointer to the current active sequence of the X axis motor in the stepper motor activation sequence table at XPMDAT.

Each sequence is 8 bytes long, so we have to multiply XPTR by 8 in order to point to the beginning of the sequence data in the table. 

 

At the Chicago pre-Faire gathering, Lee managed to simply point to the assembly driver from FbForth and directly access the routines like HOMEXY, PDOWN etc... without having to rework them in Forth. That's probably to most painless way to do it and it worked beautifully. Since you have already created a mini LOGO in Forth, I wonder if you could incorporate your code into his to get the plotter to plot the turtle movements directly.

 

Currently, once the blocks file is loaded, I can just type HOMEXY and the printer X and Y axes home in. PDOWN lowers the pen, PUP raises it, XRIGHT moves the X axes right 1 step etc... So basically fold these already defined primitives into your LOGO code and we've got a unique LOGO system!



#213 Vorticon OFFLINE  

Vorticon

    River Patroller

  • Topic Starter
  • 3,495 posts
  • Location:Eagan, MN, USA

Posted Wed Dec 5, 2018 11:36 AM

XPTR is a pointer to the current active sequence of the X axis motor in the stepper motor activation sequence table at XPMDAT.

Each sequence is 8 bytes long, so we have to multiply XPTR by 8 in order to point to the beginning of the sequence data in the table. 

 

At the Chicago pre-Faire gathering, Lee managed to simply point to the assembly driver from FbForth and directly access the routines like HOMEXY, PDOWN etc... without having to rework them in Forth. That's probably to most painless way to do it and it worked beautifully. Since you have already created a mini LOGO in Forth, I wonder if you could incorporate your code into his to get the plotter to plot the turtle movements directly.

 

Currently, once the blocks file is loaded, I can just type HOMEXY and the printer X and Y axes home in. PDOWN lowers the pen, PUP raises it, XRIGHT moves the X axes right 1 step etc... So basically fold these already defined primitives into your LOGO code and we've got a unique LOGO system!

 

I'll post Lee's file when I get home tonight.



#214 TheBF OFFLINE  

TheBF

    Dragonstomper

  • 853 posts
  • Location:The Great White North

Posted Wed Dec 5, 2018 12:46 PM

That sounds like that a quick way out the door for sure.  I was considering just re-doing your ASM code in RPN asm but then I pulled up the schematic and the motor driver data sheet and I got all Forthy. :-)

 

So your code is data driven which is most common in conventional languages.  But when I read the description of how you sequence the coils in a stepper motor,

I realized that was the language I needed to create to write the motor controller.  I  took the "code" sequence from the BLOG. 

 

I have not tested any of this yet, but here an alternative way to code, replacing DATA with Forth words. (Edit: it now compiles)

 

All of this is the low level driver language to make the motors move. All I have to do now is write the high level words that you had in your DEF statements using this interface language.

 

Edit2:  I already see problems with this but they are just about re-organizing the order of things in the motor sequencing. Ah well...

Edit3:  I had forgotten that I had to activate 2 coils at once sometimes so this version corrects that. No attempt was made to make it tiny so it uses a about 1546 bytes.

However it replaces the ASM code and the Basic code so not too bad. 

 

*NOT TESTED* on a PIO port.*  ( Need to get one those cool db25 to terminal block thingies)

 

Spoiler


Edited by TheBF, Wed Dec 5, 2018 11:01 PM.


#215 TheBF OFFLINE  

TheBF

    Dragonstomper

  • 853 posts
  • Location:The Great White North

Posted Wed Dec 5, 2018 11:49 PM

 

Currently, once the blocks file is loaded, I can just type HOMEXY and the printer X and Y axes home in. PDOWN lowers the pen, PUP raises it, XRIGHT moves the X axes right 1 step etc... So basically fold these already defined primitives into your LOGO code and we've got a unique LOGO system!

 

I'll post Lee's file when I get home tonight.

 

I will give that a whirl.  I need to fully setup FBForth first.  I don't have the block file easily accessible at the moment. Been meaning to do that.

 

If you have time, mount this disk or the contents, as dsk1 of your system and try out the code I wrote.

It will have bugs, but since you wrote code wars you could handle finding them easily I'm sure.

 

I set the delay in the motor on/off longer than yours in ASM code, so if you wanted to go faster just open the PLOTTER file in EDIT1 or your favourite TI programming editor and change the parameter for DELAY in the word STEP. 

Attached Files



#216 TheBF OFFLINE  

TheBF

    Dragonstomper

  • 853 posts
  • Location:The Great White North

Posted Thu Dec 6, 2018 7:38 AM

I forgot to give you some instructions:

 

The system assumes support files are on DKS1.

 

E/A option 5:  DSK1.CAMEL99

 

After the extensions load... type INCLUDE DSK1.PLOTTER

 

To see FORTH words type WORDS   (FNCT 4 will stop the listing)

 

Your commands are available (maybe) :-0

: PUP      ( -- ) WRITING?    IF  PENUP   THEN ;
: PDOWN    ( -- ) WRITING? 0= IF  PENDOWN THEN ;

: HOMEXY   ( -- ) HOMEX HOMEY ;
: HOMEP    ( -- ) TESTPEN PENUP ;
: XRIGHT   ( -- ) 12 0 DO  XFWD  LOOP ;
: XLEFT    ( -- ) 12 0 DO  XREV  LOOP ;
: YUP      ( -- ) 12 0 DO  YFWD  LOOP ;
: YDOWN    ( -- ) 12 0 DO  YREV  LOOP ;

Edited by TheBF, Thu Dec 6, 2018 7:39 AM.


#217 Vorticon OFFLINE  

Vorticon

    River Patroller

  • Topic Starter
  • 3,495 posts
  • Location:Eagan, MN, USA

Posted Fri Dec 7, 2018 6:12 AM

So I can fit all the files on a single DSSD disk except the VDPTYPE and VECTORIO files (a total of 6 sectors combined). Is it possible to trim the files down a bit? I cannot test it otherwise...



#218 TheBF OFFLINE  

TheBF

    Dragonstomper

  • 853 posts
  • Location:The Great White North

Posted Fri Dec 7, 2018 7:10 AM

You can remove those files no problem.

 

I just bundled up what I had.  

The system only uses the files you can see listed in the START file: 

DSK1.NEEDFROM

DSK1.INCLUDE

DSK1.CODE

DSK1.CELLS

DSK1.CHAR

 

and  your program uses DSK1.TOOLS, DSK1.CRU  and of course DSK1.PLOTTER.

 

Type  COLD  to reboot the system back to defaults.

 

Sorry for the inconvenience.


Edited by TheBF, Fri Dec 7, 2018 2:50 PM.


#219 Vorticon OFFLINE  

Vorticon

    River Patroller

  • Topic Starter
  • 3,495 posts
  • Location:Eagan, MN, USA

Posted Sat Dec 8, 2018 6:44 AM

Looks like we need a little more trimming :) Could the PLOTTER file be located on DSK2?



#220 TheBF OFFLINE  

TheBF

    Dragonstomper

  • 853 posts
  • Location:The Great White North

Posted Sat Dec 8, 2018 8:28 AM

Looks like we need a little more trimming :) Could the PLOTTER file be located on DSK2?

 

You only need 8 files so remove anything else you want to.  Remove ASM9900 and ANSFILES they are big.

 

SK1.NEEDFROM

DSK1.INCLUDE

DSK1.CODE

DSK1.CELLS

DSK1.CHAR

 

 DSK1.TOOLS, DSK1.CRU  DSK1.PLOTTER.



#221 Vorticon OFFLINE  

Vorticon

    River Patroller

  • Topic Starter
  • 3,495 posts
  • Location:Eagan, MN, USA

Posted Sat Dec 8, 2018 9:15 AM

OK thanks. I'll give it another shot tonight.



#222 Vorticon OFFLINE  

Vorticon

    River Patroller

  • Topic Starter
  • 3,495 posts
  • Location:Eagan, MN, USA

Posted Mon Dec 10, 2018 6:07 AM

I finally got a chance to test the Camel Forth program, and unfortunately it did not work. I have loaded all the files on one disk except for the ASM9900 and ANSFILES, so I don't think I'm missing anything here. I get a file error after the CHAR word is loaded. I am still able to continue afterwards but none of the plotter commands do anything. After I issue the first command, the cursor disappears although I am still able to type. I can see the RS232 card light come on and off with each command, so that part seems to be working at least :)

 

Attached File  20181209_214527.jpg   949.76KB   1 downloads



#223 TheBF OFFLINE  

TheBF

    Dragonstomper

  • 853 posts
  • Location:The Great White North

Posted Mon Dec 10, 2018 6:50 AM

OK. That's progress.  The CHAR file seems to been corrupted.  I saw that this weekend here and I saw the cursor disappear too.

I have only this weekend used this system on real iron for any length of time so you are something of an Alpha tester. (sorry)

 

I will wrap up a different ZIP file with the small file set for you and a hopefully a cursor too.

 

I have FBForth running on my PC but I have not integrated the LOGO examples yet. (got distracted by a serial port driver and...

some hospital time.  (halidol levels were a little too low for a couple of patients on my mom's floor this weekend) :-0






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users