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 - Runer112

Pages: 1 ... 10 11 [12] 13 14 ... 153
166
The Axe Parser Project / Re: Image scaling
« on: April 29, 2015, 11:16:59 pm »
To clarify... just downscaling? Because the existing Axiom only supports downscaling, not upscaling.

If that's the case, I could perhaps give modifying the Axiom a try tomorrow.

167
The Axe Parser Project / Re: Image scaling
« on: April 29, 2015, 11:05:41 pm »
Realistically, that would be nearly impossible. So unless you're planning on learning z80 assembly, you'd probably need to recruit someone to produce the code for you. If you do in fact only need downscaling in one direction, it doesn't sound like it would be a huge undertaking, as one would just need to cut out the downscaling logic for the other direction from the existing scaled sprite Axiom. Or, it could be generalized to support separate horizontal and vertical scaling factors, and you'd just use a factor of 1.0 for one of them.

168
The Axe Parser Project / Re: 84+ce AXE
« on: April 29, 2015, 10:56:32 pm »
Despite the similar name, the 84+CE is wildly different from the monochrome 83+/84+ calculators. Not only would many of the standard library commands need to be redesigned, but the compiler itself would need of lots modifications, if not a rewrite.

I've had ideas of doing such a thing, but it's a massive undertaking. It took over 5 years for Axe to get where it is today. So at least for the near future, the answer is: no, Axe won't run on the 84+CE.

169
Axe / Re: Axe Random Numbers
« on: April 29, 2015, 09:29:00 pm »
Yep, years of experience. Looking at my post history, I've been using Axe for just over 5 years now. And when I started, I also asked a bunch of questions. So you're on a good track. :)

By the way, if you want to ask somewhat simple questions like these in the future (which are totally fine; good, even), I'd recommend asking in the Axe Q&A thread instead of making a topic for each one. Having one thread concentrated with questions and answers is a lot nicer than a bunch of individual topics that die off within a few posts. You can even just browse around the thread as a kind of grab-bag Axe documentation that covers practical information and techniques that may not be documented elsewhere.

170
Axe / Re: Axe Random Numbers
« on: April 29, 2015, 07:55:50 pm »
Axe really could use a command to generate an integer in a specified range. I think that's been on the to-do list for a long time, but getting it to work in an optimal fashion is a bit tricky. So it remains unimplemented...

Anyways, you can still generate a random integer in a certain range with rand. And you might kick yourself when you hear that, although the necessary information is a bit fractured, you can glean this technique from the Documentation.pdf file:
  • Page 13: This code block uses rand^88 and rand^54 to generate random X and Y coordinates, respectively. The sidebar mentions that "the easiest way to get random numbers is to take the modulus with X to get a random number between 0 and X-1." So the first snippet generates a random integer between 0 and 88-1=87, and the second generates a random integer between 0 and 54-1=53.
  • Page 18: The last code block uses rand^512-256 to generate a X random velocity. By following up the modulo operation with an addition/subtraction, this generates a random integer between 0-256=-256 and 512-1-256=255. In the general case: rand^A+B generates a random integer between B and A+B-1.

171
The Axe Parser Project / Re: Image scaling
« on: April 29, 2015, 05:03:14 pm »
I believe such a routine has never been made. It may be possible to modify the existing scaled sprite Axiom to do that, though, especially if all you need is horizontal downscaling.

172
Axe / Re: Displaying Variables
« on: April 28, 2015, 09:30:06 pm »
If you're just starting with Axe, I'd highly recommend reading the included Documentation.pdf file (also available online here). Although it's a bit outdated and doesn't cover more advanced commands and techniques, it can provide a good base understanding of the language.

This happens to include the answer to your problem on page 9, which explains that you have to append the ▶Dec token to a value to display it as a number. For your example, you'd want to use Text(0,0,A▶Dec). And the next page explains when and how to use the display commands without the ▶Dec modifier, which may give you a rough understanding of where the garbage you saw is coming from.

I'd also highly suggest perusing through the included Commands.html file (also available online here) once you feel you have a working understanding of the language basics. Although it doesn't explain things as fully as the documentation does or provide examples, it is kept completely up to date and briefly documents every command available in Axe.

173
TI Z80 / Re: [AXE LIBRARY] GrayLib: (nearly) perfect grayscale
« on: April 24, 2015, 08:45:31 am »
Ok thanks. But by "stip out" i litraly ment take all the Asm() opcodes out and insert them into my program.  :P

I'm not sure why you'd want to try to manually extract code from the library. It seems more difficult to manage than just including the library with the desired settings. Even the absolute minimum required to make the library work requires code from at least half a dozen different places in the library.

Ps: why cant you just make a small PDF for this, as i think it will be the easiest option for everybody.

I'm not great at making fancy documentation... But I guess I could at least pull out all the definitions and their comments into a separate file to be able to see every setting and routine available without code cluttering it up.

174
Axe / Re: Axe Q&A
« on: April 20, 2015, 04:53:18 pm »
That looks like a snippet intended for use by a BASIC program. In Axe, the snippet becomes much simpler, as it's just the system call with no wrapper logic needed: Asm(EFE542).

175
TI Z80 / Re: [AXE LIBRARY] GrayLib: (nearly) perfect grayscale
« on: April 20, 2015, 04:45:05 pm »
I have several things:
1) Can you replace all the lower case letters with uppercase ones in the commented version? they take up a lot of MEM. (lowercase letters are two bytes right?)

If you're trying to read and understand GrayLib in the calculator editor, you're probably going to have a bad time. It's a huge library that doesn't display well on a tiny screen, so navigating around in on a calculator isn't fun. Consider the lowercase letters taking up extra space a deterrent against trying to learn the library on-calc. :P

On a computer, you can also open multiple programs at once. Doing something like opening an example program and GrayLib together and looking at how they interact is probably the best way to get a feel for how to use the library. And the examples cover basically all the included commands and ramp up in difficulty, from simply invoking the built-in tuner, to screensaver-like bouncing text, to a very faithful clone of the first-generation Pokemon games' overworld movement engine.

2)If i don't know weather my user is using a ti83 or a ti84 then how do i compile? Should i just fallback upon the ti83 method? Is there a way for greylib, when run, to automatically choose the correct setting?

As Sorunome said, if both the 83+ and 84+ grayscale methods are included, the library will automatically choose the appropriate one based on which calculator the program is run on.


3) Can i strip out every thing i don't need to just leave the timer/inturupt stuff.

What Sorunome said about unused things being stripped out during compilation isn't exactly true. Axe doesn't have "real" functions, so the compiler doesn't have enough information to be able to remove unused code. But it does have preprocessor conditionals that allow the programmer to specify simple logic for whether or not to compile sections of the program. That's why there are so many options starting with GI, which stands for GrayLib Include. You'll notice that only the most essential two are included by default: saving/loading settings in an appvar across runs and "allocating" the four buffers. Even these can be disabled if you desire, but you'd need to implement your own logic to replace them.

4)Is there any advantage of using the Crystal timer (84 method) verses just using interrupts?

As Sorunome said, the crystal timer method provides much finer tuning. This makes it possible to minimize tearing artifacts, usually seen as a rolling horizontal line of garbled pixel values, much more. It may also provide more consistent tuning across different levels of battery charge.

5)Doest using the Crystal timer (84 method) mess with the cpu speed?

The CPU speed is unchanged by GrayLib. However, as Sorunome mentioned, the effective CPU speed of your code is greatly lessened because lots of CPU time is used by GrayLib. Your code probably only gets access to about 25% of the CPU time, which is unfortunate, but unavoidable. At least, it is on the 83+; I've been working on something to free up more CPU time with the crystal timer method, so stay tuned for that. :)

AND LAST BUT NOT LEAST:
Your library can render text with all shades of back/fore ground. And yet when i asked about the ti84 and the location of the sprite sheets, you "At least, I hope that information's correct. I haven't tried any of this, but this would be my best guess as to doing it correctly." (https://www.omnimaga.org/general-calculator-help/where-does-ti-(84)-os-store-the-sprite-sheets-for-chars/msg399940/#msg399940). So how exactly do you render text? ("performs magic" is not a good enoufe explanation for me   ;) )

The "magic" is a lot of assembly to somewhat efficiently convert the character bitmap (not an Axe bitmap!) produced by B_CALL(_LoadPattern) into sprite data that is then displayed with Axe's Pt-Mask(X,Y,PIC)ʳ (masked 8x8 sprite) command. This is done for each buffer, setting blank and invert flags (explained in a moment) as necessary to get the correct values for that buffer. Included in this "magic" is logic to blank out the character bitmap if the blank flag is set and logic to invert the character bitmap if the invert flag is set. Combinations of these two flags give the four possible combinations of black-on-white, white-on-white, white-on-black, and black-on-black.

176
Axe / Re: Why does axe greyscale look so bad at very high speeds?
« on: April 18, 2015, 06:17:02 pm »
I'm going to assume that by "high speed" you mean updating the screen with very little time between updates. In this case, it's possible that you're updating faster than the screen's refresh rate, which is about 60Hz. So, for example, if you're sending frames at 90Hz, you'll send 3 frames in the time that the display can only show 2. This likely means that one of those frames will be skipped (more realistically, parts of different frames get skipped, but the outcome is similar). Grayscale relies on having pixels on and off for the correct ratio of time, so the screen skipping some updates results in the ratio being wrong and pixels having the wrong shades.

I believe the "diagonal line thing" you're seeing is another artifact of the updates not being perfectly in sync with the screen's refresh rate and frames being mixed. You'd still have frames mixing if you just alternated sending complete buffers. But combining the buffers into a dithered image makes each individual frame appear much closer to the desired shades, to the degree that your eyes can't really tell when the refresh rate is fast enough. If you simply alternated buffers, a flashing effect would be much more apparently because your eyes can pick out large blocks of pixels alternating between black and white. And I think the screen has problems with it.

As Sorunome suggested, if you're looking for high-quality grayscale, I would definitely recommend trying GrayLib. I realize it can be a bit daunting to get into, but if you have any questions, just ask and I (or someone else) should be happy to answer.

177
Axe / Re: HELP - Maximum Optimization
« on: April 13, 2015, 03:42:42 pm »
Objective:
Reduce file size, increase program speed, and general optimizations.

I love optimization!

Does space organizing your program cost space?

Nope (although in the source file, of course). The project's original name of "Axe Parser" is a pretty bad misnomer, since it suggests that Axe is an interpreted langauge, but it's actually compiled.

How can I avoid repetitively storing empty sprites without losing the tile-maps sprite synchronization?

Instead of having one tileset that's a mix of tiles with different color depths/palettes, I'd suggest segregating the tiles into different tilesets based on the colors used. For tilemap purposes, continue to treat these tilesets as if they were one, so tile values for eeach subsequent tileset continue to count up from where the last tileset left off.

As an example, say you have a white-black tileset of size x, followed by a white-gray tileset of size y, followed by a white-gray-black tileset of size z. Then a tile index t:
  • Between 0 and x-1 corresponds to the white-black tile t
  • Between x and x+y-1 corresponds to the white-gray tile t-x
  • Between x+y and x+y+z-1 corresponds to the white-gray-black tile t-x-y

Is it possible to shrink down my map size while maintaining the same tile map?

Map compression is absolutely possible, and definitely suggested once you have a lot of map data. Many programs store their maps in a compressed form and, when that map is entered, decompress it to somewhere in RAM for quick accesses.

Your example shows a form of run-length encoding, which is a basic but fair map compression algorithm. However, Axe doesn't have any built-in compression routines, so you have to supply one. Perhaps you'd be interested in Iambian's Pucrunch decompression Axiom? It implements one of the better general data compression algorithms, in a similar class to the kind of compression used for .zip files.



Regarding specific optimizations to your program, I may come back and look for some later. But I'd like to at least post my general answers first.

178
Axe / Re: Axe Q&A
« on: April 13, 2015, 02:48:11 pm »
I recently made a mega-post of every good Axe coding tool I know about. Here's an excerpt that should interest you:

IDE
  • SourceCoder : Browser-based TI-BASIC editor and image converter. Directly links with jsTIfied.
  • TokenIDE ★ Windows-based TI-BASIC editor with an Axe token set and sprite/image editor. Works on Linux with Mono.
  • IES : Browser-based TI-BASIC editor with an Axe token set and simple picture editor.

179
Axe / Re: HELP - Tilemap fill black outside the map
« on: April 11, 2015, 04:34:36 pm »
Sure, I can break down the code a bit. Since only the tile lookup logic changed, I'm just going to focus on that. Also, I realized I could make the logic a bit nicer, so I'm going to explain this slightly different version:

Code: [Select]
Pt-On(A*8,B*8,((B+Y→D<32?A+X→C<32)?{D*32+C+GDB0},BLACK_TILE_INDEX)*8→C+Pic0)
Pt-On(A*8,B*8,C+Pic1)ʳ

((B+Y→D<32If the Y-coordinate (saved for later in D) is between 0 and 31 (this is an unsigned comparison, so negative coordinates are interpreted as really large positive coordinates and are not less than 32)
?And (a ternary operator with only one following clause is like a short-circuit AND operator)
A+X→C<32)If the X-coordinate (saved for later in C) is between 0 and 31
?Then:
{D*32+C+GDB0}Look up the tile index at (C, D) in the map GDB0
,Else:
BLACK_TILE_INDEX)Use the black tile index
*8→CCalculate the pointer offset of this tile index (saved for later in C)
+Pic0Add the pointer offset to the tileset primary data pointer to obtain a pointer to the tile's primary sprite
... In the next sprite command...
C+Pic1Add the pointer offset to the tileset secondary data pointer to obtain a pointer to the tile's secondary sprite

180
Axe / Re: HELP - Tilemap fill black outside the map
« on: April 11, 2015, 11:55:18 am »
There are two solutions to this problem:

  • Add enough black tiles around the edges of your tilemap so that the camera can never move far enough to go past them. This only costs as much extra time as it takes to perform the larger Y-coordinate multiplication to look up a tile, but does cost a fair amount of extra map space, so might not be ideal.
  • Check if a tile to render's coordinates are outside of the map, and if so, produce a black tile instead. This only costs a small amount of time and requires no extra map data, so is probably the desired solution. Your map tile drawing code should then look something like the following (untested!), which should look up the tile index normally if both coordinates are between 0 and 31 or return the black tile index if not:
Code: [Select]
Pt-On(A*8,B*8,((B+Y→D<32?A+X→C<32)?{D*32+C+GDB0}*8,BLACK_TILE_INDEX)+Pic0→C)
Pt-On(A*8,B*8,C-Pic0+Pic1)ʳ

Unrelated to your question, but there's also a good potential for optimization (and a bit of a bug) with how you display each frame and prepare the next. The optimization is that DispGraphʳ : ClrDraw : ClrDrawʳ can all be done in one command with DispGraphClrDrawʳ. And the bug is that the DispGraph without the ʳ shouldn't be there, as you have two display commands fighting between monochrome and grayscale graphics.

Pages: 1 ... 10 11 [12] 13 14 ... 153