1) 512 bytes is used as sector buffer for bytes read from micro sd card (sector with data)
2) 512 bytes is used as sector buffer for bytes read from micro sd card (sector containing FAT entries)
3) ~256 bytes are used as a data result the function that read single directory entry (4 bytes starting cluster, 1 byte type, 256 bytes filename - maximum FAT filename length is 256 characters
4) ~256 bytes are used as input variable to function that search for a directory entry with specified name
probably around 128 bytes are used by other variables
5) ~512 bytes are used as a temporary place in RAM to copy and execute code from that can't be run from ROM (responsible for self programming ROM), but that code does not use the functions from 3) and 4) so the buffer can be be in the same place
6) Around 256 bytes for variables
1) Of course stack is also needed, but is there any tool that could automaticaly analyze my code and calculate maximum stack depth in pesimistic call-nesting? (I don't use recurrent functions)
2) I use just one sprite as an arrow, so wasting 256 bytes for OAM and using OAM_DMA is ridiculous.
2a) is it safe to just do:
Code: Select all
lda #0 sta OAMADDR lda OAM sta OAMDATA lda OAM + 1 sta OAMDATA lda OAM + 2 sta OAMDATA lda OAM +3 sta OAMDATA
2b) For the remaining unused 252 bytes of OAM, do I have to initialize them to zeros once? Or should I anyway refresh them every frame? Maybe it is good to declare 256 zero-byte array somewhere in ROM and make
Code: Select all
.SEGMENT "DATA" OAM_ZEROS: .REPEAT 256 .byte 0 .ENDREPEAT LDA #>OAM_ZEROS STA OAM_DMA and then manually fill the 4 bytes like above?