Jump to content

TheBF

+AtariAge Subscriber
  • Posts

    4,464
  • Joined

  • Last visited

Posts posted by TheBF

  1. 780 CALL MOTION(#TUNA,30*RND-15,X*(RND*6))

    I am not at my programming computer but here are some things for you to work on for your study.


    PS! How do you hide the programming text?

    - Not sure which text you mean exactly. General idea: 

      - Use CALL COLOR() to make all the text characters transparent

      - Write the text to the screen

      - then change all the text characters to white.

    OR remove those lines from the program?


    PS!! How do you re-number the program outside of the TI?

    -  Manually is the only way I know. But it is not to tricky with a text editor. (This is the reason that most other languages don't use line numbers :)  )


    PS!!! If anyone else want to add to the Aquarium, would be cool to make a "Demo" that many people has added different stuff to it.

    -  Yes


    PS!!!! Could you Brian Fox make the sudden change in speed not be so great? I do not get that part of your code, so I don't want o mess with it. But I think that slow it a little, would look better.

    - I will explain it and then you can make it what you want.

     

    Here is where the movement is created for the "tuna" :) 

    780 CALL MOTION(#TUNA,30*RND-15,X*(RND*6))

    Here is your reference 

    ! CALL MOTION(#sprite number, row velocity, column velocity,...)

     

    So the Tuna motion in up/down direction (ROW) is 30 x RND - 15.  This means you will get a RND number between 0 and 30, but then we subtract 15 so it will be a RND number between -15 and 15.

    The Tuna "speed" is  RND*6 which is slow, but we multiply by the loop value X which goes up every time we go around the loop so the TUNA speed could be as high as 6 x the highest loop value (12)=72!

    So that is pretty fast. But the next time through the loop the speed might slow down.  This was done to make them look erratic.

     

    Try your own numbers now that you see what I did. Remove the X from the equation and it will be much slower or divide X by 2 to reduce the effect.

     

    Regarding backgrounds.

     

    Use HCHAR() to place your rocks. Sprites are for things that move.  Rocks are normally still. :) 

     

    I think the bubbles could be placed better with a column value of RND*200+10. This would put them somewhere in the range of the 10..210 .

     

    Make a copy and have fun with it. :) 

     

    • Like 1
  2. I reversed the direction of the goldfish. I will leave it to you if you want them going the other direction. :) 

     

    The lesson, to answer your original question is that you can animate the fish with CALL PATTERN().

    This is the fastest way because you only change one character number in the Sprite's definition.  It assumes you have the characters pre-defined with CALL CHAR().

     

     

    Spoiler
    
    
    100 ! Aquarium III  Brian Fox 2020
    110 ! Angel fish by Oddemann
    120 ! REQUIRES EXTENDED BASIC
    130 CALL SCREEN(2)
    140 CALL CLEAR
    150 FOR I=1 TO 14 :: CALL COLOR(I,15,1):: NEXT I
    160 PRINT "TI AQUARIUM III": : : :
    170 PRINT "This program allows you to"
    180 PRINT "use your TI-99 to enjoy the"
    190 PRINT "relaxing sight of fish"
    200 PRINT "swimming by, without the"
    210 PRINT "expense and bother of a"
    220 PRINT "real aquarium."
    230 PRINT : :"To end the program"
    240 PRINT " press FCTN BREAK"
    250 PRINT
    260 FOR X=1 TO 600::NEXT X
    270 CALL CLEAR
    280 RANDOMIZE
    290 A$="0000000043476F7F7F6F474300000000004020F0F8DCB6BFBFDEFCF820400000"
    300 B$="0000010003272F3F3F2F270300010000000000F0F8DCB6BFBFDEFCF8F0000000"
    310 C$="000C060383C3EF7F7F7FCFC786868E0C0000000080E0F8FCFEFAFEF8F0800000"
    320 D$="0000060343416F3F3F3F4F47424202040000000080E0F8FCFEFAFEF8F0800000"
    330 E$="000402030381C77F7F7FCFC78387860C0000000080E0F8FCFEFAFEF8F0800000"
    340 CALL CHAR(104,A$)! Tuna 1
    350 CALL CHAR(112,B$)! Tuna 2
    360 CALL CHAR(120,C$)! Angel fish1
    370 CALL CHAR(128,D$)! Angel fish2
    380 CALL CHAR(136,E$)! Angel fish3
    390 CALL MAGNIFY(3)
    410 !
    420 ! Put 5 tuna fish on the screen,
    430 ! Sprites 1..5
    440 !
    450 FOR TUNA=1 TO 5
    460 CALL SPRITE(#TUNA,104,1,90+30*(RND-0.5),1,4*RND-3,5*RND+1)
    470 CALL COLOR(#TUNA,TUNA+2)
    480 CALL SOUND(1000,-6,30)
    490 NEXT TUNA
    500 ! Put 5 GOLD fish on the screen,
    510 ! Sprites 6..10
    520 !
    530 FOR GOLD=6 TO 10
    540 CALL SPRITE(#GOLD,120,1,90+30*(RND-0.5),1,4*RND-3,5*RND+1)
    550 CALL COLOR(#GOLD,GOLD+2)
    560 CALL SOUND(1000,-6,30)
    570 NEXT GOLD
    580 !
    590 ! make random Goldfish Swim
    600 !
    610 GOLD=RND*4+6
    620 XVEC=8*RND-4 :: YVEC=RND*3+5
    630 FOR X=1 TO 10
    640 CALL PATTERN(#GOLD,136)!  pattern 3
    650 CALL SOUND(200,-6,30)
    660 CALL PATTERN(#GOLD,128)
    670 CALL MOTION(#GOLD,XVEC,YVEC)
    680 CALL SOUND(200,-6,30)
    690 CALL PATTERN(#GOLD,120)
    700 NEXT X
    710 CALL MOTION(#GOLD,XVEC/2,1)
    720 !
    730 ! make a random Tuna swim
    740 !
    750 TUNA=RND*4+1
    760 FOR X=1 TO 12
    770 CALL PATTERN(#TUNA,112)!  wiggle
    780 CALL MOTION(#TUNA,30*RND-15,X*(RND*6))
    790 CALL SOUND(50,-6,30)! DELAY
    800 CALL PATTERN(#TUNA,104)
    810 NEXT X
    820 CALL MOTION(#TUNA,2*RND-1,RND*3-1)
    830 GOTO 610
    840 END

     

     

     

    aquariumIII.png

    • Like 1
  3. This version is cute.

    Spoiler
    
    
    100 ! REQUIRES EXTENDED BASIC.
    110 CALL SCREEN(2)
    120 CALL CLEAR
    130 FOR I=1 TO 14 :: CALL COLOR(I,15,1):: NEXT I
    140 PRINT "TI AQUARIUM": : : :
    150 PRINT "This program allows you to"
    160 PRINT "use your TI-99 to enjoy the"
    170 PRINT "relaxing sight of fish"
    180 PRINT "swimming by, without the"
    190 PRINT "expense and bother of a"
    200 PRINT "real aquarium."
    210 PRINT : :"To end the program, press"
    220 PRINT "FCTN BREAK"
    230 PRINT
    240 FOR D=1 TO 500 :: NEXT D
    250 CALL CLEAR
    260 RANDOMIZE
    270 A$="0000000043476F7F7F6F474300000000004020F0F8DCB6BFBFDEFCF820400000"
    280 B$="0000010003272F3F3F2F270300010000000000F0F8DCB6BFBFDEFCF8F0000000"
    290 CALL CHAR(120,A$)
    300 CALL CHAR(124,B$)
    310 CALL MAGNIFY(3)
    320 CALL SCREEN(2)
    330 !
    340 ! Put 10 fish on the screen,
    350 ! colors are sequential
    360 !
    370 FOR Q=1 TO 10
    380 CALL SPRITE(#Q,120,1,90+30*(RND-0.5),1,4*RND-3,5*RND+1)
    390 CALL COLOR(#Q,Q+2)
    400 NEXT Q
    410 !
    420 ! Now that all the fish are on the screen
    430 ! make random changes in their motion
    440 !
    450 FOR FISH= 1 TO 10
    470    FOR X=1 TO 15
    480      CALL PATTERN(#FISH,124)!  wiggle
    482      CALL MOTION(#FISH,30*RND-15,X*(RND*6))
    490      CALL SOUND(30,-6,30)! DELAY
    500      CALL PATTERN(#FISH,120)
    510    NEXT X
    515    CALL MOTION(#FISH,2*RND-1,RND*3-1)
    517 NEXT FISH
    520 GOTO 450
    530 END

     

     

    • Like 2
  4. 1 hour ago, oddemann said:

    Could you explain the sound thing?

     

    
    480 CALL PATTERN(#FISH,124)!  wiggle
    490 CALL SOUND(RND*100+20,-6,30)! DELAY
    500 CALL PATTERN(#FISH,120)

    Since CALL SOUND() has an accurate timer, you can use it as a delay.  Just set the volume to 30db attenuation (off).

    Works great and only 1 line of code.

     

    • Like 4
  5. Try this for some ideas.  I removed CALL KEY because it slows down the loop.  BREAK is the only way out.

     

    Spoiler
    
    
    100 ! REQUIRES EXTENDED BASIC.
    110 CALL SCREEN(2)
    120 CALL CLEAR
    130 FOR I=1 TO 14 :: CALL COLOR(I,15,1):: NEXT I
    140 PRINT "TI AQUARIUM": : : :
    150 PRINT "This program allows you to"
    160 PRINT "use your TI-99 to enjoy the"
    170 PRINT "relaxing sight of fish"
    180 PRINT "swimming by, without the"
    190 PRINT "expense and bother of a"
    200 PRINT "real aquarium."
    210 PRINT : :"To end the program, press"
    220 PRINT "any key while the fish are"
    230 PRINT "being displayed."
    240 FOR D=1 TO 500 :: NEXT D
    250 CALL CLEAR
    260 RANDOMIZE
    270 A$="0000000043476F7F7F6F474300000000004020F0F8DCB6BFBFDEFCF820400000"
    280 B$="0000010003272F3F3F2F270300010000000000F0F8DCB6BFBFDEFCF8F0000000"
    290 CALL CHAR(120,A$)
    300 CALL CHAR(124,B$)
    310 CALL MAGNIFY(3)
    320 CALL SCREEN(2)
    330 !
    340 ! Put 10 fish on the screen,
    350 ! colors are sequential
    360 !
    370 FOR Q=1 TO 10
    380 CALL SPRITE(#Q,120,1,90+30*(RND-0.5),1,4*RND-3,5*RND+1)
    390 CALL COLOR(#Q,Q+2)
    400 NEXT Q
    410 !
    420 ! Now that all the fish are on the screen
    430 ! make random changes in their motion
    440 !
    450 FISH=INT(10*RND)+1
    460 CALL MOTION(#FISH,4*RND-2,8*RND-4)
    470 FOR X=1 TO 20
    480 CALL PATTERN(#FISH,124)!  wiggle
    490 CALL SOUND(RND*100+20,-6,30)! DELAY
    500 CALL PATTERN(#FISH,120)
    510 NEXT X
    520 GOTO 450
    530 END

     

     

    • Like 1
  6. I have been AWOL for a while working on my version of DSR Link code.  In the process I found two small things that can be "improved" in insanemultitasker version that was 

    my starting place.

     

    1.  Removing a MOV and a SRL  by using the empty R6 register to read and copy into the NAMBUF

    Oops.  This was an mistake.

     

    2.  Moving the init R2 to >4000 outside of the scanning loop. It is invariant in the loop so no need to set it every time.

    This is still valid

     

    I put the changes into the TI ASM code along with comments of how I understood this thing.

    This code is not tested and as noted I don't use the conventional Assembler much anymore so treat this as faulty syntax but the changes have been shown to work in my Forth Assembler version.

     

    This stuff is probably common knowledge for many but perhaps the comments will be helpful for another newbie somewhere down the road. 

     

    ?

    • Like 1
  7. Branching and looping

     

    I was reading comp.lang.forth this morning and a poster named dxforth posted his code for branches and looping.

    I had been using a version similar to FIG-Forth which was a little bigger than I wanted and doesn't allow a new construct with double WHILE clauses in a loop.

    The double while clause has been used to good effect in some new Forth code.

     

    Here is what dxforth posted with some minor changes for Camel99 Forth which uses an offset calculation versus dxforth using an absolute address.

    I still find it remarkable that you can write all this functionality so succinctly.

     

    Spoiler
    
    
    \ dxforth uses absolute address for branching.
    \ Changed THEN and <RESOLVE to compute branch offsets for Camel99
     : >MARK    HERE 0 , ;
     : <RESOLVE  HERE -  , ;
     : AHEAD    POSTPONE BRANCH >MARK ; IMMEDIATE
    
     : IF       POSTPONE ?BRANCH >MARK ; IMMEDIATE
     : THEN     HERE OVER - SWAP ! ; IMMEDIATE
     : ELSE     POSTPONE AHEAD SWAP POSTPONE THEN ; IMMEDIATE
     
     : BEGIN    HERE ; IMMEDIATE
     : UNTIL    POSTPONE ?BRANCH <RESOLVE ; IMMEDIATE
     : AGAIN    POSTPONE BRANCH  <RESOLVE ; IMMEDIATE
     : WHILE    POSTPONE IF SWAP ; IMMEDIATE
     : REPEAT   POSTPONE AGAIN POSTPONE THEN ; IMMEDIATE
    

     

     

    • Like 2
  8. Lee,

     

    Here is something you could try to compare your new and old versions.

     

     

    Spoiler
    
    \ Sieve of Erathosenes for FbForth
    
    1 CONSTANT 1
    2 CONSTANT 2
    
    HEX
    : FREEMEM  ( -- n) FF00 HERE - ;
    : ?MEM     ( n -- )  FREEMEM OVER < IF ." Out of memory"  ABORT THEN ;
    
    : SEEPRIMES ( -- )
            CR ." Primes: "
            2 DO
                I HERE + C@ 0= IF I . THEN
                ?TERMINAL IF ." Primes halted" ABORT THEN
            LOOP ;
    
    \ byte array uses unallocated memory at HERE
    DECIMAL
    : PRIMES ( n -- )
            ?MEM
            CR ." Running..."
            HERE OVER ERASE
            1 0 HERE + C!       \ mark as prime like 'C' version
            1 1 HERE + C!
            2                  \ start at 2
            BEGIN
               OVER OVER DUP * >
            WHILE
               DUP HERE + C@  0=
               IF  OVER OVER DUP *
                   DO
                      1 I HERE + C!
                   DUP +LOOP
               THEN
               1+
            REPEAT
            CR ." Complete."
            CR
            DROP
            CR ." Press ENTER to see primes:" KEY 13 =
            IF   SEEPRIMES   THEN
    ;
    

     

     

  9. 5 hours ago, Kchula-Rrit said:

     

     

    VDPWD for VMPOKE is stored in R3, so I can change MOVB *R1+,@VDPWD change MOVB *R1+,*R3,  and did the equivalent for VMPEEK.

     

     

     

    Also, I would love an autodecrement instruction (like MOV R8,*R14-) instruction.  It would make stack-pushes and loops a lot easier.

     

    K-R.

     

     

    You are having PDP-11 dreams again.  I know a good shrink... :) 

    Sounds like you did all the good stuff.

     

    FYI: On block VDP R/W I have measured using a register rather than the port address to be 12.9% faster on Classic99.

    • Like 1
  10. 7 hours ago, Lee Stewart said:

    For those wanting to test the beta version of build 13, here is fbForth 2.0:A13

     

    fbForth200_A13_20200922.zip 85.74 kB · 0 downloads

     

    Included are inverted (ends in “9.bin”), non-inverted (ends in “8.bin”) and individual (end in “b0.bin” – “b3.bin”) binaries, as well as the current FBLOCKS file. The individual binaries are bank-switched in inverted order, so, if you need to assemble your own composite binary, the programmed (inverted) order is b0, b1, b2, b3. Reversing this order to b3, b2, b1, b0, makes the composite binary, effectively, non-inverted—clear as mud, right? :ponder:

     

    ...lee

    Not a clue. :) 

  11. 6 hours ago, InsaneMultitasker said:

    I believe the DSRLNK in question starts the scan at 0x1200 [R12 is first set to 0x1100 and 0x0100 is added to R12 before the test starts]  then loops back around to 0x1000 [R12 set to 0x0f00 then 0x0100 is added to R12] , thus skipping the floppy controller in favor of higher CRU bases. This was also done to hit the HFDC and other devices at 0x1000 before the floppy controller.  There are programs where changing the first scanned address was beneficial long ago.  If this is indeed the DSRLNK version I shared long ago, I probably had forgotten about this modification.  Good eagle eye. 

     

    Thanks. Nice to know some history.  I have another question.

    I see things being saved but then not restored or used from the saved locations.

    Any ideas on the thinking behind that?

     

     

  12. The TI-99 seems to have been designed to require various pieces of extra firmware. I suspect someone thought it would lead to higher sales revenue. :) 

     

    Apersson850 is the resident expert but the P system which needs it's own card that lives in the expansion box with firmware and extra software.

    It is better described as an operating system from what he describes.

     

    Any system that generates a binary program for TI-99 must have some kind of loader added to the computer. The E/A cartridge is the one normally used and it requires external RAM to be part of the system as well.

    There has been a hack created to allow machine code to be loaded and even use VDP RAM to hold machine code that is shuttled in and out of the 256 byte console RAM but I would not consider that a way to go.

    Extended BASIC also can load binary code so there is that option as well.

     

    All that to say it's a weird little machine.

    I default to the E/A cartridge for Forth development as my system is an 8K micro kernel that compiles extensions from text files.

     

     

    • Like 1
×
×
  • Create New...