Jump to content

TheBF

+AtariAge Subscriber
  • Content Count

    2,863
  • Joined

  • Last visited

Everything posted by TheBF

  1. So I used the TI Tech pages to create this little snippet of Code in my Forth Assembler to read the keyboard quickly. (just pretend the instructions are on the left side and it should make sense. TOS is just an alias for R4 PUSH is a macro that pushes a register onto the Forth data stack) I wanted something that reads the keyboard faster than KSCAN that just returns a non-zero value if a key is pressed. It works as expected BUT, the first few times I call it, it returns >400 even though no key is pressed. I am only using CLASSIC99, so I don't know if that is significant. So to use it I have to put it in a loop until I get a 0 which defeats the speed advantage I wanted. Any thoughts on what I am missing? HEX CODE: ?KEY ( -- ?) \ check if key pressed, ?=0 means no key TOS PUSH, R1 CLR, \ Start with column 0 @@1: R12 0024 LI, \ R12-address for column selection R1 3 LDCR, \ Set 3 bits R12 0006 LI, \ R12-address to read rows TOS SETO, \ set all bits TOS 8 STCR, \ Get 8 row values TOS INV, \ outputs are low active @@2 JNE, \ A key was pressed R1 0100 ADDI, \ Next column R1 0600 CMPI, \ Are we done @@1 JNE, \ Not yet NEXT, \ return to Forth @@2: SCRTO @@ CLR, \ Reset TI system screen timeout counter NEXT, \ return to Forth END-CODE
  2. The TI Forth manual credits the authors of the system. If they could be tracked down, perhaps they know the whereabouts of others who worked on the TI-99. (?) (only six degrees of separation for the whole planet)
  3. This looks like a dream I had one night. Nice work! But if I get one, my life would go on hold and I would need a divorce lawyer.
  4. This sounds SOOOO much like a programmers life.
  5. Because he had a chicken stapled to his forehead.
  6. Why did the punk rocker cross the road?
  7. In Canada, to get to the middle.😄 I'll bite. Why?
  8. ​"It is practically impossible to teach good programming to students that have had a prior exposure to BASIC as potential programmers. They are mentally mutilated beyond hope of regeneration." ​ Edsger W. Dijkstra ​As demonstrated by many people here, it's not impossible, but this statement emphasizes the point that the BASIC language paradigm ​alters the perspective of programming enough that you must fight hard against it to learn a new programming language model ​
  9. Thanks. The sprite control has some interesting features that are not too hard for me to emulate.
  10. I was referring to the fact that the compiler is running as a P-code application and if it was a native code app it would be faster. But as you say, it could never run on a standard TI-99 with regular memory expansion as native code.
  11. ok fair enough. I recently implemented a Sprite control mechanism using a cooperative multi-tasker rather than on an interrupt, so I am very interested in what the P system sprite control does. Can you show what a "free running list of sprite actions" looks like in Pascal code? I don't want to give you a "make work" project, but perhaps there is some demonstration code somewhere I can look at or a section of the P system manual that describes this functionality.
  12. This is cool to see inside this system. Can you think of any good reason that the interpreter has three NOP instructions in it? I find it astounding that someone wanted to slow down this critical piece of the system.
  13. Your are such an expert on this system. Thanks for all the insights! Forth does almost nothing without explicit code so no, there are not breaks in the loops. :-) But it can be done by re-defining the loop words like this: \ example to add BREAK to Forth BEGIN/UNTIL loops : ?BREAK ( -- ) KEY? ABORT" HALTED BY USER" ; : UNTIL ( ? --) POSTPONE ?BREAK POSTPONE UNTIL ; IMMEDIATE That's something that is difficult in conventional languages. :-) However to your point this would slow the loops down to 1000 loops per second because of the infernal KSCAN. So maybe this is why Pascal is operating slowly. Maybe you should compare a different benchmark that unrolls a loop into many lines of sequential code and see if things speed up. ?
  14. From the benchmark result Apersson850 posted, there is room for improvement. Since the Pascal compiler is written in Pascal, the slowdown seems to be in the p-code interpreter implementation. If the Pascal compiler emitted Forth that was r"linked" by Turbo Forth and then run, I have a strong feeling it would be much faster than it is currently. Of course if the Pascal compiler emitted native TMS9900 code it would be comparable in speed to C that we see from GCC and potentially the compiler would run even faster on the TI-99. The caveat is that the compiler program might be larger as native code, but with appropriate compiler optimizations it could be made to be comparable size. Pascal normally compiles much much faster than C, comparable to Forth compilation speeds, because of C's more complicated grammar so I go back to the p-code interpreter as the most probable bottle-neck.
  15. Wow. That is very peculiar to me. If you replaced the P-code system, a stack VM with a Forth stack base VM I am certain that Pascal code compiled to Forth would still run much faster than your results even with the run-time tests that Pascal incorporates. Does this indicate that there is a significant amount of GPL in the P-code interpreter?
  16. Not sure if this gives you a little help, but it's an illustration in a manual I am working on. The Forth Programming Pyramid You program in Forth by adding functionality to the Forth system itself. Your WORDs are added to the system word by word and you can test each word as you go. This makes your pyramid of code very solid and reliable. · Assembler CODE words are the foundation of the language that control the computer hardware · The Forth language is normally written using a mix of those Assembler words and Forth · Your program’s words are just more words added to the system. No different than the Language itself. · All of this culminates in creating the final word that starts the entire program running which you can call anything you like. RUN is as good as any other. ​The word "RUN" in the pyramid could be anything, but it shows the last word (sub-routine) you create kicks off your entire program.
  17. Another way to go is to create a set of words that emulate the functionality of TI-BASIC to give you some higher level building blocks. Turbo Forth already has many of them already. For example: \ CALL clear in CAMEL99 Forth (Consult Turbo Forth docs for equivalent words) DECIMAL : CLEAR ( -- ) PAGE 0 23 AT-XY ; ( just because you love it ) \ make an input buffer CREATE BUF$ 80 ALLOT : INPUT$ ( -- BUF$) PAD DUP 80 ACCEPT BUF$ PLACE ; : INPUT# ( -- number) INPUT$ BUF$ ?NUMBER 0= ABORT" not a number" ; Warning CAMEL99 Forth "tries" to keep to Forth 94 standard. TF is Forth 83 Standard so there are some differences, but Willsy can give us the translations. ​
  18. Try writing an outline for the game like you would for an essay. The titles of the outline are the word names for the big blocks of the game. The names in the bullet points become the internal routine names. In other words design top down ... Then figure out how to build it Bottom up, testing your words as you build. Try the outline and post it here and we can give you support.
  19. That's a fun project. I am a musician and producer myself but have been programming for almost as long. Another exercise for you could be to open a file and have your note frequency calculator program print the values out to a file as BASIC DATA statements. Sort of like below. BUT please read the manual on the OPEN statement, I have not used TI BASIC for many years so my memory is faulty. 5 OPEN #1:"FILENAME" BLAH BLAH (check your manual) 10 LET F=110 20 FOR I=1 TO 91 30 PRINT #1: I * 100;" DATA "; F 40 LET F=F*92^(1/12)) 50 NEXT I 60 END But if you make the text file you could use it like a prefab building block for future music programs. Just an idea.
  20. Lol. It sounds Friday evening has started in Uk.😄
  21. This book has been the defacto text for many years and is a good adjunct to Willsys pages https://www.forth.com/starting-forth/0-starting-forth/
×
×
  • Create New...