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 ... 15 16 [17] 18 19 ... 317
241
TI Z80 / Re: Yet Another VAT Sort
« on: February 01, 2019, 10:59:01 am »
That is pretty impressive. And that's basically how I got into calc programming. It was super portable and relatively easy to use and didn't have a computer at home.

242
TI Z80 / [Grammer] Quadratic Formula
« on: February 01, 2019, 12:18:42 am »
Requires Grammer 2.50.1.1 and up.

This program gives you the zeros of a quadratic function! Inputs must include a decimal point so that Grammer knows it is a float. Hopefully that can be fixed in the future. Also it looks like Grammer has some float issues, so it gives weird answers when the result is complex.

243
Grammer / Re: Grammer 2-The APP
« on: January 31, 2019, 11:59:06 pm »
I made the readme a little easier to read, splitting it up into different files and using tables. I also added in support for automatic conversion of a number to a float if there is a decimal point in there. For example, 3.0 is now converted to a float and its pointer is returned (where it is stored in temp memory). See the readme for a slightly more detailed look at how Grammer handles floats. Finally, a really minor modification was that I found a size and speed optimization in pixel plotting, so you will now be able to get in an extra pixel or two per minute! :P

244
ASM / Re: Working on Textbox program for asm
« on: January 30, 2019, 08:59:46 pm »
Here is my take on it (not the whole code):
Code: [Select]
  ld c,(hl);grab string size
  inc hl
  ld b,(hl)
  inc hl
loop:
  ld a,(hl)   ;Need to check if it is a two-byte token, later
  push af   ;Save A for later
  push hl
  push bc
  bcall(_Get_Tok_Strng)
  ld hl,op3-1    ;point to the byte *before* the output characters.
tokenloop:
  push hl     ;save HL
  push bc    ;and BC
  call CheckXPos
  pop bc
  pop hl
  inc hl   ;Need to increment first to get to the character since we started one byte behind
  ld a,(hl)
  bcall(_VPutMap)
  dec c
  jr nz,tokenloop
  pop bc
  pop hl
  pop af
  bcall(_IsA2ByteTok) ;Check if it was a 2 byte token
  jr nz,+_
  inc hl  ;increment hl for next calc since token was 2 bytes
  dec bc  ;decrement bc since token was 2 bytes
_:
  cpi
  jp pe,loop  ; pe is used to test if BC reached 0.
  bcall(_getKey)
  ret
CheckXPos:
  ld (hl),1  ;Just want a 1-byte string. HL points to an already drawn char, so no need to save it
  bcall(_SStringLength) ;Returns length in A and B
  ld a,(penCol)
  add a,b ; Grab the future penCol position
  ld b,a
  dec b
  dec b
  ld a,(mX)
  cp b ; call Resetcur if pencol > mX
  ret nc
Resetcur:
  ld a,(cX)
  inc a ;if pencol > mX, change the cursor position
  inc a ;to next line before writing
  ld (penCol),a
  ld a,(penRow)
  add a,6
  ld (penRow),a
  ret

245
ASM / Re: Working on Textbox program for asm
« on: January 30, 2019, 09:40:54 am »
It looks like you are only displaying the first ASCII character of the token, btw. When you use Get_Tok_Strng, it returns how many characters there are in BC (alternatively, you can use C, since B=0 always). If vPutMap preserves HL and C, you can loop through like this:
Code: [Select]
puttokloop:
 ld a,(hl)
 inc hl
 bcall(_VPutMap)
 dec c
 jr nz,puttokloop

246
ASM / Re: Working on Textbox program for asm
« on: January 29, 2019, 10:45:58 pm »
You can use the _Get_Tok_Str bcall to convert a token to it's characters. Another routine that might be useful to you later is _SStringLength which calculates how many pixels wide a string is in the variable-width (small) font.

247
TI Z80 / Re: Yet Another VAT Sort
« on: January 29, 2019, 09:53:54 am »
Haha, yeah, VAT manipulation is a pain. I saw your Axe program and it looks pretty low level; have you ever done any assembly work?

248
Axe / Re: Alphabetize the VAT
« on: January 29, 2019, 09:47:32 am »
Necroposting is generally frowned upon (the last post was over 5 years ago); ideally you should create a new topic. That said, cool!
I don't see how it sorts or anything :| To me it looks like it just filters out programs :P

249
Grammer / Re: Grammer 2-The APP
« on: January 28, 2019, 08:14:26 pm »
Grammer has a few new commands since the last update.
  • G-T returns the address of the default front buffer.
  • G-T' returns the address of the AppBackUpScreen, a typical back buffer.
  • Else is finally back to being supported.
  • →. will write four bytes from one pointer to another. This is intended for single-precision floats
  • Text(0,0,.A allows you to print the float pointed to by A.
  • A+.B adds two floats pointed to by A and B
  • A-.B subtractss two floats pointed to by A and B
  • A*.B multiplies two floats pointed to by A and B
  • A/.B divides two floats pointed to by A and B
  • √(.A calculates the square root of the float pointed to by A.
So an example program using the GFLOAT module to get the pi and e constants:
Code: [Select]
.0:Return
ClrDraw
ClrHome
"5GFLOAT→$
π8800→X+4→Y
$π→.X
$e→.Y
For(A,0,7
√(.X*.Y→.X
Text(A*6,0,.X
DispGraph
End
Stop

250
Lua / Re: WZ_ST_Lib.tns HELPPP
« on: January 28, 2019, 09:44:31 am »
I was hoping someone would show up to answer. I don't know how to do this; I never got into nspire programming outside of purely math programs :|

251
ASM / Re: Number too large to fit?
« on: January 27, 2019, 08:44:42 pm »
You need to do ld a,(Keystore). The way you currently have it, you are trying to store the pointer, Keystore, to the 8-bit register A, but pointers are 16-bit for the Z80. By using (Keystore) instead, you are loading the byte at keystone.

252
ASM / Re: [z80] Floating Point Routines
« on: January 22, 2019, 04:38:28 pm »
Update:
For the extended-precision floats, I added:
Code: [Select]
xcmp     for comparing two numbers
xneg     -x -> z
xabs     |x|-> z
xinv     1/x -> z   Observed a bug in 1/pi !
xpow     x^y -> z
xpow2    2^x
xpow10   10^x
xlog     log_y(x)   It's failing miserably
xlg      log2(x)
xlog10   log10(x)   Observed a bug in log10(pi)
I made the str->single routine better (it had been quickly thrown together and failed on many/most cases). Now it appears that digits get swapped in some cases! :( I have to look into this.

To Do:
Look into the string->single routine and figure out what is wrong
I still have to look into the bugs observed in the single-precision Mandelbrot set program
Look into the errors in xinv, xlog, and xlog10  (these might all be related, or maybe I accidentally a byte in the built-in constants).
Have to make xsin, xcos, xtan, xsinh, xcosh, xtanh, xtoTI (x-float to TI float), TItox (TI float to x-float), and strtox (string --> x-float).
For all of the trig routines, I still need to apply range-reduction :|

Once these are done, it's just finding and fixing bugs and optimizing, and the project is as complete as what I wanted to do. BCD floats were a cute idea, but I'm a bit more realistic now :P

253
Chu Chu Rocket is built in to CrunchyOS, so you can't delete it without deleting CrunchyOS.

Apps are always a multiple of 16384 bytes. If your App is not using all of that space, you may decide to put that additional space to use by storing files or other useful routines. or whatnot. I believe this was the motivation for the author, since the App is 1 page (16384 bytes) and the app seems pretty straight-forward, not at all needing the full 16384 bytes.

254
TI Z80 / Re: Floatlib
« on: January 14, 2019, 11:22:26 pm »
I put this project up on GitHub (Floatlib), incorporating the z80float library that I have been updating and fixing and adding to. Floatlib now has extended-precision support as well as a more complete library of single-precision float routines! The only problem is that when I went to test the library with the the Mandelbrot Set program, it appeared that there are some new issues that need fixing :|


Those two white pixels at/near the center of the circular and cardioid part of the set should be black.

255
ASM / Re: [z80] Floating Point Routines
« on: January 14, 2019, 02:40:17 pm »
x-post

I have been focusing on the single-precision floats this past week or so. I rewrote or re-worked a lot of routines. I got rid of most of the tables by switching to a polynomial approximation for the 2^x routine (thanks to the Sollya program!) and using the B-G algorithm to compute lnSingle. It turned out to be faster this way, anyways.

I implemented sine, cosine, and tangent, the first  two, again, using minimax polynomial approximation. I optimized the square-root routine (much faster but a few bytes bigger). I re-implemented the B-G algorithm using math optimizations I came up with a few months ago. I opted for two B-G implementations-- one for lnSingle which requires only 1 iteration for single precision, and one for the inverse trig and hyperbolic functions which needs 2 iterations. For anybody looking to save on size, you can just use the second B-G routine for natural logarithm. It will be a little slower, but it'll work just fine (maybe even give you an extra half-bit of precision :P).

I included the Python program that I use for converting numbers to my single precision format. You can use it to convert a single float or a bunch of them. I also included a Python tool I made for computing more efficient coefficients in the B-G algorithm, but that'll only be useful to me and maybe a handful of other people. It's there on the off chance somebody stumbles across my project looking for a B-G implementation.


The single precision floats are largely complete in that I can't think of any other functions that I want to add. There is still work to be done on range reduction and verification, as well as bug fixes and more extensive testing.

Here is a current screenshot of some of the routines and their outputs:


The current list of single-precision routines:
Code: [Select]
Basic arithmetic:
  absSingle     |x| -> z       Computes the absolute value
  addSingle     x+y -> z
  ameanSingle   (x+y)/2 -> z.  Arithmetic mean of two numbers.
  cmpSingle     cmp(x,y)       Compare two numbers. Output is in the flags register!
  rsubSingle    y-x -> z
  subSingle     x-y -> z
  divSingle     x/y -> z
  invSingle     1/x -> z
  mulSingle     x*y -> z
  negSingle     -x  -> z
  sqrtSingle    sqrt(x*y) -> z
  geomeanSingle sqrt(x*y) -> z

Logs, Exponentials, Powers
  expSingle    e^x -> z
  pow2Single   2^x -> z
  pow10Single  10^x-> z
  powSingle    y^x -> z
  lgSingle     log2(x)  -> z
  lnSingle     ln(x)    -> z
  log10Single  log10(x) -> z
  logSingle    log_y(x) -> z

Trig, Hyperbolic, and their Inverses
  acoshSingle   acosh(x) -> z
  acosSingle    acos(x)  -> z
  asinhSingle   asinh(x) -> z
  asinSingle    asin(x)  -> z
  atanhSingle   atanh(x) -> z
  atanSingle    atan(x)  -> z
  coshSingle    cosh(x)  -> z
  cosSingle     cos(x)   -> z
  sinhSingle    sinh(x)  -> z
  sinSingle     sin(x)   -> z
  tanhSingle    tanh(x)  -> z
  tanSingle     tan(x)   -> z

Special-Purpose    Used by various internal functions, or optimized for special cases
  bg2iSingle     1/BG(x,y) -> z   Fewer iterations, but enough to be suitable for ln(x). Kind of a special-purpose routine
  bgiSingle      1/BG(x,y) -> z   More iterations, general-purpose, needed for the inverse trig and hyperbolics
  div255Single   x/255 -> z
  div85Single    x/85  -> z
  div51Single    x/51  -> z
  div17Single    x/17  -> z
  div15Single    x/15  -> z
  div5Single     x/5   -> z
  div3Single     x/3   -> z
  mul10Single    x*10  -> z
  mulSingle_p375         x*0.375  -> z      Used in bg2iSingle.  x*(3/8)
  mulSingle_p34375       x*0.34375-> z      Used in bgiSingle.   x*(11/32)
  mulSingle_p041015625   x*0.041015625-> z  Used in bgiSingle.   x*(21/512)

Miscellaneous and Utility
  randSingle    rand   -> z
  single2str    str(x) -> z           Convert a single to a null-terminated string, with formatting
  single2TI     tifloat(x) -> z       Converts a single to a TI-float. Useful for interacting with the TI-OS
  ti2single     single(tifloat x)->z  Converts a TI-float to a single. Useful for interacting with the TI-OS
  single2char   Honestly, I forgot what it does, but I use it in some string routines. probably converts to a uint8
  pushpop       pushes the main registers to the stack and sets up a routine so that when your code exits, it restores registers. Replaces manually surrounding code with push...pop

Pages: 1 ... 15 16 [17] 18 19 ... 317