Sunday, 23 February 2014

Progress on kickstart after a week of pain

The past week has been a frustrating cycle of making some progress on the kickstart ROM and related SD card controller work, followed by a plethora of bizarre bugs popping up, and in some cases FPGA synthesis totally failing.

Some of the causes are known, such as a long-standing bug relating to code executed from the fastio bus (as compared to chipram or slowram busses).  However, others are more elusive, and it has proven better to backtrack and reattempt scaling the mountain, rather than figuring out how to escape the quagmire.  In the process, hopefully the design of some of the components has improved through repeated implementation.

Anyway, after such a frustrating week, it is nice that I have finally got an FPGA build with a prototype kickstart ROM in it that can correctly initialise the SD card, and then understand enough of the FAT file system to find the C65GS.ROM file:


  The FAT code is now even fairly structured, so that the search for the ROM file happens using structured routines, not unlike the real-mode calls in the early versions of MS-DOS.  To give an idea of the API, here is the loop of my directory search:

                ; Now load root directory cluster.
  ; (fs_clusternumber was set above)
  jsr fs_cd_rootdir
  jsr fs_opendir
  bcc sdcarderror

  ; iterate through directory entries looking for ordinary file 
  ; C65GS.ROM
nextdirectoryentry:
  jsr fs_readdir
  bcc sdcarderror


  ldx #$00
l17b:  lda fs_direntry,x
  jsr toupper
  cmp txt_c65gsrom,x
  bne nextdirectoryentry
  inx
  cpx #$0b
  bne l17b
  ; this is the entry
  jmp foundromfile


The full source is in the kickstart branch at http://github.com/gardners/c65gs.  Also note that there is now a Google Group for this project at https://groups.google.com/forum/#!forum/c65gs-development.

But now it is time for sleep and getting ready for the week ahead.

No comments:

Post a Comment