Subversion Repositories SvarDOS

Rev

Rev 1781 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1781 Rev 1782
Line 103... Line 103...
103
"int 0x21" \
103
"int 0x21" \
104
modify [ax]  /* AX might contain an error code on failure */ \
104
modify [ax]  /* AX might contain an error code on failure */ \
105
parm [bx]
105
parm [bx]
106
 
106
 
107
 
107
 
108
static unsigned short FREAD(unsigned short handle, void *buff, unsigned short bytes) {
108
static unsigned short FREAD(unsigned short handle, void far *buff, unsigned short bytes);
109
  unsigned short buff_seg = FP_SEG(buff);
-
 
110
  unsigned short buff_off = FP_OFF(buff);
-
 
111
  unsigned short res = 0;
-
 
112
 
-
 
113
  _asm {
-
 
114
    push bx
-
 
115
    push cx
-
 
116
    push dx
-
 
117
 
-
 
118
    mov bx, handle
-
 
119
    mov cx, bytes
-
 
120
    mov dx, buff_off
-
 
121
    mov ax, buff_seg
-
 
122
    push ds
-
 
123
    mov ds, ax
-
 
124
    mov ah, 0x3f    /* read cx bytes from file handle bx to DS:DX */
-
 
125
    int 0x21
-
 
126
    pop ds
-
 
127
    jc ERR
-
 
128
 
-
 
129
    mov res, ax
-
 
130
    ERR:
-
 
131
 
-
 
132
    pop dx
-
 
133
    pop cx
-
 
134
    pop bx
-
 
135
  }
-
 
136
 
109
 
-
 
110
#pragma aux FREAD = \
-
 
111
"push ds" \
137
  return(res);
112
"push es" \
-
 
113
"pop ds" \
-
 
114
"mov ah, 0x3F"    /* read cx bytes from file handle bx to DS:DX */ \
-
 
115
"int 0x21" \
-
 
116
"jnc ERR" \
-
 
117
"xor ax, ax"      /* return 0 on error */ \
138
}
118
"ERR:" \
-
 
119
"pop ds" \
-
 
120
parm [bx] [es dx] [cx] \
-
 
121
value [ax]
139
 
122
 
140
 
123
 
141
static void FSEEK(unsigned short handle, unsigned short bytes);
124
static void FSEEK(unsigned short handle, unsigned short bytes);
142
 
125
 
143
#pragma aux FSEEK = \
126
#pragma aux FSEEK = \