Jump to content

TheBF

+AtariAge Subscriber
  • Content Count

    2,860
  • Joined

  • Last visited

Posts posted by TheBF


  1. 12 minutes ago, oddemann said:

    Could you implement the correct audio?

    I was looking at the code briefly and I don't exactly see where the pitch is being changed yet.

    I will look again.

     

    :

    Ah yes.  They made a sounder sub-program.  

    The timing is not right either as I listen.  If you find the time delays.

    Change it to this:

    2380 SUB SOUNDER(M,N)
    2382 ADIT=150
    2390 FOR I=1 TO 300 :: NEXT I
    2400 DISPLAY AT(1,4):"NOW SOUNDING-OUT CODE" :: DISPLAY AT(24,1):""
    2410 FOR I=M TO 24 STEP N :: FOR J=2 TO 31 :: CALL GCHAR(I,J,C)
    2420 IF C=32 THEN CALL SOUND(250,42000,30):: X=X+1
    2430 IF X=5 THEN 2470
    2440 IF C=46 THEN CALL SOUND(ADIT,2125,0) :: CALL SOUND(ADIT*3,42000,30) :: X=0
    2450 IF C=95 THEN CALL SOUND(ADIT*3,2125,1) :: CALL SOUND(ADIT*3,42000,30) :: X=0
    2460 NEXT J :: NEXT I
    2470 DISPLAY AT(1,1):"" :: DISPLAY AT(24,4):"SOUND-OFF COMPLETED" :: X=0
    2480 SUBEND

    edit ADIT to 80

     

    • Like 1
    • Thanks 1

  2. 52 minutes ago, GDMike said:

    BTW, do you have a simple Forth assembly code I can look at to figure out how things are done without labels, branches like what I use in a loop whenever you find a moment.. just something I'd like to review. 

    I did put together marks TF assembler manual that he provides, but again, I forgot to bring it to work with me for the second day.

    Oops.

    You may have questions about Forth loops not Assembler loops. The good news is they are similar.

    Forth has two "jump"  instructions.

     

    ?BRANCH  ( sometimes called 0BRANCH)   jumps if  top of stack=0.

    The cell right after ?branch contains a negative or a positive number.  TurboForth uses a 16bit address to jump to.   FbForth and Camel Forth use +/- value to add to the instruction pointer to know where to jump to.

     

    BRANCH  Jump unconditionally to the address (or the offset) that follows branch.

     

    So the trick is how you do all those fancy IF THEN  BEGIN UNTIL  when you only have 2 jump instructions?

     

    Here is the magic code from Australia. :) 

    They are dead simple without error checking so it's simpler to understand. 

    : AHEAD    ( -- addr) HERE   0 , ;
    : <BACK ( addr --) HERE -  , ;
    
    : THEN   ( addr -- ) HERE OVER - SWAP ! ;     IMMEDIATE
    : BEGIN   HERE ;                              IMMEDIATE
    : IF      POSTPONE ?BRANCH AHEAD ;            IMMEDIATE
    : ELSE    POSTPONE BRANCH  AHEAD SWAP POSTPONE THEN ; IMMEDIATE
    : UNTIL   POSTPONE ?BRANCH <BACK ;  IMMEDIATE
    : AGAIN   POSTPONE BRANCH  <BACK ;  IMMEDIATE
    : WHILE   POSTPONE IF SWAP ;        IMMEDIATE
    : REPEAT  POSTPONE AGAIN POSTPONE THEN ; IMMEDIATE
    
    

    Think of POSTPONE as a word that "compiles" something into a Forth definition.  

     

     Simplest loop structure to understand:   BEGIN  AGAIN 

    : TEST    

         BEGIN        ( puts HERE on the data stack because it's an immediate word) 

            2 2 +    (  we put some code in the definition which moves the dictionary pointer forward. (Remember that HERE just does fetch on the dictionary pointer variable)

            DUP DROP 

         AGAIN     ( compile the Forth BRANCH word into the definition,

                       ( <BACK  computes the difference between the HERE at BEGIN and HERE right now and compiles that number with comma)

                       ( TF compiles the actual HERE from BEGIN)

    ;  

    Give it a stare and ask more questions.

     

     

    • Like 2

  3. 20 minutes ago, GDMike said:

    BTW, do you have a simple Forth assembly code I can look at to figure out how things are done without labels, branches like what I use in a loop whenever you find a moment.. just something I'd like to review. 

    I did put together marks TF assembler manual that he provides, but again, I forgot to bring it to work with me for the second day.

    Well... I have overhauled the old TI-Forth assembler for these things using some new-fangled thinkin' that came from a crazy Forth guy in Australia.

    It's much simpler code and takes less space in our little 99s.

    To be clear, the parts that are "really" changed are IF, ELSE, THEN,  UNTIL, WHILE, etc.

    They have no error checking they just work.  You may have a question or two. It took me a while to grok these things. :) 

     

    Here is a link:

    https://github.com/bfox9900/CAMEL99-V2/blob/master/LIB.ITC/ASM9900.FTH

    • Like 1

  4. The cleanup never ends :) 

     

    I was never happy with the TRANSIENT, PERMANENT, ERADICATE  system I created, mostly because I didn't finish it. 

    I like it now. This is clean and easy.  ERADICATE  removes the TRANSIENT dictionary.

     

    Spoiler
    CR .( Transient.fth    Jan 17 2022 B Fox)
    
    \ Compile code into another RAM location and remove it later)
    \ SEE: DSK1.LOWTOOLS DSK1.SUPERTOOLS for demo code
    HEX
    VARIABLE SAVEDP
    VARIABLE OLDNFA  \ NFA of last word in the old dictionary 
    
    : TRANSIENT ( NEWDP -- ) \ Usage   HEX 2000 TRANSIENT
               LATEST @ OLDNFA !
               HERE SAVEDP !     \ save the dictionary pointer.
               DP ! ;            \ Point DP to transient memory
    
    : PERMANENT ( -- ) ( Restores high ram compiling )
               HERE H !          \ give back what we didn't use to the HEAP
               SAVEDP @ DP !     \ restore DP back to original address
    
             \ built a dummy word as the link to the permanent dictionary
              S" $$$$" HEADER, COMPILE DOCON  HERE ,  COMPILE EXIT
    ;
    
    : ERADICATE ( -- ) ( removes TRANSIENT dictionary code)
              OLDNFA @  LATEST !  \ relink the dictionary
              2000 H ! ;          \ init-the heap.
    

     

     

    DSK1.SUPERTOOLS 

    CR .( Compile Tools in SuperCart RAM)
    
    NEEDS TRANSIENT FROM DSK1.TRANSIENT
    HEX 6000 TRANSIENT   \ transient dictionary in supercart
    CR .( Compiling to address:) HERE U.
    
      INCLUDE DSK1.ELAPSE
      INCLUDE DSK1.TOOLS
      INCLUDE DSK1.ASM9900
    
    PERMANENT
    CR .( Now compiling to: ) HERE HEX U.
    
    .FREE
    DECIMAL
    

     

     

     

     

    • Like 2

  5. 5 hours ago, dhe said:

    Will the Camel Forth BIO's be accessible via the serial port?

     

    If you can run Camel Forth from a serial connection, it would make even that one card very attractive! 😃

    I run Camel Forth over Serial Port here on my TI-99 for testing Forth code on real iron. :)

    We will use a variation of that system to debug hardware for Eric's board (s).

    It may stay in the system as a resident boot loader/debugger kind of like OpenFirmware but less sophisticated. 

    It's  a nice debug console because you can script/automate things and it runs pretty fast.

     

    • Like 2

  6. Just now, Lee Stewart said:

     

    This will only be valid in a, likely unpredictable, narrow window of time, n’est-ce pas?

     

    ...lee

    I think so. I don't even remember where I found the ALC reference. :)

    Perhaps the intent is that you run it early and retain the string in your program for future file reads to use. ?

     

    Come to think of it I could use it in my Shell program to set the load disk as a default and display it in a prompt like DOS/CPM maybe.

     

    I will try a couple of other file reads from other disks and see what happens.

     

     

    • Like 1

  7. 47 minutes ago, GDMike said:

    I hope it's something I can grasp. Hehe...

    I'm wondering, would the BSave load into VRAM or could it partition into SAMS.. because, I'm afraid of running outta VRAM and MAIN CPU ram to continue coding...or Maybe I'm missing something.. not unusual..

    What is the project you are making that uses all of CPU RAM and VDP RAM?

    • Like 1

  8. Looking at my Github site I find a few half-baked files. Oops.

    So I fixed up this one that might be useful.

     

    \ *
    \ * Boot tracking
    \ *
    \ * Code copied more or less verbatim from:
    \ * 1.7. The Art Of Assembly Part 7. Why A Duck?
    \ * By Bruce Harrison 1991
    \ *
    \ BOOTTR MOV  @>83D0,R12          * GET THE CRU BASE IN R12
    \        MOV  @>83D2,R9           * GET THE ROM ADDRESS FOR \DEVICE
    \        SBO  0                   * ENABLE THE ROM
    \        AI   R9,4                * ADDING FOUR PUTS US AT THE LENGTH BYTE
    \        MOVB *R9+,R4             * PLACE THAT IN R4 AND INCREMENT R9
    \        SRL  R4,8                * RIGHT JUSTIFY LENGTH IN R4
    \        LI   R10,FILEDV          * POINT TO TEXT BUFFER
    \ MOVIT  MOVB *R9+,*R10+          * MOV ONE BYTE FROM ROM TO TEXT BUFFER
    \        DEC  R4                  * FINISHED?
    \        JNE  MOVIT               * NO, DO ANOTHER BYTE
    \        SBZ 0                    * DISABLE THE ROM (R4 IS ZERO AT THIS POINT)
    \        B   *R11                 * BRANCH TO NEXT SECTION OF CODE
    \ FILEDV TEXT "DSK1."             * File device
    
    \ NEEDS MARKER     FROM DSK1.MARKER
    \ NEEDS .S         FROM DSK1.TOOLS
    \ MARKER REMOVE
    
    DECIMAL
    24 USER 'R12  \ address of R12 in any CAmel99 workspace
                  \ >8324 in other TI-99 Forths
    
    HEX
    CODE 0SBO  ( -- ) 1D00 ,  NEXT, ENDCODE
    CODE 0SBZ  ( -- ) 1E00 ,  NEXT, ENDCODE
    
    83D0 CONSTANT DISKCARD
    83D2 CONSTANT ROMADDR
    
    HEX
    : BOOTDISK ( -- addr len)
              DISKCARD @ 'R12 !
              0SBO
              ROMADDR @ 4 + COUNT PAD PLACE
              0SBZ
              PAD COUNT ;

     

     

     

     

     

    BOOTDISK.png

    • Like 2

  9. 2 minutes ago, Lee Stewart said:

     

    TurboForth’s block buffers live in VRAM.

     

    ...lee

    So that's a bit of a wrinkle but not too hard to overcome I think. It's might better for this that my system since I have both in Low Ram.

    In Camel99 you would have to put the SAMS window at >2000. The 3 block buffers start at:  >3FFF  >404 3 * -   ( -- >33F3)

    • Like 1

  10. 39 minutes ago, Willsy said:

    Yeah, BSAVE ain't gonna work if you're using SAMS banks, sorry!

    The good news is that saving a 4K sams block to disk blocks should be pretty simple no?

     

    I don't know where TF's block buffers live so this could bomb badly

    \ UNTESTED!
    $400 CONSTANT 1K
    $3000 CONSTANT WINDOW
    
    : SAMS>BLOCK ( bank# block# --)
                  SWAP  WINDOW MAP
                 4 0 DO
                       WINDOW 1K I * + ( -- addr1 )
                       I BLOCK         ( -- addr1 addr2 )
                       1K CMOVE
                  LOOP ; 

     

    • Like 1

  11. 7 minutes ago, Lee Stewart said:

     

    Here is a @FALCOR4 post from SAMS usage in Assembly.

     

    ...lee

    I think this is a slightly different situation that that doc addresses in that the AMSINI code from Bruce, is writing a word to the SAMS register but it still doesn't work on Classic99.

    I think Classic99 actually gives you more than 1M of memory although I have never tested how much.

    The first byte is counting pages 0..255 for a 1M card and the second byte lets you access more pages.

    Or am I missing something completely. Been known to happen. :)

     

     

     


  12. Just now, Vorticon said:

    Why is this the case?

    Something to do with supporting bigger cards.

    The old cards wanted duplicate values in each byte. Bigger cards need the extra byte to go beyond 256 total pages. 

     

    I can't remember if I sent this to @Tursi in a clear enough manner. (oops my bad)

    He has said he hasn't done much with SAMS somewhere in the forum so probably not a top priority.

     

    • Thanks 1

  13. 2 hours ago, Vorticon said:

    Hi. Aside from Thierry's documentation of the SAMS card, is there another reference available, particularly aimed at the software side of things and for the 1meg card? 

    I should also mention this difference between Classic99 and real iron.

     

    The AMSINI code below works on real IRON.

    To use it on Classic99 you must change the >0101 to >0100.

     

    * SUBROUTINES SECTION
    *
    * AMSINI SETS AMS CARD TO "POWER-UP" CONDITION
    *
    AMSINI 	LI R12,>1E00 		AMS CRU BASE
    		SBO 0 				TURN ON AMS
    		LI R1,>FEFF 		(THIS IS ->0101)
    		LI R0,>4000 		START OF MEMORY
    		AMSLP AI R1,>0101 	ADD 1 PAGE
    		MOV R1,*R0+ MOVE 	2 BYTES TO MEM-MAPPER
    		CI R0,>4020 		ALL DONE?
    		JLT 				AMSLP NO, INIT MORE
    		RT  				RETURN

     


  14. 2 hours ago, Willsy said:

    Hey that's really nice! Works like a charm! Can I ask, what is the thinking behind the use of ] on the words ]PDT and ]GFONT? There's some kind of idiom at work, but I couldn't fathom it. I'm going to steal your code and put in the TF website if that's okay - with attribution of course!

     

    Another question: Is the TI title screen drawn in code, or is it a byte-stream that is simply dumped to VDP upon boot? Anyone know? Brian, the words you have presented above would form a nice start to a TI title screen rendering lexicon. Would just need a few words to initialise the colour sets appropriately, and draw text boxes. I presume the TI logo/graphic is also in GROM memory somewhere?

     

    M

    I first saw that ']' notation in Open Firmware by Mitch Bradley.  It is just a reminder that this word needs an index ie. some kind of array.

    It's not pretty, but it helps my old memory. Kind of like $ for strings.

     

    I am sure there is world of stuff in the GROMs that I have never investigated. I found the listing of what is there somewhere... 

    http://www.unige.ch/medecine/nouspikel/ti99/groms.htm

     

    So yes the colour table and the patterns are all there.  I might try that myself some day.

     

    Address Contents
    >0451 Default values of the 8 VDP registers.
    >0459 Content of the color table, for title screen.
    >04B4 Characters 32 to 95 patterns, for title screen.
    >06B4 Regular upper case character patterns.
    >0874 Lower case character patterns.
    >16E0 Joysticks codes returned by SCAN.
    >1700 Key codes returned by SCAN.
    >1730 Ditto with SHIFT.
    >1760 Ditto with FCTN.
    >1790 Ditto with CTRL.
    >17C0 Key codes in keyboard modes 1 et 2 (half-keyboards).
    >2022 Error messages (with Basic bias of >60, and lenght byte).
    >285C Reserved words in Basic, and corresponding tokens.

    Revision 1. 3/2/00 Preliminary
    Revision 2. 3/4/00 OK to release
    Revision 3. 5/25/01 Corrected clock and Vss info.
    • Like 4

  15. On 1/10/2022 at 3:36 AM, GDMike said:

    I found my old blocks file. Maybe I can add to it..

    It's using 3 banks to set SAMs, sound, and the display.

    the word A: will set dsk1.blocks active and the word  B: will set dsk2.blocks active.

    A: is also the boot disk. 

    It's cute, come on..

     

     

    I adapted this for TurboForth from my code.

    If you put this code in a couple of blocks and run the word BIGCAPS you will have the big font used by TI for the title screen. :) 

    CHARSET restores the default TI-99 characters if you ever need them.

     

    Spoiler
    \ CHARSET TI-99 default characters from GROM for Turbo Forth
    HEX
    \ GROM ports for reference
    \ 9800 CONSTANT GRMRD ( GROM base)   \ GROM read byte
    \ 9802 CONSTANT GRMRA                \ GROM set read address
    \ 9C00 CONSTANT GRMWD                \ GROM write byte
    \ 9C02 CONSTANT GRMWA                \ GROM set write address
    
    HEX
    : GROM   ( addr -- ) DUP 9C02 ! 9C02 C! ;  \ set GROM address
    : [email protected]+   ( -- c)   9800 [email protected] ;               \ read & auto-incr
    : ]PDT   ( char# -- 'pdt[n] )  8 * 800 + ;  \ patt. Descriptor table
    : ]GFONT ( ascii -- grom_adr) BL -  7 * 6B4 + ; \ GROM TIFont data
    
    \ transfer from GROM to VDP
     : GVMOVE  ( grom_addr vdp_addr cnt -- )
            ROT GROM OVER + SWAP  DO  [email protected]+ I V!  LOOP ;
    
    : CHARSET ( -- ) ( change to ti-99 default )
            ASCII ~ 1+  BL                \ all ASCII chars
            DO
               I ]GFONT  I ]PDT  0 OVER V! 1+ 7 GVMOVE  
            LOOP ;
    
    \ BONUS WORD: loads the TITLE screen font from GROM
     : BIGCAPS  ( -- ) 4B4 900 200 GVMOVE ;  \ TI title page fonts
    
    \ move data from GROM to CPU RAM
    \ : GCMOVE  ( grom addr cnt -- ) ROT GROM  BOUNDS DO  [email protected]+ I C!  LOOP  ;
    

     

     

    • Like 2

  16. I have forgotten a lot of XBASIC stuff, but here is some ideas that might help.

    Although a shark is probably not within the artistic motiviation here. :) 

    But you can see a method to keep your wake running while checking for other things to happen. You can play with the RND number anyway you want to

    randomly make things happen without going into a delay loop.

     

    Spoiler
    
    
    10 CALL CLEAR
    20 CALL MAGNIFY(3)
    
    80 CALL CHAR(112,"FFFFFFFFFFFFFFFF")
    90 REM SHIP
    100 REM Venstre topp
    110 CALL CHAR(36,"0000000000FF000000000000000000000704020100FF01020404080810204040")
    120 REM Høyre topp
    130 CALL CHAR(40,"F090A0C080FFC0A090908888848281810000000000FF00000000000000000000")
    140 REM Venstre mid
    150 CALL CHAR(44,"00000101020204087F1F0F0818080F078181010139013913FFFFFF888888FFFF")
    160 REM Høyre mid
    170 CALL CHAR(48,"C0C0C0C0CEC0CEE4FFFFFF888888FFFF8080404020201008FFFCFC888C88F8F0")
    180 REM Venstre bunn
    190 CALL CHAR(52,"03010000000000000000000000000000FFFFFFFF000000000000000000000000")
    200 REM Høyre bunn
    210 CALL CHAR(56,"FFFFFFFF000000000000000000000000E0C08000000000000000000000000000")
    
    220 REM SAIL
    230 REM SAIL LEFT UP
    240 CALL CHAR(64,"00000000000000FF7F7F7F7F7F7F7F7F00000000000000FDFFFFFFFFFFFFFFFF")
    250 REM SAIL RIGHT UP
    260 CALL CHAR(68,"000000000000005FFFFFFFFFFFFFFFFF00000000000000FFFEFEFEFEFEFEFEFE")
    270 REM SAIL LEFT DOWN
    280 CALL CHAR(72,"7F7F7F7F7F7F7F000000000000000000FFFFFFFFFFFFFF000000000000000000")
    290 REM SAIL RIGHT DOWN
    300 CALL CHAR(76,"FFFFFFFFFFFFFF000000000000000000FEFEFEFEFEFEFE000000000000000000")
    
    310 REM LIGHT
    320 REM LEFT WINDOWS
    330 CALL CHAR(80,"0000000707070000000000000000000000000077777700000000000000000000")
    340 REM RIGHT WINDOWS
    350 CALL CHAR(84,"0000007777770000000000000000000000000070707000000000000000000000")
    
    360 REM WAKE
    370 CALL CHAR(96,"2940245108101000224252142004040048244829A28024888850042848400000")
    380 CALL CHAR(100,"004429402451081214002A4212140000842048244829A2802488885000204000")
    390 CALL CHAR(104,"2524104429402451081214000A0202041020842048244829A280248880400000")
    400 CALL CHAR(108,"4400252410442940240108020400020248441020842048244828A08020808040")
    
    
    770 CALL COLOR(11,5,1)
    780 FOR A=19 TO 24
    790 CALL HCHAR(A,1,112,32)
    800 NEXT A
    
    810 REM SAIL
    820 CALL SPRITE(#11,64,15,112,112,0,0)
    830 CALL SPRITE(#12,68,15,112,128,0,0)
    840 CALL SPRITE(#13,72,15,128,112,0,0)
    850 CALL SPRITE(#14,76,15,128,128,0,0)
    
    910 REM SHIP
    920 CALL SPRITE(#1,36,2,112,112,0,0)
    930 CALL SPRITE(#2,40,2,112,128,0,0)
    940 CALL SPRITE(#3,44,2,128,112,0,0)
    950 CALL SPRITE(#4,48,2,128,128,0,0)
    960 CALL SPRITE(#5,52,2,144,112,0,0)
    970 CALL SPRITE(#6,56,2,144,128,0,0)
    
    1010 REM LIGHT
    1020 CALL SPRITE(#7,80,11,136,112,0,0)
    1030 CALL SPRITE(#8,84,11,136,128,0,0)
    1032 REM CALL SPRITE(#9,81,11,148,120,0,0)
    1034 REM CALL SPRITE(#10,82,11,148,128,0,0)
    
    1040 CALL CHAR(124,"0000000000000000000010181C3E3EFF00000000000000000000000000000000")
    1050 CALL CHAR(120,"000000000000000000000818387C7CFF00000000000000000000000000000000")
    
    
    2040 REM Wake & random shark movement
    2044 CALL SPRITE(#28,124,15,160,15,0,2)
    
    2050 CALL SPRITE(#13,96,6,150,120,0,0)
    2060 FOR A=96 TO 108 STEP 4
    2070    CALL PATTERN(#13,A)
    2082    IF RND >0.5 THEN GOSUB 5010  ELSE GOSUB 5040
    2084    IF RND >0.95 THEN GOSUB 3000
    2090 NEXT A
    2999 GOTO 2050
    
    3000 REM JAWS
    3020 CALL SOUND(400,110,8)
    3030 CALL SOUND(400,118,8)
    3999 RETURN
    
    5000 ! MOVEFIN LEFT
    5010 CALL PATTERN(#28,124) :: CALL MOTION(#28,0,2)
    5020 RETURN
    
    5030 ! MOVE FIN RIGHT
    5040 CALL PATTERN(#28,120) :: CALL MOTION(#28,0,-2)
    5050 RETURN
    

     

     

×
×
  • Create New...