Peng Jia

mc9sdp512 ucontroller R/W CF card question

Discussion created by Peng Jia on Aug 19, 2010
Latest reply on Aug 19, 2010 by kef

Hi,

I am a newbie of mc9sdp512 ucontroller. I am digging a CF file issue for my company and I had a hard time to understand some legacy asm code.

 

The following is the code:

 

_gfOpen::
    pshx
    tfr    d,x                ;file name pointer is in accd
    lda    5,sp            ;get drive num and operation type
    ldb    #14
        swi
        clra
    pulx
        rts

 

What I don't understand is that after load 14 to accumulator b and call software interrupt. The file on CF card is open "magically". How it is opened I don't know. Here in the vector table, swi is defined as this:

 

word swiHndl        ;$fff6 SWI

 

this is swiHndl:

swiHndl:
        tsx
        xgdx                    ;accd = sp of current stack
        jmp     jOS_call    ;do OS_call    

 

And jOS_call:

jOS_call::        jmp    0        ;operating system call

 

Anyone can hlep me figure how the file on the CF card is opened?

Outcomes