Subversion Repositories SvarDOS

Rev

Rev 1574 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1556 mateusz.vi 1
/*
2
 * replacement for a couple of libc functions
3
 */
4
 
5
#include <i86.h>
6
#include <stddef.h>
7
 
8
#include "libc.h"
9
 
10
 
11
 
1557 mateusz.vi 12
unsigned short mdr_dos_resizeblock(unsigned short siz, unsigned short segn) {
1556 mateusz.vi 13
  unsigned short res = 0;
14
 
15
  _asm {
16
    push bx
17
    push es
18
 
19
    mov ah, 0x4a
20
    mov bx, siz
21
    mov es, segn
22
    int 0x21
23
    jnc done
24
    mov res, ax
25
 
26
    done:
27
 
28
    pop es
29
    pop bx
30
  }
31
 
32
  return(res);
33
}
34
 
35
 
36
unsigned short mdr_dos_write(unsigned short handle, const void far *buf, unsigned short count, unsigned short *bytes) {
37
  unsigned short res = 0;
38
  unsigned short resax = 0;
39
  unsigned short buf_seg = FP_SEG(buf);
40
  unsigned short buf_off = FP_OFF(buf);
41
 
42
  _asm {
43
    push bx
44
    push cx
45
    push dx
46
 
47
    mov ah, 0x40
48
    mov bx, handle
49
    mov cx, count
50
    mov dx, buf_off
51
    push ds
52
    mov ds, buf_seg
53
 
54
    int 0x21
55
    pop ds
56
    jnc done
57
    mov res, ax
58
 
59
    done:
60
    mov resax, ax
61
 
62
    pop dx
63
    pop cx
64
    pop bx
65
  }
66
 
67
  *bytes = resax;
68
  return(res);
69
}