Hmm, WriteAByte appears to destroy OP1, can someone clarify on why this is? I'd rather it not, personally.
It's likely that all of these routines overwrite some RAM, because you can't execute code from flash and write to flash at the same time.
Does anyone know how these routines work? It may just be a good idea to write my own, seeing as I don't know what TI may do to my precious RAM while running these routines.
calc84maniac wrote:
It's likely that all of these routines overwrite some RAM, because you can't execute code from flash and write to flash at the same time.
Yeah, it would have to store at least a page-switching chunk of code in RAM. SirCmpwn, did you take a look at the WikiTI pages that I linked you to earlier in this topic.
I did, but those explain the calls, not how they do it. And looking through the source for BAOS, it uses port 0 to "reset the chip" and port 6 to do all the work. It's quite confusing.

This asks for the sector to erase in A:


Code:
    LD A, $F0 ; RESET the chip
    OUT (0), A
    LD A, 2 ; <AA>
    OUT (6), A
    LD A, $AA
    LD ($6AAA), A
    LD A, 1 ; <55>
    OUT (6), A
    LD A, $55
    LD ($5555), A
    LD A, 2 ; [80]
    OUT (6), A
    LD A, $80
    LD ($6AAA), A     ; \
    LD A, $AA ; <AA>  ; | WTF?
    LD ($6AAA), A     ; /
    LD A, 1 ; <55>
    OUT (6), A
    LD A, $55
    LD ($5555), A
    LD A, B ; (30)
    OUT (6), A
    LD A, $30
    LD ($4000), A
    LD A, $FF ; Check for finished
    LD DE, $4000
That's odd, taking a look at WikiTI's documentation on Port 00, there's no mention of it having a secondary function of controlling the flash chip with its high nibble, and its Port 06 documentation only mentions that as the page-swapping port, which of course we already knew.
Yeah, I took a look at that. I don't just blindly post without doing my research Razz
And the redundant write to 6AAA is kinda weird, too.
SirCmpwn wrote:
Yeah, I took a look at that. I don't just blindly post without doing my research Razz
And the redundant write to 6AAA is kinda weird, too.
I'd again invoke BrandonW's assistance on the matter, but he seems to have disappeared off the face of IRC. :O That is indeed weird; that routine makes almost no sense to me.
I think the only part that makes sense to me is the part that checks to see if the page has been erased.
SirCmpwn wrote:
I think the only part that makes sense to me is the part that checks to see if the page has been erased.
Yeah, I am as confused as you, but since BrandonW has magically reappeared on #cemetech, hopefully all shall be elucidated soon.
Apparently he's working on hacking the PS3 via a calculator, so it may be a while.
SirCmpwn wrote:
Apparently he's working on hacking the PS3 via a calculator, so it may be a while.
Aye, that's what I've been hearing, and he's been sporadically disappearing. I get the impression that he has zero time because of work (and possibly his book too).
If you want to write the routines yourself, there's the flash chip documentation, download link here: http://www.alldatasheet.com/datasheet-pdf/pdf/61850/FUJITSU/MBM29LV160B.html
Mainly if you don't want to use TI's routines. Also, again, you only need to page in the right flash page and write the appropriate commands as described in the datasheet. Note that 'fast mode' will not work on the TI-83+'s flash chip.
Good call on that, calcdude. That actually sounds like a pretty fun project, if only I had the time for it. Sad
x.x My brain just melted a little.
Anyone want to just tell me what I have to do to write/erase flash?
SirCmpwn wrote:
x.x My brain just melted a little.
Anyone want to just tell me what I have to do to write/erase flash?


Copy what the boot code does and study the previously-linked-to Flash documentation.
BrandonW wrote:
SirCmpwn wrote:
x.x My brain just melted a little.
Anyone want to just tell me what I have to do to write/erase flash?


Copy what the boot code does and study the previously-linked-to Flash documentation.
This. Don't ask for the easy way out before you've even tried to do the hard way.
So this is what I have so far on erasing a page:
The documentation on Flash shows the following "command sequence" to erase:
555H/AAH
2AAH/55H
555H/80H
555H/AAH
2AAH/55H
555H/10H

I'm assuming that the H means that it represents hex.
In the comments for the BAOS routine, all of the right hand values are mentioned as they are loaded into various places, excepting the last entry, 555H/10H. This appears to be the general method for performing one of the entries, assuming that each entry is XXXH\YYH:


Code:
ld A, ? ; This value is either a 2 or a 1 every time
out (6), A
ld a, YYH ; Loads the second value in the entry
ld (????), a ; This is either 6AAAh or 5555h


This table shows the different values in the documentation's table vs the BAOS code (each ?? in the above code):
XXXH/YYH | value output to port 6/address YYH is loaded into
555H/AAH | 2/6AAA
2AAH/55H | 1/5555
555H/80H | 2/6AAA
555H/AAH | none/6AAA
2AAH/55H | 1/5555
555H/10H | n/a
After the last operation in this table, it outputs the sector that we are erasing to 6. Any ideas?

Also, what is the difference between a page and a sector?
pages 17 and 18 are the relevant ones, along with 22 and 45 to 52. Also, beware of trying to set a 0 to a 1
Small example routine that erases the sector corresponding to the paged in page:

Code:
ld hl,$4AAA
ld (hl),$AA
push hl
ld hl,$4555
ld (hl),$55
ex (sp),hl
ld (hl),$80
ld (hl),$AA
pop hl
ld (hl),$55
ld (hl),$30 ;Actual address here doesn't matter as long as it's on the right sector
erase_loop:
call data_poll
jr z,fail
ld a,(hl)
cp $FF
jr nz,erase_loop
ret ;Success!
fail:
;Erase failed. I hope you never get here
ret ;Hm...

data_poll: ;This'll have to be changed to work with programming
ld a,(hl)
bit 7,a
ret nz ;Success!
bit 5,a
jr z,data_poll
bit 7,(hl)
ret ;zero flag set if failed

This is untested but should work
Edit: A sector is the minimum erasure unit. Also, they are different because you're trying to use the word-style commands. Use the byte ones, like the code above Smile
Oh, so you write the values to the addresses in question? And you add the offset of the swapped in bank?
And is a sector equal to one page?
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 2 of 5
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement