Here is some code to look at.
do you run LNKFIL afterwards? you must!

note you must ensure the address of the new file name in the ram directory
is 1 less than the actual starting location to ensure LNKFIL orders the
file names correctly.



ramfile_copy_DO:            ; new directory entry address in TEMP3
                    ; source directory entry at input buffer

                    ; ASCTAB-1 start of new file in directory entry
                    ; make xx byte hole at ASCTAB, xx is file length incl
EOF
                    ; copy data to hole
                    ; LNKFIL

    lhld    BINTAB            ; hl points to injection point
    shld    TEMP3            ; store injection point in TEMP3
    dcx    h
    shld    TEMP1            ; start address for new directory entry in
TEMP1

    call    ramcopy_makehole    ; make the hole
    call    ramfile_copy_file    ; copy the data into the hole
    jmp    rammenu_loop0        ; done

;---------------------------------------------------------------------------
ramcopy_makehole:

    lhld     TEMP4        ; get length of file
    push    h        ; on stack

  ........

    pop    b            ; length of file in bc

    lhld    TEMP3            ; hl is injection point

    rst    6
    .dw    MAKHOL            ; make hole BC long at HL, adjusting pointers

; MAKHOL adjusts BINTAB, VARTAB, ARYTAB
; MAKHOL does not adjust ASCTAB, needed by LNKFIL


    jc    ramfile_copy_fail4    ; jump here if not enough space

    ret


;---------------------------------------------------------------------------
ramfile_copy_file:            ; copy the data into the hole

                    ; TEMP2 new directory entry address
                    ; INPUT_BUFFER source directory entry, points to source
file
                    ; TEMP3 injection point of new file
                    ; TEMP1 start address for directory entry
                    ; TEMP4 size
                    ; TEMP5 source data (system file)

    lhld    TEMP4
    mov    b,h
    mov    c,l            ; get size in BC

    lhld    TEMP3            ; target in hl
    xchg                ; target in de

    lda    DSTATE
    ani    10000000b
    jz    ramfile_copy_file_1
                    ; use when in ram file mode
    lhld    INPUT_BUFFER+1d
    call    fix_hl_mode        ; correct hl for lower block

                    ; hl source, de target
    call    ramfile_copy_block    ; copy block
    jmp    ramfile_copy_file_2

ramfile_copy_file_1:                ; use when copying system files
    lhld    TEMP5            ; hl = source
                    ; hl source, de target
    xchg                ; de source hl target
    call    MOVEB_D_H        ; mov bc bytes from de to hl

ramfile_copy_file_2:

    lhld    TEMP2            ; TEMP2 holds pointer for new directory entry
    inx    h
    xchg
    lhld    TEMP1            ; start address for directory entry in hl
    shlx                ; store new start of file into new directory entry

    rst    6
    .dw    LNKFIL            ; fix up directory


    ret


On Wed, Oct 25, 2017 at 4:40 PM, Stephen Adolph <[email protected]>
wrote:

> willard, would commented assembly help?
> I have this working in REX Manager...
>
>
> On Wed, Oct 25, 2017 at 4:20 PM, Willard Goosey <[email protected]> wrote:
>
>> So, there is this (from Mike Nugent's RAM-ROM file)
>>
>> ;2239H - Insert entry into directory.
>> ;         Entry:
>> ;               HL - Points to empty directory slot
>> ;               DE - Contains address of file in RAM
>> ;                A - Attribute (80h=.BA, C0h=.DO, A0h=.CO, etc.)
>> ;         Note: Routine gets filename from FC93H, where it must be
>> ;       stored,padded with spaces, no delimiter.
>> ;         Exit: DE - Unchanged
>>
>> And I have the ROM call itself working in smallclib... but this is only
>> part of the story. To use this successfully (ie without causing a cold
>> start) we need to know more about it.
>>
>> I've been trying to create a .DO file.
>>
>> 1) Where do yo get a starting address for the file? I've tried every
>> variant of COSTART (FBB0h) and DOSTART (FBAEh). At best I can get is
>> intact DO files and the CO file directory entries switched around (using
>> COSTART-1). DOSTART results in the text files being switched around and
>> the binary files remaining correct. Anything else (COSTART or
>> DOSTART-1) leads to file corruption and/or cold starts.
>>
>> 2)Is there a second directory-repair routine, besides DIROK (2146h)?
>> Because DIROK() is not being sufficient. :-(
>>
>> Here is the test code. DO NOT USE!!!!
>> /*tmf.c
>>  *Test MakFil
>>  *test for Model 100 Small C-85 Library
>>  *
>>  *Willard Goosey
>>  *[email protected]
>>  *10/19/2017
>>  */
>>
>> #include "m100vars.h"
>> #include "dir.h"
>>
>> /*MAKFIL extension bytes: */
>> #define BA 0x80
>> #define DO 0xC0
>> #define CO 0xA0
>>
>> main(char A, char *HL)
>> {
>>   char *name;
>>   struct dir *slot;
>>   char *start;
>>   int i;
>>
>>   name= "RTMF1.DO";
>>   start= COSTART-1; //start at beginning of CO files
>>
>>   slot=FREDIR();
>>
>>   hex16(start);CRLF();
>>
>>   prsnam(name,strlen(name));
>>
>>   hex16(makfil(slot,start,DO)); CRLF();
>>   if(makhol(1,start)<0)
>>   {
>>     BEEP();
>>     MENU();
>>   }
>>   *start=0x1a;
>>  //makfil doesn't autoinsert EOF
>>   DIROK();
>> }
>>
>> HELP!!!!
>> Willard
>> --
>> Willard Goosey  [email protected]
>> Socorro, New Mexico, USA
>> I search my heart and find Cimmeria, land of Darkness and the Night.
>>   -- R.E. Howard
>>
>
>

Reply via email to