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.
unbibium: (animated pacman)
So, Eliza is still pretty slow, but a little faster.

I fixed some things about the screen editor.

I don't know what to do next.
unbibium: (animated pacman)
Suddenly the solution seems obvious: optimize Eliza first.

Much of the slowdown must be coming from how every time it needs to retrieve a string, it has to do a RESTORE command and then READ through all the DATA statements until it finds the right one. But CBM BASIC, and therefore my BASIC, has string arrays, so I can just READ everything once at the beginning of the program. The string pointers in the array will all point to the DATA statements themselves, so they won't use much more memory, and they won't count against the quadratic part of the garbage collection routine.

won't know for sure until I get home and can try it, though.
unbibium: (animated pacman)
Feels a little anticlimactic. Maybe I'll work on improving the speed.

when it comes down to it, there's not that many cool things you can do in ordinary BASIC.
unbibium: (animated pacman)
...and, now Eliza works.

It's really monstrously slow, perhaps too slow for a demo video. But it works.

now what...
unbibium: (animated pacman)
A bit of a milestone moment tonight: I fixed MID$ and managed to create a stub for LOAD that would copy ELIZA into memory.

It got to the INPUT I$ and gave a ?STRING TOO LONG error before accepting any input.

Profile

unbibium: (Default)
unbibium

April 2017

S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526272829
30      

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 22nd, 2017 01:19 pm
Powered by Dreamwidth Studios