views:

290

answers:

1

I've coded a SIC assembler and everything seems to be working fine except for the I/O aspect of it.

I've loaded the object code into memory (converted char format into machine representation), but when I call SICRun(); to execute the code, I get an error stating "devf1 cannot be found".

I know this is related to the input/output device instructions in the source code.
The c file states that it depends on external files, most notably, Dev[6]. Am I supposed to create this myself? My instructor did not give us any other files to work with. Any insight?

Example: TD OUTPUT ;TEST OUTPUT DEVICE

This directory contains the source code (source.asm), header file (sic.h) and the SIC simulator (sicengine.c)

+2  A: 

From the sicengine.c source file it looks as though the devf1 (also dev2/dev3) file is expected to exist so this 'input device' can be read from (fopen is passed "r" as a parameter):

if (opcode == 216) {  /* RD */
    /* ... */
    if ((Dev[Devcode] = fopen(SICFile[Devcode],"r")) == NULL) {
        printf("cannot open file %s\n", SICFile[Devcode]);
        exit(1);
    }

The comment in the code about depending on file Dev[6] is ambiguous. It really means the names of the files in the Dev array, which are devf1, devf2 and devf3 (input devices) and devf04, devf05 and devf05 (output devices).

I would suggest creating files devf1, devf1 and devf3.

Matthew Murdoch
Perfect! This worked.
Mikey D