From 1895d3a959982e6a9b1bcae177a4135e4244f71a Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Sat, 9 Feb 2013 22:22:31 +0100 Subject: [PATCH 1/7] Fixed severe bug in PSOCK_READTO (?) Either I found and fixed a severe bug in PSOCK_READTO() or I misunderstood something completely. To me PSOCK_READTO() is supposed to return if either the supplied character was read or if the user supplied buffer is exhausted - sor far so good. However if the latter occurs up to now PSOCK_READTO() was continuing to process characters already read from the network (aka present in the uIP buffer) in order to check if the supplied character was found there and adjust the return value accordingly. But this means that the character processed this way were lost forever for the caller as the next call to PSOCK_READTO() would continue to read past the characters processed this way. Therefore I removed that character processing altogether. So now if the user supplied buffer is exhausted before the supplied character is found the next call to PSOCK_READTO() starts exactly where previous call left off. --- core/net/psock.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/core/net/psock.c b/core/net/psock.c index fa488f724..47893a5de 100644 --- a/core/net/psock.c +++ b/core/net/psock.c @@ -124,16 +124,6 @@ buf_bufto(CC_REGISTER_ARG struct psock_buf *buf, uint8_t endmarker, return BUF_NOT_FOUND; } - while(*datalen > 0) { - c = **dataptr; - --*datalen; - ++*dataptr; - - if(c == endmarker) { - return BUF_FOUND | BUF_FULL; - } - } - return BUF_FULL; } /*---------------------------------------------------------------------------*/ @@ -274,9 +264,9 @@ PT_THREAD(psock_readto(CC_REGISTER_ARG struct psock *psock, unsigned char c)) psock->readptr = (uint8_t *)uip_appdata; psock->readlen = uip_datalen(); } - } while((buf_bufto(&psock->buf, c, - &psock->readptr, - &psock->readlen) & BUF_FOUND) == 0); + } while(buf_bufto(&psock->buf, c, + &psock->readptr, + &psock->readlen) == BUF_NOT_FOUND); if(psock_datalen(psock) == 0) { psock->state = STATE_NONE; From 1eda821a756a8fc1ca256d14bbe259b38113b258 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Sat, 9 Feb 2013 22:22:31 +0100 Subject: [PATCH 2/7] Fixed severe bug in PSOCK_READTO (?) Either I found and fixed a severe bug in PSOCK_READTO() or I misunderstood something completely. To me PSOCK_READTO() is supposed to return if either the supplied character was read or if the user supplied buffer is exhausted - sor far so good. However if the latter occurs up to now PSOCK_READTO() was continuing to process characters already read from the network (aka present in the uIP buffer) in order to check if the supplied character was found there and adjust the return value accordingly. But this means that the character processed this way were lost forever for the caller as the next call to PSOCK_READTO() would continue to read past the characters processed this way. Therefore I removed that character processing altogether. So now if the user supplied buffer is exhausted before the supplied character is found the next call to PSOCK_READTO() starts exactly where previous call left off. --- core/net/psock.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/core/net/psock.c b/core/net/psock.c index fa488f724..47893a5de 100644 --- a/core/net/psock.c +++ b/core/net/psock.c @@ -124,16 +124,6 @@ buf_bufto(CC_REGISTER_ARG struct psock_buf *buf, uint8_t endmarker, return BUF_NOT_FOUND; } - while(*datalen > 0) { - c = **dataptr; - --*datalen; - ++*dataptr; - - if(c == endmarker) { - return BUF_FOUND | BUF_FULL; - } - } - return BUF_FULL; } /*---------------------------------------------------------------------------*/ @@ -274,9 +264,9 @@ PT_THREAD(psock_readto(CC_REGISTER_ARG struct psock *psock, unsigned char c)) psock->readptr = (uint8_t *)uip_appdata; psock->readlen = uip_datalen(); } - } while((buf_bufto(&psock->buf, c, - &psock->readptr, - &psock->readlen) & BUF_FOUND) == 0); + } while(buf_bufto(&psock->buf, c, + &psock->readptr, + &psock->readlen) == BUF_NOT_FOUND); if(psock_datalen(psock) == 0) { psock->state = STATE_NONE; From ea4fac679fd65a66e05095c0e656e0c73abf093b Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Mon, 11 Feb 2013 00:24:51 +0100 Subject: [PATCH 3/7] Allow user to read the result of wget. Several retro targets clear the screen after program termination so allow user to read the result. --- examples/wget/wget.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/wget/wget.c b/examples/wget/wget.c index 00bc6439b..5cac9b885 100644 --- a/examples/wget/wget.c +++ b/examples/wget/wget.c @@ -142,6 +142,8 @@ app_quit(void) if(file != -1) { cfs_close(file); } + puts("Press any key to continue..."); + getchar(); process_exit(&wget_process); LOADER_UNLOAD(); } From c385dd13937facdd618addac72f306eb9b1ac27a Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Mon, 11 Feb 2013 00:28:31 +0100 Subject: [PATCH 4/7] Be consistent with tab chars in Makefiles. --- Makefile.include | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile.include b/Makefile.include index fa3c9d65a..b0e294b5e 100644 --- a/Makefile.include +++ b/Makefile.include @@ -1,7 +1,7 @@ # -*- makefile -*- ifndef CONTIKI - ${error CONTIKI not defined! You must specify where CONTIKI resides} + ${error CONTIKI not defined! You must specify where Contiki resides} endif ifeq ($(TARGET),) @@ -105,8 +105,8 @@ PROJECT_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(PROJECT_SOURCEFI ifdef APPS APPDIRS += ${wildcard ${addprefix $(CONTIKI)/apps/, $(APPS)} \ - ${addprefix $(CONTIKI)/platform/$(TARGET)/apps/, $(APPS)} \ - $(APPS)} + ${addprefix $(CONTIKI)/platform/$(TARGET)/apps/, $(APPS)} \ + $(APPS)} APPINCLUDES = ${foreach APP, $(APPS), ${wildcard ${foreach DIR, $(APPDIRS), $(DIR)/Makefile.$(APP)}}} -include $(APPINCLUDES) APP_SOURCES = ${foreach APP, $(APPS), $($(APP)_src)} @@ -163,7 +163,7 @@ endif ifneq ($(MAKECMDGOALS),clean) -include ${addprefix $(OBJECTDIR)/,$(CONTIKI_SOURCEFILES:.c=.d) \ - $(PROJECT_SOURCEFILES:.c=.d)} + $(PROJECT_SOURCEFILES:.c=.d)} endif ### See http://make.paulandlesley.org/autodep.html#advanced @@ -178,8 +178,8 @@ endef clean: rm -f *~ *core core *.srec \ *.lst *.map \ - *.cprg *.bin *.data contiki*.a *.firmware core-labels.S *.ihex *.ini \ - *.ce *.co $(CLEAN) + *.cprg *.bin *.data contiki*.a *.firmware core-labels.S *.ihex *.ini \ + *.ce *.co $(CLEAN) -rm -rf $(OBJECTDIR) ifndef CUSTOM_RULE_C_TO_CE From 98060c1eab2abf45d11a6bb2195c59aacdb259b9 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Thu, 14 Feb 2013 15:42:43 +0100 Subject: [PATCH 5/7] Moved from last cc65 release (2.13.3) to recent cc65 snapshot (2.13.9). Relevant cc65 changes... General: - The compiler generates "extended" dependency info (like gcc) so there's no need for postprocessing whatsoever :-) - The linker is very pernickety regarding the ordering of cmdline options so a custom linker rule is necessary :-( Apple2: - The various memory usage scenarios aren't specified anymore via separate linker configs but via defines overriding default values in the builtin linker config. Atari: - The builtin linker config allows to override the start addr so there no more need for a custom linker config. - The C library comes with POSIX directory access. So there's no more need for for a custom coding. CBM: - The C library comes with POSIX directory access. So there's no more need for for a custom coding. --- cpu/6502/Makefile.6502 | 32 ++---- platform/apple2enh/Makefile.apple2enh | 12 +- platform/atari/Makefile.atari | 21 ++-- platform/atari/lib/posixdirent.S | 159 -------------------------- platform/c128/Makefile.c128 | 5 +- platform/c128/cfs/cfs-cbm-dir.c | 69 ----------- platform/c128/lib/pfs.S | 4 +- platform/c64/Makefile.c64 | 5 +- platform/c64/cfs/cfs-cbm-dir.c | 69 ----------- platform/c64/lib/pfs.S | 4 +- 10 files changed, 35 insertions(+), 345 deletions(-) delete mode 100644 platform/atari/lib/posixdirent.S delete mode 100644 platform/c128/cfs/cfs-cbm-dir.c delete mode 100644 platform/c64/cfs/cfs-cbm-dir.c diff --git a/cpu/6502/Makefile.6502 b/cpu/6502/Makefile.6502 index f67f77692..4d5c53a35 100644 --- a/cpu/6502/Makefile.6502 +++ b/cpu/6502/Makefile.6502 @@ -39,7 +39,7 @@ endif all: cs8900a.eth lan91c96.eth -CONTIKI_TARGET_DIRS = . lib sys cfs +CONTIKI_TARGET_DIRS = . lib sys CONTIKI_CPU_DIRS = . lib sys ctk net CONTIKI_TARGET_SOURCEFILES += contiki-main.c @@ -47,10 +47,8 @@ CONTIKI_CPU_SOURCEFILES += log.c error.c unload.c config.c ctk-mouse.c \ clock.c mtarch.c mtarch-asm.S lc-asm.S \ uip_arch.c ethernet-drv.c ethernet.c -CONTIKI_SOURCEFILES += $(CTK) ctk-conio.c petsciiconv.c \ +CONTIKI_SOURCEFILES += $(CTK) ctk-conio.c petsciiconv.c cfs-posix-dir.c \ $(CONTIKI_TARGET_SOURCEFILES) $(CONTIKI_CPU_SOURCEFILES) - -TARGET_LIBFILES = $(TARGET).lib ifdef ETHERNET CONTIKI_SOURCEFILES += $(ETHERNET)-eth.S @@ -60,7 +58,7 @@ endif ### Compiler definitions AS = ca65 -CC = cc65 +CC = cl65 LD = ld65 AR = ar65 @@ -69,35 +67,29 @@ AR = ar65 ASFLAGS = -t $(TARGET) CFLAGS += -t $(TARGET) -Or -LDFLAGS = -D __STACKSIZE__=0x200 -u _main -m contiki-$(TARGET).map +LDFLAGS = $(STARTADDR_FLAG) -t $(TARGET) -m contiki-$(TARGET).map -D __STACKSIZE__=0x200 AROPTS = a ### Compilation rules .SUFFIXES: -CMD.EXE := $(shell echo) - CUSTOM_RULE_C_TO_OBJECTDIR_O = 1 $(OBJECTDIR)/%.o: %.c - $(CC) $(CFLAGS) --create-dep $< -o $(@:.o=.s) - @$(AS) $(ASFLAGS) $(@:.o=.s) -o $@ - @sed -e "s!.s:!.o:!" -e "s!\t! !" < $(@:.o=.u) > $(@:.o=.d) - @rm -f $(@:.o=.s) $(@:.o=.u) -ifndef CMD.EXE - @$(FINALIZE_DEPENDENCY) -endif + $(CC) -c -o $@ $(CFLAGS) --create-dep $(@:.o=.d) $< CUSTOM_RULE_C_TO_CO = 1 %.co: %.c - $(CC) $(CFLAGS) -DAUTOSTART_ENABLE $< -o $(@:.co=.s) - @$(AS) $(ASFLAGS) $(@:.co=.s) -o $@ - @rm -f $(@:.co=.s) + $(CC) -c -o $@ $(CFLAGS) -DAUTOSTART_ENABLE --create-dep $(@:.o=.d) $< + +CUSTOM_RULE_LINK = 1 +%.$(TARGET): %.co contiki-$(TARGET).a + $(LD) -o $@ $(LDFLAGS) -u _main $^ $(TARGET).lib %.eth: $(OBJECTDIR)/%.o - $(LD) -t module -m $@.map $< -o $@ + $(LD) -o $@ -t module -m $@.map $< ifdef ETHERNET $(ETHERNET)-eth.S: $(ETHERNET).eth - co65 --code-label _$(ETHERNET) -o $@ $< + co65 -o $@ --code-label _$(ETHERNET) $< endif diff --git a/platform/apple2enh/Makefile.apple2enh b/platform/apple2enh/Makefile.apple2enh index 6e318b904..5add9a8e9 100644 --- a/platform/apple2enh/Makefile.apple2enh +++ b/platform/apple2enh/Makefile.apple2enh @@ -33,22 +33,22 @@ # $Id: Makefile.apple2enh,v 1.19 2010/10/23 08:17:45 oliverschmidt Exp $ # -CONTIKI_SOURCEFILES += cfs-posix-dir.c CONTIKI_TARGET_SOURCEFILES += pfs.S CONTIKI_CPU = $(CONTIKI)/cpu/6502 include $(CONTIKI_CPU)/Makefile.6502 +LDFLAGS += -D __HIMEM__=0xBF00 + ifeq ($(findstring WITH_REBOOT,$(DEFINES)),WITH_REBOOT) - HIGHCODE_SOURCEFILES = process.c etimer.c uip_arp.c - LDFLAGS += -C apple2enh-reboot.cfg + LC_SOURCEFILES = process.c etimer.c uip_arp.c + LDFLAGS += -D __LCADDR__=0xD000 -D __LCSIZE__=0x1000 else - HIGHCODE_SOURCEFILES = process.c etimer.c ethernet.c - LDFLAGS += -C apple2enh-loader.cfg + LC_SOURCEFILES = process.c etimer.c ethernet.c endif # Set a target-specific variable value -${addprefix $(OBJECTDIR)/,${call oname, $(HIGHCODE_SOURCEFILES)}}: CFLAGS += --code-name HIGHCODE +${addprefix $(OBJECTDIR)/,${call oname, $(LC_SOURCEFILES)}}: CFLAGS += --code-name LC ifeq ($(MAKECMDGOALS),disk) ifndef AC diff --git a/platform/atari/Makefile.atari b/platform/atari/Makefile.atari index c8377655a..b795367b4 100644 --- a/platform/atari/Makefile.atari +++ b/platform/atari/Makefile.atari @@ -35,13 +35,10 @@ ETHERNET = cs8900a -CONTIKI_SOURCEFILES += cfs-posix-dir.c -CONTIKI_TARGET_SOURCEFILES += posixdirent.S - CONTIKI_CPU = $(CONTIKI)/cpu/6502 include $(CONTIKI_CPU)/Makefile.6502 -LDFLAGS += -C $(CONTIKI)/platform/$(TARGET)/$(TARGET).cfg -S 0x2000 +STARTADDR_FLAG = -S 0x2000 ifeq ($(MAKECMDGOALS),disk) ifndef DIR2ATR @@ -51,15 +48,15 @@ endif disk: all mkdir atr - cp $(CONTIKI)/tools/$(TARGET)/dos.sys atr/dos.sys - cp $(CONTIKI)/tools/$(TARGET)/dup.sys atr/dup.sys - cp $(CONTIKI_PROJECT).$(TARGET) atr/autorun.sys - cp $(CONTIKI)/tools/$(TARGET)/sample.cfg atr/contiki.cfg + cp $(CONTIKI)/tools/$(TARGET)/dos25/dos.sys atr/dos.sys + cp $(CONTIKI)/tools/$(TARGET)/dos25/dup.sys atr/dup.sys + cp $(CONTIKI_PROJECT).$(TARGET) atr/autorun.sys + cp $(CONTIKI)/tools/$(TARGET)/sample.cfg atr/contiki.cfg ifeq ($(HTTPD-CFS),1) - cp httpd-cfs/index.htm atr/index.htm - cp httpd-cfs/backgrnd.gif atr/backgrnd.gif - cp httpd-cfs/contiki.gif atr/contiki.gif - cp httpd-cfs/notfound.htm atr/notfound.htm + cp httpd-cfs/index.htm atr/index.htm + cp httpd-cfs/backgrnd.gif atr/backgrnd.gif + cp httpd-cfs/contiki.gif atr/contiki.gif + cp httpd-cfs/notfound.htm atr/notfound.htm endif $(DIR2ATR) -b Dos25 1040 contiki.atr atr rm -r atr diff --git a/platform/atari/lib/posixdirent.S b/platform/atari/lib/posixdirent.S deleted file mode 100644 index f33a7f04f..000000000 --- a/platform/atari/lib/posixdirent.S +++ /dev/null @@ -1,159 +0,0 @@ -; Native: Shawn Jefferson, December 2005 -; POSIX: Stefan Haubenthal, April 2008 - - .include "atari.inc" - .export _opendir, _readdir, _closedir - .import findfreeiocb, clriocb - .import __oserror, return0, __do_oserror - .importzp ptr1, tmp1 -.ifdef DEFAULT_DEVICE - .import __defdev -.endif - - -.proc _opendir - sta ptr1 - stx ptr1+1 - jsr findfreeiocb - beq @iocbok - bne cioerr -@iocbok: stx diriocb - jsr clriocb - ldx diriocb - ldy #0 ; '.' -> "D:*.*" - lda (ptr1),y - cmp #'.' - bne @use_parm - -; "." was given as parameter, use default device/dir - -.ifdef DEFAULT_DEVICE - ; construct a "Dn:*.*" like string from the default drive - lda __defdev+1 - sta dddefdev+1 ; copy drive number (overwrite 2nd 'D') - lda #dddefdev - sta ICBAH,x - bne @cont -.else - lda #defdev - sta ICBAH,x - bne @cont -.endif - -@use_parm: lda ptr1 - sta ICBAL,x - lda ptr1+1 - sta ICBAH,x - -@cont: lda #OPEN - sta ICCOM,x - lda #OPNIN|DIRECT - sta ICAX1,x - jsr CIOV - bmi cioerr - lda #0 - sta __oserror - tax - lda diriocb - rts -.endproc - -cioerr: sty __oserror - jmp return0 - -.proc _readdir - tax - lda #GETREC - sta ICCOM,x - lda #entry - sta ICBAH,x - sta ptr1+1 - lda #DSCTSZ - sta ICBLL,x - lda #0 - sta ICBLH,x - jsr CIOV - bmi cioerr - ldy #0 ; FREE SECTORS - lda (ptr1),y - cmp #'0' - bcs cioerr - dey -@next: iny ; remove trailing spaces - iny - iny - lda (ptr1),y - dey - dey - sta (ptr1),y - cpy #9 - bcs @break - cmp #' ' - bne @next - -@break: lda #'.' ; extension dot - sta (ptr1),y - iny ; copy extension - sty tmp1 - ldy #10 - lda (ptr1),y - cmp #' ' - bne @hasext - -; no extension present: remove the trailing dot and be done - ldy tmp1 - dey - bne @done - -@hasext: jsr copychar - ldy #11 - jsr copychar - ldy #12 - jsr copychar - -@done: lda #0 ; end of string - sta (ptr1),y - lda ptr1 - ldx ptr1+1 - rts - - -copychar: lda (ptr1),y ; src=y dest=tmp1 - ldy tmp1 - cmp #' ' - beq @break - sta (ptr1),y - iny - sty tmp1 -@break: rts -.endproc - -.proc _closedir - tax - lda #CLOSE - sta ICCOM,x - jsr CIOV - bmi @cioerr - ldx #0 - stx __oserror ; clear system specific error code - txa - rts -@cioerr: jmp __do_oserror -.endproc - - .data -.ifdef DEFAULT_DEVICE -dddefdev: .byte "D" -.endif -defdev: .asciiz "D:*.*" - - .bss -diriocb: .res 1 -entry: .res DSCTSZ diff --git a/platform/c128/Makefile.c128 b/platform/c128/Makefile.c128 index 70273bba4..f2cf2b6ef 100644 --- a/platform/c128/Makefile.c128 +++ b/platform/c128/Makefile.c128 @@ -33,13 +33,12 @@ # $Id: Makefile.c128,v 1.15 2010/10/23 13:48:06 oliverschmidt Exp $ # -CONTIKI_TARGET_SOURCEFILES += cfs-cbm-dir.c pfs.S pfs_write.S +CONTIKI_TARGET_SOURCEFILES += pfs.S pfs_write.S CONTIKI_CPU = $(CONTIKI)/cpu/6502 include $(CONTIKI_CPU)/Makefile.6502 -CFLAGS += -DWITH_PETSCII -LDFLAGS += -t $(TARGET) +CFLAGS += -DWITH_PETSCII ifeq ($(MAKECMDGOALS),disk) ifndef C1541 diff --git a/platform/c128/cfs/cfs-cbm-dir.c b/platform/c128/cfs/cfs-cbm-dir.c deleted file mode 100644 index 7ea8079d4..000000000 --- a/platform/c128/cfs/cfs-cbm-dir.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Oliver Schmidt - * - */ - -#include -#include - -#include "contiki.h" - -#include "cfs/cfs.h" - -/*---------------------------------------------------------------------------*/ -int -cfs_opendir(struct cfs_dir *p, const char *n) -{ - return cbm_opendir(12, _curunit); -} -/*---------------------------------------------------------------------------*/ -int -cfs_readdir(struct cfs_dir *p, struct cfs_dirent *e) -{ - struct cbm_dirent dirent; - - do { - if(cbm_readdir(12, &dirent)) { - return -1; - } - } while(dirent.type == CBM_T_HEADER); - strcpy(e->name, dirent.name); - e->size = dirent.size; - return 0; -} -/*---------------------------------------------------------------------------*/ -void -cfs_closedir(struct cfs_dir *p) -{ - cbm_closedir(12); -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/c128/lib/pfs.S b/platform/c128/lib/pfs.S index 07cf0cb69..e82a1cb7c 100644 --- a/platform/c128/lib/pfs.S +++ b/platform/c128/lib/pfs.S @@ -36,7 +36,7 @@ .constructor init_pfs .destructor done_pfs .importzp ptr1, ptr2, ptr3, sp - .import __curunit, __filetype, popax, addysp, subysp + .import curunit, __filetype, popax, addysp, subysp .export pfs_rwcommon, pfs_rwsetflags, pfs_rwcommonend .if F_IDE64 .export ide64_rwprepare, ide64_rwfinish @@ -178,7 +178,7 @@ next: inc ptr2 ;next file number stx ptr2+1 nextsa: inc ptr2+1 ;next channel retr: lda ptr2 ;file number - ldx __curunit + ldx curunit ldy ptr2+1 ;secondary address jsr SETLFS jsr OPEN ;open diff --git a/platform/c64/Makefile.c64 b/platform/c64/Makefile.c64 index a7011892d..72dfc9144 100644 --- a/platform/c64/Makefile.c64 +++ b/platform/c64/Makefile.c64 @@ -33,13 +33,12 @@ # $Id: Makefile.c64,v 1.17 2010/10/23 13:48:06 oliverschmidt Exp $ # -CONTIKI_TARGET_SOURCEFILES += cfs-cbm-dir.c pfs.S pfs_write.S +CONTIKI_TARGET_SOURCEFILES += pfs.S pfs_write.S CONTIKI_CPU = $(CONTIKI)/cpu/6502 include $(CONTIKI_CPU)/Makefile.6502 -CFLAGS += -DWITH_PETSCII -LDFLAGS += -t $(TARGET) +CFLAGS += -DWITH_PETSCII ifeq ($(MAKECMDGOALS),disk) ifndef C1541 diff --git a/platform/c64/cfs/cfs-cbm-dir.c b/platform/c64/cfs/cfs-cbm-dir.c deleted file mode 100644 index 7ea8079d4..000000000 --- a/platform/c64/cfs/cfs-cbm-dir.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Oliver Schmidt - * - */ - -#include -#include - -#include "contiki.h" - -#include "cfs/cfs.h" - -/*---------------------------------------------------------------------------*/ -int -cfs_opendir(struct cfs_dir *p, const char *n) -{ - return cbm_opendir(12, _curunit); -} -/*---------------------------------------------------------------------------*/ -int -cfs_readdir(struct cfs_dir *p, struct cfs_dirent *e) -{ - struct cbm_dirent dirent; - - do { - if(cbm_readdir(12, &dirent)) { - return -1; - } - } while(dirent.type == CBM_T_HEADER); - strcpy(e->name, dirent.name); - e->size = dirent.size; - return 0; -} -/*---------------------------------------------------------------------------*/ -void -cfs_closedir(struct cfs_dir *p) -{ - cbm_closedir(12); -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/c64/lib/pfs.S b/platform/c64/lib/pfs.S index 0ebe24a07..89eb03ae0 100644 --- a/platform/c64/lib/pfs.S +++ b/platform/c64/lib/pfs.S @@ -36,7 +36,7 @@ .constructor init_pfs .destructor done_pfs .importzp ptr1, ptr2, ptr3, sp - .import __curunit, __filetype, popax, addysp, subysp + .import curunit, __filetype, popax, addysp, subysp .export pfs_rwcommon, pfs_rwsetflags, pfs_rwcommonend .if F_IDE64 .export ide64_rwprepare, ide64_rwfinish @@ -178,7 +178,7 @@ next: inc ptr2 ;next file number stx ptr2+1 nextsa: inc ptr2+1 ;next channel retr: lda ptr2 ;file number - ldx __curunit + ldx curunit ldy ptr2+1 ;secondary address jsr SETLFS jsr OPEN ;open From 107b79c0193c604b8c47ef1593493ed999b7172d Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Thu, 14 Feb 2013 15:45:33 +0100 Subject: [PATCH 6/7] The recent cc65 snapshot yields somewhat small programs so we can move back to the MTU size used before. --- examples/webbrowser/Makefile.atari.defines | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/webbrowser/Makefile.atari.defines b/examples/webbrowser/Makefile.atari.defines index 7713f7f1e..54380b38d 100644 --- a/examples/webbrowser/Makefile.atari.defines +++ b/examples/webbrowser/Makefile.atari.defines @@ -1 +1 @@ -DEFINES = WITH_CLIENT,WITH_DNS,WITH_GUI,MTU_SIZE=900 +DEFINES = WITH_CLIENT,WITH_DNS,WITH_GUI,MTU_SIZE=1000 From 9040f83fd42d45c7a591bdc45a17676ff2deb888 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Thu, 14 Feb 2013 15:51:09 +0100 Subject: [PATCH 7/7] Reduced program size. On the C128 the custom PFS code doesn't add functionality (as it does with IDE64 support on the C64) but is "only" smaller than the POSIX file i/o code in the C library. But the POSIX directory access code in the C library relies on the POSIX file i/o code anyway so there no point in additionally adding the PFS code to the FTP program. --- examples/ftp/Makefile.c128.defines | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ftp/Makefile.c128.defines b/examples/ftp/Makefile.c128.defines index 688d85113..7f438d1d1 100644 --- a/examples/ftp/Makefile.c128.defines +++ b/examples/ftp/Makefile.c128.defines @@ -1 +1 @@ -DEFINES = WITH_CLIENT,WITH_DNS,WITH_GUI,WITH_PFS +DEFINES = WITH_CLIENT,WITH_DNS,WITH_GUI