1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 19:29:37 +00:00

Splitted the lconvert module into three smaller ones to allow for smaller

executables if not all functions are used.


git-svn-id: svn://svn.cc65.org/cc65/trunk@392 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2000-10-25 07:06:55 +00:00
parent b0e41e487d
commit e3a8e6bbe4
5 changed files with 223 additions and 107 deletions

View File

@ -12,26 +12,128 @@
@echo $<
@$(AS) -g -o $@ $(AFLAGS) $<
OBJS = runtime.o mul.o div.o push.o inc.o dec.o shl.o shr.o add.o\
sub.o rsub.o or.o xor.o and.o neg.o bneg.o compl.o icmp.o\
call.o swap.o switch.o gt.o ugt.o ge.o makebool.o ldau0sp.o\
uge.o lt.o ult.o le.o ule.o eq.o ne.o test.o subeqsp.o\
udiv.o umod.o mod.o shelp.o aslax1.o asrax1.o shrax1.o\
aslax2.o asrax2.o shrax2.o aslax3.o asrax3.o shrax3.o\
enter.o leave.o leasp.o popsreg.o ldai.o ldaxi.o ldauisp.o\
ldaui.o pushw.o pushb.o staxsp.o ldaxsp.o addeqsp.o\
bpushbsp.o pushwsp.o pushbsp.o
OBJS = add.o \
addeqsp.o \
and.o \
aslax1.o \
aslax2.o \
aslax3.o \
asleax1.o \
asleax2.o \
asleax3.o \
asrax1.o \
asrax2.o \
asrax3.o \
asreax1.o \
asreax2.o \
asreax3.o \
axlong.o \
bneg.o \
bpushbsp.o \
call.o \
compl.o \
dec.o \
div.o \
enter.o \
eq.o \
ge.o \
gt.o \
icmp.o \
inc.o \
ladd.o \
laddeq.o \
laddeqsp.o \
land.o \
lbneg.o \
lcmp.o \
lcompl.o \
ldai.o \
ldau0sp.o \
ldaui.o \
ldauisp.o \
ldaxi.o \
ldaxsp.o \
ldeax.o \
ldeaxi.o \
ldec.o \
ldiv.o \
le.o \
leasp.o \
leave.o \
leq.o \
lge.o \
lgt.o \
linc.o \
lle.o \
llt.o \
lmod.o \
lmul.o \
lne.o \
lneg.o \
lor.o \
lpop.o \
lpush.o \
lrsub.o \
lruntime.o \
lsave.o \
lshelp.o \
lshl.o \
lshr.o \
lsub.o \
lsubeq.o \
lsubeqsp.o \
lswap.o \
lswitch.o \
lt.o \
ltest.o \
ludiv.o \
luge.o \
lugt.o \
lule.o \
lult.o \
lumod.o \
lxor.o \
makebool.o \
mod.o \
mul.o \
ne.o \
neg.o \
or.o \
popsreg.o \
push.o \
pushb.o \
pushbsp.o \
pushw.o \
pushwsp.o \
rsub.o \
runtime.o \
shelp.o \
shl.o \
shr.o \
shrax1.o \
shrax2.o \
shrax3.o \
shreax1.o \
shreax2.o \
shreax3.o \
staxsp.o \
steaxsp.o \
sub.o \
subeqsp.o \
swap.o \
switch.o \
test.o \
tosint.o \
toslong.o \
udiv.o \
uge.o \
ugt.o \
ule.o \
ult.o \
umod.o \
xor.o
LOBJS = lruntime.o lconvert.o ladd.o lsub.o lrsub.o leq.o lne.o\
lneg.o lbneg.o lcompl.o lpush.o land.o lor.o lxor.o ldeaxi.o\
ltest.o llt.o lle.o lge.o lgt.o lsave.o asleax1.o laddeqsp.o\
asreax1.o shreax1.o asleax2.o asreax2.o shreax2.o lsubeqsp.o\
asleax3.o asreax3.o shreax3.o lmul.o lshelp.o ludiv.o lumod.o\
ldiv.o lmod.o lswitch.o steaxsp.o lshr.o lshl.o lcmp.o lugt.o\
luge.o lult.o lule.o linc.o ldec.o lswap.o lpop.o ldeax.o\
lsubeq.o laddeq.o
all: $(OBJS) $(LOBJS)
all: $(OBJS)
clean:
@rm -f *~ $(COBJS:.o=.s) $(OBJS) $(LOBJS)

26
libsrc/runtime/axlong.s Normal file
View File

@ -0,0 +1,26 @@
;
; Ullrich von Bassewitz, 25.10.2000
;
; CC65 runtime: Convert int in ax into a long
;
.export axulong, axlong
.importzp sreg
; Convert AX from int to long in EAX
axulong:
ldy #0
sty sreg
sty sreg+1
rts
axlong: cpx #$80 ; Positive?
bcc axulong ; Yes, handle like unsigned type
ldy #$ff
sty sreg
sty sreg+1
rts

View File

@ -1,88 +0,0 @@
;
; Ullrich von Bassewitz, 05.08.1998
;
; CC65 runtime: long conversion routines
;
;
; Convert TOS from long to int by cutting of the high 16bit
;
.export tosint, tosulong, toslong, axulong, axlong
.import incsp2, decsp2
.importzp sp, sreg
tosint: pha
ldy #0
lda (sp),y ; sp+1
ldy #2
sta (sp),y
ldy #1
lda (sp),y
ldy #3
sta (sp),y
pla
jmp incsp2 ; Drop 16 bit
;
; Convert TOS from int to long
;
tosulong:
pha
jsr decsp2 ; Make room
ldy #2
lda (sp),y
ldy #0
sta (sp),y
ldy #3
lda (sp),y
ldy #1
sta (sp),y
lda #0 ; Zero extend
toslong2:
iny
sta (sp),y
iny
sta (sp),y
pla
rts
toslong:
pha
jsr decsp2 ; Make room
ldy #2
lda (sp),y
ldy #0
sta (sp),y
ldy #3
lda (sp),y
bmi toslong1
ldy #1
sta (sp),y
lda #$00 ; Positive, high word is zero
bne toslong2
toslong1:
ldy #1
sta (sp),y
lda #$FF
bne toslong2
;
; Convert AX from int to long in EAX
;
axulong:
ldy #0
sty sreg
sty sreg+1
rts
axlong: cpx #$80 ; Positive?
bcc axulong ; Yes, handle like unsigned type
ldy #$ff
sty sreg
sty sreg+1
rts

24
libsrc/runtime/tosint.s Normal file
View File

@ -0,0 +1,24 @@
;
; Ullrich von Bassewitz, 25.10.2000
;
; CC65 runtime: Convert tos from long to int
;
.export tosint
.import incsp2
.importzp sp
; Convert TOS from long to int by cutting of the high 16bit
tosint: pha
ldy #0
lda (sp),y ; sp+1
ldy #2
sta (sp),y
ldy #1
lda (sp),y
ldy #3
sta (sp),y
pla
jmp incsp2 ; Drop 16 bit

52
libsrc/runtime/toslong.s Normal file
View File

@ -0,0 +1,52 @@
;
; Ullrich von Bassewitz, 25.10.2000
;
; CC65 runtime: Convert tos from int to long
;
.export tosulong, toslong
.import decsp2
.importzp sp
; Convert TOS from int to long
tosulong:
pha
jsr decsp2 ; Make room
ldy #2
lda (sp),y
ldy #0
sta (sp),y
ldy #3
lda (sp),y
ldy #1
sta (sp),y
lda #0 ; Zero extend
toslong2:
iny
sta (sp),y
iny
sta (sp),y
pla
rts
toslong:
pha
jsr decsp2 ; Make room
ldy #2
lda (sp),y
ldy #0
sta (sp),y
ldy #3
lda (sp),y
bmi toslong1
ldy #1
sta (sp),y
lda #$00 ; Positive, high word is zero
bne toslong2
toslong1:
ldy #1
sta (sp),y
lda #$FF
bne toslong2