File: asm.c

package info (click to toggle)
mixal 1.08-10
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny, squeeze
  • size: 208 kB
  • ctags: 286
  • sloc: ansic: 1,597; makefile: 89; awk: 10
file content (52 lines) | stat: -rw-r--r-- 1,104 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* MIX simulator, copyright 1994 by Darius Bacon */ 
#include "mix.h"

#include "asm.h"
#include "run.h"    /* for memory[] */

/* --- The assembly buffer --- */

Address here = 0;

Cell asm_fetch_field(Address address, unsigned L, unsigned R)
{
    assert(address < memory_size);
    return field(make_field_spec(L, R), memory[address]);
}

#include <stdio.h>

void asm_store_field(Address address, unsigned L, unsigned R, Cell cell)
{
    assert(address < memory_size);
    if (VERBOSE) {
	char temp[12];
	unparse_cell(temp, cell);
	printf("%4o(%u,%u): %s\n", address, L, R, temp);
    }
    memory[address] = set_field(cell, make_field_spec(L, R), memory[address]);
}

void assemble(Cell cell)
{
    if (VERBOSE) {
        char temp[12];
	unparse_cell(temp, cell);
	printf("%4o: %s\n", here, temp);
    }
    if (here < memory_size)
	memory[here] = cell;
    else
	error("Address out of range");
    ++here;
}

Address entry_point;

void set_entry_point(Address address)
{
    assert(address < memory_size);
    if (VERBOSE)
        printf("entry point: %4o\n", address);
    entry_point = address;
}