Jump to content

Photo

In DeNile


45 replies to this topic

#1 Retrospect OFFLINE  

Retrospect

    Dragonstomper

  • 865 posts
  • Location:Wakefield, England

Posted Thu May 4, 2017 8:45 AM

little TI Basic program 

 

 
10 CALL CLEAR
20 FOR L=65 TO 70
30 READ Q$
40 CALL CHAR(L,Q$)
50 NEXT L
60 DATA 010207091F247F92,8040E090F824FE49,FF92FF24FF92FF49,AA55448920024801,000217357CFC44AA,0008081C2A081414
70 CALL CHAR(104,"0083C7AEFBEFBDF7")
80 CALL CHAR(105,"00078F5DF7DF7BEF")
90 CALL CHAR(106,"000E1FBAEFBFF6DF")
100 CALL CHAR(107,"001C3E75DF7FEDBF")
110 CALL CHAR(108,"00387CEABFFEDB7F")
120 CALL CHAR(109,"0070F8D57FFDB7FE")
130 CALL CHAR(110,"00E0F1ABFEFB6FFD")
140 CALL CHAR(111,"00C1E357FDF7DEFB")
150 CALL COLOR(10,6,5)
160 X=13
170 C=1
180 PRINT TAB(X+1);"AB"
190 C$=C$&"CC"
200 B$="A"&C$&"B"
210 PRINT TAB(X);B$
220 C=C+1
230 X=X-1
240 IF C=13 THEN 250 ELSE 190
250 CALL HCHAR(24,1,68,32)
260 CALL HCHAR(23,1,69)
270 CALL HCHAR(23,2,70)
280 PRINT
290 PRINT
295 PRINT
296 CALL HCHAR(24,1,68,32)
300 T=104
310 Y=106
320 T=T+1
330 IF T>111 THEN 340 ELSE 350
340 T=104
350 Y=Y+2
360 IF Y>111 THEN 370 ELSE 380
370 Y=104
380 CALL HCHAR(22,1,T,32)
390 CALL HCHAR(23,1,Y,32)
400 GOTO 320
 
:)  feel free to add your own creations or work out shorter routines for this
 
Attached File  INDENILE.zip   775bytes   7 downloads


#2 sometimes99er OFFLINE  

sometimes99er

    River Patroller

  • 3,805 posts
  • Location:Denmark

Posted Thu May 4, 2017 8:53 AM

Very nice.  :thumbsup:



#3 Retrospect OFFLINE  

Retrospect

    Dragonstomper

  • Topic Starter
  • 865 posts
  • Location:Wakefield, England

Posted Thu May 4, 2017 8:57 AM

Very nice.  :thumbsup:

Thanks. :)

 

I'm thinking, "If only they had allowed multiple parenthesis on HCHAR commands in TI Basic!" it would have made this sort of thing that little bit smoother. 



#4 Retrospect OFFLINE  

Retrospect

    Dragonstomper

  • Topic Starter
  • 865 posts
  • Location:Wakefield, England

Posted Thu May 4, 2017 9:03 AM

Interestingly, if you compile that code without making a single alteration, you get this ...

 

Where's the little chap with his camel gone?  compiling caused the Great Flood!!

 

Attached File  nileshot.png   185.94KB   2 downloads


Edited by Retrospect, Thu May 4, 2017 9:05 AM.


#5 chue OFFLINE  

chue

    Space Invader

  • 39 posts

Posted Thu May 4, 2017 9:09 AM

In the compiled version the water flows faster, therefore it overflows and washes away the guy.



#6 Retrospect OFFLINE  

Retrospect

    Dragonstomper

  • Topic Starter
  • 865 posts
  • Location:Wakefield, England

Posted Thu May 4, 2017 2:01 PM

Add these lines to the program for added effect :)
 
141 CALL CHAR(71,"000000187EFF3C42")
311 S=32
371 CALL HCHAR(3,1,32,32)
372 S=S-1
373 IF S<1 THEN 374 ELSE 380
374 S=32
 
EDIT: This is wrong. There's a DSK further down the posts.  

Edited by Retrospect, Thu May 4, 2017 4:18 PM.


#7 Lee Stewart OFFLINE  

Lee Stewart

    River Patroller

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

Posted Thu May 4, 2017 3:13 PM

Here is your first program in fbForth 2.0:

 

Spoiler

 

The river flows too fast without delays.

 

...lee



#8 Lee Stewart OFFLINE  

Lee Stewart

    River Patroller

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

Posted Thu May 4, 2017 3:14 PM

Add these lines to the program for added effect :)

 
141 CALL CHAR(71,"000000187EFF3C42")
311 S=32
371 CALL HCHAR(3,1,32,32)
372 S=S-1
373 IF S<1 THEN 374 ELSE 380
374 S=32

 

Something is not right with this code, Joe.

 

...lee



#9 Retrospect OFFLINE  

Retrospect

    Dragonstomper

  • Topic Starter
  • 865 posts
  • Location:Wakefield, England

Posted Thu May 4, 2017 4:17 PM

Ok Lee, thanks, I've corrected it now.

Attached Files


Edited by Retrospect, Thu May 4, 2017 7:17 PM.


#10 Retrospect OFFLINE  

Retrospect

    Dragonstomper

  • Topic Starter
  • 865 posts
  • Location:Wakefield, England

Posted Thu May 4, 2017 4:22 PM

 

 

The river flows too fast without delays.

 

...lee

Hi Lee.  I just pasted this into JS99er as I'm not near the main computer.  Running FBforth, it pasted in but then produced an unexpected result, a kind of graphics glitch/crash.



#11 Lee Stewart OFFLINE  

Lee Stewart

    River Patroller

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

Posted Thu May 4, 2017 4:42 PM

Hi Lee.  I just pasted this into JS99er as I'm not near the main computer.  Running FBforth, it pasted in but then produced an unexpected result, a kind of graphics glitch/crash.

 

I will need to take a look.

 

...lee



#12 Lee Stewart OFFLINE  

Lee Stewart

    River Patroller

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

Posted Thu May 4, 2017 5:06 PM

Hi Lee.  I just pasted this into JS99er as I'm not near the main computer.  Running FBforth, it pasted in but then produced an unexpected result, a kind of graphics glitch/crash.

 

Are you using it with v2.0:9?  When I selected "software", it brought up v2.0:5---that definitely will not work!

 

...lee



#13 Retrospect OFFLINE  

Retrospect

    Dragonstomper

  • Topic Starter
  • 865 posts
  • Location:Wakefield, England

Posted Thu May 4, 2017 5:21 PM

 

Are you using it with v2.0:9?  When I selected "software", it brought up v2.0:5---that definitely will not work!

 

...lee

Yeah it's 2.05 



#14 Retrospect OFFLINE  

Retrospect

    Dragonstomper

  • Topic Starter
  • 865 posts
  • Location:Wakefield, England

Posted Thu May 4, 2017 6:36 PM

Hey Lee, I got home and tried it out, using fbforth 2.09 in classic99 ... it's fast, isn't it!

 

I gotta say, forth has a lot of potential gaming wise as well as anything else.  What would we do to introduce a delay?



#15 Lee Stewart OFFLINE  

Lee Stewart

    River Patroller

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

Posted Thu May 4, 2017 7:07 PM

Hey Lee, I got home and tried it out, using fbforth 2.09 in classic99 ... it's fast, isn't it!

 

I gotta say, forth has a lot of potential gaming wise as well as anything else.  What would we do to introduce a delay?

 

We could write a NOP loop and supply it a number for the number of times to go through the loop:

 

: DELAY  ( n --- )

   0 DO 

      NOP

   LOOP  ;

 

1000 DELAY would execute NOP 1000 times to give some delay.  The more you give the loop to do, the longer each time through the loop will take.  You could time certain operations to get a desired value for the loop to give DELAY a more specific delay like, perhaps msec or sec .  DELAY as written here takes 0.14 ms per loop.

 

...lee



#16 Lee Stewart OFFLINE  

Lee Stewart

    River Patroller

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

Posted Thu May 4, 2017 7:48 PM

Here it is with ~100 ms delay between rewrites of the river graphics.  Note the definition of msec and its use in RIVER :

 

Spoiler

 

...lee



#17 Lee Stewart OFFLINE  

Lee Stewart

    River Patroller

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

Posted Thu May 4, 2017 9:10 PM

And, here is UFO with the same ~100 ms delay.  Sorry about the increased stack-ro-batics in RIVER   | :)  :

 

Spoiler

 

...lee



#18 TheBF OFFLINE  

TheBF

    Chopper Commander

  • 164 posts
  • Location:The Great White North

Posted Thu May 4, 2017 11:26 PM

I am always fascinated by the difference in programs written in BASIC and converted to Forth.

The authors of BASIC really created a very consise language. The programs are pretty small

compared to the Forth version.

But it's a closed box unless you want to re-write the language.

 

I am working on creating a layer that adds a little more TI BASIC functionality by adding some words

to Forth. That might close the gap on line count a little.

 

But Forth was designed to be primitive and expandable as your DENILE routine demonstrates Lee.

Very nice.

 

It's late. I need to crash.

 

BF



#19 TheBF OFFLINE  

TheBF

    Chopper Commander

  • 164 posts
  • Location:The Great White North

Posted Fri May 5, 2017 7:33 AM

Put this in the "for what it's worth" jar.

 

ANS Standard Forth has a word called 'MS' which gives you a delay in milliseconds, just like Lee's 'msec' word.

 

In real time systems this is connected to some kind of timer so it can be very accurate.

In multi-tasking systems it also puts the task to sleep so the computer can do other things while

the delay is going on.

 

It's a pretty cool word even though it looks simple.

 

BF



#20 Retrospect OFFLINE  

Retrospect

    Dragonstomper

  • Topic Starter
  • 865 posts
  • Location:Wakefield, England

Posted Fri May 5, 2017 8:52 AM

And, here is UFO with the same ~100 ms delay.  Sorry about the increased stack-ro-batics in RIVER   | :)  :

 

 

 

...lee

Nice execution!  ... I've just spent five or so minutes looking at that code.  All very well documented, but alas, no idea how to comprehend it , :)

In fact I think that if that source wasn't documented it's byte-count would be less than the BASIC list I made.



#21 Lee Stewart OFFLINE  

Lee Stewart

    River Patroller

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

Posted Fri May 5, 2017 9:44 AM

Nice execution!  ... I've just spent five or so minutes looking at that code.  All very well documented, but alas, no idea how to comprehend it , :)

In fact I think that if that source wasn't documented it's byte-count would be less than the BASIC list I made.

 

It can be a little rough---especially when one is not used to a stack-oriented language. 

 

When I get home, I will add stack-tracking to the comments.  That may make it clearer. 

 

...lee



#22 TheBF OFFLINE  

TheBF

    Chopper Commander

  • 164 posts
  • Location:The Great White North

Posted Fri May 5, 2017 2:15 PM

Nice execution!  ... I've just spent five or so minutes looking at that code.  All very well documented, but alas, no idea how to comprehend it , :)

In fact I think that if that source wasn't documented it's byte-count would be less than the BASIC list I made.

 

According MS Word

125 words in BASIC

193 words in the 1st version in FB-Forth (comments removed)

 

Not bad for a "low level" language.

 

But if I group the HEX numbers together as done in BASIC the Forth version goes to 151 words.

So Lee would have to revise his DATA[   ]DATA words.

 

You could save 2 words by replacing DROP DROP with 2DROP and OVER OVER with 2DUP.

But I don't see too many other places to consolidate code. Lee's pretty good at this.

 

BF



#23 Retrospect OFFLINE  

Retrospect

    Dragonstomper

  • Topic Starter
  • 865 posts
  • Location:Wakefield, England

Posted Fri May 5, 2017 2:20 PM

 

According MS Word

125 words in BASIC

193 words in the 1st version in FB-Forth (comments removed)

 

Not bad for a "low level" language.

 

But if I group the HEX numbers together as done in BASIC the Forth version goes to 151 words.

So Lee would have to revise his DATA[   ]DATA words.

 

You could save 2 words by replacing DROP DROP with 2DROP and OVER OVER with 2DUP.

But I don't see too many other places to consolidate code. Lee's pretty good at this.

 

BF

Yeah , he sure is ... Forth really boggles my head.  It's a little bit like talking to my missus ... I'm looking at it, I'm trying to understand it, but it's just getting muddier and muddier.



#24 Asmusr OFFLINE  

Asmusr

    River Patroller

  • 2,270 posts
  • Location:Denmark

Posted Fri May 5, 2017 3:13 PM

What's the color of the pyramids, are they red, are they blue, or are we all in DeNile?

 

Attached File  pyramids.png   8.11KB   0 downloads

 

 



#25 Lee Stewart OFFLINE  

Lee Stewart

    River Patroller

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

Posted Fri May 5, 2017 4:52 PM

OK...Here is the promised stack-tracking (in comments) version.  It also has a little more detail in the comments:

 

Spoiler

 

...lee






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users