Jump to content
IGNORED

Commodore style code entry on TI99


jrhodes

Recommended Posts

Is there any version of Basic/Extended Basic/RXB/similar that already has a code input method more similar to Commodore machines?

If i could navigate around the entire screen similar to vic-20/C64 Basic, while writing XB/RXB code on my TI, i would be in coders heaven.

Rich, if you read this, please consider adding (if at all possible) a "full screen, free form" code editor, similar to the one found on Commodore machines.

You find a way to let users enter code in a more C64-like fashion from RXB, and i don't think i would ever boot into normal TI-XB again.

Link to comment
Share on other sites

If I remember correctly, the Commodore parser simply read the characters on the line that your cursor is on and processed them. This is quite different to an approach where you wait for the user's input and process it.

 

The advantage of the Commodore approach was that you could list the floppy directory, walk up to the desired line, type load (or l-shift-o), walk behind the name, add ",8:" and press Return. The disadvantage was that you could accidentally execute stuff that you never planned to invoke. When you pressed Return on the line with "READY", you got a DATA ERROR because it parsed the line as "READ Y" (I somewhat hated that sloppy parser).

  • Thanks 1
Link to comment
Share on other sites

13 hours ago, mizapf said:

If I remember correctly, the Commodore parser simply read the characters on the line that your cursor is on and processed them. This is quite different to an approach where you wait for the user's input and process it.

The Apple II's editor was similar. You could enter an 'escape' mode and move the cursor anywhere around the screen, but pressing right-arrow entered whatever character was under the cursor as if you typed it. A little weird, but not too hard to implement (since you only need to special case one key) and quite flexible. However, pretty easy for the user to get confused ;) 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

22 hours ago, jrhodes said:

Is there any version of Basic/Extended Basic/RXB/similar that already has a code input method more similar to Commodore machines?

If i could navigate around the entire screen similar to vic-20/C64 Basic, while writing XB/RXB code on my TI, i would be in coders heaven.

Rich, if you read this, please consider adding (if at all possible) a "full screen, free form" code editor, similar to the one found on Commodore machines.

You find a way to let users enter code in a more C64-like fashion from RXB, and i don't think i would ever boot into normal TI-XB again.

Funny this topic came up. I have been considering modifying CAMEL99 Forth to do this.

It is very convenient, and the text is sitting there in VDP memory so why not?

  • Like 2
Link to comment
Share on other sites

1 hour ago, TheBF said:

Funny this topic came up. I have been considering modifying CAMEL99 Forth to do this.

It is very convenient, and the text is sitting there in VDP memory so why not?

I was thinking for specifically Basic dialects, but if you do go ahead with this for CAMEL99, i may have to take a deeper look at it.

  • Like 1
Link to comment
Share on other sites

So this question gave me a little push to try this out and it works pretty well.  Thank you JRhodes.

Currently you can only edit around the screen and when you hit ctrl X the current line, left of the cursor gets put into a buffer in CPU RAM.

It's not too hard to put the text into Forth's "Terminal input buffer" (TIB) but I want to add some features before I make a new Forth kernel.

 

Spoiler  has the code it took to do it.

Video shows it working.

Spoiler

\ VDP Screen editor
\ Allows cursoring around the screen and passing VDP text to CPU buffer

INCLUDE DSK1.TOOLS    \ debugging

VARIABLE INSERT    \ insert/over-write flag

\ cursor movement controls
: CUP       VROW @ 1-  0 MAX VROW ! ;
: CDOWN     VROW @ 1+  L/SCR 1- MIN  VROW ! ;
: CRGHT     VCOL @ 1+  C/L@ 1- MIN  VCOL ! ;
: CLEFT     VCOL @ 1-  0 MAX  VCOL ! ;

: NEWLINE   CDOWN  VCOL OFF ;

: INS/DEL   INSERT @ -1 XOR INSERT ! ; \ toggle insert mode

\ ========================
\ Helpers

\ return vdp address of current screen row
: VLINE ( -- VDPaddr)  VROW @ C/L@ * ;

\ return text right of the cursor as a VDP stack string
: RIGHTSIDE  ( -- VDPaddr len)  VLINE C/L@  VCOL @ /STRING ;

\ return text left of cursor as a VDP stack string
: LEFTSIDE   ( -- VDPaddr len)  VLINE VCOL @ ;

\ copy vdp stack string to RAM address
: VCOPY      ( vaddr len addr -- ) SWAP VREAD ;

\ =======================
\ text manipulation

: DELCHAR    ( -- )
     RIGHTSIDE 1 /STRING TUCK     \ cut 1st char of RIGHTSIDE, tuck length
     PAD VCOPY                    \ copy to temp buffer
     PAD VPOS ROT VWRITE          \ write buffer back to CURSOR position
;

: PUSHRIGHT ( -- )
     RIGHTSIDE TUCK               \ tuck length for later
     PAD VCOPY                    \ read right side of line into PAD
     BL VPUT                      \ put a blank at cursor position
     PAD VPOS 1+ ROT VWRITE ;     \ write PAD back at VPOS+1
;


\ CASE compiler with BREAK that exits routine after a match
: CASE:      ( -- )
          POSTPONE OVER   POSTPONE =
          POSTPONE IF POSTPONE DROP  ; IMMEDIATE

: BREAK;   ( -- ) POSTPONE EXIT POSTPONE THEN ; IMMEDIATE

: KEYHANDLER ( char -- )
            0D CASE:  NEWLINE      BREAK;  \ ENTER key
            08 CASE:  CLEFT        BREAK;
            0B CASE:  CUP          BREAK;
            0A CASE:  CDOWN        BREAK;
            09 CASE:  CRGHT        BREAK;
            03 CASE:  DELCHAR      BREAK;
            04 CASE:  INS/DEL      BREAK;
            90 CASE:  PAGE         BREAK;  \ ^P

            INSERT @ IF  PUSHRIGHT THEN  VPUT VCOL 1+!
;

: EDITKEY ( -- char)              \ non-repeating KEY
            VPOS VC@ >R           \ Read screen char & RPUSH
            BEGIN                 \ start the loop
              TMR@ 1FFF >         \ read 9901 timer. compare to >2000
              IF CURS @           \ true? fetch cursor char
              ELSE R@             \ false? fetch screen char
              THEN VPUT           \ multi-tasking friendly screen write
              KEY?                \ check the keyboard
              ?DUP                \ DUP IF <> 0
            UNTIL                 \ loop until a key pressed
            R> VPUT ;             \ RPOP the screen char, put it back

\ Accept text from VDP screen, copy to Forth PAD buffer
\ Return address and length
: EDITOR ( -- addr n)
             BEGIN
                EDITKEY DUP 98 <>  \ ^X exit editor
             WHILE
                KEYHANDLER
             REPEAT
             DROP
             LEFTSIDE TUCK PAD VCOPY
             PAD SWAP ;

 

 

Link to comment
Share on other sites

On 9/28/2019 at 12:52 PM, jrhodes said:

Is there any version of Basic/Extended Basic/RXB/similar that already has a code input method more similar to Commodore machines?

If i could navigate around the entire screen similar to vic-20/C64 Basic, while writing XB/RXB code on my TI, i would be in coders heaven.

Rich, if you read this, please consider adding (if at all possible) a "full screen, free form" code editor, similar to the one found on Commodore machines.

You find a way to let users enter code in a more C64-like fashion from RXB, and i don't think i would ever boot into normal TI-XB again.

As Mizapf and Tursi pointed out it is similar but different.

Secondly RXB has a thing that makes the Commodore look like crap:

CALL USER("DSK#.BATCHFILE")

What does this do? Well it does everything you could type in including move the cursor on screen or load, save, edit, merge or TRACE test XB programs.

Watch these 14 videos and tell me how the Commodore editor can touch this with a 10 foot pole:

RXB demo 1 to 9 and A, B, C, D all from 2011 in RXB 2012, but need to make a new group on RXB 2020 soon.

Keep in mind these video show RXB doing all of this from a single DV80 file, there is no FILE SIZE LIMIT!

It is quite possible in Classic99 to make a DV80 file RXB will run for weeks if you are crazy enough to do it.

Look you could put every single XB program ever made into this DV80 file and load and run all of them and edit or merge them....

 

Again can the Commodore touch this feature with a ten foot pole????

Edited by RXB
wrong number in this post.
  • Like 3
Link to comment
Share on other sites

That's pretty cool stuff Rich.  You are making this old man work hard to try and catch up! :)

 

I like the QUITON QUITOFF.  I have done it in programs with bit twiddling,  but never created a Forth command so I am going to "borrow" those. Thanks for the idea.

 

Because CAMEL99 reads DV80 files for source code I can do some of those things but you have a lot of years put into your system.

Very very nice work.

  • Like 2
Link to comment
Share on other sites

  • 2 months later...

Been distracted by life but I finally got around to trying to do this. I am not sure that I am mimicking the VIC20 very well since the last time I touched one was 1980 something or other.  In fact it isn't the native mode really. I would have to change the kernel's ABORT routine to handle errors and restart the editor window rather than dump back into the normal Forth console.  It can be done if anyone really wants it.  As it is you restart the editor window manually after a fatal error.

 

I still have an intermittent bug in my repeating key code. It sometimes puts a random character on the screen.

The video shows it working the hidden window has the code.

As usual it was harder than I thought it would be. :)

 

\ VDP Screen editor
\ Allows cursoring around the screen and passing VDP text to CPU buffer

NEEDS DUMP FROM DSK1.TOOLS    \ debugging
NEEDS CASE FROM DSK1.CASE
NEEDS RKEY FROM DSK1.RKEY

HEX
: GREEN    13 7 VWTR ;
: CYAN     17 7 VWTR ;

VARIABLE INSERTING    \ INSERTING/over-write flag

\ auto-limited cursor movement controls
: CUP       VROW @ 1-  0 MAX VROW ! ;
: CDOWN     VROW @ 1+  L/SCR 1- MIN  VROW ! ;
: CRIGHT    VCOL @ 1+  C/L@  1- MIN  VCOL ! ;
: CLEFT     VCOL @ 1-  0 MAX  VCOL ! ;

: NEWLINE  ( -- ) CDOWN  VCOL OFF ;

DECIMAL
: INS/DEL  ( -- ) \ toggle mode
           INSERTING @ -1 XOR INSERTING !
           INSERTING @ IF 30 CURS ! ELSE 31 CURS ! THEN
;  
: BETWEEN  ( n lo hi -- ?) 1+ WITHIN ;

\ ========================
\ Helpers

\ return vdp address of current screen row
: VLINE ( -- VDPaddr)  VROW @ C/L@ * ;

\ return text right of the cursor as a VDP stack string
: RIGHTSIDE  ( -- VDPaddr len)  VLINE C/L@  VCOL @ /STRING ;

\ return text left of cursor as a VDP stack string plus one extra space
: LEFTSIDE   ( -- VDPaddr len)  VLINE VCOL @ 1+ ;

\ copy vdp stack string to RAM address
: VCOPY      ( vaddr len addr -- ) SWAP VREAD ;

\ =======================
\ text manipulation

: DELCHAR    ( -- )
     RIGHTSIDE 1 /STRING TUCK     \ cut 1st char of RIGHTSIDE, tuck length
     PAD VCOPY                    \ copy to temp buffer
     PAD VPOS ROT VWRITE          \ write buffer back to CURSOR position
;

: PUSHRIGHT ( -- )
     RIGHTSIDE TUCK               \ tuck length for later
     PAD VCOPY                    \ read right side of line into PAD
     BL VPUT                      \ put a blank at cursor position
     PAD VPOS 1+ ROT VWRITE       \ write PAD back at VPOS+1
;

: VDP>TIB   ( Vaddr len -- TIB len) \ VDP to Terminal input buffer (TIB)
            TUCK TIB SWAP VREAD   TIB SWAP
;

: INTERP-LINE ( -- )
               LEFTSIDE DUP 1 >   \ ignore empty lines
               IF    VDP>TIB INTERPRET
               ELSE  2DROP
               THEN
               STATE @ 0= IF ."   ok"  NEWLINE THEN
;

: STD-CONSOLE ( -- ) CR ." Forth" CYAN ABORT  ;

HEX
: KEYHANDLER ( char -- )
             CASE
                 0D OF  INTERP-LINE     ENDOF  \ ENTER key
                 08 OF  CLEFT           ENDOF  \ FCTN S
                 0B OF  CUP             ENDOF  \ FCTN E
                 0A OF  CDOWN           ENDOF  \ FCTN X
                 09 OF  CRIGHT          ENDOF  \ FCTN D
                 03 OF  DELCHAR         ENDOF  \ FCTN 1
                 04 OF  INS/DEL         ENDOF  \ FCTN 2
                 90 OF  PAGE            ENDOF  \ ^P
                 98 OF  STD-CONSOLE     ENDOF  ( ^X )
             ENDCASE
;

\ Accept text from VDP screen, copy to Forth PAD buffer
\ Return address and length
DECIMAL
: /ED ( -- addr n)   \ EDITing QUIT
         GREEN
         INSERTING OFF
         31 CURS !
         RP0 RP!
         SOURCE-ID OFF
         POSTPONE [
         BEGIN
            RKEY DUP BL [CHAR] ~ BETWEEN ( printable test)
            IF INSERTING @
               IF
                 PUSHRIGHT
               THEN  VPUT CRIGHT
            ELSE
               KEYHANDLER
            THEN
         AGAIN ;

 

 

Edited by TheBF
fixed spoiler
  • Like 2
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...