Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Xeda112358

Pages: 1 ... 17 18 [19] 20 21 ... 317
271
TI-Nspire / Re: Electric Circuit Calculation
« on: November 09, 2018, 09:39:43 am »
Pretty much the only difference in the BASIC language is no real graphics functions on the nspire. The rest is pretty much the same.

272
TI-Nspire / Re: Electric Circuit Calculation
« on: November 08, 2018, 09:53:07 pm »
Thanks for weighing in, Stefan, you are probably one of the most knowledgeable 68k/nSpire BASIC programmers here, so you'd really know what was feasible ^_^ And the link looks pretty useful.

273
Grammer / Re: Grammer 2-The APP
« on: November 08, 2018, 09:49:11 am »
I have been cleaning up code and doing some optimizations and modifications. I probably broke something, but I wanted a backup.
Updates:
  • I cleaned up the source a bit.
  • Going with the previous update, without the jumptable I had so e unused routines (intended for Grammer Assembly programs) that I removed
  • I implemented some custom VAT traversal routines. The OS routines were incredibly slow and I needed an excuse to use my VAT sort code :P
  • Added in code to throw an error if a Grammer Assembly program is run.
  • Version number is going to be sensible now, starting at 2.50.0.0
  • Minor optimizations.

Features I want:
  • with a sorted VAT, I can speed up the look-up of OS variables.
  • I want a scrollable start menu

274
TI-BASIC / Re: Simple little character generation program.
« on: November 04, 2018, 01:36:27 pm »
Then the next part is to train a neural network to generate an image based on those attributes !

Ijust recently started playing Pathfinder and my first thought was how useful a calc program could be for this.

275
TI Z80 / Hacked Lists!
« on: November 04, 2018, 10:56:56 am »
So, fun fact: floating point numbers can be changed to a variable reference instead, kind of like a shortcut on your computer, and the OS doesn't verify it.

In assembly, when you are looking for a variable, you put a name in OP1 and use FindSym or ChkFindSym. Those names are 9 bytes, which is also the size of a float (not a coincidence-- it's part of why names are limited to 8 bytes).
You can actually change the contents of a Real variable to such a name, and when you try to read it's value, it will instead return the value of the variable it points to.
For example, change the bytes of the Real variable, A, from 008000000000000000 (the number 0) to 015D01000000000000 and when you read A, it will return the contents of L2.

Or, since lists are just stored as a bunch of Real (or Complex) numbers, you can modify elements of the list to be pointers. In this way, you could read Str1, Str2, Str3,..., Str0 by reading an element of L1, which could be useful, occasionally :P

Some things to note:
You can't modify the contents of the original variable in this way. If A points to Str2, then "33"+A→A does not modify Str2. However, "33"+A will work like "33"+Str2.
Storing the names of programs and appvars and whatnot isn't useful.


Attached is a program that turns L1 into a 4-element list {L2,[A],Str1,L1}. Here is the source. You need to delete L1 first, my code wasn't reliably deleting it.
Code: [Select]
#define bcall(x) rst 28h \ .dw x
rMOV9TOOP1  = 20h
_ChkFindSym = 42F1h
_CreateRList= 4315h
.db $BB,$6D
.org $9D95
  ld hl,name
  rst rMOV9TOOP1
  bcall(_ChkFindSym)
  ret c
  ld hl,name
  rst rMOV9TOOP1
  ld hl,4
  bcall(_CreateRList)
  inc de
  inc de
  ld hl,data
  ld bc,31
  ldir
  ret
data:
  .db 1,$5D,1,0,0,0,0,0,0
  .db 2,$5C,0,0,0,0,0,0,0
  .db 4,$AA,0,0,0,0,0,0,0
name:
  .db 1,$5D,0,0

276
ASM / Re: eZ80 on calc?
« on: November 02, 2018, 01:30:43 am »
Probably, though it would take some effort. Most instruction can use literal replacements, but labels and macros need some more advanced treatment.

277
ASM / Re: eZ80 on calc?
« on: November 01, 2018, 10:53:28 pm »
I asked a little while ago, and as far as I know it doesn't exist yet.

278
Math and Science / Re: Efficient Plotting of Polynomials
« on: October 29, 2018, 07:39:23 pm »
Your computation of f(x+1) is correct, but then you need to subtract f(x), so:
##
\begin{aligned}
f(x+1)-f(x)&=(x^{3}-x+3)-(x^{3}-3x^{2}+2x+3),\\
&=x^{3}-x+3-x^{3}+3x^{2}-2x-3,\\
&=-3x+3x^{2},\\
&=3x^{2}-3x.\\
\end{aligned}
##

279
Math and Science / Re: Efficient Plotting of Polynomials
« on: October 29, 2018, 02:04:57 pm »
It is basically 3+2(x+1)-3(x+1)2+(x+1)3-(3+2x-3x2+x3) which should be 3x^2-3x (I hope).

280
Axe / Re: Painting Sprites from File/RAM
« on: October 29, 2018, 10:58:21 am »
Try without the brackets. The way you are doing it is actually taking the data at Y0 as an address, but you want to use Y0 itself as an address.

281
Math and Science / Re: Efficient Plotting of Polynomials
« on: October 29, 2018, 09:27:07 am »
For what it's worth, I did get it to work in TI-BASIC. My program only worked up to degree 8 polynomials (I could extend it; it was just a convenient size).
I'm on mobile atm and AFC, so I'll try to describe my code:

What I did is I computed Y1(Xmin+K∆X), for k from 0 to 8, storing them to a list, then I recombined starting from the end  (the last element is a function of all previous elements and itself) applying that sum.

Then for efficiency, I clipped off any trailing zeros in L1.
I started plotting from Xmin to Xmax with step of ∆X:
Code: [Select]
For(X,Xmin,Xmax,∆X
Pt-On(X,L1(1
For(K,1,N-1
L1(K)+L1(K+1→L1(K
End
End

Note that it doesn't work well for non-polynomials like sine and cosine, but it can do rough estimates. I'm also sure it would fail at poles.

282
Math and Science / Efficient Plotting of Polynomials
« on: October 28, 2018, 10:32:12 pm »
Hi folks, I wanted to share a technique I came up with for evaluating sequential points of a polynomial, which is especially useful when you are drawing them. A naive approach would be evaluate the whole polynomial at each point, but the method I'll show you allows you to evaluate at a few points, and then for each subsequent point just use additions.

The basic premise is to use ##f(x)## as a starting point to get to ##f(x+1)##. For example, take ##f(x)=3+2x##. To get to ##f(x+1)##, all you have to do is add 2. Things get more complicated as you go to higher degree polynomials. For example, take ##f(x)=3+2x-3x^{2}+x^{3}##. Then to get to ##f(x+1)##, you need to add ##3x^{2}-3x##. However, you can go even further by finding how to get from ##3x^{2}-3x## to ##3(x+1)^{2}-3(x+1)##.

Now comes the theory.

Take ##f_{1}(x)=f(x+1)-f(x)## and ##f_{n+1}(x)=f_{n}(x+1)-f_{n}(x)##.
Then ##f(x+1)=f(x)+f_{1}(x)## and ##f_{n}(x+1)=f_{n}(x)+f_{n+1}(x)##.

##\begin{aligned}
f_{2}(x) &=f_{1}(x+1)-f_{1}(x),\\
&=(f(x+2)-f(x+1))-(f(x+1)-f(x)),\\
&=f(x+2)-2f(x+1)+f(x).
\end{aligned}##


##\begin{aligned}
f_{3}(x)&=f_{2}(x+1)-f_{2}(x),\\
&=(f(x+3)-2f(x+2)+f(x+1))-(f(x+2)-2f(x+1)+f(x)),\\
&=f(x+3)-3f(x+2)+3f(x+1))-f(x).
\end{aligned}##

And in general,
##f_{n}(x)=\sum_{k=0}^{n}{{n\choose k}(-1)^{k}f(x+n-k)}##
If you set ##x=0##:
##f_{n}(0)=\sum_{k=0}^{n}{{n\choose k}(-1)^{k}f(n-k)}##

So now let's take again, ##f(x)=3+2x-3x^{2}+x^{3}##.
##\begin{aligned}
f(0)&=3,\\
f_{1}(0)&=f(1)-f(0)&=0,\\
f_{2}(0)&=f(2)-2f(1)+f(0)&=0,\\
f_{3}(0)&=f(3)-3f(2)+3f(1)-f(0)&=6,\\
f_{k>3}(0)&=0.\\
\end{aligned}##

So what these values allow us to do, ##{3,0,0,6}##, is use a chain of additions to get the next value, instead of evaluating the cubic polynomial at each x:
##\begin{array}{rrrr}
[&3,&0,&0,&6]\\
[&3,&0,&6,&6]\\
[&3,&6,&12,&6]\\
[&9,&18,&18,&6]\\
[&27,&36,&24,&6]\\
[&63,&60,&30,&6]\\
[&123,&90,&36,&6]\\
[&213,&126,&42,&6]\\
...
\end{array}##

Basically, add the second element to the first, third element to the second, and fourth element to the third. The new value is the first. Repeat. So the next iteration would yield [213+126,126+42,42+6,6]=[339,168,48,6], and indeed, f(8)=339.

I'd like to apologise for how garbled this is, I'm really tired.

Also, you should note that for an n-th degree polynomial, you need to compute up to ##f_{n}(x)##, but everything after that is 0.

283
TI-Boy SE - Game Boy Emulator For TI-83+SE/84 / Re: Good Ti-Boy games?
« on: October 17, 2018, 05:17:51 pm »
Earlier in the thread it is stated that some games just can't fit in the non-SE calcs. The Pokemon games are among those, so you are out of luck.

284
TI Calculators / Re: Unfinished TI-84 CE 3d Grapher (ICE)
« on: October 16, 2018, 06:49:23 pm »
Wow, that's pretty cool!

285
ASM / Re: ASM Optimized routines
« on: October 16, 2018, 06:33:14 pm »
Here is a decent arctangent routine that works on [0,1), so you'll have to do the work to extend it outside that range. It uses a small lookup table and linear interpolation.
Spoiler For Range Reduction:
atan(-x)=-atan(x) is useful to extend to negative numbers
atan(x)=pi/2-atan(1/x) is useful to extend to inputs with magnitude >=1
Code: [Select]
atan8:
;computes 256*atan(A/256)->A
;56 bytes including the LUT
;min: 246cc
;max: 271cc
;avg: 258.5cc
  rlca
  rlca
  rlca
  ld d,a
  and 7
  ld hl,atan8LUT
  add a,l
  ld l,a
#if (atan8LUT&255)>248    ;this section not included in size/speed totals
  jr nc,$+3               ;can add three bytes, 12cc to max, 11cc to min, and 11.5cc to avg
  inc h
#endif
  ld c,(hl)
  inc hl
  ld a,(hl)
  sub c
  ld e,0
  ex de,hl
  ld d,l
  ld e,a
  sla h \ jr nc,$+3 \ ld l,e
  add hl,hl \ jr nc,$+3 \ add hl,de
  add hl,hl \ jr nc,$+3 \ add hl,de
  add hl,hl \ jr nc,$+3 \ add hl,de
  add hl,hl \ jr nc,$+3 \ add hl,de
  add hl,hl
  add hl,hl
  add hl,hl
;  add hl,hl    ;used in rounding...
  ld a,h
;  rra          ;but doesn't seem to improve the error
  adc a,c
  ret
atan8LUT:
  .db 0,32,63,92,119,143,165,184,201

Pages: 1 ... 17 18 [19] 20 21 ... 317