From e3a8e6bbe4998a81052fa2c35ae4f683f4833aff Mon Sep 17 00:00:00 2001 From: cuz Date: Wed, 25 Oct 2000 07:06:55 +0000 Subject: [PATCH] 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 --- libsrc/runtime/Makefile | 142 ++++++++++++++++++++++++++++++++------ libsrc/runtime/axlong.s | 26 +++++++ libsrc/runtime/lconvert.s | 88 ----------------------- libsrc/runtime/tosint.s | 24 +++++++ libsrc/runtime/toslong.s | 52 ++++++++++++++ 5 files changed, 224 insertions(+), 108 deletions(-) create mode 100644 libsrc/runtime/axlong.s delete mode 100644 libsrc/runtime/lconvert.s create mode 100644 libsrc/runtime/tosint.s create mode 100644 libsrc/runtime/toslong.s diff --git a/libsrc/runtime/Makefile b/libsrc/runtime/Makefile index f4774970e..6b7fc18a8 100644 --- a/libsrc/runtime/Makefile +++ b/libsrc/runtime/Makefile @@ -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 - -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) +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 + +all: $(OBJS) clean: @rm -f *~ $(COBJS:.o=.s) $(OBJS) $(LOBJS) diff --git a/libsrc/runtime/axlong.s b/libsrc/runtime/axlong.s new file mode 100644 index 000000000..dd208bf17 --- /dev/null +++ b/libsrc/runtime/axlong.s @@ -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 + + + diff --git a/libsrc/runtime/lconvert.s b/libsrc/runtime/lconvert.s deleted file mode 100644 index f33c75415..000000000 --- a/libsrc/runtime/lconvert.s +++ /dev/null @@ -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 - - - diff --git a/libsrc/runtime/tosint.s b/libsrc/runtime/tosint.s new file mode 100644 index 000000000..aab0dded3 --- /dev/null +++ b/libsrc/runtime/tosint.s @@ -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 + diff --git a/libsrc/runtime/toslong.s b/libsrc/runtime/toslong.s new file mode 100644 index 000000000..d14915fa5 --- /dev/null +++ b/libsrc/runtime/toslong.s @@ -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 + -- 2.39.5