ANSI C SRC Assembler


The ANSI C toolset consists of a text-based assembler and simulator/monitor. The tools have text input and output, and do not rely on any graphical user interface. Thus they can be compiled and run on any computer that has an ANSI C compiler.

(There is also a one-line disassembler, extract, that is useful in extracting fields from SRC "ascii hex" instruction codes.)

The assembler accepts SRC assembly language, as defined in CSDA, Appendix B. Here is an example file, tst.asm:

.org 1000
A: .dw 1
B: .equ -10
C: .equ 14
D: .equ 14
E: .equ 18
F: .dw 1
la r0, B
la r1, C
add r2, r0, r1
st r2, A
la r3, D
la r4, E
add r5, r4, r3
st r5, A
stop

This program is assembled by invoking the command, srcasm tst.asm, and results in a listing file, tst.lst:

*****SRC Assembler***** V1.0
 
HexLoc DecLoc MachWord Source Code
00000000 000000 00000000 1:
00000000 000000 00000000 2: .org 1000
000003e8 001000 00000000 3: A: .dw 1
000003ec 001004 00000000 4: B: .equ -10
000003ec 001004 00000000 5: C: .equ 14
000003ec 001004 00000000 6: D: .equ 14
000003ec 001004 00000000 7: E: .equ 18
000003ec 001004 00000000 8: F: .dw 1
000003f0 001008 2801fff6 9: la r0, B
000003f4 001012 2840000e 10: la r1, C
000003f8 001016 60801000 11: add r2, r0, r1
000003fc 001020 188003e8 12: st r2, A
00000400 001024 28c0000e 13: la r3, D
00000404 001028 29000012 14: la r4, E
00000408 001032 61483000 15: add r5, r4, r3
0000040c 001036 194003e8 16: st r5, A
00000410 001040 f8000000 17: stop

an "ascii binary" file, tst.bin:

000003f0 2801fff6
000003f4 2840000e
000003f8 60801000
000003fc 188003e8
00000400 28c0000e
00000404 29000012
00000408 61483000
0000040c 194003e8
00000410 f8000000

This file is the proper format for input to the ANSI C SRC Simulator

return to home page