Subversion Repositories SvarDOS

Rev

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

Rev 1730 Rev 1797
Line 347... Line 347...
347
  *s = 0;
347
  *s = 0;
348
  output(buff);
348
  output(buff);
349
}
349
}
350
 
350
 
351
 
351
 
352
static void dos_fname2fcb(char far *fcb, const char *cmd) {
352
static void dos_fname2fcb(char far *fcb, const char near *cmd);
353
  unsigned short fcb_seg, fcb_off;
353
#pragma aux dos_fname2fcb = \
354
  fcb_seg = FP_SEG(fcb);
-
 
355
  fcb_off = FP_OFF(fcb);
-
 
356
  _asm {
-
 
357
    push ax
-
 
358
    push bx
-
 
359
    push cx
-
 
360
    push dx
-
 
361
    push es
-
 
362
    push si
-
 
363
 
-
 
364
    mov ax, 0x2900   /* DOS 1+ - parse filename into FCB (DS:SI=fname, ES:DI=FCB) */
354
"mov ax, 0x2900"   /* DOS 1+ - parse filename into FCB (DS:SI=fname, ES:DI=FCB) */ \
365
    mov si, cmd
-
 
366
    mov es, fcb_seg
-
 
367
    mov di, fcb_off
-
 
368
    int 0x21
355
"int 0x21" \
369
 
-
 
370
    pop si
356
parm [es di] [si] \
371
    pop es
-
 
372
    pop dx
-
 
373
    pop cx
-
 
374
    pop bx
-
 
375
    pop ax
357
modify [ax si]
376
  }
-
 
377
}
-
 
378
 
358
 
379
 
359
 
380
/* parses cmdtail and fills fcb1 and fcb2 with first and second arguments,
360
/* parses cmdtail and fills fcb1 and fcb2 with first and second arguments,
381
 * respectively. an FCB is 12 bytes long:
361
 * respectively. an FCB is 12 bytes long:
382
 * drive (0=default, 1=A, 2=B, etc)
362
 * drive (0=default, 1=A, 2=B, etc)
Line 635... Line 615...
635
  env_setvar(envseg, buff);
615
  env_setvar(envseg, buff);
636
}
616
}
637
 
617
 
638
 
618
 
639
/* wait for user input */
619
/* wait for user input */
640
static void cmdline_getinput(unsigned short inpseg, unsigned short inpoff) {
620
static void cmdline_getinput(unsigned short inpseg, unsigned short inpoff);
641
  _asm {
-
 
642
    push ax
621
#pragma aux cmdline_getinput = \
643
    push bx
622
"push ds" \
644
    push cx
623
/* set up buffered input to inpseg:inpoff */ \
645
    push dx
624
"push ax" \
646
    push ds
625
"pop ds" \
647
 
626
\
648
    /* is DOSKEY support present? (INT 2Fh, AX=4800h, returns non-zero in AL if present) */
627
/* is DOSKEY support present? (INT 2Fh, AX=4800h, returns non-zero in AL if present) */ \
649
    mov ax, 0x4800
628
"mov ax, 0x4800" \
650
    int 0x2f
629
"int 0x2f" \
651
    mov bl, al /* save doskey status in BL */
-
 
652
 
-
 
653
    /* set up buffered input to inpseg:inpoff */
-
 
654
    mov ax, inpseg
-
 
655
    push ax
-
 
656
    pop ds
-
 
657
    mov dx, inpoff
-
 
658
 
630
\
659
    /* execute either DOS input or DOSKEY */
631
/* execute either DOS input or DOSKEY */ \
660
    test bl, bl /* zf set if no DOSKEY present */
632
"test al, al" /* al=0 if no DOSKEY present */ \
661
    jnz DOSKEY
633
"jnz DOSKEY" \
662
 
634
\
-
 
635
/* buffered string input */ \
663
    mov ah, 0x0a
636
"mov ah, 0x0a" \
664
    int 0x21
637
"int 0x21" \
665
    jmp short DONE
638
"jmp short DONE" \
666
 
639
\
667
    DOSKEY:
640
"DOSKEY:" \
668
    mov ax, 0x4810
641
"mov ax, 0x4810" \
669
    int 0x2f
642
"int 0x2f" \
670
 
643
\
671
    DONE:
644
"DONE:" \
672
    /* terminate command with a CR/LF */
645
/* terminate command with a CR/LF */ \
673
    mov ah, 0x02 /* display character in dl */
646
"mov ah, 0x02" /* display character in dl */ \
674
    mov dl, 0x0d
647
"mov dl, 0x0d" \
675
    int 0x21
648
"int 0x21" \
676
    mov dl, 0x0a
649
"mov dl, 0x0a" \
677
    int 0x21
650
"int 0x21" \
678
 
-
 
679
    pop ds
651
"pop ds" \
680
    pop dx
652
parm [ax] [dx] \
681
    pop cx
-
 
682
    pop bx
-
 
683
    pop ax
653
modify [ax dl]
684
  }
-
 
685
}
-
 
686
 
654
 
687
 
655
 
688
/* fetches a line from batch file and write it to buff (NULL-terminated),
656
/* fetches a line from batch file and write it to buff (NULL-terminated),
689
 * increments rmod counter and returns 0 on success. */
657
 * increments rmod counter and returns 0 on success. */
690
static int getbatcmd(char *buff, unsigned char buffmaxlen, struct rmod_props far *rmod) {
658
static int getbatcmd(char *buff, unsigned char buffmaxlen, struct rmod_props far *rmod) {