Jump to content

TheBF

+AtariAge Subscriber
  • Content Count

    3,161
  • Joined

  • Last visited

Everything posted by TheBF

  1. Interesting. And yes the simple rules observation is supported by most human activity in the world.
  2. TheBF

    ...

    I feel your pain with postfix. We have been pretty solidly brainwashed into thinking in "infix" notation after just a few years at school. Willsy has given you some excellent insights on how postfix in Forth really works. The thing that saves Forth for me is the interpreter. I type in the inputs and use the math operators and see what comes out. No compiling, no linking no waiting. When it works I give it name. It's now in the can and locked down. Once you have a named function that it is no different than calling TI-BASIC FUNCTION which is PREFIX notation. So the interpreter is your friend and making little words to do pieces of math are your friend.
  3. TheBF

    ...

    I did not implement FORGET, but I should. It's still very handy for testing new code. I do miss it.
  4. TheBF

    ...

    It's sad but true, you are shooting a moving target. Forth has been going through standards changes. Forget is easy to implement in a simple system and near impossible in a complex native code system like Swiftforth. So it has been deprecated. The new word is MARKER used as below. MARKER STARTOVER Then you type STARTOVER and the system goes back to the point where the MARKER was compiled. But FORGET is part of TurboForth and FB-Forth.
  5. Hey thanks. That gave me some real world experience. The ROBOT player on the site knows the game and beat me handily.
  6. Forth will hurt your head for while and then the penny drops. It's so stripped down from normal languages it is easier to assume it's a kind of assembly language with some handy support macros when your first give it a spin. But if you take some time with it, you actually end up being a better programmer in all the other languages you use, just because you see more "behind the curtain" stuff in your mind. In that sense it is also like assembly language too. You have some good support here with the three amigos assembled on Atariage. B
  7. That's pretty cool too. I will see what it takes. I have to get my cross-compiler making programs larger than 8K first :-)
  8. Nice work. I will create a set of these words and play with them. I have TIB up at the top of memory, but I have a crude HEAP in low memory where I can implement this. I have been pondering locals for the TMS9900 myself. I keep rolling around the idea of using free registers and a set of words to operate directly on the register variables. ( I am just a little jealous that GCC can do this) :-) Since memory and registers are the same thing in 9900 land I think your method could accommodate that too with a little tweaking. Need to study it more. Another thing that goes with locals in memory is using the mem-to-mem architecture ability of the 9900 and creating words that operate variable to variable rather than going through the stack. I think there are some nice opportunities there. Thanks for this Willsy.
  9. I started... but this month will be trouble. The AI component has me interested, but I will get the basics setup first. No pun intended.
  10. And so Forth :-) I couldn't resist. I must confess after watching the video I am intrigued.
  11. So... I had been playing with a playback speed variable and changed it without knowing it so that is why the durations are all wrong. This is the sound I was playing with. Sounds kind of wimpy to me now. :-) Gotta leave for a while. Star trek is on :-) : FIRESND ( from Parsec ) DATA[ 088A 10C2 01DF 92E3 F007 048F 1092 F102 0294 F203 0296 F303 048E 1197 F403 029A F503 038F 9FFF 0100 ]DATA DROP ;
  12. Well I am using my own player so it interprets this differently. I will fix it with your game so we are on the same page. Standby...
  13. I have had some fun with minimalist sound chip control words that don't need the ISR to work. *These words work on FB-Forth, Turbo Forth and CAMEL99 Forth.* It all starts with a word to write a byte to the 9919 chip. I call it SND!. (sound store in Forth speak) HEX : SND! ( c -- ) 8400 C! ; Then you need a little delay. CAMEL99 uses the 9901 chips timer to make MS, a delay in milliseconds. It is simple to emulate for another TI Forth system. : MS ( n -- ) 0 DO 8 0 DO LOOP LOOP ; Controlling the noise channel is the simplest. The word NOISE takes 1 parameter. Thierry Nouspikel shows it this way: 1 1 1 0 0 w r r >E | | | | 0 0 : 6991 Hz | 0 1 : 3496 Hz | 1 0 : 1748 Hz | 1 1 : freq of generator 3 | 0 : Periodic noise 1 : White noise The Forth word to do this: : NOISE ( n -- ) E0 OR SND! ; \ n selects the noise type We just take the parameter n, OR it with >E0 and send it off to the chip. In real terms it means this: 0, 1 or 2 give you 1 of the three frequencies listed as very high harmonic content waveforms. (not very useful) 4 , 5 or 6 gives you 3 flavours of noise. 7 as a parameter lets you control this oscillator with the frequency of channel 3 (this mode is fun cuz it let's get real BASS notes out of the chip. More later ...) If it's easier for you to work in Binary, you can program it like this. 2 BASE ! ( switch to BASE 2) 000 NOISE 001 NOISE 010 NOISE 011 NOISE 100 NOISE 101 NOISE 110 NOISE 111 NOISE Once the noise chip is given the parameter you need to set the attenuator to control the volume of the sound. In DECIMAL arithmetic we have 0 to 14 as the volume range, Level 15 is OFF. 0 NOISE-DB has the least attenuation so that is full volume. Our word for controlling the attenutator is NOISE-DB and with it we can make a quick NOISE-OFF word to kill the noise. : NOISE-DB ( db --) F MIN F0 OR SND! ; : NOISE-OFF ( -- ) F NOISE-DB ; But to really make synthetic sounds you need control of the "sound envelope"; how fast the sound comes on and goes off. So we created NOISE-UP & NOISE-DOWN. They each take a delay number to control the rise time and decay time. (They could be made more interesting by take the start and end volume as parameters as well) HEX : NOISE-UP ( speed -- ) 2 F DO I NOISE-DB DUP MS -1 +LOOP DROP ; : NOISE-DOWN ( speed -- ) F 2 DO I NOISE-DB DUP MS LOOP DROP NOISE-OFF ; With those you can make a nice SWOOSH sound this simply. : SWOOSH ( -- ) NOISE-OFF 5 NOISE 8 NOISE-UP 20 NOISE-DOWN ;
  14. A new version of the SNAKE with sound enhancements I have been playing with methods to do sound control without using interrupts and sound lists. I think I am getting somewhere. The spoiler has the new version with sounds. I added scraping as the snake slides, a squeak when the mouse gets eaten and nice swoosh when a new mouse materializes. I will explain the sound control words in another topic. (I have not got past 50 segments of snake length playing this myself.)
  15. Yes that is my observation too. And I'd like have a way to MOVE data 2 bytes at a time in the kernel. I been struggling with naming as well. Perhaps for CAMEL Forth I will move it closer to 2012 standard and add MOVE (16 bit) I have already done some of that anyway. I can simply put the "smart" code into PLACE itself or remove it completely and include a warning about overlapping strings in the docs. I lean towards simplicity versus overly "smart" words. But I still need to figure out how make MOVE work inside PLACE rather than using CMOVE. The TI machine still baffles me at times.
  16. LOL. I have gone done some of those rabbit holes too. I limit my spinning on these things if they get too long. I wrote a version of MOVE that does 16 bit cells and so is 2X faster than CMOVE, but I could not make it work with PLACE. It was 1 byte off probably due to 9900 byte order, but I didn't waste much time on it. I am on my laptop at the moment and the code is on my desktop machine I will get it up here shortly and also some new words for controlling sound without sound lists for anyone who wants to try it that way.
  17. PLACE is a word in GForth and I think was first used by Wil Baden (RIP) who's real name was Neil Baud. He has a great legacy of Forth utilities for managing text. It's all ANS 94 Forth, but still full of great ideas. So PLACE is not a "standard" word, but very handy to PLACE a stack string (addr len --) into a buffer as a counted string. Here is the CAMEL Forth version by Brad Rodriguez. I found you can replace the MOVE word with CMOVE for most circumstances, because we seldom have overlapping string buffers in Forth, however the use of MOVE is technically correct. : MOVE ( src dst n -- ) \ version for 1 address unit = 1 char >R 2DUP SWAP DUP [email protected] + \ -- ... dst src src+n WITHIN IF R> CMOVE> \ src <= dst < src+n ELSE R> CMOVE THEN ; \ otherwise \ CAMEL Forth calls this ">COUNTED" : PLACE ( src n dst -- ) 2DUP C! CHAR+ SWAP MOVE ; $BUF in my system was a temp buffer that I was using all the time. I have since retired it and will create buffers as needed. You could use PAD I think depending on how PAD is implemented in FB Forth. (albeit slower)
  18. Sounds good Lee, I will get you the code for the words you are looking for. Yes I quite like the BYTES format for these sound strings and I have since changed it to BYTE just to be more like TI Assembler. This would mean then you could explore making sound lists interactively from the Forth console and then take the code and put it in an ASM program by just adding the '>" and commas. I am also considering making a sound list compiler. This would let you use language like Hz , dB and mS to describe you sounds but the result will create a sound list data structure. That might be cool for FB Forth users to have in the tool box.
  19. That's pretty cool. When you get some time try the other sounds just to say we didn't completely plagiarize. So the big question is ... Which source code is easier to understand. BASIC or Forth? B
  20. Hi Lee, Here is a shooter sound and an explosion. They are in my (new) format but not to hard for you to change them to FB Forth The explosion is a variation on the Parsec explosion but is slips through three "bandwidths" of white noise starting with the highest frequency one and going down. Parsec stays on the same one and just ramps the decay down. I used my SOUND words to make sound and also print out the hex code at the same time as you can see in the jpeg. Makes an pretty nice tool for exploring. HEX CREATE LASER \ 420 hz BYTE 4 9F BF DF FF 0 BYTE 8 8A 10 C2 1 DF 92 E3 F0 5 BYTE 4 8F 10 92 F1 10 BYTE 2 94 F2 20 BYTE 2 96 F3 20 BYTE 4 8E 11 97 F4 15 BYTE 2 9A F9 35 BYTE 2 9F FF 1 /END CREATE EXPLODE BYTE 7 9F BF DF E5 F0 C0 07 5 BYTE 1 F1 6 BYTE 1 F2 7 BYTE 1 F3 8 BYTE 1 F4 9 BYTE 2 E6 F5 10 BYTE 1 F6 11 BYTE 1 F7 12 BYTE 1 F8 13 BYTE 2 E7 F9 14 BYTE 1 FA 15 BYTE 1 FB 16 BYTE 1 FC 17 BYTE 1 FD 18 BYTE 1 FE 30 BYTE 1 FF 0 /END
  21. This is fun. I have been playing with sound lists and the 9919. Maybe I can come up with a sound or 2 for you.
  22. I hope I am not breaking any rules by posting a reference to another discussion site but for those interested in reading/learning about Forth I just found out about there are healthy discussions going on at: http://forum.6502.org/viewforum.php?f=9 I suspect our TI-99 group is smaller than the 6502 crowd so it probably does not make sense to partition up into narrow forums here. And of course since we are all upper crust 16 bit types, we are interested in a broader range of topics, unlike those 8 bitters down the street.
×
×
  • Create New...