Loading file from MMC
I don't know how to do it with the original firmware. There are fileOpen, fileRead, fileWrite, and fileClose built-in functions. But, it could turn the phone off if we call it directly.
That's why I modify some function to get access to the file function more savely.
If you already install FAM patch, the file access will be like this :
Code:
#define FACBuff 36h:3FF8h
#define BFABuff 20h:0
#define BMPString 2e2h:2285h
myReadFile_start:
mov r14, #pof(FACBuff)+8
mov r13, #pag(BFABuff)
mov r12, #pof(BFABuff)
mov r5, #seg(after_loading_func)
mov r4, #ofs(after_loading_func)
extp #pag(FACBuff), #4
mov [-r14], r5
mov [-r14], r4
mov [-r14], r13
mov [-r14], r12
mov r12, #0
mov r13, #0
mov [-r0], r13
mov [-r0], r12
mov r12, #pof(filename)
mov r13, #pag(filename)
mov r14, #pof(BMPString)
mov r15, #pag(BMPString)
calls 0d7d912h
add r0, #4
rets
after_loading_func:
;type something here to be executed after the file is loaded
rets
filename:
db 'A:\Misc\MyTest.txt',0
FACBuff is a temporary buffer used by FAM to distinguish between a normal fileOpen and our fileOpen (I use 36h:3FF8h in FAM, you can not modify this unless you modify the FAM patch also).
BFABuff is the buffer for fileRead content. You can select any "free" RAM, usually, I use 20:0 until 29:3FFF (used by Java midlet).
after_loading_func is the function which will be executed after the fileRead is finished, just after the original fileClose is executed. Put all your instruction which need to be executed after the file is loaded here ...
I know how to load any file (including midi ones) into the memory, but I need to search the convertMID2Tones() and playTonesMemory() function to be able to play the file after it is loaded.
Hope it is helpfull,
rizapn