[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lcc for the GS - info
- Subject: lcc for the GS - info
- From: tm@netcom.com (Toshiyasu Morita)
- Date: Tue, 27 Apr 1993 08:51:47 GMT
- Keywords: lcc C compiler info
- Newsgroups: comp.sys.apple2
- Organization: NETCOM On-line Communication Services (408 241-9760 guest)
If anyone's interested, I've been working on an 65816 C compiler for a while
and it's starting to generate code.
Briefly, the C compiler consists of the lcc-1.9 C front-end and a custom
code generator back-end which outputs code for a 32-bit single register
virtual machine, and a utility called VM2GS which reads VM code and
outputs peephole-optimized 65816 code.
Currently it's hosted under MS-DOS (Watcom C/386), and there are no libraries
for it yet so it's not ready for general use, but it may be attractive for
hardcore programmers.
If you're a C/assembly programmer and would like to help by
bug-hunting, writing libraries, or attempting to compile it
under ORCA/C please send mail to me (tm@netcom.com).
For the curious, here's some sample input code:
char *strcat(char *s1, const char *s2)
{
char *dest = s1;
while (*dest)
dest++;
while (*dest++ = *s2++);
return s1;
}
and the corresponding output: (comments and spacing mine)
_strcat start
longa on
longi on
scratch equ 1
_dest equ 5
temp0 equ 9
temp1 equ 11
temp2 equ 13
temp3 equ 15
_s1 equ 20
_s2 equ 24
tsc
sec
sbc #16
tcs
phd
tcd
lda <_s1 ; *dest = *s1;
ldx <_s1+2
sta <_dest
stx <_dest+2
jmp L40
L39 anop
inc <_dest ; dest++;
bne *+4
inc <_dest+2
L40 anop ; if (*dest != 0) goto L39
lda [<_dest]
and #$00ff
ldx #0
bit #$0080
beq *+6
ora #$ff00
dex
sta scratch
stx scratch+2
CMP4 scratch,#0
beq *+5
jmp L39
L42 anop
L43 anop ; temp0 = dest; dest++;
lda <_dest
ldx <_dest+2
sta <temp0
stx <temp0+2
inc a
bne *+3
inx
sta <_dest
stx <_dest+2
lda <_s2 ; temp2 = s2; s2++;
ldx <_s2+2
sta <temp2
stx <temp2+2
inc a
bne *+3
inx
sta <_s2
stx <_s2+2
lda [<temp2] ; *temp0 = *temp2;
sta <temp2
sep #$20
longa off
sta <temp3
rep #$20
longa on
lda <temp3
sep #$20
longa off
sta [<temp0]
rep #$20
longa on
lda <temp2 ; if (*temp2 != 0) goto L42
ldx <temp2+2
and #$00ff
ldx #0
bit #$0080
beq *+6
ora #$ff00
dex
sta scratch
stx scratch+2
CMP4 scratch,#0
beq *+5
jmp L42
lda <_s1 ; return s1;
ldx <_s1+2
tay
pld
tsc
clc
adc #16
tcs
tya
rtl
L38 anop ; (extra return code I haven't suppressed yet)
tay
pld
tsc
clc
adc #16
tcs
tya
rtl
_strcat end
Toshi Morita
tm@netcom.com