From e5eda9d6a5ea34e83b0b1fdcf05db3b04b7aaac8 Mon Sep 17 00:00:00 2001 From: MaartenBrock Date: Fri, 15 Sep 2006 06:52:50 +0000 Subject: [PATCH] moved mcs51 linker to as/link/mcs51 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4378 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 38 ++++++++ Makefile.in | 2 +- as/{ => link}/mcs51/Makefile.aslink | 0 as/link/mcs51/Makefile.bcc | 17 ++++ as/link/mcs51/Makefile.in | 111 ++++++++++++++++++++++ as/link/mcs51/alloc.h | 4 + as/{ => link/mcs51}/aslink.dsp | 64 ++++++------- as/{ => link}/mcs51/aslink.h | 0 as/{ => link}/mcs51/aslink.mak | 0 as/link/mcs51/clean.mk | 25 +++++ as/link/mcs51/conf.mk | 10 ++ as/{ => link}/mcs51/lkaomf51.c | 0 as/{ => link}/mcs51/lkarea.c | 0 as/{ => link}/mcs51/lkdata.c | 0 as/{ => link}/mcs51/lkeval.c | 0 as/{ => link}/mcs51/lkhead.c | 0 as/{ => link}/mcs51/lkihx.c | 0 as/{ => link}/mcs51/lklex.c | 0 as/{ => link}/mcs51/lklibr.c | 0 as/{ => link}/mcs51/lklist.c | 0 as/{ => link}/mcs51/lkmain.c | 0 as/{ => link}/mcs51/lkmem.c | 0 as/{ => link}/mcs51/lknoice.c | 0 as/{ => link}/mcs51/lkrloc.c | 0 as/{ => link}/mcs51/lks19.c | 0 as/{ => link}/mcs51/lkstore.c | 0 as/{ => link}/mcs51/lksym.c | 0 as/link/mcs51/readme.390 | 141 ++++++++++++++++++++++++++++ as/link/mcs51/strcmpi.c | 35 +++++++ as/link/mcs51/strcmpi.h | 3 + as/mcs51/Makefile.bcc | 13 +-- as/mcs51/Makefile.in | 24 ++--- as/mcs51/clean.mk | 2 +- configure | 2 +- sdcc.dsw | 2 +- 35 files changed, 424 insertions(+), 69 deletions(-) rename as/{ => link}/mcs51/Makefile.aslink (100%) create mode 100644 as/link/mcs51/Makefile.bcc create mode 100644 as/link/mcs51/Makefile.in create mode 100644 as/link/mcs51/alloc.h rename as/{ => link/mcs51}/aslink.dsp (76%) rename as/{ => link}/mcs51/aslink.h (100%) rename as/{ => link}/mcs51/aslink.mak (100%) create mode 100644 as/link/mcs51/clean.mk create mode 100644 as/link/mcs51/conf.mk rename as/{ => link}/mcs51/lkaomf51.c (100%) rename as/{ => link}/mcs51/lkarea.c (100%) rename as/{ => link}/mcs51/lkdata.c (100%) rename as/{ => link}/mcs51/lkeval.c (100%) rename as/{ => link}/mcs51/lkhead.c (100%) rename as/{ => link}/mcs51/lkihx.c (100%) rename as/{ => link}/mcs51/lklex.c (100%) rename as/{ => link}/mcs51/lklibr.c (100%) rename as/{ => link}/mcs51/lklist.c (100%) rename as/{ => link}/mcs51/lkmain.c (100%) rename as/{ => link}/mcs51/lkmem.c (100%) rename as/{ => link}/mcs51/lknoice.c (100%) rename as/{ => link}/mcs51/lkrloc.c (100%) rename as/{ => link}/mcs51/lks19.c (100%) rename as/{ => link}/mcs51/lkstore.c (100%) rename as/{ => link}/mcs51/lksym.c (100%) create mode 100644 as/link/mcs51/readme.390 create mode 100644 as/link/mcs51/strcmpi.c create mode 100644 as/link/mcs51/strcmpi.h diff --git a/ChangeLog b/ChangeLog index 0e3315f2..0207c575 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,41 @@ +2006-09-15 Maarten Brock + + as/link/mcs51 + as/aslink.dsp, as/link/mcs51/aslink.dsp, + as/link/mcs51/aslink.h, as/mcs51/aslink.h, + as/link/mcs51/aslink.mak, as/mcs51/aslink.mak, + as/link/mcs51/lkaomf51.c, as/mcs51/lkaomf51.c, + as/link/mcs51/lkarea.c, as/mcs51/lkarea.c, + as/link/mcs51/lkdata.c, as/mcs51/lkdata.c, + as/link/mcs51/lkeval.c, as/mcs51/lkeval.c, + as/link/mcs51/lkhead.c, as/mcs51/lkhead.c, + as/link/mcs51/lkihx.c, as/mcs51/lkihx.c, + as/link/mcs51/lklex.c, as/mcs51/lklex.c, + as/link/mcs51/lklibr.c, as/mcs51/lklibr.c, + as/link/mcs51/lklist.c, as/mcs51/lklist.c, + as/link/mcs51/lkmain.c, as/mcs51/lkmain.c, + as/link/mcs51/lkmem.c, as/mcs51/lkmem.c, + as/link/mcs51/lknoice.c, as/mcs51/lknoice.c, + as/link/mcs51/lkrloc.c, as/mcs51/lkrloc.c, + as/link/mcs51/lks19.c, as/mcs51/lks19.c, + as/link/mcs51/lkstore.c, as/mcs51/lkstore.c, + as/link/mcs51/lksym.c, as/mcs51/lksym.c, + as/link/mcs51/Makefile.aslink, as/mcs51/Makefile.aslink, + as/link/mcs51/alloc.h, + as/link/mcs51/clean.mk, + as/link/mcs51/conf.mk, + as/link/mcs51/Makefile.bcc, + as/link/mcs51/Makefile.in, + as/link/mcs51/readme.390, + as/link/mcs51/strcmpi.c, + as/link/mcs51/strcmpi.h, + as/mcs51/clean.mk, + as/mcs51/Makefile.bcc, + as/mcs51/Makefile.in, + configure, + Makefile.in, + sdcc.dsw: moved mcs51 linker to as/link/mcs51 + 2006-09-14 Maarten Brock * as/link, diff --git a/Makefile.in b/Makefile.in index fd9410ad..54f76486 100644 --- a/Makefile.in +++ b/Makefile.in @@ -25,7 +25,7 @@ SDCC_ASLINK += as/hc08 endif ifeq ($(OPT_DISABLE_MCS51), 0) -SDCC_ASLINK += as/mcs51 +SDCC_ASLINK += as/mcs51 as/link/mcs51 SDCC_MISC += debugger/mcs51 endif diff --git a/as/mcs51/Makefile.aslink b/as/link/mcs51/Makefile.aslink similarity index 100% rename from as/mcs51/Makefile.aslink rename to as/link/mcs51/Makefile.aslink diff --git a/as/link/mcs51/Makefile.bcc b/as/link/mcs51/Makefile.bcc new file mode 100644 index 00000000..a61786ee --- /dev/null +++ b/as/link/mcs51/Makefile.bcc @@ -0,0 +1,17 @@ +# Makefile for Borland C++ + +PRJDIR = ../.. + +!include $(PRJDIR)/Bcc.inc + +LKOBJECTS = lkmain.obj lkhead.obj lkarea.obj lkdata.obj \ + lkeval.obj lklex.obj lksym.obj lkrloc.obj \ + lklibr.obj lklist.obj lkihx.obj lks19.obj \ + lkstore.obj lknoice.obj lkmem.obj lkaomf51.obj strcmpi.obj + +ASLINK = $(PRJDIR)/bin/aslink.exe + +all: $(ASLINK) + +$(ASLINK): $(LKOBJECTS) + $(CC) $(CFLAGS) -e$@ $(LKOBJECTS) diff --git a/as/link/mcs51/Makefile.in b/as/link/mcs51/Makefile.in new file mode 100644 index 00000000..90d52bd7 --- /dev/null +++ b/as/link/mcs51/Makefile.in @@ -0,0 +1,111 @@ +# +# +# + +VERSION = @VERSION@ +VERSIONHI = @VERSIONHI@ +VERSIONLO = @VERSIONLO@ +VERSIONP = @VERSIONP@ + +SHELL = /bin/sh +CC = @CC@ +CPP = @CPP@ +INSTALL = @INSTALL@ +STRIP = @STRIP@ + +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +libdir = @libdir@ +datadir = @datadir@ +includedir = @includedir@ +mandir = @mandir@ +man1dir = $(mandir)/man1 +man2dir = $(mandir)/man2 +infodir = @info@ + +EXEEXT = @EXEEXT@ + +VPATH = @srcdir@ + +CPPFLAGS = @CPPFLAGS@ -I. -I$(srcdir) +CFLAGS = @CFLAGS@ -Wall -DINDEXLIB +M_OR_MM = @M_OR_MM@ +LDFLAGS = @LDFLAGS@ + +LKOBJECTS = lkmain.o lkhead.o lkarea.o lkdata.o \ + lkeval.o lklex.o lksym.o lkrloc.o \ + lklibr.o lklist.o lkihx.o lks19.o \ + lkstore.o lknoice.o lkmem.o lkaomf51.o strcmpi.o +LKSOURCES = $(patsubst %.o,%.c,$(LKOBJECTS)) + +ASLINK = $(top_builddir)bin/aslink$(EXEEXT) + +transform = @program_transform_name@ + +# Compiling entire program or any subproject +# ------------------------------------------ +all: checkconf $(ASLINK) + +$(ASLINK): $(LKOBJECTS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(LKOBJECTS) + +# Compiling and installing everything and running test +# ---------------------------------------------------- +install: all installdirs + $(INSTALL) $(ASLINK) `echo $(DESTDIR)$(bindir)/aslink$(EXEEXT)|sed '$(transform)'` + $(STRIP) `echo $(DESTDIR)$(bindir)/aslink$(EXEEXT)|sed '$(transform)'` + +# Deleting all the installed files +# -------------------------------- +uninstall: + rm -f $(DESTDIR)$(bindir)/aslink$(EXEEXT) + + +# Performing self-test +# -------------------- +check: + + +# Performing installation test +# ---------------------------- +installcheck: + + +# Creating installation directories +# --------------------------------- +installdirs: + $(INSTALL) -d $(DESTDIR)$(bindir) + + +# Creating dependencies +# --------------------- +dep: Makefile.dep + +Makefile.dep: $(LKSOURCES) $(srcdir)/*.h $(top_builddir)*.h $(top_srcdir)/*.h + $(CPP) $(CPPFLAGS) $(M_OR_MM) $(filter %.c,$^) >Makefile.dep + +ifeq "$(findstring $(MAKECMDGOALS),uninstall check installcheck installdirs \ + clean distclean mostlyclean realclean)" "" + include Makefile.dep +endif +include $(srcdir)/clean.mk + +# My rules +# -------- +.c.o: + $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< + + +# Remaking configuration +# ---------------------- +checkconf: + @if [ -f $(top_builddir)devel ]; then\ + $(MAKE) -f conf.mk srcdir="$(srcdir)" top_builddir="$(top_builddir)" freshconf;\ + fi + +# End of Makefile diff --git a/as/link/mcs51/alloc.h b/as/link/mcs51/alloc.h new file mode 100644 index 00000000..dd404a86 --- /dev/null +++ b/as/link/mcs51/alloc.h @@ -0,0 +1,4 @@ +/* alloc.h */ +/* DECUS C */ + +#include diff --git a/as/aslink.dsp b/as/link/mcs51/aslink.dsp similarity index 76% rename from as/aslink.dsp rename to as/link/mcs51/aslink.dsp index d6d410af..f19847e1 100644 --- a/as/aslink.dsp +++ b/as/link/mcs51/aslink.dsp @@ -37,8 +37,8 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "mcs51\Debug" -# PROP Intermediate_Dir "mcs51\Debug" +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "INDEXLIB" /D "MLH_MAP" /D "SDK" /FR /FD /GZ /c @@ -49,8 +49,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /out:"..\bin_vc\aslink.exe" /pdbtype:sept -# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /out:"..\bin_vc\aslink.exe" /pdbtype:sept +# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /out:"..\..\..\bin_vc\aslink.exe" /pdbtype:sept +# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /out:"..\..\..\bin_vc\aslink.exe" /pdbtype:sept !ELSEIF "$(CFG)" == "aslink - Win32 Release" @@ -62,8 +62,8 @@ LINK32=link.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "mcs51\Release" -# PROP Intermediate_Dir "mcs51\Release" +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "INDEXLIB" /D "MLH_MAP" /D "SDK" /FD /c @@ -74,8 +74,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:console /machine:I386 /out:"..\bin_vc\aslink.exe" /pdbtype:sept -# ADD LINK32 /nologo /subsystem:console /machine:I386 /out:"..\bin_vc\aslink.exe" /pdbtype:sept +# ADD BASE LINK32 /nologo /subsystem:console /machine:I386 /out:"..\..\..\bin_vc\aslink.exe" /pdbtype:sept +# ADD LINK32 /nologo /subsystem:console /machine:I386 /out:"..\..\..\bin_vc\aslink.exe" /pdbtype:sept !ENDIF @@ -88,71 +88,71 @@ LINK32=link.exe # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File -SOURCE=.\mcs51\lkaomf51.c +SOURCE=.\lkaomf51.c # End Source File # Begin Source File -SOURCE=mcs51\lkarea.c +SOURCE=.\lkarea.c # End Source File # Begin Source File -SOURCE=mcs51\lkdata.c +SOURCE=.\lkdata.c # End Source File # Begin Source File -SOURCE=mcs51\lkeval.c +SOURCE=.\lkeval.c # End Source File # Begin Source File -SOURCE=mcs51\lkhead.c +SOURCE=.\lkhead.c # End Source File # Begin Source File -SOURCE=mcs51\lkihx.c +SOURCE=.\lkihx.c # End Source File # Begin Source File -SOURCE=mcs51\lklex.c +SOURCE=.\lklex.c # End Source File # Begin Source File -SOURCE=mcs51\lklibr.c +SOURCE=.\lklibr.c # End Source File # Begin Source File -SOURCE=mcs51\lklist.c +SOURCE=.\lklist.c # End Source File # Begin Source File -SOURCE=mcs51\lkmain.c +SOURCE=.\lkmain.c # End Source File # Begin Source File -SOURCE=.\mcs51\lkmem.c +SOURCE=.\lkmem.c # End Source File # Begin Source File -SOURCE=mcs51\lknoice.c +SOURCE=.\lknoice.c # End Source File # Begin Source File -SOURCE=mcs51\lkrloc.c +SOURCE=.\lkrloc.c # End Source File # Begin Source File -SOURCE=mcs51\lks19.c +SOURCE=.\lks19.c # End Source File # Begin Source File -SOURCE=mcs51\lkstore.c +SOURCE=.\lkstore.c # End Source File # Begin Source File -SOURCE=mcs51\lksym.c +SOURCE=.\lksym.c # End Source File # Begin Source File -SOURCE=.\mcs51\strcmpi.c +SOURCE=.\strcmpi.c # End Source File # End Group # Begin Group "Header Files" @@ -160,23 +160,15 @@ SOURCE=.\mcs51\strcmpi.c # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File -SOURCE=.\mcs51\alloc.h +SOURCE=.\alloc.h # End Source File # Begin Source File -SOURCE=.\mcs51\aslink.h +SOURCE=.\aslink.h # End Source File # Begin Source File -SOURCE=.\mcs51\asm.h -# End Source File -# Begin Source File - -SOURCE=.\mcs51\i8051.h -# End Source File -# Begin Source File - -SOURCE=.\mcs51\string.h +SOURCE=.\strcmpi.h # End Source File # End Group # End Target diff --git a/as/mcs51/aslink.h b/as/link/mcs51/aslink.h similarity index 100% rename from as/mcs51/aslink.h rename to as/link/mcs51/aslink.h diff --git a/as/mcs51/aslink.mak b/as/link/mcs51/aslink.mak similarity index 100% rename from as/mcs51/aslink.mak rename to as/link/mcs51/aslink.mak diff --git a/as/link/mcs51/clean.mk b/as/link/mcs51/clean.mk new file mode 100644 index 00000000..7b293ffb --- /dev/null +++ b/as/link/mcs51/clean.mk @@ -0,0 +1,25 @@ +# Deleting all files created by building the program +# -------------------------------------------------- +include $(top_builddir)Makefile.common + +clean: + rm -f *core *[%~] *.[oa] + rm -f .[a-z]*~ + rm -f $(top_builddir)bin/aslink$(EXEEXT) aslink$(EXEEXT) + + +# Deleting all files created by configuring or building the program +# ----------------------------------------------------------------- +distclean: clean + rm -f Makefile *.dep + + +# Like clean but some files may still exist +# ----------------------------------------- +mostlyclean: clean + + +# Deleting everything that can reconstructed by this Makefile. It deletes +# everything deleted by distclean plus files created by bison, etc. +# ----------------------------------------------------------------------- +realclean: distclean diff --git a/as/link/mcs51/conf.mk b/as/link/mcs51/conf.mk new file mode 100644 index 00000000..e0e34319 --- /dev/null +++ b/as/link/mcs51/conf.mk @@ -0,0 +1,10 @@ +# +# Makefile targets to remake configuration +# + +freshconf: Makefile + +Makefile: $(srcdir)/Makefile.in $(top_srcdir)/configure.in + cd $(top_prjdir) && $(SHELL) ./config.status + +# End of conf.mk diff --git a/as/mcs51/lkaomf51.c b/as/link/mcs51/lkaomf51.c similarity index 100% rename from as/mcs51/lkaomf51.c rename to as/link/mcs51/lkaomf51.c diff --git a/as/mcs51/lkarea.c b/as/link/mcs51/lkarea.c similarity index 100% rename from as/mcs51/lkarea.c rename to as/link/mcs51/lkarea.c diff --git a/as/mcs51/lkdata.c b/as/link/mcs51/lkdata.c similarity index 100% rename from as/mcs51/lkdata.c rename to as/link/mcs51/lkdata.c diff --git a/as/mcs51/lkeval.c b/as/link/mcs51/lkeval.c similarity index 100% rename from as/mcs51/lkeval.c rename to as/link/mcs51/lkeval.c diff --git a/as/mcs51/lkhead.c b/as/link/mcs51/lkhead.c similarity index 100% rename from as/mcs51/lkhead.c rename to as/link/mcs51/lkhead.c diff --git a/as/mcs51/lkihx.c b/as/link/mcs51/lkihx.c similarity index 100% rename from as/mcs51/lkihx.c rename to as/link/mcs51/lkihx.c diff --git a/as/mcs51/lklex.c b/as/link/mcs51/lklex.c similarity index 100% rename from as/mcs51/lklex.c rename to as/link/mcs51/lklex.c diff --git a/as/mcs51/lklibr.c b/as/link/mcs51/lklibr.c similarity index 100% rename from as/mcs51/lklibr.c rename to as/link/mcs51/lklibr.c diff --git a/as/mcs51/lklist.c b/as/link/mcs51/lklist.c similarity index 100% rename from as/mcs51/lklist.c rename to as/link/mcs51/lklist.c diff --git a/as/mcs51/lkmain.c b/as/link/mcs51/lkmain.c similarity index 100% rename from as/mcs51/lkmain.c rename to as/link/mcs51/lkmain.c diff --git a/as/mcs51/lkmem.c b/as/link/mcs51/lkmem.c similarity index 100% rename from as/mcs51/lkmem.c rename to as/link/mcs51/lkmem.c diff --git a/as/mcs51/lknoice.c b/as/link/mcs51/lknoice.c similarity index 100% rename from as/mcs51/lknoice.c rename to as/link/mcs51/lknoice.c diff --git a/as/mcs51/lkrloc.c b/as/link/mcs51/lkrloc.c similarity index 100% rename from as/mcs51/lkrloc.c rename to as/link/mcs51/lkrloc.c diff --git a/as/mcs51/lks19.c b/as/link/mcs51/lks19.c similarity index 100% rename from as/mcs51/lks19.c rename to as/link/mcs51/lks19.c diff --git a/as/mcs51/lkstore.c b/as/link/mcs51/lkstore.c similarity index 100% rename from as/mcs51/lkstore.c rename to as/link/mcs51/lkstore.c diff --git a/as/mcs51/lksym.c b/as/link/mcs51/lksym.c similarity index 100% rename from as/mcs51/lksym.c rename to as/link/mcs51/lksym.c diff --git a/as/link/mcs51/readme.390 b/as/link/mcs51/readme.390 new file mode 100644 index 00000000..80170bd0 --- /dev/null +++ b/as/link/mcs51/readme.390 @@ -0,0 +1,141 @@ +DS80C390 flat mode support + +2/4/2000 Kevin Vigor (e-mail: kevin at vigor.nu) + +I have hacked the 8051 assembler to support the 24 bit flat address mode of +the DS80C390 processor. This mode allows the chip to directly address up to +4 Meg of RAM. Details can be found at Dallas' web site: www.dalsemi.com. + +1: Assembler changes. + +24 bit mode is entered via a new assembler directive, .flat24. This directive +takes a mandatory argument, which is either the string "on" or the string +"off". ".flat24 on" enables 24-bit mode, and ".flat24 off" puts the assembler +into standard 8051 mode. + +Note that any .included files within a ".flat24 on" segment of the code will +be compiled in 24-bit mode. + +In 24-bit mode, 8 instructions have altered behavior. Of these, 5 modify +the instruction encoding, while 3 differ only in behavior. These +instructions are discussed in the DS80C390 User's Guide, but a summary is +included here: + +ACALL and AJMP now take a 19 bit offset instead of the 8051's 11 bit offset. +An extra address byte is added to the encoded instruction. + +LCALL and LJMP now take a 24 bit target address instead of the 8051's 16 bit +address. An extra address byte is added to the encoded instruction. + +MOV DPTR, #immed now takes a 24 bit immediate value instead of the 8051's 16 +bit address. An extra data byte is added to the encoded instruction. + +INC DPTR now increments the entire 24 bit DPTR. The encoding is not changed. + +RET and RETI restore the full 24 bit PC from the stack. The encoding is not +changed. + +2: Linker changes. + +The linker supports (through a variety of evil hacks) 19 bit ACALL/AJMP +relocations and 24 bit LCALL/LJMP/DPTR relocations. These changes should be +invisible to the user. + +The linker can now also generated extended linear address records in the +Intel hex output format. This is necessary for any areas located above the +64K mark. This is enabled by the "-r" linker flag, and is disabled by +default (but the linker will throw a warning if an extended address is +encountered without the -r flag being enabled). + +Note that for various reasons, areas may still not be larger than 64K. +However, they may be located anywhere in the 4 Meg address space via the +assembler .org directive (for ABS areas) or the linker "-b" option. + +3: Examples + +Note that this example uses ABS areas to make the layout obvious. This code +won't do anything useful at all, but demonstrates the instruction encoding +in .flat24 mode vs 8051 mode. + +; test1.asm +.area CODE (ABS) +.org 0 + +; SFRs not known to the assembler yet... +$TA = 0x00C7 +$ACON = 0x009D + +; Set the chip to 24 bit flat mode via the DS "timed access" procedure. +mov $TA, #0xAA +mov $TA, #0x55 +mov $ACON, #0x06 ; 10 bit stack & 24 bit flat addressing. + +.flat24 on ; Enable 24-bit mode. The AM1 bit had better be + ; on... + +mov dptr, #myData ; Valid on the '390: myData is in the FARDATA + ; area at 0x300001. + ; Generates: 90 30 00 01 +acall _junkNear ; Within 11 bit range, but still must generate + ; 19 bit address for '390 flat mode. + ; Generates: 11 04 00 +ajmp _junkFar ; Within 16 bit range. + ; Generates 01 08 00 +acall _junkReallyFar ; Within 19 bit range. + ; Generates 91 00 00 +lcall _junkReallyReallyFar ; Within 24 bit range. + ; Generates 12 08 00 00 + +; Set the chip to 8051 mode via the DS "timed access" procedure. +mov $TA, #0x0AA +mov $TA, #0x055 +mov $ACON, #0x00 ; 8 bit stack & 16 bit flat addressing. + +.flat24 off ; Now we're an 8051 again. The AM1 bit had better be + ; off... + +;mov dptr, #myData ; Can't do that: myData is too far away. +acall _junkNear ; Within 11 bit range. + ; Generates 91 00 +ljmp _junkFar ; Within 16 bit range; can't AJMP, but can LJMP + ; Generates 02 08 00 +ret + +.area CODE2 (ABS) +.org 0x400 +; This is within the 11 bit ACALL/AJMP range of the 8051. +_junkNear: +ret + +.area CODE3 (ABS) +.org 0x800 +; This is within the 390's 19 bit ACALL/AJMP range, and inside the stock +; 8051's 16 bit LCALL range. +_junkFar: +ret + +.area CODE4 (ABS) +; This is within the 390's 19 bit ACALL/AJMP range and outside the +; 8051's LCALL range. +; Note that to link an image with an area beyond 64K (like this one), +; the '-r' flag must be provided to the linker, and Intel Hex output format +; must be used. +.org 0x40000 +_junkReallyFar: +ret + +.area CODE5 (ABS) +; This is outside anybody's ACALL/AJMP range. +.org 0x80000 +_junkReallyReallyFar: +ret + +.area FARDATA (ABS) +.org 0x300000 +; This is way, way up there. +.byte 0x01 +myData: +.byte 0x02 + +; test1.asm ends. + diff --git a/as/link/mcs51/strcmpi.c b/as/link/mcs51/strcmpi.c new file mode 100644 index 00000000..434529ce --- /dev/null +++ b/as/link/mcs51/strcmpi.c @@ -0,0 +1,35 @@ +/* strcmpi.c */ + +/* + * Compare two strings ignoring case. + * + * Taken from GLIBC 2.2.5. Original code is copyrighted "Free + * Software Foundation" and published under the GNU Lesser General + * Public License. + * + */ + +#include +#include "strcmpi.h" + +int as_strcmpi (const char *s1, const char *s2) +{ + const unsigned char *p1 = (const unsigned char *) s1; + const unsigned char *p2 = (const unsigned char *) s2; + unsigned char c1, c2; + + if (p1 == p2) + return 0; + + do + { + c1 = tolower (*p1++); + c2 = tolower (*p2++); + if (c1 == '\0') + break; + } + while (c1 == c2); + + return c1 - c2; +} + diff --git a/as/link/mcs51/strcmpi.h b/as/link/mcs51/strcmpi.h new file mode 100644 index 00000000..63c35c43 --- /dev/null +++ b/as/link/mcs51/strcmpi.h @@ -0,0 +1,3 @@ +/* strcmpi.h */ + +int as_strcmpi (const char *s1, const char *s2); diff --git a/as/mcs51/Makefile.bcc b/as/mcs51/Makefile.bcc index 84e61f1f..97fc05a6 100644 --- a/as/mcs51/Makefile.bcc +++ b/as/mcs51/Makefile.bcc @@ -1,4 +1,4 @@ -# Makefile for Borlad C++ +# Makefile for Borland C++ PRJDIR = ../.. @@ -8,18 +8,9 @@ ASOBJECTS = asmain.obj aslex.obj assym.obj assubr.obj asnoice.obj \ asexpr.obj asdata.obj aslist.obj asout.obj asstore.obj \ i51ext.obj i51pst.obj i51mch.obj i51adr.obj strcmpi.obj -LKOBJECTS = lkmain.obj lkhead.obj lkarea.obj lkdata.obj \ - lkeval.obj lklex.obj lksym.obj lkrloc.obj \ - lklibr.obj lklist.obj lkihx.obj lks19.obj \ - lkstore.obj lknoice.obj lkmem.obj lkaomf51.obj strcmpi.obj - ASX8051 = $(PRJDIR)/bin/asx8051.exe -ASLINK = $(PRJDIR)/bin/aslink.exe -all: $(ASX8051) $(ASLINK) +all: $(ASX8051) $(ASX8051): $(ASOBJECTS) $(CC) $(CFLAGS) -e$@ $(ASOBJECTS) - -$(ASLINK): $(LKOBJECTS) - $(CC) $(CFLAGS) -e$@ $(LKOBJECTS) diff --git a/as/mcs51/Makefile.in b/as/mcs51/Makefile.in index 3511edcb..42e5f995 100644 --- a/as/mcs51/Makefile.in +++ b/as/mcs51/Makefile.in @@ -42,39 +42,27 @@ ASOBJECTS = asmain.o aslex.o assym.o assubr.o asnoice.o \ i51ext.o i51pst.o i51mch.o i51adr.o strcmpi.o ASSOURCES = $(patsubst %.o,%.c,$(ASOBJECTS)) -LKOBJECTS = lkmain.o lkhead.o lkarea.o lkdata.o \ - lkeval.o lklex.o lksym.o lkrloc.o \ - lklibr.o lklist.o lkihx.o lks19.o \ - lkstore.o lknoice.o lkmem.o lkaomf51.o strcmpi.o -LKSOURCES = $(patsubst %.o,%.c,$(LKOBJECTS)) - ASX8051 = $(top_builddir)bin/asx8051$(EXEEXT) -ASLINK = $(top_builddir)bin/aslink$(EXEEXT) transform = @program_transform_name@ # Compiling entire program or any subproject # ------------------------------------------ -all: checkconf $(ASX8051) $(ASLINK) +all: checkconf $(ASX8051) $(ASX8051): $(ASOBJECTS) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(ASOBJECTS) - -$(ASLINK): $(LKOBJECTS) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(LKOBJECTS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(ASOBJECTS) -# Compiling and installing everything and runing test -# --------------------------------------------------- +# Compiling and installing everything and running test +# ---------------------------------------------------- install: all installdirs $(INSTALL) $(ASX8051) `echo $(DESTDIR)$(bindir)/asx8051$(EXEEXT)|sed '$(transform)'` $(STRIP) `echo $(DESTDIR)$(bindir)/asx8051$(EXEEXT)|sed '$(transform)'` - $(INSTALL) $(ASLINK) `echo $(DESTDIR)$(bindir)/aslink$(EXEEXT)|sed '$(transform)'` - $(STRIP) `echo $(DESTDIR)$(bindir)/aslink$(EXEEXT)|sed '$(transform)'` # Deleting all the installed files # -------------------------------- uninstall: - rm -f $(DESTDIR)$(bindir)/asx8051$(EXEEXT) $(DESTDIR)$(bindir)/aslink$(EXEEXT) + rm -f $(DESTDIR)$(bindir)/asx8051$(EXEEXT) # Performing self-test @@ -97,7 +85,7 @@ installdirs: # --------------------- dep: Makefile.dep -Makefile.dep: $(ASSOURCES) $(LKSOURCES) $(srcdir)/*.h $(top_builddir)*.h $(top_srcdir)/*.h +Makefile.dep: $(ASSOURCES) $(srcdir)/*.h $(top_builddir)*.h $(top_srcdir)/*.h $(CPP) $(CPPFLAGS) $(M_OR_MM) $(filter %.c,$^) >Makefile.dep ifeq "$(findstring $(MAKECMDGOALS),uninstall check installcheck installdirs \ diff --git a/as/mcs51/clean.mk b/as/mcs51/clean.mk index 829d0694..90a6b2a9 100644 --- a/as/mcs51/clean.mk +++ b/as/mcs51/clean.mk @@ -5,7 +5,7 @@ include $(top_builddir)Makefile.common clean: rm -f *core *[%~] *.[oa] rm -f .[a-z]*~ - rm -f $(top_builddir)bin/asx8051$(EXEEXT) $(top_builddir)bin/aslink$(EXEEXT) asx8051$(EXEEXT) aslink$(EXEEXT) + rm -f $(top_builddir)bin/asx8051$(EXEEXT) asx8051$(EXEEXT) # Deleting all files created by configuring or building the program diff --git a/configure b/configure index 5c3bf823..6d3de06d 100755 --- a/configure +++ b/configure @@ -8135,7 +8135,7 @@ if test $OPT_DISABLE_HC08 = 0; then fi if test $OPT_DISABLE_MCS51 = 0; then - ac_config_files="$ac_config_files src/mcs51/Makefile as/mcs51/Makefile debugger/mcs51/Makefile" + ac_config_files="$ac_config_files src/mcs51/Makefile as/mcs51/Makefile as/link/mcs51/Makefile debugger/mcs51/Makefile" test $OPT_DISABLE_DEVICE_LIB = 0 && ac_config_files="$ac_config_files device/lib/mcs51/Makefile device/lib/small/Makefile device/lib/medium/Makefile device/lib/large/Makefile" diff --git a/sdcc.dsw b/sdcc.dsw index 954f07aa..f710d000 100644 --- a/sdcc.dsw +++ b/sdcc.dsw @@ -87,7 +87,7 @@ Package=<4> ############################################################################### -Project: "aslink"=.\as\aslink.dsp - Package Owner=<4> +Project: "aslink"=.\as\link\mcs51\aslink.dsp - Package Owner=<4> Package=<5> {{{ -- 2.47.2