-
Notifications
You must be signed in to change notification settings - Fork 0
/
small_c_compiler.z80
11019 lines (9864 loc) · 291 KB
/
small_c_compiler.z80
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
EOF: EQU 26
EOL: EQU 13
YES: EQU 1
NO: EQU 0
BPW: EQU 2
LBPW: EQU 1
SBPC: EQU 1
COMPSIZE: EQU 4
NAMESIZE: EQU 14
NAMEMAX: EQU NAMESIZE+1
IDENT: EQU 0
TYPE: EQU 1
CLASS: EQU 2
OFFSET: EQU 3
INFOBYTE: EQU 5 ; bit 0 if unsigned
; bit 1 if function defined
; bit 2 if used
; bit 3 if struct item
; bit 4 if autostatic
; bit 5 if discardable
; bit 6 if const
SIZEOF: EQU 6
PARMS: EQU 8 ; 0 for void, -1 for auto & variadic
IDENT2: EQU 9
IDENT3: EQU 10
IDENT4: EQU 11
ONE: EQU 12
EXTEND: EQU 13
MENOSTR: EQU 15
NAME: EQU 17
SYMMAX: EQU NAME+NAMEMAX ; 32
SYMAVG: EQU SYMMAX ; 32
NUMLOCS: EQU 50
STARTLOC: EQU symtab
ENDLOC: EQU NUMLOCS*SYMAVG+symtab
NUMGLBS: EQU 800-50
STARTGLB: EQU ENDLOC
ENDGLB: EQU NUMGLBS-1*SYMMAX+ENDLOC
SYMTBSZ: EQU 25600 ; (50+750)*32
VARIABLE: EQU 1+128
ARRAY: EQU 2+128
POINTER: EQU 3+128
FUNCTION: EQU 4+128
MENOVKA: EQU 5+128
SYMBOL: EQU 6+128
LABEL: EQU 128
CVOID: EQU %0010 ; 2
CCHAR: EQU %0100 ; 4
CUCHAR: EQU %0101 ; 5
CINT: EQU %1000 ; 8
CUINT: EQU %1001 ; 9
CLONG: EQU %1100 ; 16
CULONG: EQU %1101 ; 17
CFLOAT: EQU %10000 ; 32
CDOUBLE: EQU %10001 ; 33
CSTRUCT: EQU %10000000 ; 128
CUNION: EQU %10000001 ; 129
CENUM: EQU %10000010 ; 130
MASK: EQU %11100
STATIC: EQU 1 ; g
AUTOMATIC: EQU 2 ; l
EXTERNAL: EQU 3 ; g
AUTOEXT: EQU 4 ; l
REGISTER: EQU 5 ; l
TYPEDEF: EQU 6
SWSIZ: EQU 2*2
SWTABSZ: EQU 35*SWSIZ
WQSIZ: EQU 3*2
WQTABSZ: EQU WQSIZ*15
WQMAX: EQU wq+WQTABSZ-WQSIZ
WQSP: EQU 0
WQLOOP: EQU 2
WQEXIT: EQU 4
LITABSZ: EQU 1024
LITMAX: EQU LITABSZ-1
LINESIZE: EQU 1024
LINEMAX: EQU LINESIZE-1
STAGESIZE: EQU 800
STAGELIMIT: EQU STAGESIZE-1
MACNBR: EQU 256
MACNSIZE: EQU NAMEMAX+3*MACNBR
MACEND: EQU macn+MACNSIZE
MACQSIZE: EQU MACNBR*8
MACMAX: EQU MACQSIZE-1
STEXPR: EQU 7
To: EQU 160
Tauto: EQU To
Tstatic: EQU 01+To
Textern: EQU 02+To
Tregister: EQU 03+To
Ttypedef: EQU 04+To
Tchar: EQU 05+To
Tshort: EQU 06+To
Tint: EQU 07+To
Tlong: EQU 08+To
Tunsigned: EQU 09+To
Tfloat: EQU 10+To
Tdouble: EQU 11+To
Tenum: EQU 12+To
Tstruct: EQU 13+To
Tunion: EQU 14+To
Tif: EQU 15+To
Telse: EQU 16+To
Twhile: EQU 17+To
Tdo: EQU 18+To
Tfor: EQU 19+To
Tswitch: EQU 20+To
Tcase: EQU 21+To
Tdefault: EQU 22+To
Tbreak: EQU 23+To
Tcont: EQU 24+To
Treturn: EQU 25+To
Tgoto: EQU 26+To
Tconst: EQU 31+To
T#define: EQU 49+To
T#undef: EQU 50+To
T#include: EQU 51+To
T#ifdef: EQU 52+To
T#ifndef: EQU 53+To
T#ifdeclared: EQU 54+To
T#else: EQU 55+To
T#endif: EQU 56+To
T#error: EQU 57+To
T#asm: EQU 58+To
T#endasm: EQU T#asm+1
T#pragma: EQU 60+To
Tsizeof: EQU 61+To
Tvoid: EQU 62+To
T#if: EQU 63+To
Tsigned: EQU 64+To
Tinterrupt: EQU 65+To
T#elif: EQU 66+To
Tdefined: EQU 67+To
T#warning: EQU 68+To
BUFER: EQU &80
ORG 0
DUMP 11,0
JP main+32768
JP zotav+32768
file.page: DS 2
errors: DS 1
liness: DS 2
linesd: DS 2
destiny: DB 0
DW 0
prefix: DB "C","C"
warnings: NOP
optimize: NOP
uchar: DB 1
myorg: DW 32768
codesp: DW &4A00
global: DW 0
objects: DW STARTGLB
macros: DW macn
fast: DB 0
smalljmp: DB 0
startcode: DB 1
skipline: DB 0
makier: DB 0
fname: DM "1234567890"
svflag: NOP
smartcode: DB 1
DS &38-$
ORG &38
PUSH HL
LD HL,0
INC HL
LD (&3A),HL
POP HL
EI
RET
zotav: LD (zot+1+32768),A
IN A,(250)
SUB COMPSIZE
OUT (250),A
JP $+3
LD SP,0
callsp: EQU $-2
AND 31
ADD 2
OUT (251),A
zot: LD A,0
DB 195
loopv: DW 0
DS &66-$
NMI: NOP
LD A,201
LD (NMI),A
LD (errstack),SP
abort: LD A,1
JP volaj
errstack: DW 0
DS &100-$
ORG &100
main: IN A,(250)
LD (lmpr+32768),A
LD (stc+32768),SP
EI
SUB COMPSIZE
OUT (250),A
JP $+3
LD SP,&7FC0
CALL init.c
LD A,(svflag)
AND A
CALL NZ,addsvmac
CALL preprocess
CALL option
CALL header
CALL parse
CALL outside
CALL trailer
CALL fclose
XOR A
volaj: LD B,A
IN A,(250)
AND 31
OUT (251),A
JP $+3+32768
LD A,(lmpr+32768)
LD SP,(stc+32768)
OUT (250),A
LD A,B
RET
lmpr: NOP
stc: DW 0
init.c: IN A,(250)
ADD 2
AND 31
OUT (251),A
LD A,(file.page)
LD (source),A
LD A,(file.page+1)
LD (destiny),A
LD HL,swq
LD (swnext),HL
LD IY,&8000
LD (source+1),IY
LD (destiny+1),IY
LD HL,swq+SWTABSZ-SWSIZ
LD (swend),HL
LD HL,stage+STAGELIMIT
LD (stagelast),HL
LD HL,STARTGLB
LD (glbptr),HL
XOR A
LD L,A
LD H,A
LD (NMI),A
LD (incom),A
LD (swactive),A
LD (errors),A
LD (test2),A
LD (stagenext),HL
LD (iflevel),A
LD (discard2),A
LD (esc),A
LD (nxtlab),HL
LD (&3A),HL
LD (skiplevel),HL
LD (macptr),HL
LD (csp),HL
LD (global),HL
LD (errflag),A
LD (eof),A
LD (ncmp),A
LD (input),A
LD (makier),A
INC A
LD (ccode),A
LD A,&22
LD (quote),A
LD A,"0"
LD (quote+1),A
LD HL,wq
LD (wqptr),HL
LD A,EOF
LD (input2),A
LD HL,"@"
LD (hk+1),HL
LD HL,symtab
LD DE,symtab+1
LD BC,end2-symtab-1
LD (HL),0
LDIR
CALL openfile
LD A,(smalljmp)
AND A
LD A,"p"
JR Z,$+4
LD A,"r"
LD (mov10+1),A
LD (mov121+1),A
LD (mov131+1),A
LD (mov141+1),A
LD HL,fname
LD DE,fname2
LD BC,8
LDIR
LD HL,symbuf+2
LD (symbuf),HL
LD HL,extbuf+2
LD (extbuf),HL
RET
option: LD A,T#pragma
CALL matches
RET NZ
JP dopragma
dovars: LD A,Tregister ; pre istotu
CALL matches
LD A,Tauto
CALL matches
LD A,Tinterrupt
CALL matches
LD (intf),A
LD A,Ttypedef
CALL matches
LD (tfl),A ; zero if typedef
JR NZ,l0
LD A,TYPEDEF
JP dodeclare
l0: LD A,Textern
CALL matches
JR NZ,l1
LD A,EXTERNAL
JP dodeclare
l1: LD A,Tstatic
CALL matches
LD A,STATIC
JP dodeclare
parse: LD A,(eof)
AND A
RET NZ
CALL dovars
JR NZ,parse1
LD HL,tabcom
CALL dotok
LD A,H
OR L
JR Z,l5
PUSH HL
CALL preskoc
POP HL
CALL jphl
JR parse1
l5: CALL newfunc
parse1: CALL blanks
JP parse
dotok: LD A,(ch)
LD C,A
findtok: LD A,(HL)
INC HL
AND A
JP Z,nula
CP C
JP Z,hlhl
INC HL
INC HL
JR findtok
doendasm: LD A,1
LD (ccode),A
JP kill
dopragma: LD HL,msname
CALL symname
LD HL,msname
LD DE,pragma.1
CALL streq
CP 4
JR NZ,r0
LD (argc),A
RET
r0: LD HL,msname
LD DE,pragma.2
CALL streq
CP 4
JR NZ,r1
LD A,(test2)
XOR 1
LD (test2),A
RET
r1: LD HL,msname
LD DE,pragma.3
CALL streq
CP 6
JR NZ,r2
CALL volby
RET
r2: CALL kill
RET
volby: LD HL,atab
yr: LD A,(HL)
AND A
JR Z,xr
PUSH HL
CALL matches
POP HL
INC HL
CALL dehl
INC HL
JR NZ,yr
EX DE,HL
JP (HL)
xr: CALL error
DM "bad option switch"
NOP
CALL kill
RET
poo: CALL tog
XOR 1
LD (optimize),A
volby2: LD A,","
CALL matches
RET NZ
JR volby
pf: CALL tog
LD (fast),A
JR volby2
pa: CALL value
LD (myorg),HL
JR volby2
ps: CALL value
LD (codesp),HL
JR volby2
pv: CALL tog
LD (svflag),A
JR volby2
pp: CALL tog
LD (startcode),A
JR volby2
pu: CALL tog
LD (uchar),A
JR volby2
pr: CALL value
LD A,H
AND A
JR Z,volby2
LD A,L
AND A
JR Z,volby2
LD (prefix),HL
JR volby2
pj: CALL tog
LD (smalljmp),A
JR volby2
pc: CALL tog
LD (skipline),A
JR volby2
px: CALL tog
LD (pushreg),A
JR volby2
pi: CALL tog
CP 1
SBC 1
LD (regflag),A
JP volby2
pee: LD A,1
LD (esc),A
JP volby2
pl: CALL tog
LD (smartcode),A
JR volby2
tog: LD A,"-"
CALL matches
RET Z
LD A,"+"
CALL matches
LD A,1
RET Z
CALL error
DM "'+' or '-' use only"
NOP
XOR A
RET
dumplits: LD (cald),A ; A = size
LD HL,0 ; k
LD (mysk),HL
dumpli: LD HL,(litptr)
LD DE,(mysk)
AND A
SBC HL,DE
RET Z ; RET if k=(litptr)
LD A,(cald)
CALL defstorage
LD B,11
dodefb: PUSH BC ; j = pocet defb
LD A,(cald)
LD HL,(mysk)
LD DE,litq
ADD HL,DE ; indexuj do zasobnika
CP 1 ; HL odkial
PUSH AF
CALL NZ,hlhl ; A velkost
POP AF
JR NZ,$+5
LD L,(HL)
LD H,0
JR NZ,nout
LD A,L
CP " "
JR C,nout
CP 128
JR NC,nout
CP 34
JR Z,nout
PUSH HL
LD A,34
CALL outbyte
POP HL
LD A,L
CALL outbyte
LD A,34
CALL outbyte
JR zaou
nout: CALL outdec
zaou: LD HL,(mysk)
LD DE,(cald)
LD D,0
ADD HL,DE
LD (mysk),HL
LD DE,(litptr)
AND A
SBC HL,DE
POP BC
JR NC,konec
DEC B
JR Z,konec
LD A,","
CALL outbyte
JR dodefb
konec: CALL nl
JP dumpli
dumpzero: LD E,A ; A = velkost
LD D,0
EX DE,HL
CALL CCUMUL ; HL =pocet
dumpl1: BIT 7,D
RET NZ ; -1 nic
LD A,H
OR L
RET Z ; 0 nic
CALL defspace
RET Z ; bol nop
CALL outdec
JP nl
defspace: DEC HL
LD A,H
OR L
JR NZ,nonop
LD HL,nopt
CALL ol
XOR A
RET
nonop: DEC HL
LD A,H
OR L
JR NZ,nonop2
LD A,2
CALL defstorage
LD HL,0
XOR A
INC A
RET
nonop2: PUSH HL
LD A,3
CALL defstorage
POP HL
INC HL
INC HL
XOR A
INC A
RET
outside: LD HL,ncmp
LD A,(ccode)
XOR 1
OR (HL)
LD HL,iflevel
OR (HL)
RET Z
CALL error
DM "no closing #endasm or #endif"
DB 0
RET
fclose: LD A,(destiny) ; zatvor vystupny subor
LD (file.page+1),A
INC IY
LD (destiny+1),IY
RET
openfile: IN A,(251) ; otvor include
EX AF,AF'
LD A,(destiny)
OUT (251),A
LD (IY+0),0
INC IY
EX AF,AF'
OUT (251),A
RET
doinclude: CALL blanks ; !!!!!!!!
LD A,(input2)
CP EOF
JR Z,prvi
CALL error
DM "include nested"
NOP
JP kill
prvi: CALL getname
JR NC,incerr
LD HL,filename
PUSH IY
PUSH IX
CALL fopen
POP IX
POP IY
LD (input2),A ; EOF ak nieje OK
CP EOF
JP NZ,kill
incerr: CALL error
DM "open failure on include file"
DB 0
JP kill
getname: LD A,34
CALL matches
JR Z,oknames
LD A,"<"
CALL matches
JR Z,oknames
CALL error
DM "bad include name"
NOP
SCF
CCF ; nc = err
RET
oknames: LD B,10
LD HL,filename
LD DE,(lptr)
get1: LD A,(DE)
CP 34
JR Z,get2
CP ">"
JR Z,get2
LD (HL),A
INC HL
INC DE
DEC B
JR NZ,get1
get2: DEC B
SCF
RET M
LD (HL)," "
INC HL
JR get2
dodeclare: LD B,A ; vola sa z reg. A
PUSH BC ; = STATIC or EXTERN
XOR A ; (static, extern)
LD (unsigned),A
CALL settype ; A=type or NULL
POP BC
RET Z ; neuspel
CALL declglb ; A & B
JP jedna ; vracia tiez reg. A
dotype: CALL blanks ; vracia -1 : 0 podla
LD HL,(lptr) ; to synonymum
PUSH HL
LD HL,ssname
PUSH HL
CALL symname
POP HL
JR NC,v2
CALL findglb
JR Z,v2
INC HL
INC HL
LD A,(HL)
CP TYPEDEF
JR NZ,v2
DEC HL
DEC HL
LD (synonym),HL
POP HL
LD A,&40
RET
v2: POP HL
CALL bump2 ; obnovi lptr
JP nula
unava: CALL warning
DM "not implemented - int used"
NOP
CALL preskoc
LD A,CINT
JR mastyp ; float, long ... ako int
settype: LD HL,0
LD (synonym),HL
LD (menovka),HL
LD (extensia),HL
XOR A
LD (constf),A
LD (unsigned),A
CALL clstru2
LD A,Tconst
CALL matches
JR NZ,$+6
INC A
LD (constf),A
LD A,Tunsigned ; implicint unsign
CALL matches
JR NZ,dodec21
INC A
LD (unsigned),A
JR dodec2
dodec21: LD A,Tsigned ; implicint signed
CALL matches
JR NZ,dodec2
LD A,2
LD (unsigned),A
dodec2: LD A,(ch)
CP Tlong
JR Z,unava
CP Tdouble
JR Z,unava
CP Tfloat
JR Z,unava
LD A,Tstruct
CALL matches
JR NZ,dodecl
LD A,CSTRUCT
mastyp: AND A ; nastav NZ a vrat typ
RET
dodecl: LD A,Tunion
CALL matches
LD A,CUNION
JR Z,mastyp
LD A,Tenum
CALL matches
LD A,CENUM
JR Z,mastyp
LD A,Tshort
CALL matches
JP Z,dodec9 ; posud aj znaminko
LD A,Tvoid
CALL matches
LD A,CVOID
JR Z,mastyp
LD A,Tchar
CALL matches
JR NZ,dodec1
LD B,CCHAR
LD HL,unsigned
LD A,(HL)
AND A
JR Z,$+7
dosign: AND 1 ; explicint
OR B
JR mastyp
LD A,(uchar) ; implicint
OR B
JR mastyp
dodec1: CALL match
DB Tint
LD HL,unsigned
LD A,(HL)
LD B,CINT
JR Z,dosign
AND 3 ; samotne unsigned
JR Z,dot6
CP 2
LD A,CUINT
JR NZ,mastyp
LD A,CINT ; samotne signed
JR mastyp
dot6: CALL dotype
AND A
JR Z,mastyp
expdef: PUSH IX ; typedef
LD IX,(synonym)
LD A,(IX+IDENT)
LD (jj),A
LD A,(IX+IDENT2)
LD (jj+1),A
LD A,(IX+IDENT3)
LD (stru2+15),A
LD L,(IX+SIZEOF)
LD H,(IX+SIZEOF+1)
LD (stru2+12),HL
LD A,(IX+ONE)
LD (one),A
LD A,(IX+TYPE) ; zober si typ
LD (dtype),A
LD L,(IX+MENOSTR)
LD H,(IX+MENOSTR+1)
LD (menovka),HL
POP IX ; u struktur set menovka
JP mastyp
dodec9: CALL match
DB Tint
LD A,CINT
JP Z,mastyp
XOR A
LD A,2
LD (unsigned),A
JP dodec1+4
setjj: PUSH AF ; IDENT -> IDENT2 -> IDENT3
LD A,(jj+1)
LD (stru2+15),A
LD A,(jj)
LD (jj+1),A
POP AF
LD (jj),A
RET
anonym: LD A,"_"
LD (ssname),A
hk: LD HL,"@"
INC HL
LD (hk+1),HL
LD (ssname+1),HL
RET
dostruct: LD A,(synonym+1)
AND A
JP NZ,named ; via typedef
LD HL,ssname ; spracovanie strukturovanych
CALL symname ; premennych struct, enum ..
CALL NC,anonym
CALL clstru2
LD HL,ssname
CALL findglb
LD (menovka),HL ; hl=cptr
JP NZ,named ; ide o definovanie
LD HL,ssname
LD (stru2),HL
LD HL,MENOVKA
LD (stru2+2),HL
LD A,(dtype3)
LD (stru2+4),A ; type = ENUM, STRUCT, UNION
LD HL,glbptr
LD (stru2+8),HL
LD HL,(dclas)
LD H,0
LD (stru2+10),HL
; uloz menovku predbezne
CALL addsym
LD (menovka),HL
LD A,"{"
CALL needtoken
XOR A
LD (parms),A
LD HL,0
LD (some3),HL ; posun pre polozky (stru2+6
LD (some4),HL ; sizeof =0
LD HL,msname
LD (stru2),HL ; name
LD HL,SYMBOL
LD (stru2+2),HL ; ident = SYMBOL
LD A,(dtype3)
CP CENUM
JP Z,doenum ; enum urob oddelene
nexitem: CALL dositem ; hl=sizeof
JR Z,serr
CALL aktualizuj ; hl a de
CALL dosymbol2 ; type, ident is set
LD A,","
CALL matches
JR NZ,cezcoma
CALL dositemx
JR nexitem+3
cezcoma: LD A,":"
CALL matches
JR NZ,nobitf
CALL error
DM "bitfields isn't implemented"