How to resolve the algorithm Create a file step by step in the M6809 Assembler programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Create a file step by step in the M6809 Assembler programming language

Table of Contents

Problem Statement

In this task, the job is to create a new empty file called "output.txt" of size 0 bytes and an empty directory called "docs". This should be done twice: once "here", i.e. in the current working directory and once in the filesystem root.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Create a file step by step in the M6809 Assembler programming language

Source code in the m6809 programming language

        nam     create_file
        ttl     M6809 Program to create a file and a directory
*
*       M6809 Assembler running under the OS-9 Operating System
*             built with:  asm cf.a L O=cf #32k
*
        ifp1
        use     /DD/defs/os9.d
        endc
*
        mod     PRGSIZ,PRGNAM,TYPE,REVS,START,SIZE
PRGNAM  fcs     /cf/
TYPE    set     Prgrm+Objct
REVS    set     ReEnt+1

HEREF   fcs     './output.txt'
        fcb     $0D
ROOTF   fcs     '/dd/output.txt'
        fcb     $0D
HERED   fcs     './docs'
        fcb     $0D
ROOTD   fcs     '/dd/docs'
        fcb     $0D
        rmb     250
        rmb     200
SIZE    equ     .
*
START   equ     *
        leax    HEREF,pcr
        lda     #UPDAT.
        ldb     #READ.+WRITE.+PREAD.+PWRIT.
        os9     I$Create
        leax    ROOTF,pcr
        lda     #UPDAT.
        ldb     #READ.+WRITE.+PREAD.+PWRIT.
        os9     I$Create
        leax    HERED,pcr
        lda     #UPDAT.
        ldb     #READ.+WRITE.+PREAD.+PWRIT.
        os9     I$MakDir
        leax    ROOTD,pcr
        lda     #UPDAT.
        ldb     #READ.+WRITE.+PREAD.+PWRIT.
        os9     I$MakDir
        clrb
        os9     F$Exit
        emod
PRGSIZ  equ     *
        END

  

You may also check:How to resolve the algorithm System time step by step in the LIL programming language
You may also check:How to resolve the algorithm CRC-32 step by step in the PL/I programming language
You may also check:How to resolve the algorithm Haversine formula step by step in the AutoHotkey programming language
You may also check:How to resolve the algorithm Self-describing numbers step by step in the MATLAB / Octave programming language
You may also check:How to resolve the algorithm Tau function step by step in the Sidef programming language