home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / EXTRA-ST / CPM-80-E / CPM-0.2 / CPM-0 / cpm-0.2 / z80-sources / mylib / open.mac < prev    next >
Encoding:
Text File  |  1994-06-06  |  1.3 KB  |  48 lines

  1. ;****************************************************************    *
  2. ;*                                *    *
  3. ;*        Unterprogramm f}r OPEN, CREATE und KILL        *    *
  4. ;*                                *    *
  5. ;****************************************************************    *
  6.  
  7.         .z80            ;
  8.         entry _setfcb        ;
  9.  
  10. ascii_fcb:    call _xfcb##        ; mu~ erst umgewandelt werden!
  11.         jr count_wildcard    ;
  12.  
  13. file_open:    ld hl,errmsg        ;
  14.         jp _exit##        ;
  15.         dseg            ;
  16. errmsg:        db 'MACLIB Err: File open!',0
  17.         cseg            ;
  18.  
  19. _setfcb:                ; HL enth{lt Dateinamen in ASCII
  20.                     ; oder in vorgefertigter Form,
  21.                     ; DE ist Adresse des FCB
  22.         ld a,(de)        ;
  23.         rrca            ;
  24.         jr c,file_open        ;
  25.         inc de            ;
  26.         push de            ; FCB Beginn
  27.         ld a,(hl)        ; Drive-Field
  28.         cp 16+1            ;
  29.         jr nc,ascii_fcb        ;
  30.         ld bc,12        ; Dateiname vorgefertigt, mache nur LDIR
  31.         ldir            ;
  32. count_wildcard:    pop hl            ; nochmal FCB Adresse
  33.         ld bc,11*256        ; z{hle Anzahl der '?' im FCB
  34.         ld a,'?'        ;
  35. count_wcloop:    inc hl            ;
  36.         cp (hl)            ; ist es Fragezeichen?
  37.         jr nz,test_next        ;
  38.         inc c            ; Z{hler erh|hen
  39. test_next:    djnz count_wcloop    ; next one
  40.         xor a            ;
  41.         ld b,24            ; restliche Zeichen im FCB
  42. zero_fcb:    inc hl            ;
  43.         ld (hl),a        ;
  44.         djnz zero_fcb        ;
  45.         or c            ; Anzahl Wildcard
  46.         ret            ; ZERO-Flag richtig setzen
  47.         end            ;
  48.