Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
About
Team
Rules
Stats
Status
Sitemap
Chat
Downloads
Forum
News
Our Projects
Major Community Projects
Recent Posts
Unread Posts
Replies
Tools
SourceCoder3
Other Things...
Omnimaga Radio
TI-83 Plus ASM File Unsquisher
Z80 Conversion Tools
IES TI File Editor
Free RAM areas
Comprehensive Getkeyr table
URL Shortener
Online Axe Tilemap Editor
Help
Contact Us
Change Request
Report Issue/Bug
Team
Articles
Members
View the memberlist
Search For Members
Buddies
Login
Register
Omnimaga
»
Forum
»
Calculator Community
»
TI Calculators
»
ASM
»
[z80] Writing to flash
« previous
next »
Print
Pages: [
1
]
2
Go Down
Author
Topic: [z80] Writing to flash (Read 13909 times)
0 Members and 1 Guest are viewing this topic.
Matrefeytontias
Axe roxxor (kinda)
LV10
31337 u53r (Next: 2000)
Posts: 1982
Rating: +310/-12
Axe roxxor
[z80] Writing to flash
«
on:
March 23, 2013, 06:56:50 am »
Hi guys,
I'm working on a file system for cmdOS, and I want every files to be in archive to allow user programs to use a maximal amount of free RAM. I planned to handle it this way :
A 3-bytes pointer on a VAT at a static address in RAM consisting of a 2-bytes address (low byte then high byte) and a page number.
At the location pointed to by this pointer and in the given flash page, the start of the VAT.
After this location, each and every file whose structure will be discussed later.
The problem is : I don't know how to write to flash. I know how to swap pages using ports 6 and 7, but I also know that you can't just write to the corresponding areas like that.
How can I, say, write a byte to a flash page ?
Note that I don't have any built-in routine for that. I'm NOT using the TI-OS nor any library, and I don't want to. I just want to understand how to do that and then being able to implement it.
«
Last Edit: March 23, 2013, 06:57:52 am by Matrefeytontias
»
Logged
/\ >< [- |_| _\~ [- /?
All of the TI-z80 screenshots that I will post, unless I specifically mention that it's not the case, will run at 6 MHz.
Always
. If you find that unbelievable, you should check the last link of my sig
Nerdiness
Projects :
[Ndless3.1] nKaruga
,
[Axe] Worms (yes !)
,
[Ndless 3.1] F-Zero TrackSpire (dropped)
,
[Ndless 3.1] nSpeedX 3D (paused)
,
[Ndless 3.1] nRayC, an easy-to-use raycasting (3D) engine in C for your Nspire ! (paused)
Proud author of :
[TI-8x] Jetpack 8x+
,
[TI-8x+] Gravity Walls
,
[ASM for Axe] AxeDCS axiom for Axe programmers
,
[TI-8x+] WiredWorks : a SolidWorks on your Ti-83+/84+ !
,
[TI-8x+] Super Crate Box
,
[Axe] IkarugaX, an awesomely challenging danmaku/shoot-them-up for your TI-83+/84+ !
,
[ASM for Axe] AxeJh3D axiom, a very fast 3D ASM library for Axe coders !
If at a certain moment you think that I'm awesome, you can express it by
giving me one more Internet (>^_^)>
Streetwalrus
LV12
Extreme Poster (Next: 5000)
Posts: 3821
Rating: +80/-8
Re: [z80] Writing to flash
«
Reply #1 on:
March 23, 2013, 08:33:24 am »
I think there's some boot code stuff but IDK how to use it. :s
Logged
Hayleia
Programming Absol
Coder Of Tomorrow
LV12
Extreme Poster (Next: 5000)
Posts: 3367
Rating: +393/-7
Re: [z80] Writing to flash
«
Reply #2 on:
March 23, 2013, 08:43:51 am »
Quote from: Matrefeytontias on March 23, 2013, 06:56:50 am
How can I, say, write a byte to a flash page ?
That is not a good idea. The flash can't bear an infinite number of writes. That number is high (10000 or something) so in "normal conditions of use", you don't reach it, but if you plan on writing byte per byte, or even 10 bytes per 10 bytes, as long as you use it often, you have more chance of having a flash wear.
Also, sorry not to actually answer the question (
), I think that you should ask thepenguin or DrDnar or Runer or other people like that about unlocking flash.
Logged
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.
click here to know where you got your last +1s
Lionel Debroux
LV11
Super Veteran (Next: 3000)
Posts: 2135
Rating: +290/-45
Re: [z80] Writing to flash
«
Reply #3 on:
March 23, 2013, 08:48:13 am »
What wears out Flash memories is erasing sectors / blocks / full chip, not writing to sectors / blocks
The OS and boot code contain BCALLs to those effects. They're certainly documented, and besides, the datasheet of the Flash memory chip could enable you finding them more easily.
Logged
Member of the
TI-Chess Team
.
Co-maintainer of
GCC4TI
(
GCC4TI online documentation
),
TILP
and
TIEmu
.
Co-admin of
TI-Planet
.
Matrefeytontias
Axe roxxor (kinda)
LV10
31337 u53r (Next: 2000)
Posts: 1982
Rating: +310/-12
Axe roxxor
Re: [z80] Writing to flash
«
Reply #4 on:
March 23, 2013, 09:18:23 am »
Well, if you can only erase sectors, how can you save datas into them ?
And btw I won't be able to understand a code which does something I don't know anything about.
«
Last Edit: March 23, 2013, 09:18:33 am by Matrefeytontias
»
Logged
/\ >< [- |_| _\~ [- /?
All of the TI-z80 screenshots that I will post, unless I specifically mention that it's not the case, will run at 6 MHz.
Always
. If you find that unbelievable, you should check the last link of my sig
Nerdiness
Projects :
[Ndless3.1] nKaruga
,
[Axe] Worms (yes !)
,
[Ndless 3.1] F-Zero TrackSpire (dropped)
,
[Ndless 3.1] nSpeedX 3D (paused)
,
[Ndless 3.1] nRayC, an easy-to-use raycasting (3D) engine in C for your Nspire ! (paused)
Proud author of :
[TI-8x] Jetpack 8x+
,
[TI-8x+] Gravity Walls
,
[ASM for Axe] AxeDCS axiom for Axe programmers
,
[TI-8x+] WiredWorks : a SolidWorks on your Ti-83+/84+ !
,
[TI-8x+] Super Crate Box
,
[Axe] IkarugaX, an awesomely challenging danmaku/shoot-them-up for your TI-83+/84+ !
,
[ASM for Axe] AxeJh3D axiom, a very fast 3D ASM library for Axe coders !
If at a certain moment you think that I'm awesome, you can express it by
giving me one more Internet (>^_^)>
Xeda112358
they/them
Moderator
LV12
Extreme Poster (Next: 5000)
Posts: 4704
Rating: +719/-6
Calc-u-lator, do doo doo do do do.
Re: [z80] Writing to flash
«
Reply #5 on:
March 23, 2013, 09:30:23 am »
In case anybody missed it, Matrefeytontias is working on building an OS, so he won't have some tools (but it should be easier). I
think
this page might be useful.
Logged
My pastebin
|
Pokémon Amber
|
Grammer Programming Language
|
BatLib Library
|
Jade Simulator
|
Zeda's Hex Opcodes
|
FileSyst Library
|
CopyProg
|
TPROG
|
GroupRead
|
Lbl Read/Write
|
Z80 Floating Point Routines
(
z80float on GitHub
)|
Z80 Optimized Routines Repository
Matrefeytontias
Axe roxxor (kinda)
LV10
31337 u53r (Next: 2000)
Posts: 1982
Rating: +310/-12
Axe roxxor
Re: [z80] Writing to flash
«
Reply #6 on:
March 23, 2013, 09:32:39 am »
How could I have missed that, I read every page of Ti-83+:OS on WikiTi
(well, I thought)
Thanks a lot, that'll help me
Logged
/\ >< [- |_| _\~ [- /?
All of the TI-z80 screenshots that I will post, unless I specifically mention that it's not the case, will run at 6 MHz.
Always
. If you find that unbelievable, you should check the last link of my sig
Nerdiness
Projects :
[Ndless3.1] nKaruga
,
[Axe] Worms (yes !)
,
[Ndless 3.1] F-Zero TrackSpire (dropped)
,
[Ndless 3.1] nSpeedX 3D (paused)
,
[Ndless 3.1] nRayC, an easy-to-use raycasting (3D) engine in C for your Nspire ! (paused)
Proud author of :
[TI-8x] Jetpack 8x+
,
[TI-8x+] Gravity Walls
,
[ASM for Axe] AxeDCS axiom for Axe programmers
,
[TI-8x+] WiredWorks : a SolidWorks on your Ti-83+/84+ !
,
[TI-8x+] Super Crate Box
,
[Axe] IkarugaX, an awesomely challenging danmaku/shoot-them-up for your TI-83+/84+ !
,
[ASM for Axe] AxeJh3D axiom, a very fast 3D ASM library for Axe coders !
If at a certain moment you think that I'm awesome, you can express it by
giving me one more Internet (>^_^)>
DJ Omnimaga
Clacualters are teh gr33t
CoT Emeritus
LV15
Omnimagician (Next: --)
Posts: 55943
Rating: +3154/-232
CodeWalrus founder & retired Omnimaga founder
Re: [z80] Writing to flash
«
Reply #7 on:
March 23, 2013, 09:34:34 am »
Hmm if you write to flash, be very careful to not accidentally write to the wrong page. If you accidentally erase the certificate, you're screwed.
Logged
Lionel Debroux
LV11
Super Veteran (Next: 3000)
Posts: 2135
Rating: +290/-45
Re: [z80] Writing to flash
«
Reply #8 on:
March 23, 2013, 09:37:09 am »
Yup, the raw commands are in the datasheet, which is why I suggested him to read the datasheet and then find the corresponding routines in TI's boot code
But if it's documented in WikiTI, even better.
Logged
Member of the
TI-Chess Team
.
Co-maintainer of
GCC4TI
(
GCC4TI online documentation
),
TILP
and
TIEmu
.
Co-admin of
TI-Planet
.
Matrefeytontias
Axe roxxor (kinda)
LV10
31337 u53r (Next: 2000)
Posts: 1982
Rating: +310/-12
Axe roxxor
Re: [z80] Writing to flash
«
Reply #9 on:
March 23, 2013, 09:47:12 am »
I'll go with the page Xeda112358 gave me, and then I'll see if I can do something with it
By the way, Hayleia said that writing a byte to flash wasn't a good practice, but the said page gives an entire writeFlashByte routine .. what are your thoughts on that ?
Logged
/\ >< [- |_| _\~ [- /?
All of the TI-z80 screenshots that I will post, unless I specifically mention that it's not the case, will run at 6 MHz.
Always
. If you find that unbelievable, you should check the last link of my sig
Nerdiness
Projects :
[Ndless3.1] nKaruga
,
[Axe] Worms (yes !)
,
[Ndless 3.1] F-Zero TrackSpire (dropped)
,
[Ndless 3.1] nSpeedX 3D (paused)
,
[Ndless 3.1] nRayC, an easy-to-use raycasting (3D) engine in C for your Nspire ! (paused)
Proud author of :
[TI-8x] Jetpack 8x+
,
[TI-8x+] Gravity Walls
,
[ASM for Axe] AxeDCS axiom for Axe programmers
,
[TI-8x+] WiredWorks : a SolidWorks on your Ti-83+/84+ !
,
[TI-8x+] Super Crate Box
,
[Axe] IkarugaX, an awesomely challenging danmaku/shoot-them-up for your TI-83+/84+ !
,
[ASM for Axe] AxeJh3D axiom, a very fast 3D ASM library for Axe coders !
If at a certain moment you think that I'm awesome, you can express it by
giving me one more Internet (>^_^)>
Lionel Debroux
LV11
Super Veteran (Next: 3000)
Posts: 2135
Rating: +290/-45
Re: [z80] Writing to flash
«
Reply #10 on:
March 23, 2013, 10:02:42 am »
Writing more than one byte is just a matter of embedding the code for writing a byte into a loop. As I wrote above, what wears out the Flash memory is erasing it, not writing to it.
Logged
Member of the
TI-Chess Team
.
Co-maintainer of
GCC4TI
(
GCC4TI online documentation
),
TILP
and
TIEmu
.
Co-admin of
TI-Planet
.
Matrefeytontias
Axe roxxor (kinda)
LV10
31337 u53r (Next: 2000)
Posts: 1982
Rating: +310/-12
Axe roxxor
Re: [z80] Writing to flash
«
Reply #11 on:
March 23, 2013, 10:04:53 am »
Erasing a sector is what the TI-OS does when Defragmenting after an app deletion right ?
Logged
/\ >< [- |_| _\~ [- /?
All of the TI-z80 screenshots that I will post, unless I specifically mention that it's not the case, will run at 6 MHz.
Always
. If you find that unbelievable, you should check the last link of my sig
Nerdiness
Projects :
[Ndless3.1] nKaruga
,
[Axe] Worms (yes !)
,
[Ndless 3.1] F-Zero TrackSpire (dropped)
,
[Ndless 3.1] nSpeedX 3D (paused)
,
[Ndless 3.1] nRayC, an easy-to-use raycasting (3D) engine in C for your Nspire ! (paused)
Proud author of :
[TI-8x] Jetpack 8x+
,
[TI-8x+] Gravity Walls
,
[ASM for Axe] AxeDCS axiom for Axe programmers
,
[TI-8x+] WiredWorks : a SolidWorks on your Ti-83+/84+ !
,
[TI-8x+] Super Crate Box
,
[Axe] IkarugaX, an awesomely challenging danmaku/shoot-them-up for your TI-83+/84+ !
,
[ASM for Axe] AxeJh3D axiom, a very fast 3D ASM library for Axe coders !
If at a certain moment you think that I'm awesome, you can express it by
giving me one more Internet (>^_^)>
Lionel Debroux
LV11
Super Veteran (Next: 3000)
Posts: 2135
Rating: +290/-45
Re: [z80] Writing to flash
«
Reply #12 on:
March 23, 2013, 10:09:50 am »
Yup, erasing a sector is necessary so that you can write again arbitrary data to it. When writing to Flash memory (both NOR and NAND), the write operation is effectively an AND operation: it can only turn bits from 1 (default state after erasing) to 0. Only erasing makes it possible to turn bits from 0 to 1, but erasing is a slow, bulk operation performed over large blocks (sectors).
Logged
Member of the
TI-Chess Team
.
Co-maintainer of
GCC4TI
(
GCC4TI online documentation
),
TILP
and
TIEmu
.
Co-admin of
TI-Planet
.
Matrefeytontias
Axe roxxor (kinda)
LV10
31337 u53r (Next: 2000)
Posts: 1982
Rating: +310/-12
Axe roxxor
Re: [z80] Writing to flash
«
Reply #13 on:
March 23, 2013, 10:11:37 am »
But then if I want to write a single 1 bit to a sector I need to erase it first !?
Logged
/\ >< [- |_| _\~ [- /?
All of the TI-z80 screenshots that I will post, unless I specifically mention that it's not the case, will run at 6 MHz.
Always
. If you find that unbelievable, you should check the last link of my sig
Nerdiness
Projects :
[Ndless3.1] nKaruga
,
[Axe] Worms (yes !)
,
[Ndless 3.1] F-Zero TrackSpire (dropped)
,
[Ndless 3.1] nSpeedX 3D (paused)
,
[Ndless 3.1] nRayC, an easy-to-use raycasting (3D) engine in C for your Nspire ! (paused)
Proud author of :
[TI-8x] Jetpack 8x+
,
[TI-8x+] Gravity Walls
,
[ASM for Axe] AxeDCS axiom for Axe programmers
,
[TI-8x+] WiredWorks : a SolidWorks on your Ti-83+/84+ !
,
[TI-8x+] Super Crate Box
,
[Axe] IkarugaX, an awesomely challenging danmaku/shoot-them-up for your TI-83+/84+ !
,
[ASM for Axe] AxeJh3D axiom, a very fast 3D ASM library for Axe coders !
If at a certain moment you think that I'm awesome, you can express it by
giving me one more Internet (>^_^)>
Xeda112358
they/them
Moderator
LV12
Extreme Poster (Next: 5000)
Posts: 4704
Rating: +719/-6
Calc-u-lator, do doo doo do do do.
Re: [z80] Writing to flash
«
Reply #14 on:
March 23, 2013, 10:15:06 am »
Only if you want to overwrite it. If you have erased the sector (a chunk of 4 flash pages), you can write to all of the bytes. That is why the OS needs to garbage collect. When you unarchive to edit, then rearchive, it gets written back to a different place instead of overwriting the whole sector just to replace the data.
Logged
My pastebin
|
Pokémon Amber
|
Grammer Programming Language
|
BatLib Library
|
Jade Simulator
|
Zeda's Hex Opcodes
|
FileSyst Library
|
CopyProg
|
TPROG
|
GroupRead
|
Lbl Read/Write
|
Z80 Floating Point Routines
(
z80float on GitHub
)|
Z80 Optimized Routines Repository
Print
Pages: [
1
]
2
Go Up
« previous
next »
Omnimaga
»
Forum
»
Calculator Community
»
TI Calculators
»
ASM
»
[z80] Writing to flash