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

Pages: 1 ... 5 6 [7] 8 9 ... 20
91
Well, yeah, that has to be our primary focus; in order to be useful for debugging, it needs to be as faithful as possible to the real hardware.  But, if people wanted to have a virtual calculator with 2 MB of RAM and a 100 MHz CPU, that would be easy enough to do, and maybe useful for some purposes.

Now this is a curosity question, since writing to flash is dangerous...does the routine work on all operating systems?
If you're talking about Brandon's write-to-user-Flash routine - yes, I think it works on all current operating systems.  Whether it'll work on future OSes, of course, is anybody's guess, but one of the things that bothers me about Brandon's routines is that they don't do any sanity checks to see whether the OS will work or not; they have no failure mode except to crash.

92
Yeah, but I mean maybe you could make an unused port return a certain value or something? That could be useful in some situations. Heck, maybe you could make those ports do things like have the LCD mapped to a spot in memory and then people could make emulator only games XD
I suppose we could do something like that.  With the ability for the user to disable it if programmers abuse the feature.

The idea of emulator-only games seems a little silly, but maybe if folks in the community wanted to get together and produce a new, fictitious hardware design (Omni-84 Plus Iridium Edition), we could support that as an alternative to the "real" calculator models.

93
Ooh, that actually makes me wonder if emulators should have a way for some programs to detect if it is an emulator... That way if it isn't, you could make your programs not execute certain code :D
Seems like that would be a bug in the emulator, don't you think? :P

(There are various seldom-used aspects of the hardware that most emulators don't properly handle; you could probably find one of those to exploit.  But don't be surprised if later emulators fix those holes.  One of my personal goals for TilEm 2 is to eliminate as many of them as possible.)

94
Ok, so this is what I remember reading. It was not a DMCA, but it was pretty close. Of course I don't know the whole story (I was 9 when that was posted), so you'll have to get someone older to explain what really happened.

And since I had to go hand copy the link from my old computer, here is the topic that I've had favorited for over a year from which I figured out how to unlock flash. It's by floppusMaximus and you can see on page 2 how cautious everyone is getting. It's pretty vague on the details so it took me quite a while to figure out how to do it...
Haha, I remember those discussions (good old thread #240...)

I did eventually find a simpler and more robust version of the technique I was talking about in that second thread, but I don't know if I ever released that; it's SE-only, of course.  What I would currently recommend using is the technique used by DuckSign, which is based on Brandon's well-known exploit, but much more robust.

But...

It is dangerous to write to Flash.  It's not a matter to be approached lightly.  The Flash protection is sometimes annoying, but it's actually a very nice feature, because it means that you can run all kinds of assembly programs, with nearly unrestricted access to the hardware, without worrying that your data could be corrupted (or worse, your calculator made unbootable.)  Every time somebody writes a program to work around that protection - no matter how skillful or how careful the programmer - that creates new risks, makes users less safe.  If you can do what you want to do without writing to Flash, or only using the supported API - and, most of the time, you can! - we are all better off.  I'm not going to tell people what they can and can't do, but these are things you really need to consider before releasing such a program.

95
Axe / Re: No Key Pressed
« on: April 20, 2011, 11:20:36 pm »
Is there an Axe command to halt the CPU?  It's a good idea to do so while you're waiting for user input.

96
ASM / Re: Shifting program locations
« on: April 20, 2011, 11:09:02 pm »
There isn't a system routine to do that.  There are many third-party routines to do so; that's exactly what shells do. :)

Probably the most popular approach (taken by Ion and many others since) is to copy a block of up to 768 bytes from the start of the program to a temporary buffer (such as saveSScreen), then DelMem those bytes, InsertMem at the desired location, and copy the data from the temporary buffer to the new location.  Then, if the program was larger than 768 bytes, repeat as needed.

Another technique is the one used by Venus (which I belive Kalimero invented); what he does is to repeatedly swap blocks of memory, each time smaller than the last.  It's a beautiful algorithm, and a marvelously simple bit of code, and it's also faster in most cases than the Ion algorithm.  It will leave you scratching your head for a while trying to understand why the code works. :)  And to use it, you also need to know about a couple of undocumented system routines (DelVar3D and DelVar3DC), which you can use to fix up the VAT after moving programs around.

97
ASM / Re: Keeping the Crystal Timers going
« on: April 20, 2011, 10:46:16 pm »
If you wanted to use the auto-repeat mode as I've described (i.e., timer keeps running and fires every N ticks, regardless of what the CPU is doing), then you'd want to:
- select the desired frequency (ticks per second) using port 30
- set port 31 to 3
- set port 32 to the desired number of ticks per interrupt period

Then, each time a timer interrupt occurs, you'd write 3 to port 31 again.  You wouldn't touch ports 30 or 32 after that, except to turn the timer off when your program finishes, and perhaps you might want to read port 32 to determine precisely how much time has elapsed.  If port 31 bit 2 ever gets set, you're probably doing something wrong.

If you wanted to use the non-auto-repeat mode (i.e., timer fires N ticks after the previous interrupt was acknowledged), then you'd want to:
- select the desired frequency using port 30
- set port 31 to 2
- set port 32 to the desired number of ticks until the next interrupt

and do that again each time an interrupt occurs (though you could omit the re-initialization of port 30 if you like.)

I think that's basically all there is to it.  There's also some weirdness (seemingly a hardware bug) where the programmable timers won't generate interrupts if you turn off regular timer interrupts (port 3 bit 1) and the CPU is halted.  Don't do both of those things at once, and you should be fine.

98
ASM / Re: Keeping the Crystal Timers going
« on: April 20, 2011, 09:23:36 pm »
Well, in general, you can't have an event timed more precisely than one instruction (i.e., 4 to 23 clock cycles), except by writing code to explicitly delay for that long.  Interrupts can't "fire" in the middle of an instruction, only between one instruction and the next.

If you use the auto-repeating mode, though, the timer keeps ticking after it has expired, so you can use it for accurate long-term timekeeping.  (I.e., you'll still be off by 4 to 23 clock cycles each time, but the errors won't accumulate.)  If you want to do this, you do have to be sure that you acknowledge the interrupt (by writing a value to port 31/34/37) every time the timer expires, and before it underflows.  Is that what you were originally asking about, Hot_Dog?

In answer to Runer112's implied question about whether you can count up to 256: no, the timers don't really work right if you set the initial value to zero.  But if you want an interrupt every 256 clock cycles, you can switch to (say) the CPU/2 mode and set the initial value to 128.

99
ASM / Re: Edit buffer questions
« on: April 14, 2011, 11:45:10 pm »
There are two independent "layers" here, which are often confusingly lumped together.

First, we have the routines EditProg and CloseProg.  These routines are documented in the SDK guide.  EditProg allocates all free RAM into a given variable; CloseProg reverses the effect.  In order for this to work, the iMathPtrs are used to remember which variable is "open" for editing.  You shouldn't ever modify iMathPtr1, iMathPtr3, or iMathPtr4; you'll presumably need to modify iMathPtr2 in order to change the size of the variable.

Second, we have the "edit buffer" layer.  An edit buffer is a region of RAM that stores text for the user to edit.  The buffer might be allocated using EditProg (which is what the OS often does, e.g. when editing a program or equation), or it might be a static buffer that you create in safe RAM somewhere.  Or it might be allocated in some other way; it's up to you.  The edit buffer routines have nothing to do with the iMathPtrs; they use only the pointers (editTop), (editCursor), (editTail), and (editBtm).

An edit buffer consists of three parts: "head", "gap", and "tail".  The head contains the tokens that come before the insertion point, the tail contains the tokens that come after the insertion point, and the gap contains all of the free space.  These three areas are defined by the four pointers I mentioned above:
Code: [Select]
   tokens          free space            more tokens
|***************|.....................|*****************|
^               ^                     ^                 ^
(editTop)       (editCursor)          (editTail)        (editBtm)
This arrangement means that all of the usual editing operations take constant time.  Moving the insertion point "right", for instance, means copying a byte from (editTail) to (editCursor), then incrementing both pointers.  Inserting a token means writing it to (editCursor) and incrementing (editCursor).  Deleting a token means simply incrementing (editTail).  (Of course, if you're dealing with BASIC tokens, you also need to consider the possibility of 2-byte tokens, but you get the idea.)  On the other hand, it's not random access: you can't just start editing at an arbitrary place in the buffer; you first need to "move" the insertion point to that location.

You can see from the above diagram that:
- (editTop) ≤ (editCursor) ≤ (editTail) ≤ (editBtm); all of the system routines will assume this is true, and will most likely crash if it's violated.
- If (editCursor) = (editTop), the insertion point is at the "beginning" of the buffer.
- If (editTail) = (editBtm), the insertion point is at the "end" of the buffer.
- If (editCursor) = (editTail), the buffer is "full".

100
The Axe Parser Project / Re: ASM code and program editoring
« on: April 08, 2011, 12:00:43 am »
You're right, that does seem to be the case.  What would you do instead?

101
ASM / Re: Help with signing a flash app
« on: April 07, 2011, 11:49:20 pm »
Weird.  Have you tried installing any official apps from TI?

Oh, and maybe this is a silly question, but did you edit the application header to use the correct key ID?  I've never worked with TI's 68k development tools, but they presumably default to using the 14F03 key (a special key that's only accepted by their emulator and isn't used on any real calculators.)

I was wondering about that. I'm guessing that the 0109 key is like the 010A key in terms of usefulness and popularity. Speaking of which, why isn't USB8X signed with it?
Maybe because usb8x was last updated in 2007?  :P

102
TI Z80 / Re: zStart - an app that runs on ram clears
« on: April 07, 2011, 11:46:57 pm »
I've only had a brief look at the code, but it looks like when the hook is called in fracDrawLFont mode, you're trying to shift the font bitmap yourself.  Don't do that; you're supposed to return the normal bitmap to the OS, and the OS will shift it left for you.

Also, it looks like you're using OP1, which is a recipe for disaster if the hook is active while assembly programs are running.

103
ASM / Re: Help with signing a flash app
« on: April 07, 2011, 11:23:38 pm »
Maybe try using the 0103 key instead?  Unless you're doing stuff that specifically requires the Titanium hardware or OS 3.x, older 89 users will thank you. :)  In any case, I don't think I've ever seen any apps in the wild that used the 0109 key.

104
The Axe Parser Project / Re: ASM code and program editoring
« on: April 05, 2011, 09:22:02 pm »
I don't know how the Axe parser does it.  But what I would do is this:

- set parseVar to the name of the program, begPC and endPC to the starting and ending addresses, and curPC to the location of the error - just as if you're really executing the program
- set errNo to a valid error code greater than 128, indicating an editable error
- reset the stacks (B_CALL ResetStacks / ld sp, (onSP))
- load the cxError context (ld a, cxError / B_CALL NewContext0)
- and send a k2 keycode (ld a, k2 / B_JUMP MonForceKey)

This can only be done by a Flash app.

From an Asm( program, it's simpler: I would simply set up parseVar, begPC, curPC, and endPC, as before, then throw the desired error, and let the user choose whether to Quit or Goto it.  (If the built-in error messages aren't enough for you, you can use AppErr1/AppErr2 to display a custom error message.)  I don't think it would be worth trying to do anything fancier, and anything fancier would be likely to break in nasty ways.

Shell programs absolutely cannot do this kind of thing ever.

Edit: Oops, I made a couple of mistakes there.  You want an error code with bit 7 set, not bit 0, and it does have to be a valid error code.  And directly sending kGoto doesn't quite work because there's still a popup active.

105
The Axe Parser Project / Re: RabbitSign licensing
« on: April 02, 2011, 06:59:19 pm »
Great.  Thank you!

Pages: 1 ... 5 6 [7] 8 9 ... 20