Jump to content
IGNORED

fbForth/Triple Tech Card -- Question


Omega-TI

Recommended Posts

There is probably a slim chance I'll get an answer to this question, but I gotta ask it anyway...

 

Does anyone out there with fbForth also have a CorComp Triple Tech Card? If so, do you have possession of the proper code to read the time & date and then display it on screen? That would so bloody awesome to have.

 

 

 

My fbForth blog entry

 

I do not own a CC Triple Tech card; but, I can help you get the answer. Type the following code at the cursor and tell me what happens—hopefully, there will be two lines displayed after you finish typing:

0 VARIABLE CLOKBUF 32 ALLOT PABS @ CLOKBUF
OVER 32 + FILE CLOK CLOK SET-PAB F-D" CLOCK"
: TIME OPN RD CLSE CR CR DUP 0 DO CLOKBUF I + C@ EMIT LOOP CR . ;
TIME

...lee

Link to comment
Share on other sites

 

Type the following code at the cursor and tell me what happens—hopefully, there will be two lines displayed after you finish typing:

0 VARIABLE CLOKBUF 32 ALLOT PABS @ CLOKBUF
OVER 32 + FILE CLOK CLOK SET-PAB F-D" CLOCK"
: TIME OPN RD CLSE CR CR DUP 0 DO CLOKBUF I + C@ EMIT LOOP CR . ;
TIME

...lee

 

Oh yeah....Baby! I'm digging this fbForth so far!

 

gallery_35324_1027_43448.jpg

 

What's the next step? :grin:

Link to comment
Share on other sites

 

Cool! :cool:

 

 

That depends on what, exactly, you want to do—particularly, the format you want to display it in.

 

...lee

 

Wow, you mean I get a choice? :-o

And here I was just wondering how to save this for future use every time I typed 'TIME'!

 

Ultimately, I'd like it to display like, "Monday, 07/06/15 @ 12:24:02"

I would probably also add the TIME display to show upon booting as well.

Link to comment
Share on other sites

Wow, you mean I get a choice? :-o

And here I was just wondering how to save this for future use every time I typed 'TIME'!

 

Ultimately, I'd like it to display like, "Monday, 07/06/15 @ 12:24:02"

I would probably also add the TIME display to show upon booting as well.

 

All of that is easy enough to do. You could even install a small user ISR (Interrupt Service Routine) to update a clock at a particular location on the screen every second—or, whatever.

 

The one fly in the ointment is where exactly to place the PAB (Peripheral Access Block) for the CLOCK file so it doesn't get stepped on by other files you may wish to open or that you open without realizing you are doing so. The latter occurs in words I have defined, like DIR and CAT . They use the VRAM area pointed to by PABS . That is the same place I used in the code I had you type. What I think I will do is to allow the user to change the location at her/his whim and have the TIME word copy the PAB every time it is executed. That is what I did with DIR and CAT . I usually open/read(or write)/close a file in one routine to avoid problems. That is what I do with reading/writing fbForth blocks files.

 

...lee

Link to comment
Share on other sites

 

All of that is easy enough to do. You could even install a small user ISR (Interrupt Service Routine) to update a clock at a particular location on the screen every second—or, whatever.

 

 

Interesting! On the old TRS-80 Model III there was a command "CLOCK ON" that put the time and date display in the upper right-hand corner of the display. "CLOCK OFF" would turn it off. This fbForth is starting to look like it has more utility than I originally envisioned. :)

 

Would I be able to do what I did before: TYPE 1 EDIT then insert those lines of code and then type FLUSH to save it, or would it be better done differently?

Link to comment
Share on other sites

Interesting! On the old TRS-80 Model III there was a command "CLOCK ON" that put the time and date display in the upper right-hand corner of the display. "CLOCK OFF" would turn it off. This fbForth is starting to look like it has more utility than I originally envisioned. :)

 

Would I be able to do what I did before: TYPE 1 EDIT then insert those lines of code and then type FLUSH to save it, or would it be better done differently?

 

That is precisely what I would do, but with some modification. After all, I was trying to discover what was going on with that code. I will get you something in a bit.

 

...lee

Link to comment
Share on other sites

Thanks Lee.

 

I tried putting that text into the first block and saved it like I did with the screen commands, but for some unknown reason to me, it simply would not work. :?

 

You probably put it before the execution of TEXT80 . That's one reason I need to change the definition for this purpose. PABS points to a different VRAM address in TEXT from what it does in TEXT80 . Type the following after the cursor:

HEX TEXT PABS @ TEXT80 PABS @ U. U. DECIMAL 

The two numbers are the hexadecimal addresses of the VRAM area pointed to by PABS in the two VDP modes. When you defined TIME and first executed it, it was pointing to the first. When you executed it later by typing it after the cursor, it was pointing to the second, which was not where the PAB had been copied.

 

I'll try to have something later this evening or first thing tomorrow. Right now I'm going to a movie with my honey. TTFN!

 

...lee

Link to comment
Share on other sites

I played around while you were out, sort of trying to figure out the cryptic syntax... without bothering to look at a manual.

 

I got it to come up in RAW format on boot up, but I get a bloody '13' that shows up that I cannot seem to get rid of.

 

 

BTW - I noticed the command CLS works to clear the screen (I like that), but it does not home the cursor, which is kind of weird and will take some getting used to.

post-35324-0-65006100-1436234235_thumb.jpg

post-35324-0-09528100-1436234262_thumb.jpg

  • Like 1
Link to comment
Share on other sites

I played around while you were out, sort of trying to figure out the cryptic syntax... without bothering to look at a manual.

 

I got it to come up in RAW format on boot up, but I get a bloody '13' that shows up that I cannot seem to get rid of.

 

BTW - I noticed the command CLS works to clear the screen (I like that), but it does not home the cursor, which is kind of weird and will take some getting used to.

 

That ‘13’ is hex 13 (decimal 19). It is the number of bytes read from the CLOCK device and left on the stack by RD . I DUPed that value to be displayed so I could have you tell me the number of bytes read. Because HEX was executed before TIME was defined, you should change the two occurrences of ‘32’ (decimal) to ‘20’ (hexadecimal). To prevent displaying of the now unwanted number, remove DUP and . from the definition of TIME in line #5.

 

...lee

Link to comment
Share on other sites

Here is a version of TIME that will require you to put it in another available block. It can still be part of the bootup process. The spoiler has a readable version to help figuring out my logic. You can paste it at the cursor in Classic99 to see what it does when you type TIME .

 

 

 

( >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<)
( >>>>>>>>>>>>>> TIME from CorComp Triple Tech Card <<<<<<<<<<<<<<)
( >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<)

HEX 0 VARIABLE CLOKBUF 12 ALLOT  ( record buffer)
0 VARIABLE CLOKPABSV 10 ALLOT    ( RAM copy of PAB)
836E CONSTANT CLOKPABPTR         ( pointer to VRAM address of PAB)
CLOKPABPTR @   ( PAB VRAM address [value stack] for CLOCK file)
CLOKBUF     ( record buffer RAM address)                        
OVER 12 +   ( record buffer VRAM address)                       
FILE CLOK   ( define CLOCK file, CLOK)                          
CLOK SET-PAB F-D" CLOCK"  ( initialize CLOK's PAB & filename)   
CLOKPABPTR @ CLOKPABSV 12 VMBR      ( get copy of PAB)
: day   
   CLOKBUF C@     ( get ASCII day of week)
   30 -           ( convert ASCII to numeric day)
   CR
   CASE
      0 OF ." Mon" ENDOF
      1 OF ." Tues" ENDOF
      2 OF ." Wed" ENDOF
      3 OF ." Thurs" ENDOF
      4 OF ." Fri" ENDOF
      5 OF ." Satur" ENDOF
      6 OF ." Sun" ENDOF
   ENDCASE
   ." day, "   ;                                               
: date   CLOKBUF 2+ 8 TYPE ."  @ "   ;
: time   CLOKBUF 0B + 8 TYPE CR   ;
: fixCLOK   ( correct PAB, RAM buffer and VRAM buffer locations)
   ' CLOK >R         ( PFA of CLOK to return stack)
   CLOKPABPTR @ DUP  ( 2 copies of PAB address)
   R 4 + !           ( correct PAB address to CLOK )
   12 + DUP          ( 2 copies of VRAM record buffer addr)
   CLOKPABSV 2+ !    ( save a copy to RAM copy of PAB)
   R> !              ( save a copy to CLOK)
   CLOKPABSV CLOKPABPTR @ 12 VMBW   ;  ( restore PAB)
: TIME   ( display time information from CorComp Triple Tech Card)
   fixCLOK     ( fix CLOK file word in case VDP mode changes)
   CLOK        ( correct PAB-ADDR, PAB-BUF and PAB-VBUF)
   OPN RD DROP CLSE day date time   ;
DECIMAL

 

 

 

You can put the code block below in block #62. That will leave a blank block before it for expansion of the previous blocks:

( TIME..Date/time from CorComp Triple Tech Card..LES 07JUL2015)
 0 CLOAD TIME  BASE->R  HEX   0 VARIABLE CLOKBUF 12 ALLOT
0 VARIABLE CLOKPABSV 10 ALLOT   836E CONSTANT CLOKPABPTR 
CLOKPABPTR @   CLOKBUF   OVER 12 +   FILE CLOK
CLOK SET-PAB F-D" CLOCK"   CLOKPABPTR @ CLOKPABSV 12 VMBR
: day   CLOKBUF C@  30 - CR   CASE   0 OF ." Mon" ENDOF
   1 OF ." Tues" ENDOF   2 OF ." Wed" ENDOF
   3 OF ." Thurs" ENDOF   4 OF ." Fri" ENDOF
   5 OF ." Satur" ENDOF   6 OF ." Sun" ENDOF
   ENDCASE   ." day, "   ; 
: date   CLOKBUF 2+ 8 TYPE ."  @ "   ;
: time   CLOKBUF 0B + 8 TYPE CR   ;
: fixCLOK   ' CLOK >R   CLOKPABPTR @ DUP   R 4 + !   12 + DUP
   CLOKPABSV 2+ !   R> !   CLOKPABSV CLOKPABPTR @ 12 VMBW   ;
: TIME   fixCLOK   CLOK   OPN RD DROP CLSE day date time   ;
                                          R->BASE 

You should replace what you have changed (all of the TIME stuff) in block #1 with

DECIMAL 62 CLOAD TIME HEX  ( conditional LOAD of TIME)

This will conditionally load block #62 when block #1 loads. It is also safe to use after switching among TEXT , TEXT80 , GRAPHICS , SPLIT and SPLIT2 modes.

 

[EDIT: There is something I need to fix in the above code before it is really “safe” to switch modes. I forgot to move the VRAM record buffer with the PAB. :dunce: I will get to that after I've had some sleep. FIXED! ]

 

...lee

Edited by Lee Stewart
  • Like 1
Link to comment
Share on other sites

Okay, thanks, I'll get to that tomorrow. Right now it looks like I screwed something up because...

 

You inadvertently stepped on my verification in the definition of MENU that tries to insure that FBLOCKS is the current blocks file when you type MENU . I should probably do something else. At any rate, MENU is checking that ‘f’ and ‘b’ are the second and third letters of block #1. That's what the hex code 6662 is all about. Either restore the position of “fbForth” in the block—perhaps, something like “( fbForth Welcome Screen for Omega)”—or change 6662 to 4F6D for the “Om” of Omega.

 

...lee

Link to comment
Share on other sites

Okay Lee, I fixed the first with the 4F6D, but will not have time until later this evening to type in the block 62 coding for a test. I did notice that you've come into possession of the erroneous documentation too. :P The Triple Tech actually goes from 0-6, for the days of the week, not the more logical 1-7 like the book purports, so I'll make that change when I type it in. :thumbsup:

 

I eventually will need to get a copy of fbForth for Classic99, that way I can just copy, paste and save to the SD card before plugging it into the TI. For now, at least on small stuff, the typing will help me get familiar with Forth.

Link to comment
Share on other sites

Okay Lee, I fixed the first with the 4F6D, but will not have time until later this evening to type in the block 62 coding for a test. I did notice that you've come into possession of the erroneous documentation too. :P The Triple Tech actually goes from 0-6, for the days of the week, not the more logical 1-7 like the book purports, so I'll make that change when I type it in. :thumbsup:

I have fixed what I posted earlier to work no matter what mode (except bitmap [ GRAPHICS2 ], of course) you change to. I will post it later today. I included your DOW numbers. I presume the lowest is still Monday?

I eventually will need to get a copy of fbForth for Classic99, that way I can just copy, paste and save to the SD card before plugging it into the TI. For now, at least on small stuff, the typing will help me get familiar with Forth.

 

You do know that is in the first post of fbForth—TI Forth with File-based Block I/O , right?

 

...lee

Link to comment
Share on other sites

The code for TIME in post #16 above now works as advertised in all VDP modes except full bitmap ( GRAPHICS2 ) regardless of the mode extant at the time of loading! Note that the definition of day uses DOW (Day Of Week) numbers 0 – 6 for Monday – Sunday.

 

...lee

Link to comment
Share on other sites

No, I did not know that. Sorry, I've only very recently paid attention to this thread. It'll come in handy when I get back to it, as I have to START ALL OVER! For some reason block 62 errors out and now will not even load for editing. I had typed it in in a couple of stages, and was able to reload, but after I modified block one to call it, it blew up. Now, I'll be too busy for the rest of today and tomorrow, so I'll try to get back to it Friday or Saturday. I really hate doing things more than once, especially when I have no clue what FUBAR'ed it. ...

 

It is possible that when you tried to edit block #62, for some reason you still had radix 16 ( HEX ) in effect. That would mean you were trying to load block #98, which would throw an error because FBLOCKS is only 80 blocks long. You can easily determine the current radix (number base) by typing .BASE , which will report the current radix in decimal.

 

We can troubleshoot the problem when you have time.

 

...lee

  • Like 1
Link to comment
Share on other sites

Okay, this is where I sit now...

 

When it loads it looks like this...

gallery_35324_1027_1474.jpg

 

So I try to edit block 62 and get this...

gallery_35324_1027_1714.jpg

 

So I go in and remove line # 8

gallery_35324_1027_25350.jpg

 

After removing line #8 I can edit block 64 again...

gallery_35324_1027_49820.jpg

 

What am I missing here? I think I did exactly what you said...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...