legacy-cc

The earliest versions of the very first c compiler known to exist in the wild written by the late legend himself dmr. https://github.com/mortdeus/legacy-cc
git clone http://git.hanabi.in/repos/legacy-cc.git
Log | Files | Refs | README

c0t.s (4278B)


      1 / word I/O
      2 
      3 .globl	_putwrd
      4 
      5 .globl	_tmpfil
      6 .globl	putw
      7 .globl	fcreat
      8 .globl	flush
      9 
     10 .data
     11 _putwrd: 1f
     12 .text
     13 1:
     14 	tst	buf
     15 	bne	1f
     16 	mov	_tmpfil,r0
     17 	jsr	r5,fcreat; buf
     18 	bec	1f
     19 	mov	$1,r0
     20 	sys	write; botch; ebotch-botch
     21 	sys	exit
     22 1:
     23 	mov	2(sp),r0
     24 	jsr	r5,putw; buf
     25 	rts	pc
     26 .globl	_flshw
     27 .data
     28 _flshw:	1f
     29 .text
     30 1:
     31 	jsr	r5,flush; buf
     32 	rts	pc
     33 
     34 botch:	<Temp file?\n\0>; ebotch:
     35 .even
     36 
     37 .bss
     38 buf:	.=.+518.
     39 .text
     40 
     41 / C operator and conversion tables
     42 
     43 .globl	_opdope
     44 .globl	_cvtab
     45 
     46 _opdope:.+2
     47 	00000	/ EOF
     48 	00000	/ ;
     49 	00000	/ {
     50 	00000	/ }
     51 	36000	/ [
     52 	02000	/ ]
     53 	36000	/ (
     54 	02000	/ )
     55 	14201	/ :
     56 	07001	/ ,
     57 	00000	/ 10
     58 	00000	/ 11
     59 	00000	/ 12
     60 	00000	/ 13
     61 	00000	/ 14
     62 	00000	/ 15
     63 	00000	/ 16
     64 	00000	/ 17
     65 	00000	/ 18
     66 	00000	/ 19
     67 	00000	/ name
     68 	00000	/ short constant
     69 	00000	/ string
     70 	00000	/ float
     71 	00000	/ double
     72 	00000	/ 25
     73 	00000	/ 26
     74 	00000	/ 27
     75 	00000	/ 28
     76 	00000	/ 29
     77 	34202	/ ++pre
     78 	34202	/ --pre
     79 	34202	/ ++post
     80 	34202	/ --post
     81 	34220	/ !un
     82 	34202	/ &un
     83 	34220	/ *un
     84 	34200	/ -un
     85 	34220	/ ~un
     86 	00000	/ 39
     87 	30101	/ +
     88 	30001	/ -
     89 	32101	/ *
     90 	32001	/ /
     91 	32001	/ %
     92 	26061	/ >>
     93 	26061	/ <<
     94 	20161	/ &
     95 	16161	/ |
     96 	16161	/ ^
     97 	00000	/ 50
     98 	00000	/ 51
     99 	00000	/ 52
    100 	00000	/ 53
    101 	00000	/ 54
    102 	00000	/ 55
    103 	00000	/ 56
    104 	00000	/ 57
    105 	00000	/ 58
    106 	00000	/ 59
    107 	22105	/ ==
    108 	22105	/ !=
    109 	24105	/ <=
    110 	24105	/ <
    111 	24105	/ >=
    112 	24105	/ >
    113 	24105	/ <p
    114 	24105	/ <=p
    115 	24105	/ >p
    116 	24105	/ >=p
    117 	12213	/ =+
    118 	12213	/ =-
    119 	12213	/ =*
    120 	12213	/ =/
    121 	12213	/ =%
    122 	12253	/ =>>
    123 	12253	/ =<<
    124 	12253	/ =&
    125 	12253	/ =|
    126 	12253	/ =^
    127 	12213	/ =
    128 	00000	/ 81
    129 	00000	/ 82
    130 	00000	/ 83
    131 	00000	/ int -> float
    132 	00000	/ int -> double
    133 	00000	/ float -> int
    134 	00000	/ float -> double
    135 	00000	/ double -> int
    136 	00000	/ double -> float
    137 	14201	/ ?
    138 	00000	/ 91
    139 	00000	/ 92
    140 	00000	/ 93
    141 	00000	/ int -> float
    142 	00000	/ int -> double
    143 	00000	/ float -> double
    144 	00000	/ int -> int[]
    145 	00000	/ int -> float[]
    146 	00000	/ int -> double[]
    147 	36001	/ call
    148 	36001	/ mcall
    149 
    150 _cvtab:	.+2
    151 	.byte	000	/ i:i
    152 	.byte	000	/ i:c
    153 	.byte	113	/ i:f
    154 	.byte	125	/ i:d
    155 	.byte	140	/ i:i[]
    156 	.byte	100	/ i:c[]
    157 	.byte	150	/ i:f[]
    158 	.byte	160	/ i:d[]
    159 	.byte	140	/ i:[][]
    160 
    161 	.byte	100	/ c:i
    162 	.byte	100	/ c:c
    163 	.byte	113	/ c:f
    164 	.byte	125	/ c:d
    165 	.byte	140	/ c:i[]
    166 	.byte	100	/ c:c[]
    167 	.byte	150	/ c:f[]
    168 	.byte	160	/ c:d[]
    169 	.byte	140	/ c[][]
    170 
    171 	.byte	211	/ f:i
    172 	.byte	211	/ f:c
    173 	.byte	000	/ f:f
    174 	.byte	136	/ f:d
    175 	.byte	211	/ f:i[]
    176 	.byte	211	/ f:c[]
    177 	.byte	211	/ f:f[]
    178 	.byte	211	/ f:d[]
    179 	.byte	211	/ f:[][]
    180 
    181 	.byte	222	/ d:i
    182 	.byte	222	/ d:c
    183 	.byte	234	/ d:f
    184 	.byte	000	/ d:d
    185 	.byte	222	/ d:i[]
    186 	.byte	222	/ d:c[]
    187 	.byte	222	/ d:f[]
    188 	.byte	222	/ d:d[]
    189 	.byte	222	/ d:[][]
    190 
    191 	.byte	240	/ i[]:i
    192 	.byte	240	/ i[]:c
    193 	.byte	113	/ i[]:f
    194 	.byte	125	/ i[]:d
    195 	.byte	000	/ i[]:i[]
    196 	.byte	000	/ i[]:c[]
    197 	.byte	100	/ i[]:f[]
    198 	.byte	100	/ i[]:d[]
    199 	.byte	100	/ i[]:[][]
    200 
    201 	.byte	000	/ c[]:i
    202 	.byte	000	/ c[]:c
    203 	.byte	113	/ c[]:f
    204 	.byte	125	/ c[]:d
    205 	.byte	200	/ c[]:i[]
    206 	.byte	000	/ c[]:c[]
    207 	.byte	200	/ c[]:f[]
    208 	.byte	200	/ c[]:d[]
    209 	.byte	200	/ c[]:[][]
    210 
    211 	.byte	250	/ f[]:i
    212 	.byte	250	/ f[]:c
    213 	.byte	113	/ f[]:f
    214 	.byte	125	/ f[]:d
    215 	.byte	000	/ f[]:i[]
    216 	.byte	000	/ f[]:c[]
    217 	.byte	000	/ f[]:f[]
    218 	.byte	100	/ f[]:d[]
    219 	.byte	000	/ f[]:[][]
    220 
    221 	.byte	260	/ d[]:i
    222 	.byte	260	/ d[]:c
    223 	.byte	113	/ d[]:f
    224 	.byte	125	/ d[]:d
    225 	.byte	000	/ d[]:i[]
    226 	.byte	000	/ d[]:c[]
    227 	.byte	000	/ d[]:f[]
    228 	.byte	000	/ d[]:d[]
    229 	.byte	000	/ d[]:[][]
    230 
    231 	.byte	240	/ [][]:i
    232 	.byte	240	/ [][]:c
    233 	.byte	113	/ [][]:f
    234 	.byte	125	/ [][]:d
    235 	.byte	000	/ [][]:i[]
    236 	.byte	000	/ [][]:c[]
    237 	.byte	100	/ [][]:f[]
    238 	.byte	100	/ [][]:d[]
    239 	.byte	000	/ [][]:[][]
    240 
    241 .even
    242 
    243 / character type table
    244 
    245 .globl	_ctab
    246 
    247 _ctab: .+2
    248 	.byte 000.,127.,127.,127.,127.,127.,127.,127.
    249 	.byte 127.,126.,125.,127.,127.,127.,127.,127.
    250 	.byte 127.,127.,127.,127.,127.,127.,127.,127.
    251 	.byte 127.,127.,127.,127.,127.,127.,127.,127.
    252 	.byte 126.,034.,122.,127.,127.,044.,047.,121.
    253 	.byte 006.,007.,042.,040.,009.,041.,127.,043.
    254 	.byte 124.,124.,124.,124.,124.,124.,124.,124.
    255 	.byte 124.,124.,008.,001.,063.,080.,065.,090.
    256 	.byte 127.,123.,123.,123.,123.,123.,123.,123.
    257 	.byte 123.,123.,123.,123.,123.,123.,123.,123.
    258 	.byte 123.,123.,123.,123.,123.,123.,123.,123.
    259 	.byte 123.,123.,123.,004.,127.,005.,049.,127.
    260 	.byte 127.,123.,123.,123.,123.,123.,123.,123.
    261 	.byte 123.,123.,123.,123.,123.,123.,123.,123.
    262 	.byte 123.,123.,123.,123.,123.,123.,123.,123.
    263 	.byte 123.,123.,123.,002.,048.,003.,127.,127.
    264