Search the web
Sign In
New User? Sign Up
vmu-dev · The VMU Development list
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
[vmu] Writing to VMU flash from inside minigames.   Message List  
Reply | Forward Message #30 of 1156 |
[vmu] Re: Writing to VMU flash from inside minigames.

soeren gust <sgus-@...> wrote:
original article:http://www.egroups.com/group/vmu-dev/?start=29
> Is there a way to use writeflash (at .org $100) to write at the
FAT/DIRECTORY?

No. There is a check that prevents you from writing outside the game
file iself. _However_, there is another BIOS vector you can use which
does not have this limitation. It's a bit tricky to call though, as it
doesn't have any code to return to the game ROM bank. Here's some code
you might find useful:


;; Firmware entry vectors

.org $100
fm_wrt_ex:
not1 ext,0
jmpf fm_wrt_ex
ret

.org $110
fm_vrf_ex:
not1 ext,0
jmpf fm_vrf_ex
ret

.org $120
fm_prd_ex:
not1 ext,0
jmpf fm_prd_ex
ret

.org $130
int3_btr_irq:
push ie
clr1 ie,7
not1 ext,0
jmpf int3_btr_irq
pop ie
reti


;[...]


;; Low level access functions

fwcall .macro
mov #<$0123,0
push 0
mov #>$0123,0
push 0
not1 ext,0
jmpf \1
.endm


bios_rflash:
fwcall $e027

bios_vflash:
fwcall $e01b

;; Danger Will Robinson!
;;
;; This call gives direct access to the flashmem write
;; function. All safeguards will be bypassed.

bios_wflash:
fwcall $e024


;; Write a quarter of a sector.
;;
;; trh,trl = sector number, acc = part (0-3)
;; returns: 0 = ok, not 0 = not ok
write_page:
bp trh,7,.bad_sector
push 0
push trh
push trl
push b
push c
callf calc_page_addr
push ie
push ocr
push xbnk
clr1 ie,7
mov #$81,ocr
mov #2,xbnk
push xram+4
set1 xram+4,0
mov #0,$7c
callf bios_wflash
callf bios_vflash
pop xram+4
pop xbnk
pop ocr
pop ie
pop c
pop b
pop trl
pop trh
pop 0
ret
.bad_sector:
mov #$ff,acc
ret

;; Read a quarter of a sector.
;;
;; trh,trl = sector number, acc = part (0-3)
read_page:
bp trh,7,.bad_sector
push 0
push trh
push trl
callf calc_page_addr
push ie
push ocr
clr1 ie,7
mov #$81,ocr
callf bios_rflash
pop ocr
pop ie
pop trl
pop trh
pop 0
ret
.bad_sector:
ret

calc_page_addr:
rorc
and #1
st $7e
rorc
st $7f
ld trl
rolc
and #$fe
or $7e
st $7e
ld trh
rolc
st $7d
ret



Not actually tested or anything... :-)


// Marcus





Tue Feb 29, 2000 8:04 pm

marcus@...
Send Email Send Email

Forward
Message #30 of 1156 |
Expand Messages Author Sort by Date
Soeren Gust
sgust@...
Send Email
Feb 29, 2000
6:10 pm

soeren gust <sgus-@...> wrote: original article:http://www.egroups.com/group/vmu-dev/?start=29 ... FAT/DIRECTORY? No. There is a check that...
Marcus Comstedt
marcus@...
Send Email
Feb 29, 2000
8:08 pm
Soeren Gust
sgust@...
Send Email
Mar 3, 2000
5:55 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help