unbibium: (err foreigner belt)

5 rem display something cool on the c64
10 poke 53281,14:print"{lblu}{clr}":poke 53281,6
20 poke 53272,88:sc=8192:ff=255
30 for ch=0 to ff
40 b=1:for r=0 to 7
50 poke sc,(ch and b)>0 and ff
60 sc=sc+1:b=b*2
70 next r,ch
80 geta$:if a$=""then 80
90 poke 53272,21
unbibium: (animated pacman)
So, I have a long-term goal of writing my own smart speaker program using publicly-available software. And I've met the intermediate goal of making essentially a version of the old Eliza chatbot that you can converse with aloud. I downloaded an Eliza implementation in Python from Github, and used one of those cloud speech recognition engines, and combined them in a way where I can swap the speech engine for a text engine -- meaning I can switch to a different speech engine, too. And I can swap out Eliza for a chatbot of my own design, once I get all the glue in place...

one of these glue elements is, I want this chatbot to have a wake word. like it shouldn't start listening for actual sentences until it hears its name. There's an engine called Snowboy that everyone seems to use... except that it's impossible to install on my Mac or my Raspberry Pi. The python bindings all fail and crash and burn. ...there's another one called Porcupine which seems to work better, but it's complicated to start using... and also seems to have some limitations. like, I'm stuck with the default wake words until I can get a commercial license to use it. so I guess I'll rename it to "bumblebee" or something instead of "Annette" which isn't a good wake word anyway; it's only four phonemes long.

a problem I'm running into with speech/AI/cloud stuff is that I keep finding things that look like they're going to work great, but they're at end-of-life. Snowboy is one of them, that's probably why I can't get it to compile on anything. Six months ago it was Kalliope, which you were supposed to run locally but program through the cloud, somehow. Now there's wit.ai, an intent detection engine, which isn't shutting down... but as I asid before, it's been bought by Facebook, which means I can't get my API token with my Github account anymore, I have to use my Facebook account. Gah.

this is going pretty slowly, I hope I can get past these dumb obstacles and get to writing the conversations soon... even then i'll probably get bogged down in data structures...
unbibium: (Default)
I really should have started with the data model and gone from there
unbibium: (Default)
I feel the need to put a finer point on this SpeedScript thing.

SpeedScript had no idea where the cursor was on the screen, only in memory. So in order to blink the cursor, it had to blink the actual letter in the document, and then redraw the screen.

This was already a problem on the c64; where I can now type faster than the screen redraws. The Vic-20 probably didn't have this problem because it had fewer letters to draw. The Commander X-16 prototype runs at 8 MHz so it's lightning fast in 40-column mode, but 80-column mode also has 60 rows. So it has to redraw 4120 characters every time anything on the screen changes.

It'd probably be worth my while to optimize it, like maybe store a line length table or something. But every optimization means I'll have to track something that SpeedScript for the C64 never had to track. It never scrolled the screen, for example; it just moved the top-of-screen pointer before redrawing.

I already tried to track the cursor position on the screen, but that's easier said than done. I can catch the cursor position when the screen is redrawn, but that means if they move the cursor, SpeedScript will have no idea where the cursor is until it redraws again. so I need to find some cheaper way of locating the cursor.

I'll probably need a lookup table or something.
unbibium: (Default)
So, the 8-Bit Guy's dream computer, the Commander X16, has reached a physical prototype stage, and seems to borrow so heavily from the Commodore 64 that I've already got SpeedScript kinda-sorta working.

It even works in the X16's 80-column mode, but it's much much slower in that mode, because it turns out SpeedScript redraws the entire screen constantly. In fact, that's how it blinks the cursor: it changes the letter your cursor is pointing at to an inverse version of itself, and just draws that whole section of the document to the screen. If you reset whil the cursor is visible, then the c64 version actualy has an NMI that smooths things out.

i need to figure out how to detect shift-ctrl commands, there's a lot of that
unbibium: (animated pacman)
the only thing from that list I did was do some Angular.JS lessons.
unbibium: (animated pacman)
Phoenix Comicon time starting today.

But first, I'll take advantage of having the morning off, and wash my sheets and record that video of the BASIC interpreter so I can edit it and put it on YouTube.
unbibium: (animated pacman)
haven't worked on BASIC for a week

because the filesystem is next
unbibium: (animated pacman)
Latest version actually allows you to type quotes and parentheses... and color codes, even on the Web emulator.

You can even type Ctrl-9 to get reverse text that doesn't blink, and Ctrl-N to go into lowercase mode.
unbibium: (animated pacman)
Star Trek kinda works. remember to press CTRL to unlock the keyboard first. you can type LOAD with or without a filename.

There are three demos: Eliza, Star Trek, and 10 PRINT.
unbibium: (animated pacman)
It's starting to look as though that bug with subtraction has to do with the emulator I'm using; it doesn't implement the carry bit correctly on subtracts.
unbibium: (animated pacman)
so I fixed the INT() problem but now the bit in Star Trek that should say "30 YEARS" now says "29.99999991 YEARS". not sure what happened there.
unbibium: (animated pacman)
So there are actually two problems, not just one, with the math.

For one, those gigantic numbers I've been seeing happen every time you INT a negative number.

Also, some subtractions come out derped. Particularly, if the number you're subtracting uses all 32 bits of the mantissa, the answer will be off by some power of two, in the negative direction.

if it's not one thing, it's another, eh. I've spent a little time walking through the routines and comparing them with the 6502 version, but haven't found anything that would explain any of this. I'll definitely have to fix it before Star Trek will work.
unbibium: (animated pacman)
No, wait... the fast inverse square root does 1 / SQR(X), while what I need is SQR(2) / X.

there's probably some algebraic principle I can exploit to turn one problem into the other, but i've already sprained my brain on it..
unbibium: (animated pacman)
Some mysterious calculation is resulting in the number -1.61061279E+09, probably a subtraction.

On a real c64, this is represented by the bytes 9f c0 00 00 6c. either the c0 doesn't belong there or the 6c doesn't belong there. I won't know until I catch it in the act. it only occurs in the Star Trek game, and not very reliably. If I can find the right random seed to make it happen early enough in the game, I can nail it.

Also, I just had an idea on how to get a tiny speed bump and postpone 32-bit division a little longer. The power and square root operators are wonky because they involve a log as one step, and the log involves an inverse square root. Well, I just remembered John Carmack had a famous "fast square root" that involved casting a float as a long integer, and subtracting it from a magic number. I think I might be able to use that here, though I'd need a 40-bit magic number.
unbibium: (animated pacman)
Apparently some calculations are resulting in strange results, and it's messing up the galactic map.

i'll deal tomorrow i guess.
unbibium: (animated pacman)
So it turns out that ?OVERFLOW ERROR occurs every time you try to raise a negative number to any power.

I worked around this by making a special case for squares -- no reason to go through all that polynimal madness when you can just multiply a number by itself, eh.

might be a release soon.
unbibium: (animated pacman)
Star Trek kinda-sorta works, but there's this overflow error I keep getting.

It uses DEF FN to compute distances with the Pythagorean formula, which uses exponents, which in turn uses division. So there's a chance that the 16-bit division shortcut is to blame. Still, it should be resulting in inaccurate answers, not aborting the program.

I'll have to dive into the floating point routines once again to fix this, and I'll have to do that before releasing this.
unbibium: (animated pacman)
OK... it looks like star trek mostly works except there are a few random seeds that create mysterious overflow errors.

and, it does want to do SQR() and power... which means that the inaccurate division might be to blame.
unbibium: (animated pacman)
It's so obvious now.

Star Trek. That's a BASIC game from the 1970s, and thematically appropriate.

I tried it, and it works with a little modification. It's slow too, probably too slow to play, but you can at least see it working. So it's more like playing Star Trek on a 300 baud modem than anything else.

Profile

unbibium: (Default)
unbibium

August 2025

S M T W T F S
     1 2
3456789
10111213141516
17181920212223
24252627282930
31      

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 14th, 2025 06:27 am
Powered by Dreamwidth Studios