Jump to content
Willsy

The 7's Problem

Recommended Posts

46 minutes ago, unhuman said:

If I remember correctly, I used HCHAR b/c printing with ; puts an extra space in on the TI, unlike other basics.

Thanks for weighing in. Nice to hear from the author.

When I ran it, the output seemed exactly the same as the original. Try it if you have an emulator and let me know if I missed something.

It also takes a fair bit less code. Always a win in TI BASIC.

  • Like 1

Share this post


Link to post
Share on other sites
On 11/18/2019 at 10:17 PM, TheBF said:

I have been using Lee's version of this program to evaluate my screen I/O routines.  I found a small improvement.

We don't have to make a counted string since TYPE uses a stack string (addr,len) and we have LENGTH.

It takes a few milliseconds off. :)

 

: TYPE-A1 ( -- )
\   LENGTH PAD C!   \ store string length
   PAD               \ copy of PAD to start string storage loop
   A1 1- DUP LENGTH + DO  \ DO A1+length-1 to A1
      I [email protected]           \ get next digit
      48 +           \ convert to ASCII
      OVER C!        \ store ASCII digit in PAD
      1+             \ next PAD location
   -1 +LOOP
   DROP              \ clean up stack
   CR PAD LENGTH TYPE CR ;  \ type number

 

And after glancing at it again I realized we don't have put the chars into PAD at all! 

Lee has nicely made the array printable as is, we just have to type from back to front.

: TYPE-A1
    A1 LENGTH 1- +
    0 LENGTH
    DO
       DUP [email protected] 48 + EMIT
       1-
    -1 +LOOP
    DROP
 ;

And if I make use of my new words to use VDP hardware auto-increment it becomes this and it runs in 1:03

: TYPE-A1
    VPOS VDPWA!
    A1 LENGTH 1- +
    0 LENGTH
    DO
       DUP [email protected] 48 + VEMIT ?CR
       1-
    -1 +LOOP
    DROP
 ;

 

 

 

Share this post


Link to post
Share on other sites
3 hours ago, unhuman said:

If I remember correctly, I used HCHAR b/c printing with ; puts an extra space in on the TI, unlike other basics.

 

TI Basic “PRINT ;” does output a space or ‘-’ before and a space after a number. It does not, however, output any spaces for characters or strings.

 

...lee

Share this post


Link to post
Share on other sites
9 minutes ago, Lee Stewart said:

 

TI Basic “PRINT ;” does output a space or ‘-’ before and a space after a number. It does not, however, output any spaces for characters or strings.

 

...lee

Wow...  I never knew that.  I was always annoyed at that extra space.  Prevented some things that other basics allowed when I was a kid... 

Edited by unhuman

Share this post


Link to post
Share on other sites
3 hours ago, TheBF said:

Thanks for weighing in. Nice to hear from the author.

When I ran it, the output seemed exactly the same as the original. Try it if you have an emulator and let me know if I missed something.

It also takes a fair bit less code. Always a win in TI BASIC.

Now you gotta compile it! 

Share this post


Link to post
Share on other sites
9 hours ago, unhuman said:

Now you gotta compile it! 

I will have to learn how first... or write a compiler :)

 

Share this post


Link to post
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.

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...