diff --git a/Makefile b/Makefile index 52fa4cc..02a2abf 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,7 @@ include $(MAKETOPDIR)/defaults.mk @ echo "SUBDIRS += $(TOPDIR)/animations" >> $@ @ echo "SUBDIRS += $(TOPDIR)/animations/bitmapscroller" >> $@ @ echo "SUBDIRS += $(TOPDIR)/smallani" >> $@ + @ echo "SUBDIRS += $(TOPDIR)/user" >> $@ @ (for subdir in `grep -e "^#define .*_SUPPORT" $(TOPDIR)/autoconf.h \ | sed -e "s/^#define /$(TOPDIR)\//" -e "s/_SUPPORT.*//" \ | tr "[A-Z]\\n" "[a-z] " `; do \ diff --git a/config.in b/config.in index a3e0154..0baff2d 100644 --- a/config.in +++ b/config.in @@ -95,6 +95,11 @@ source src/animations/config.in ############################################################################### -### small Animations Menu ##################################################### +### Small Animations Menu ##################################################### source src/smallani/config.in ############################################################################### + + +### User Menu ################################################################# +source src/user/config.in +############################################################################### diff --git a/ld_scripts/avr5.x b/ld_scripts/avr5.x index 30312af..cd9fda1 100644 --- a/ld_scripts/avr5.x +++ b/ld_scripts/avr5.x @@ -1,14 +1,19 @@ /* Default linker script, for normal executables */ +/* Copyright (C) 2014-2016 Free Software Foundation, Inc. + Copying and distribution of this script, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. */ OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr") OUTPUT_ARCH(avr:5) MEMORY { - text (rx) : ORIGIN = 0, LENGTH = 128K - data (rw!x) : ORIGIN = 0x800060, LENGTH = 0xffa0 - eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K + text (rx) : ORIGIN = 0, LENGTH = 128K + data (rw!x) : ORIGIN = 0x800060, LENGTH = 0xffa0 + eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K fuse (rw!x) : ORIGIN = 0x820000, LENGTH = 1K lock (rw!x) : ORIGIN = 0x830000, LENGTH = 1K signature (rw!x) : ORIGIN = 0x840000, LENGTH = 1K + user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = 1K } SECTIONS { @@ -70,26 +75,32 @@ SECTIONS .rel.plt : { *(.rel.plt) } .rela.plt : { *(.rela.plt) } /* Internal text space or external memory. */ - .text : + .text : { *(.vectors) KEEP(*(.vectors)) /* For data that needs to reside in the lower 64k of progmem. */ - *(.progmem.gcc*) - *(.progmem*) + *(.progmem.gcc*) + /* PR 13812: Placing the trampolines here gives a better chance + that they will be in range of the code that uses them. */ . = ALIGN(2); __trampolines_start = . ; /* The jump trampolines for the 16-bit limited relocs will reside here. */ *(.trampolines) - *(.trampolines*) + *(.trampolines*) __trampolines_end = . ; + /* avr-libc expects these data to reside in lower 64K. */ + *libprintf_flt.a:*(.progmem.data) + *libc.a:*(.progmem.data) + *(.progmem*) + . = ALIGN(2); /* For future tablejump instruction arrays for 3 byte pc devices. We don't relax jump/call instructions within these sections. */ *(.jumptables) - *(.jumptables*) + *(.jumptables*) /* For code that needs to reside in the lower 128k progmem. */ *(.lowtext) - *(.lowtext*) + *(.lowtext*) __ctors_start = . ; *(.ctors) __ctors_end = . ; @@ -122,7 +133,7 @@ SECTIONS KEEP (*(.init9)) *(.text) . = ALIGN(2); - *(.text.*) + *(.text.*) . = ALIGN(2); *(.fini9) /* _exit() starts here. */ KEEP (*(.fini9)) @@ -146,13 +157,13 @@ SECTIONS KEEP (*(.fini0)) _etext = . ; } > text - .data : AT (ADDR (.text) + SIZEOF (.text)) + .data : { PROVIDE (__data_start = .) ; - *(.data) - *(.data*) + *(.data) + *(.data*) *(.rodata) /* We need to include .rodata here if gcc is used */ - *(.rodata*) /* with -fdata-sections. */ + *(.rodata*) /* with -fdata-sections. */ *(.gnu.linkonce.d*) PROVIDE (_game_descriptors_start__ = .) ; *(.game_descriptors) @@ -160,19 +171,19 @@ SECTIONS . = ALIGN(2); _edata = . ; PROVIDE (__data_end = .) ; - } > data - .bss SIZEOF(.data) + ADDR(.data) : + } > data AT> text + .bss ADDR(.data) + SIZEOF (.data) : AT (ADDR (.bss)) { PROVIDE (__bss_start = .) ; *(.bss) - *(.bss*) + *(.bss*) *(COMMON) PROVIDE (__bss_end = .) ; } > data __data_load_start = LOADADDR(.data); __data_load_end = __data_load_start + SIZEOF(.data); /* Global data not cleared after reset. */ - .noinit SIZEOF(.bss) + ADDR(.bss) : + .noinit ADDR(.bss) + SIZEOF (.bss) : AT (ADDR (.noinit)) { PROVIDE (__noinit_start = .) ; *(.noinit*) @@ -182,7 +193,8 @@ SECTIONS } > data .eeprom : { - *(.eeprom*) + /* See .data above... */ + KEEP(*(.eeprom*)) __eeprom_end = . ; } > eeprom .fuse : @@ -208,6 +220,7 @@ SECTIONS .stab.index 0 : { *(.stab.index) } .stab.indexstr 0 : { *(.stab.indexstr) } .comment 0 : { *(.comment) } + .note.gnu.build-id : { *(.note.gnu.build-id) } /* DWARF debug sections. Symbols in the DWARF debugging sections are relative to the beginning of the section so we begin them at 0. */ @@ -221,11 +234,21 @@ SECTIONS .debug_aranges 0 : { *(.debug_aranges) } .debug_pubnames 0 : { *(.debug_pubnames) } /* DWARF 2 */ - .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } + .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) } .debug_frame 0 : { *(.debug_frame) } .debug_str 0 : { *(.debug_str) } .debug_loc 0 : { *(.debug_loc) } .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* DWARF 3 */ + .debug_pubtypes 0 : { *(.debug_pubtypes) } + .debug_ranges 0 : { *(.debug_ranges) } + /* DWARF Extension. */ + .debug_macro 0 : { *(.debug_macro) } } diff --git a/ld_scripts/avr51.x b/ld_scripts/avr51.x index 3be4c35..8a58159 100644 --- a/ld_scripts/avr51.x +++ b/ld_scripts/avr51.x @@ -1,14 +1,19 @@ /* Default linker script, for normal executables */ +/* Copyright (C) 2014-2016 Free Software Foundation, Inc. + Copying and distribution of this script, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. */ OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr") OUTPUT_ARCH(avr:51) MEMORY { - text (rx) : ORIGIN = 0, LENGTH = 128K - data (rw!x) : ORIGIN = 0x800100, LENGTH = 0xff00 - eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K + text (rx) : ORIGIN = 0, LENGTH = 128K + data (rw!x) : ORIGIN = 0x800100, LENGTH = 0xff00 + eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K fuse (rw!x) : ORIGIN = 0x820000, LENGTH = 1K lock (rw!x) : ORIGIN = 0x830000, LENGTH = 1K signature (rw!x) : ORIGIN = 0x840000, LENGTH = 1K + user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = 1K } SECTIONS { @@ -70,26 +75,32 @@ SECTIONS .rel.plt : { *(.rel.plt) } .rela.plt : { *(.rela.plt) } /* Internal text space or external memory. */ - .text : + .text : { *(.vectors) KEEP(*(.vectors)) /* For data that needs to reside in the lower 64k of progmem. */ - *(.progmem.gcc*) - *(.progmem*) + *(.progmem.gcc*) + /* PR 13812: Placing the trampolines here gives a better chance + that they will be in range of the code that uses them. */ . = ALIGN(2); __trampolines_start = . ; /* The jump trampolines for the 16-bit limited relocs will reside here. */ *(.trampolines) - *(.trampolines*) + *(.trampolines*) __trampolines_end = . ; + /* avr-libc expects these data to reside in lower 64K. */ + *libprintf_flt.a:*(.progmem.data) + *libc.a:*(.progmem.data) + *(.progmem*) + . = ALIGN(2); /* For future tablejump instruction arrays for 3 byte pc devices. We don't relax jump/call instructions within these sections. */ *(.jumptables) - *(.jumptables*) + *(.jumptables*) /* For code that needs to reside in the lower 128k progmem. */ *(.lowtext) - *(.lowtext*) + *(.lowtext*) __ctors_start = . ; *(.ctors) __ctors_end = . ; @@ -122,7 +133,7 @@ SECTIONS KEEP (*(.init9)) *(.text) . = ALIGN(2); - *(.text.*) + *(.text.*) . = ALIGN(2); *(.fini9) /* _exit() starts here. */ KEEP (*(.fini9)) @@ -146,13 +157,13 @@ SECTIONS KEEP (*(.fini0)) _etext = . ; } > text - .data : AT (ADDR (.text) + SIZEOF (.text)) + .data : { PROVIDE (__data_start = .) ; - *(.data) - *(.data*) + *(.data) + *(.data*) *(.rodata) /* We need to include .rodata here if gcc is used */ - *(.rodata*) /* with -fdata-sections. */ + *(.rodata*) /* with -fdata-sections. */ *(.gnu.linkonce.d*) PROVIDE (_game_descriptors_start__ = .) ; *(.game_descriptors) @@ -160,19 +171,19 @@ SECTIONS . = ALIGN(2); _edata = . ; PROVIDE (__data_end = .) ; - } > data - .bss SIZEOF(.data) + ADDR(.data) : + } > data AT> text + .bss ADDR(.data) + SIZEOF (.data) : AT (ADDR (.bss)) { PROVIDE (__bss_start = .) ; *(.bss) - *(.bss*) + *(.bss*) *(COMMON) PROVIDE (__bss_end = .) ; } > data __data_load_start = LOADADDR(.data); __data_load_end = __data_load_start + SIZEOF(.data); /* Global data not cleared after reset. */ - .noinit SIZEOF(.bss) + ADDR(.bss) : + .noinit ADDR(.bss) + SIZEOF (.bss) : AT (ADDR (.noinit)) { PROVIDE (__noinit_start = .) ; *(.noinit*) @@ -182,7 +193,8 @@ SECTIONS } > data .eeprom : { - *(.eeprom*) + /* See .data above... */ + KEEP(*(.eeprom*)) __eeprom_end = . ; } > eeprom .fuse : @@ -208,6 +220,7 @@ SECTIONS .stab.index 0 : { *(.stab.index) } .stab.indexstr 0 : { *(.stab.indexstr) } .comment 0 : { *(.comment) } + .note.gnu.build-id : { *(.note.gnu.build-id) } /* DWARF debug sections. Symbols in the DWARF debugging sections are relative to the beginning of the section so we begin them at 0. */ @@ -221,11 +234,21 @@ SECTIONS .debug_aranges 0 : { *(.debug_aranges) } .debug_pubnames 0 : { *(.debug_pubnames) } /* DWARF 2 */ - .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } + .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) } .debug_frame 0 : { *(.debug_frame) } .debug_str 0 : { *(.debug_str) } .debug_loc 0 : { *(.debug_loc) } .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* DWARF 3 */ + .debug_pubtypes 0 : { *(.debug_pubtypes) } + .debug_ranges 0 : { *(.debug_ranges) } + /* DWARF Extension. */ + .debug_macro 0 : { *(.debug_macro) } } diff --git a/ld_scripts/avr6.x b/ld_scripts/avr6.x index 26db017..175300d 100644 --- a/ld_scripts/avr6.x +++ b/ld_scripts/avr6.x @@ -1,14 +1,19 @@ /* Default linker script, for normal executables */ +/* Copyright (C) 2014-2016 Free Software Foundation, Inc. + Copying and distribution of this script, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. */ OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr") OUTPUT_ARCH(avr:6) MEMORY { - text (rx) : ORIGIN = 0, LENGTH = 1024K - data (rw!x) : ORIGIN = 0x800200, LENGTH = 0xfe00 - eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K + text (rx) : ORIGIN = 0, LENGTH = 1024K + data (rw!x) : ORIGIN = 0x800200, LENGTH = 0xfe00 + eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K fuse (rw!x) : ORIGIN = 0x820000, LENGTH = 1K lock (rw!x) : ORIGIN = 0x830000, LENGTH = 1K signature (rw!x) : ORIGIN = 0x840000, LENGTH = 1K + user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = 1K } SECTIONS { @@ -70,26 +75,32 @@ SECTIONS .rel.plt : { *(.rel.plt) } .rela.plt : { *(.rela.plt) } /* Internal text space or external memory. */ - .text : + .text : { *(.vectors) KEEP(*(.vectors)) /* For data that needs to reside in the lower 64k of progmem. */ - *(.progmem.gcc*) - *(.progmem*) + *(.progmem.gcc*) + /* PR 13812: Placing the trampolines here gives a better chance + that they will be in range of the code that uses them. */ . = ALIGN(2); __trampolines_start = . ; /* The jump trampolines for the 16-bit limited relocs will reside here. */ *(.trampolines) - *(.trampolines*) + *(.trampolines*) __trampolines_end = . ; + /* avr-libc expects these data to reside in lower 64K. */ + *libprintf_flt.a:*(.progmem.data) + *libc.a:*(.progmem.data) + *(.progmem*) + . = ALIGN(2); /* For future tablejump instruction arrays for 3 byte pc devices. We don't relax jump/call instructions within these sections. */ *(.jumptables) - *(.jumptables*) + *(.jumptables*) /* For code that needs to reside in the lower 128k progmem. */ *(.lowtext) - *(.lowtext*) + *(.lowtext*) __ctors_start = . ; *(.ctors) __ctors_end = . ; @@ -122,7 +133,7 @@ SECTIONS KEEP (*(.init9)) *(.text) . = ALIGN(2); - *(.text.*) + *(.text.*) . = ALIGN(2); *(.fini9) /* _exit() starts here. */ KEEP (*(.fini9)) @@ -146,13 +157,13 @@ SECTIONS KEEP (*(.fini0)) _etext = . ; } > text - .data : AT (ADDR (.text) + SIZEOF (.text)) + .data : { PROVIDE (__data_start = .) ; - *(.data) - *(.data*) + *(.data) + *(.data*) *(.rodata) /* We need to include .rodata here if gcc is used */ - *(.rodata*) /* with -fdata-sections. */ + *(.rodata*) /* with -fdata-sections. */ *(.gnu.linkonce.d*) PROVIDE (_game_descriptors_start__ = .) ; *(.game_descriptors) @@ -160,19 +171,19 @@ SECTIONS . = ALIGN(2); _edata = . ; PROVIDE (__data_end = .) ; - } > data - .bss SIZEOF(.data) + ADDR(.data) : + } > data AT> text + .bss ADDR(.data) + SIZEOF (.data) : AT (ADDR (.bss)) { PROVIDE (__bss_start = .) ; *(.bss) - *(.bss*) + *(.bss*) *(COMMON) PROVIDE (__bss_end = .) ; } > data __data_load_start = LOADADDR(.data); __data_load_end = __data_load_start + SIZEOF(.data); /* Global data not cleared after reset. */ - .noinit SIZEOF(.bss) + ADDR(.bss) : + .noinit ADDR(.bss) + SIZEOF (.bss) : AT (ADDR (.noinit)) { PROVIDE (__noinit_start = .) ; *(.noinit*) @@ -182,7 +193,8 @@ SECTIONS } > data .eeprom : { - *(.eeprom*) + /* See .data above... */ + KEEP(*(.eeprom*)) __eeprom_end = . ; } > eeprom .fuse : @@ -208,6 +220,7 @@ SECTIONS .stab.index 0 : { *(.stab.index) } .stab.indexstr 0 : { *(.stab.indexstr) } .comment 0 : { *(.comment) } + .note.gnu.build-id : { *(.note.gnu.build-id) } /* DWARF debug sections. Symbols in the DWARF debugging sections are relative to the beginning of the section so we begin them at 0. */ @@ -221,11 +234,21 @@ SECTIONS .debug_aranges 0 : { *(.debug_aranges) } .debug_pubnames 0 : { *(.debug_pubnames) } /* DWARF 2 */ - .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } + .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) } .debug_frame 0 : { *(.debug_frame) } .debug_str 0 : { *(.debug_str) } .debug_loc 0 : { *(.debug_loc) } .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* DWARF 3 */ + .debug_pubtypes 0 : { *(.debug_pubtypes) } + .debug_ranges 0 : { *(.debug_ranges) } + /* DWARF Extension. */ + .debug_macro 0 : { *(.debug_macro) } } diff --git a/profiles/borg-ancient b/profiles/borg-ancient index 414e68e..b0e70f7 100644 --- a/profiles/borg-ancient +++ b/profiles/borg-ancient @@ -5,7 +5,7 @@ # # General Setup # -MCU=atmega32 +MCU=atmega16 FREQ=16000000 # @@ -21,6 +21,7 @@ BORG_HW=HW_ANCIENTBORG # COLPORT=PORTC ROWPORT=PORTA +# WATCHDOG_ENABLED is not set # # Features diff --git a/profiles/borg-andre b/profiles/borg-andre index 9da057d..747f5cc 100644 --- a/profiles/borg-andre +++ b/profiles/borg-andre @@ -5,7 +5,7 @@ # # General Setup # -MCU=atmega644p +MCU=atmega32 FREQ=16000000 # @@ -68,11 +68,14 @@ MENU_SUPPORT=y # GAME_TETRIS_CORE=y GAME_TETRIS=y -GAME_BASTET=y -GAME_TETRIS_FP=y +# GAME_BASTET is not set +# GAME_TETRIS_FP is not set GAME_SPACE_INVADERS=y GAME_SNAKE=y +# SNAKE_POV_CONTROL is not set +SNAKE_GAME_DELAY=200 GAME_BREAKOUT=y +# GAME_KART is not set # # Animations @@ -82,7 +85,6 @@ ANIMATION_SPIRAL=y SPIRAL_DELAY=5 ANIMATION_JOERN1=y ANIMATION_SNAKE=y -SNAKE_GAME_DELAY=200 SNAKE_ANIM_DELAY=100 SNAKE_TERMINATION_DELAY=60 SNAKE_MAX_LENGTH=64 @@ -113,9 +115,10 @@ TIME_MASTER_ADDR=00 TIME_UPDATE_TIMEOUT=50 ANIMATION_BMSCROLLER=y ANIMATION_LABORLOGO=y -ANIMATION_AMPHIBIAN=y +# ANIMATION_AMPHIBIAN is not set # ANIMATION_LOGO_OOS is not set ANIMATION_FAIRYDUST=y +# ANIMATION_THISISNOTDETROIT is not set # # Fixed-point math patterns @@ -124,10 +127,13 @@ ANIMATION_PLASMA=y FP_PLASMA_DELAY=1 ANIMATION_PSYCHEDELIC=y FP_PSYCHO_DELAY=15 +ANIMATION_SURFACE_WAVE=y +FP_SURFACE_DELAY=15 ANIMATION_BLACKHOLE=y +ANIMATION_DNA=y ANIMATION_SQUARES=y -# ANIMATION_TESTS is not set -# ANIMATION_OFF is not set +ANIMATION_TESTS=y +ANIMATION_OFF=y # # small Animations @@ -144,3 +150,7 @@ SMALLANIMATION_ROWBOUNCE_COUNT=10 # SMALLANIMATION_COLBOUNCE is not set SMALLANIMATION_COLBOUNCE_SPEED=50 SMALLANIMATION_COLBOUNCE_COUNT=10 + +# +# User Animations +# diff --git a/profiles/borg-labor-lounge b/profiles/borg-labor-lounge new file mode 100644 index 0000000..7f7a189 --- /dev/null +++ b/profiles/borg-labor-lounge @@ -0,0 +1,162 @@ +# +# Automatically generated by make menuconfig: don't edit +# + +# +# General Setup +# +MCU=atmega644p +FREQ=16000000 + +# +# Borg Hardware +# +NUM_ROWS=16 +NUM_COLS=16 +NUMPLANE=3 +BORG_HW=HW_BORG_16 + +# +# Borg16 port setup +# +HIGH_CONTRAST=y +UART_SUPPORT=y +UART_BAUDRATE_SETTING=19200 +COLPORT1=PORTC +COLPORT2=PORTA +ROWPORT=PORTD +PIN_MCLR=4 +PIN_CLK=6 +PIN_DATA=7 +REVERSE_COLS=y +# INVERT_ROWS is not set +# INTERLACED_ROWS is not set +# INTERLACED_COLS is not set + +# +# Features +# +RANDOM_SUPPORT=y +# LAP_TIME_EXTENSION is not set +SCROLLTEXT_SUPPORT=y +SCROLLTEXT_FONT=FONT_ARIAL8 +SCROLLTEXT_BUFFER_SIZE=128 +SCROLL_X_SPEED=20 +SCROLL_Y_SPEED=20 +SCROLLTEXT_TEXT=" lxtemp.c + @echo "int main() {return 0;}" > lxtemp.c @if $(HOSTCC) $(HOSTCFLAGS) -lncurses lxtemp.c ; then \ rm -f lxtemp.c a.out; \ else \ diff --git a/scripts/lxdialog/lxdialog.c b/scripts/lxdialog/lxdialog.c index 6f4c1fd..c8d5286 100644 --- a/scripts/lxdialog/lxdialog.c +++ b/scripts/lxdialog/lxdialog.c @@ -208,7 +208,7 @@ j_inputbox (const char *t, int ac, const char * const * av) int ret = dialog_inputbox (t, av[2], atoi (av[3]), atoi (av[4]), ac == 6 ? av[5] : (char *) NULL); if (ret == 0) - fprintf(stderr, dialog_input_result); + fputs(dialog_input_result, stderr); return ret; } diff --git a/src/animations/Makefile b/src/animations/Makefile index ea51672..87a4ecd 100644 --- a/src/animations/Makefile +++ b/src/animations/Makefile @@ -42,7 +42,7 @@ ifeq ($(ANIMATION_LTN_ANT),y) SRC += ltn_ant.c endif -ifneq (,$(filter y,$(ANIMATION_PLASMA) $(ANIMATION_PSYCHEDELIC))) +ifneq (,$(filter y,$(ANIMATION_PLASMA) $(ANIMATION_PSYCHEDELIC) $(ANIMATION_SURFACE_WAVE))) SRC += fpmath_patterns.c endif diff --git a/src/animations/bitmapscroller/Makefile b/src/animations/bitmapscroller/Makefile index 2bdc1c7..238e0e8 100644 --- a/src/animations/bitmapscroller/Makefile +++ b/src/animations/bitmapscroller/Makefile @@ -22,6 +22,10 @@ ifeq ($(ANIMATION_FAIRYDUST),y) SRC += fairydust.c endif +ifeq ($(ANIMATION_THISISNOTDETROIT),y) + SRC += thisisnotdetroit.c +endif + include $(MAKETOPDIR)/rules.mk include $(MAKETOPDIR)/depend.mk diff --git a/src/animations/bitmapscroller/config.in b/src/animations/bitmapscroller/config.in index ba73eb1..f13ae9a 100644 --- a/src/animations/bitmapscroller/config.in +++ b/src/animations/bitmapscroller/config.in @@ -3,4 +3,5 @@ dep_bool_menu "Bitmap Scroller" ANIMATION_BMSCROLLER y $RANDOM_SUPPORT dep_bool "Amphibian" ANIMATION_AMPHIBIAN $ANIMATION_BMSCROLLER dep_bool "Out of Spec Logo" ANIMATION_LOGO_OOS $ANIMATION_BMSCROLLER dep_bool "Fairydust" ANIMATION_FAIRYDUST $ANIMATION_BMSCROLLER + dep_bool "This is not Detroit" ANIMATION_THISISNOTDETROIT $ANIMATION_BMSCROLLER endmenu \ No newline at end of file diff --git a/src/animations/bitmapscroller/thisisnotdetroit.c b/src/animations/bitmapscroller/thisisnotdetroit.c new file mode 100644 index 0000000..2241a43 --- /dev/null +++ b/src/animations/bitmapscroller/thisisnotdetroit.c @@ -0,0 +1,141 @@ +#include +#include + +#include "../../compat/pgmspace.h" +#include "bitmapscroller.h" +#include "thisisnotdetroit.h" + + +static uint8_t const athisIsNotDetroitBitmap[2][55][8] PROGMEM = + {{{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x80}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x60}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x20, 0x64}, + {0x00, 0x00, 0x00, 0x01, 0x01, 0x18, 0x03, 0x24}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x8e, 0xe1, 0xd4}, + {0x00, 0x00, 0x00, 0x00, 0x01, 0x5f, 0xeb, 0x22}, + {0x00, 0x00, 0x00, 0x01, 0x11, 0xfe, 0x10, 0x00}, + {0x00, 0x00, 0x06, 0x8f, 0xa5, 0x18, 0x00, 0x00}, + {0x00, 0x00, 0x3f, 0xf0, 0xc0, 0x00, 0x00, 0x01}, + {0x01, 0x82, 0x7f, 0xfa, 0x00, 0x00, 0x00, 0x00}, + {0x03, 0xff, 0xff, 0x40, 0x00, 0x00, 0x00, 0x00}, + {0x0f, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x1f, 0xf6, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00}, + {0x09, 0xc0, 0x00, 0x37, 0xc0, 0x00, 0x00, 0x00}, + {0x38, 0x00, 0x0a, 0xe7, 0x40, 0x00, 0x00, 0x00}, + {0x38, 0x01, 0xce, 0xff, 0x00, 0x00, 0x00, 0x00}, + {0x3c, 0xbe, 0xce, 0xf7, 0xc0, 0x00, 0x00, 0x00}, + {0x3c, 0xfd, 0xce, 0xf3, 0xe0, 0x00, 0x00, 0x00}, + {0x1c, 0xf8, 0xfe, 0xf0, 0x60, 0x00, 0x00, 0x00}, + {0x04, 0x70, 0xfe, 0xf2, 0xe0, 0x00, 0x00, 0x00}, + {0x00, 0x70, 0xee, 0xff, 0xe0, 0x00, 0x00, 0x00}, + {0x00, 0x70, 0xce, 0xf0, 0x80, 0x06, 0xc0, 0x00}, + {0x00, 0x71, 0xce, 0x60, 0x02, 0x1f, 0x80, 0x00}, + {0x00, 0x71, 0xc0, 0x00, 0x1f, 0xdf, 0x40, 0x00}, + {0x00, 0x70, 0x00, 0x03, 0xbf, 0xd6, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0xf3, 0x3d, 0xc6, 0x00, 0x00}, + {0x00, 0x01, 0x40, 0xfb, 0xf1, 0xe6, 0x00, 0x00}, + {0x00, 0x21, 0xf0, 0xfb, 0xb8, 0xc6, 0x00, 0x00}, + {0x00, 0x77, 0x80, 0xfb, 0xf0, 0xe6, 0x00, 0x00}, + {0x00, 0x73, 0x80, 0xef, 0xbf, 0xc6, 0x00, 0x00}, + {0x00, 0x77, 0xe0, 0xef, 0xbf, 0x84, 0x00, 0x0c}, + {0x00, 0x71, 0xf0, 0xef, 0x8e, 0x00, 0x00, 0xf8}, + {0x00, 0x70, 0x70, 0xe7, 0x80, 0x00, 0x1b, 0xfc}, + {0x00, 0x73, 0xf0, 0xc0, 0x00, 0x0f, 0x1b, 0xf0}, + {0x00, 0x73, 0xe0, 0x00, 0x0c, 0x3f, 0x98, 0xf0}, + {0x00, 0x70, 0x40, 0x03, 0x7f, 0x7b, 0x98, 0xf0}, + {0x00, 0x60, 0x00, 0x5f, 0x7e, 0x73, 0xd8, 0xf0}, + {0x00, 0x00, 0x1f, 0x7f, 0x67, 0xf1, 0xd8, 0xf0}, + {0x00, 0x0e, 0x1f, 0x7c, 0x77, 0xe3, 0x98, 0xf0}, + {0x00, 0x3f, 0x1e, 0x1c, 0x7c, 0xf7, 0x9c, 0xe0}, + {0x00, 0x7f, 0xdb, 0x1c, 0x6e, 0x7f, 0x1c, 0x00}, + {0x00, 0x71, 0xdf, 0x1c, 0x7f, 0x3f, 0x00, 0x00}, + {0x00, 0x71, 0xdb, 0x1c, 0x67, 0x80, 0x00, 0x00}, + {0x00, 0x71, 0xdd, 0x1c, 0x50, 0x00, 0x00, 0x00}, + {0x00, 0x73, 0xdf, 0x18, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x7f, 0x1f, 0x80, 0x00, 0x00, 0xfc, 0x00}, + {0x00, 0x7e, 0x10, 0x00, 0x00, 0x7f, 0xf0, 0x00}, + {0x00, 0x68, 0x00, 0x00, 0x2f, 0xff, 0x90, 0x00}, + {0x00, 0x00, 0x00, 0x03, 0xfe, 0xa3, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0x1f, 0xfd, 0x00, 0x00, 0x00}, + {0x00, 0x3c, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00}, + {0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, + + {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x60}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x08}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x80, 0x2a}, + {0x00, 0x00, 0x00, 0x02, 0x40, 0x3f, 0xf0, 0x00}, + {0x00, 0x00, 0x00, 0x00, 0x80, 0x7f, 0xc0, 0x00}, + {0x00, 0x00, 0x01, 0x41, 0xd7, 0xe0, 0x00, 0x02}, + {0x00, 0x00, 0x1f, 0xff, 0x80, 0x00, 0x00, 0x00}, + {0x00, 0x7d, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00}, + {0x03, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00}, + {0x1f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x0f, 0xf8, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x00}, + {0x3e, 0x00, 0x00, 0x03, 0xe0, 0x00, 0x00, 0x00}, + {0x38, 0x00, 0x06, 0x77, 0xc0, 0x00, 0x00, 0x00}, + {0x18, 0x00, 0xce, 0x66, 0x00, 0x00, 0x00, 0x00}, + {0x18, 0x7d, 0xce, 0x67, 0xc0, 0x00, 0x00, 0x00}, + {0x1d, 0xfd, 0xce, 0x67, 0xe0, 0x00, 0x00, 0x00}, + {0x0d, 0xf1, 0xfe, 0x60, 0xe0, 0x00, 0x00, 0x00}, + {0x0c, 0x31, 0xfe, 0x67, 0xe0, 0x00, 0x00, 0x00}, + {0x00, 0x31, 0xce, 0x67, 0xc0, 0x00, 0x00, 0x00}, + {0x00, 0x31, 0xce, 0x67, 0x00, 0x01, 0xc0, 0x00}, + {0x00, 0x31, 0xce, 0x00, 0x00, 0x1f, 0xc0, 0x00}, + {0x00, 0x31, 0xc0, 0x00, 0x0f, 0x9f, 0x80, 0x00}, + {0x00, 0x30, 0x00, 0x03, 0x1f, 0xc7, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0x73, 0xb9, 0xe7, 0x00, 0x00}, + {0x00, 0x00, 0xe0, 0x73, 0x38, 0xe7, 0x00, 0x00}, + {0x00, 0x13, 0xe0, 0x7b, 0x70, 0xe7, 0x00, 0x00}, + {0x00, 0x33, 0xe0, 0x7f, 0x39, 0xc7, 0x00, 0x00}, + {0x00, 0x37, 0x00, 0x7f, 0x3f, 0xc7, 0x00, 0x00}, + {0x00, 0x33, 0xe0, 0x6f, 0x3f, 0x80, 0x00, 0x00}, + {0x00, 0x33, 0xf0, 0x67, 0x1f, 0x00, 0x01, 0xfc}, + {0x00, 0x30, 0x70, 0x67, 0x00, 0x00, 0x1d, 0xf8}, + {0x00, 0x33, 0xf0, 0x60, 0x00, 0x1f, 0x1d, 0xe0}, + {0x00, 0x37, 0xe0, 0x00, 0x00, 0x3f, 0x9c, 0x60}, + {0x00, 0x33, 0x80, 0x00, 0x7e, 0x7f, 0xdc, 0x60}, + {0x00, 0x00, 0x00, 0x3f, 0x7f, 0x71, 0xdc, 0x60}, + {0x00, 0x00, 0x0f, 0x7f, 0x77, 0x61, 0xdc, 0x60}, + {0x00, 0x00, 0x1f, 0x7c, 0x7e, 0x71, 0xdc, 0x60}, + {0x00, 0x3f, 0x9c, 0x1c, 0x7e, 0x7b, 0x98, 0x60}, + {0x00, 0x3f, 0x9f, 0x1c, 0x7e, 0x7f, 0x98, 0x00}, + {0x00, 0x33, 0xdf, 0x1c, 0x67, 0x3e, 0x00, 0x00}, + {0x00, 0x31, 0xdc, 0x1c, 0x77, 0x00, 0x00, 0x00}, + {0x00, 0x31, 0xdb, 0x9c, 0x60, 0x00, 0x00, 0x00}, + {0x00, 0x33, 0x9f, 0x9c, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x3f, 0x9f, 0x00, 0x00, 0x01, 0xf8, 0x00}, + {0x00, 0x3f, 0x00, 0x00, 0x00, 0x1f, 0xf8, 0x00}, + {0x00, 0x30, 0x00, 0x00, 0x1f, 0xff, 0xe0, 0x00}, + {0x00, 0x00, 0x00, 0x0f, 0xff, 0x5c, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0x1f, 0xf8, 0x00, 0x00, 0x00}, + {0x00, 0x1e, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}}; + + +static uint8_t logo_thisIsNotDetroit_getChunk(unsigned char const nBitPlane, + unsigned char const nChunkX, + unsigned char const nChunkY, + unsigned int const nFrame) +{ + assert(nBitPlane < 2); + assert(nChunkX < 8); + assert(nChunkY < 55); + + return pgm_read_byte(&athisIsNotDetroitBitmap[nBitPlane][nChunkY][nChunkX]); +} + + +void logo_thisIsNotDetroit() +{ + // width 64, height 55, 2 bitplanes (4 colors), 600 frames à 75ms + // frame change and viewport movement after every cyle (both dividers are 1) + bitmap_scroll(64, 55, 2, 600, 75, 1, 1, logo_thisIsNotDetroit_getChunk); +} diff --git a/src/animations/bitmapscroller/thisisnotdetroit.h b/src/animations/bitmapscroller/thisisnotdetroit.h new file mode 100644 index 0000000..b2f78fd --- /dev/null +++ b/src/animations/bitmapscroller/thisisnotdetroit.h @@ -0,0 +1,6 @@ +#ifndef THISISNOTDETROIT_H_ +#define THISISNOTDETROIT_H_ + +void logo_thisIsNotDetroit(); + +#endif /* THISISNOTDETROIT_H_ */ diff --git a/src/animations/config.in b/src/animations/config.in index 31f3899..e11e962 100644 --- a/src/animations/config.in +++ b/src/animations/config.in @@ -61,6 +61,9 @@ comment "Animations" bool "Psychedelic" ANIMATION_PSYCHEDELIC $ANIMATION_FIXEDPOINT int "Additional Frame Delay (in ms) For Psychedelic" FP_PSYCHO_DELAY 15 + + bool "Surface Wave" ANIMATION_SURFACE_WAVE $ANIMATION_FIXEDPOINT + int "Additional Frame Delay (in ms) For Psychedelic" FP_SURFACE_DELAY 15 endmenu bool "Black Hole" ANIMATION_BLACKHOLE diff --git a/src/animations/fpmath_patterns.c b/src/animations/fpmath_patterns.c index a4008cf..cac7867 100644 --- a/src/animations/fpmath_patterns.c +++ b/src/animations/fpmath_patterns.c @@ -566,4 +566,81 @@ void psychedelic(void) #endif /* ANIMATION_PSYCHEDELIC */ + +#ifdef ANIMATION_SURFACE_WAVE + +/** + * This type maintains values relevant for the surface wave animation which need + * to be persistent over consecutive invocations. + */ +typedef struct fixp_surface_s +{ + fixp_t fCenterX1; /**< X-coordinate of first curl's center. */ + fixp_t fCenterY1; /**< Y-coordinate of first curl's center. */ + fixp_t fCenterX2; /**< X-coordinate of second curl's center. */ + fixp_t fCenterY2; /**< Y-coordinate of second curl's center. */ +} fixp_surface_t; + + +/** + * Generates two flowing circular waves superimposing each other. + * @param x x-coordinate + * @param y y-coordinate + * @param t A step value which changes for each frame, allowing for animations. + * @param r A pointer to persistent interim results. + * @return The brightness value (0 < n <= NUM_PLANES) of the given coordinate. + */ +static unsigned char fixAnimSurfaceWave(unsigned char const x, + unsigned char const y, + fixp_t const t, + void *const r) +{ + assert(x < (LINEBYTES * 8)); + assert(y < NUM_ROWS); + fixp_surface_t *p = (fixp_surface_t *)r; + + if (x == 0 && y == 0) + { + p->fCenterX1 = fixMul(fixCos(t), fixScaleUp(NUM_COLS / 2)); + p->fCenterY1 = fixMul(fixSin(t), fixScaleUp(NUM_ROWS / 2)); + p->fCenterX2 = p->fCenterY1 + fixScaleUp(NUM_ROWS / (NUMPLANE + 1)); + p->fCenterY2 = p->fCenterX1 + fixScaleUp(NUM_COLS / (NUMPLANE + 1)); + } + + unsigned char const nResult1 = + fixMul(fixSin(fixDist(fixScaleUp(x), fixScaleUp(y), + p->fCenterX1, p->fCenterY1)) + FIX, + (fixp_t)((NUMPLANE - 1.05) * FIX)); + + unsigned char const nResult2 = + fixMul(fixSin(fixDist(fixScaleUp(x), fixScaleUp(y), + p->fCenterX2, p->fCenterY2)) + FIX, + (fixp_t)((NUMPLANE - 1.05) * FIX)); + + unsigned char const nResult = (nResult1 + nResult2) / 2 / FIX; + assert(nResult <= NUMPLANE); + + return nResult; +} + + +/** + * Starting point for the surface wave animation. + */ +void surfaceWave(void) +{ + fixp_surface_t r; +#ifndef __AVR__ + fixDrawPattern(0, fixScaleUp(75), 0.1 * FIX, 30, fixAnimSurfaceWave, &r); +#else + #ifndef FP_SURFACE_DELAY + #define FP_SURFACE_DELAY 15 + #endif + fixDrawPattern(0, fixScaleUp(60), 0.1 * FIX, FP_SURFACE_DELAY, + fixAnimSurfaceWave, &r); +#endif /* __AVR__ */ +} + +#endif /* ANIMATION_SURFACE_WAVE */ + /*@}*/ diff --git a/src/animations/fpmath_patterns.h b/src/animations/fpmath_patterns.h index d71440e..075447b 100644 --- a/src/animations/fpmath_patterns.h +++ b/src/animations/fpmath_patterns.h @@ -16,6 +16,8 @@ void plasma(void); void psychedelic(void); +void surfaceWave(void); + #endif /* FPMATH_PATTERNS_H_ */ /*@}*/ diff --git a/src/borg_hw/borg_hw_ancient.c b/src/borg_hw/borg_hw_ancient.c index e4772b4..61d34b1 100644 --- a/src/borg_hw/borg_hw_ancient.c +++ b/src/borg_hw/borg_hw_ancient.c @@ -1,21 +1,18 @@ #include #include - -#undef WATCHDOG_ENABLED -#ifdef WATCHDOG_ENABLED -# include -#endif - +#include #include "../config.h" #include "../makros.h" #include "borg_hw.h" + // define row port #ifndef ROWPORT # define ROWPORT PORTA #endif #define ROWDDR DDR(ROWPORT) + // define column port #ifndef COLPORT # define COLPORT PORTC @@ -23,20 +20,43 @@ #define COLDDR DDR(COLPORT) +// Timer0 control +#if defined(__AVR_ATmega164__) || \ + defined(__AVR_ATmega164P__) || \ + defined(__AVR_ATmega324__) || \ + defined(__AVR_ATmega324P__) || \ + defined(__AVR_ATmega644__) || \ + defined(__AVR_ATmega644P__) || \ + defined(__AVR_ATmega1284__) || \ + defined(__AVR_ATmega1284P__) +# define TIMER0_OFF() TIMSK0 &= ~(OCIE0A); TCCR0A = 0; TCCR0B = 0 +# define TIMER0_CTC_CS64() TCCR0A = _BV(WGM01); TCCR0B = _BV(CS01) | _BV(CS00) +# define TIMER0_RESET() TCNT0 = 0 +# define TIMER0_COMPARE(t) OCR0A = t +# define TIMER0_INT_ENABLE() TIMSK0 |= _BV(OCIE0A) +# define TIMER0_ISR TIMER0_COMPA_vect +#elif defined(__AVR_ATmega16__) || \ + defined(__AVR_ATmega32__) +# define TIMER0_OFF() TIMSK &= ~(OCIE0); TCCR0 = 0 +# define TIMER0_CTC_CS64() TCCR0 = _BV(WGM01) | _BV(CS01) | _BV(CS00) +# define TIMER0_RESET() TCNT0 = 0 +# define TIMER0_COMPARE(t) OCR0 = t +# define TIMER0_INT_ENABLE() TIMSK |= _BV(OCIE0) +# define TIMER0_ISR TIMER0_COMP_vect +#else +# error MCU not supported +#endif + + // buffer which holds the currently shown frame unsigned char pixmap[NUMPLANE][NUM_ROWS][LINEBYTES]; -ISR(TIMER0_COMP_vect) +ISR(TIMER0_ISR) { static unsigned char plane = 0; static unsigned char row = 0; -#ifdef WATCHDOG_ENABLED - // reset watchdog - wdt_reset(); -#endif - ROWPORT = 0; row++; if ((COLPORT <<= 1) == 0) { @@ -46,6 +66,11 @@ ISR(TIMER0_COMP_vect) if (++plane == NUMPLANE) { plane = 0; + +#ifdef WATCHDOG_ENABLED + // reset watchdog + wdt_reset(); +#endif } } @@ -56,50 +81,28 @@ ISR(TIMER0_COMP_vect) ROWPORT = pixmap[plane][row][0]; } + void timer0_off(){ cli(); COLPORT = 0; ROWPORT = 0; -#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__) || (__AVR_ATmega1284P__) || defined (__AVR_ATmega1284__) - TCCR0A = 0x00; - TCCR0B = 0x00; - TIMSK0 = 0; -#else - TCCR0 = 0x00; - TIMSK = 0; -#endif + TIMER0_OFF(); sei(); } -static void timer0_on(){ -/* TCCR0: FOC0 WGM00 COM01 COM00 WGM01 CS02 CS01 CS00 - CS02 CS01 CS00 - 0 0 0 stop - 0 0 1 clk - 0 1 0 clk/8 - 0 1 1 clk/64 - 1 0 0 clk/256 - 1 0 1 clk/1024 - -*/ - -#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__) || (__AVR_ATmega1284P__) || defined (__AVR_ATmega1284__) - TCCR0A = 0x02; // CTC Mode - TCCR0B = 0x03; // clk/64 - TCNT0 = 0x00; // reset timer - OCR0 = 0x0A; // compare with this value - TIMSK0 = 0x02; // compare match Interrupt on -#else - TCCR0 = 0x0B; // CTC Mode, clk/64 - TCNT0 = 0x00; // reset timer - OCR0 = 0x0A; // compare with this value - TIMSK = 0x02; // compare match Interrupt on -#endif + +// initialize timer which triggers the interrupt +static void timer0_on() { + TIMER0_CTC_CS64(); // CTC mode, prescaling conforms to clk/64 + TIMER0_RESET(); // set counter to 0 + TIMER0_COMPARE(0x10); // compare with this value first + TIMER0_INT_ENABLE(); // enable Timer/Counter0 Output Compare Match (A) Int. } + void borg_hw_init(){ // switch all pins of both the row and the column port to output mode ROWDDR = 0xFF; @@ -114,6 +117,6 @@ void borg_hw_init(){ #ifdef WATCHDOG_ENABLED // activate watchdog timer wdt_reset(); - wdt_enable(0x00); // 17ms watchdog + wdt_enable(WDTO_15MS); // 15ms watchdog #endif } diff --git a/src/borg_hw/borg_hw_andreborg.c b/src/borg_hw/borg_hw_andreborg.c index b32ee8f..de1a1b6 100644 --- a/src/borg_hw/borg_hw_andreborg.c +++ b/src/borg_hw/borg_hw_andreborg.c @@ -19,18 +19,18 @@ defined(__AVR_ATmega644P__) || \ defined(__AVR_ATmega1284__) || \ defined(__AVR_ATmega1284P__) -# define TIMER0_OFF() TCCR0A = 0; TCCR0B = 0 +# define TIMER0_OFF() TIMSK0 &= ~(OCIE0A); TCCR0A = 0; TCCR0B = 0 # define TIMER0_CTC_CS256() TCCR0A = _BV(WGM01); TCCR0B = _BV(CS02) # define TIMER0_RESET() TCNT0 = 0 # define TIMER0_COMPARE(t) OCR0A = t -# define TIMER0_INT_ENABLE() TIMSK0 = _BV(OCIE0A) +# define TIMER0_INT_ENABLE() TIMSK0 |= _BV(OCIE0A) # define TIMER0_ISR TIMER0_COMPA_vect #else // ATmega16/32 -# define TIMER0_OFF() TCCR0 = 0 +# define TIMER0_OFF() TIMSK &= ~(OCIE0); TCCR0 = 0 # define TIMER0_CTC_CS256() TCCR0 = _BV(WGM01) | _BV(CS02) # define TIMER0_RESET() TCNT0 = 0 # define TIMER0_COMPARE(t) OCR0 = t -# define TIMER0_INT_ENABLE() TIMSK = _BV(OCIE0) +# define TIMER0_INT_ENABLE() TIMSK |= _BV(OCIE0) # define TIMER0_ISR TIMER0_COMP_vect #endif diff --git a/src/borg_hw/borg_hw_borg16.c b/src/borg_hw/borg_hw_borg16.c index 06cd4b0..e9458c0 100644 --- a/src/borg_hw/borg_hw_borg16.c +++ b/src/borg_hw/borg_hw_borg16.c @@ -41,14 +41,14 @@ defined(__AVR_ATmega644P__) || \ defined(__AVR_ATmega1284__) || \ defined(__AVR_ATmega1284P__) -# define TIMER0_OFF() TCCR0A = 0; TCCR0B = 0 +# define TIMER0_OFF() TIMSK0 &= ~(OCIE0A); TCCR0A = 0; TCCR0B = 0 # define TIMER0_CTC_CS256() TCCR0A = _BV(WGM01); TCCR0B = _BV(CS02) # define TIMER0_RESET() TCNT0 = 0 # define TIMER0_COMPARE(t) OCR0A = t # define TIMER0_INT_ENABLE() TIMSK0 |= _BV(OCIE0A) # define TIMER0_ISR TIMER0_COMPA_vect #else // ATmega16/32 -# define TIMER0_OFF() TCCR0 = 0 +# define TIMER0_OFF() TIMSK &= ~(OCIE0); TCCR0 = 0 # define TIMER0_CTC_CS256() TCCR0 = _BV(WGM01) | _BV(CS02) # define TIMER0_RESET() TCNT0 = 0 # define TIMER0_COMPARE(t) OCR0 = t diff --git a/src/borg_hw/config_ancient.in b/src/borg_hw/config_ancient.in index 41fb59b..0d600b8 100644 --- a/src/borg_hw/config_ancient.in +++ b/src/borg_hw/config_ancient.in @@ -15,4 +15,6 @@ choice 'Row Port' \ PORTD PORTD" \ 'PORTA' ROWPORT +bool "Watchdog" WATCHDOG_ENABLED n + endmenu diff --git a/src/display_loop.c b/src/display_loop.c index 1d96d0f..e5e0bd6 100644 --- a/src/display_loop.c +++ b/src/display_loop.c @@ -18,6 +18,7 @@ #include "animations/bitmapscroller/amphibian.h" #include "animations/bitmapscroller/outofspec.h" #include "animations/bitmapscroller/fairydust.h" +#include "animations/bitmapscroller/thisisnotdetroit.h" #include "animations/fpmath_patterns.h" #include "animations/mherweg.h" #include "animations/moire.h" @@ -53,6 +54,8 @@ # include "joystick/joystick.h" #endif +#include "user/user_loop.h" + volatile unsigned char oldMode, oldOldmode, reverseMode, mode; jmp_buf newmode_jmpbuf; @@ -274,6 +277,18 @@ void display_loop(){ break; #endif +#ifdef ANIMATION_SURFACE_WAVE + case 27: + surfaceWave(); + break; +#endif + +#ifdef ANIMATION_THISISNOTDETROIT + case 28: + logo_thisIsNotDetroit(); + break; +#endif + #ifdef ANIMATION_TESTS case 31: test_level(1, false); @@ -315,6 +330,8 @@ void display_loop(){ break; #endif +#include "user/user_loop.c" + #ifdef MENU_SUPPORT case 0xFDu: mode = 1; diff --git a/src/games/kart/kart.c b/src/games/kart/kart.c index 52461a8..bf4c566 100644 --- a/src/games/kart/kart.c +++ b/src/games/kart/kart.c @@ -23,7 +23,7 @@ #if defined MENU_SUPPORT && defined GAME_KART -// icon (TODO: convert to hex) +// icon static const uint8_t icon[8] PROGMEM = { 0xE1, // 0b11100001, 0xE1, // 0b11100001, @@ -44,7 +44,7 @@ game_descriptor_t kart_game_descriptor __attribute__((section(".game_descriptors #define WAIT 15 -#define DRIVE_DIV 10 +#define DRIVE_DIV 9 #define DIRECTION_DIV 20 #define DECREASE_WIDTH_DIV 300 #define ACCELERATE_DIV 800 @@ -64,6 +64,9 @@ game_descriptor_t kart_game_descriptor __attribute__((section(".game_descriptors #define BORDER_DARK 2 #define OBSTACLE_COLOR 3 +#define NUM_FLASHES 3 +#define BLINK_TIME 300 + // borders = (middle, width, obstacle_pos) uint8_t borders[NUM_ROWS][3]; uint32_t extra_score = 0; @@ -72,6 +75,7 @@ void kart_game(){ // Initialisation uint32_t decrease_width_div = DECREASE_WIDTH_DIV; + uint16_t accelerate_div = ACCELERATE_DIV; uint8_t key_ignore[2]; uint8_t drive_div = DRIVE_DIV; uint8_t carpos = NUM_COLS / 2; @@ -109,12 +113,13 @@ void kart_game(){ // DECREASE WIDTH if(cycle % decrease_width_div == 0){ width--; - decrease_width_div = decrease_width_div*2; + decrease_width_div *= 2; } // INCREASE SPEED - if(cycle % ACCELERATE_DIV == 0 ){ + if(cycle % accelerate_div == 0 ){ drive_div--; + accelerate_div *= 2; } // MOVE @@ -142,7 +147,8 @@ void kart_game(){ key_ignore[1] = KEY_IGNORE_INITIAL; key_ignore[0] = 0; - }else if(JOYISUP && boost_till == 0){ + }else if(JOYISFIRE && boost_till == 0){ + blink(); boost_till = cycle + BOOST_CYCLES; boost_multiplier = BOOST_MULTIPLIER; }else if(!(JOYISRIGHT || JOYISLEFT)){ @@ -224,7 +230,8 @@ void kart_game(){ wait(WAIT); } - snprintf(game_over, sizeof(game_over), " 0; flashes--){ + memcpy(pixmap_copy_1, pixmap, sizeof(pixmap)); + memcpy(pixmap, pixmap_copy_2, sizeof(pixmap)); + memcpy(pixmap_copy_2, pixmap_copy_1, sizeof(pixmap)); + wait(BLINK_TIME); + } +} + /** * check if collision occours */ diff --git a/src/games/kart/kart.h b/src/games/kart/kart.h index bd4e284..c39f123 100644 --- a/src/games/kart/kart.h +++ b/src/games/kart/kart.h @@ -13,5 +13,6 @@ void kart_game(void); void drive(void); void save_street(uint8_t middle, uint8_t width, uint8_t obstacle_pos); uint8_t check_collision(uint8_t carpos); +void blink(); #endif /* KART_H_ */ diff --git a/src/scrolltext/scrolltext3.c b/src/scrolltext/scrolltext3.c index 118ecf2..266e4cf 100644 --- a/src/scrolltext/scrolltext3.c +++ b/src/scrolltext/scrolltext3.c @@ -34,12 +34,17 @@ #define MAX_FONTS 1 font fonts[MAX_FONTS]; + +// never used +/* #define MAX_SPECIALCOLORS 3 -static const unsigned char PROGMEM colorTable[MAX_SPECIALCOLORS * NUM_ROWS] = {1, 1, 2, 3, 3, 2, 1, 1, - 3, 3, 2, 1, 1, 2, 3, 3, - 3, 3, 2, 2, 3, 3, 2, 2 +static const unsigned char PROGMEM colorTable[MAX_SPECIALCOLORS * NUM_ROWS] ={ + 1, 1, 2, 3, 3, 2, 1, 1, + 3, 3, 2, 1, 1, 2, 3, 3, + 3, 3, 2, 2, 3, 3, 2, 2 }; +*/ static const char default_text[] PROGMEM = SCROLLTEXT_TEXT; char scrolltext_text[SCROLLTEXT_BUFFER_SIZE]; diff --git a/src/uart/uart_commands.c b/src/uart/uart_commands.c index 6f64d3f..62ed3cc 100644 --- a/src/uart/uart_commands.c +++ b/src/uart/uart_commands.c @@ -50,9 +50,10 @@ extern volatile unsigned char reverseMode; #define CR "\r\n" -#if (!(defined(eeprom_update_block) && \ - ((E2PAGESIZE == 2) || (E2PAGESIZE == 4) || (E2PAGESIZE == 8)))) || \ - !defined(ANIMATION_TESTS) || !(defined(SCROLLTEXT_SUPPORT)) +#if ((__AVR_LIBC_MAJOR__ < 1) || \ + ((__AVR_LIBC_MAJOR__ == 1) && (__AVR_LIBC_MINOR__ < 7))) || \ + ((E2PAGESIZE != 2) && (E2PAGESIZE != 4) && (E2PAGESIZE != 8)) || \ + !defined(ANIMATION_TESTS) || !(defined(SCROLLTEXT_SUPPORT)) char const UART_STR_NOTIMPL[] PROGMEM = "Not implemented."CR; #endif @@ -145,8 +146,9 @@ static void uartcmd_clear_buffer(void) { * Erases the complete EEPROM to reset counters and high score tables. */ static void uartcmd_erase_eeprom(void) { -#if defined(eeprom_update_block) && \ - ((E2PAGESIZE == 2) || (E2PAGESIZE == 4) || (E2PAGESIZE == 8)) +#if ((__AVR_LIBC_MAJOR__ > 1) || \ + ((__AVR_LIBC_MAJOR__ == 1) && (__AVR_LIBC_MINOR__ >= 7))) && \ + ((E2PAGESIZE == 2) || (E2PAGESIZE == 4) || (E2PAGESIZE == 8)) uint8_t const eeclear[] = # if E2PAGESIZE == 8 {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; diff --git a/src/user/Makefile b/src/user/Makefile new file mode 100644 index 0000000..173e0f1 --- /dev/null +++ b/src/user/Makefile @@ -0,0 +1,25 @@ +# This file eases the integration of your personal animations which are not +# meant to be included in the official Borgware-2D repository. +# +# Just add your own source files to the SRC variable (checking for options +# introduced in your config.in file) as shown in the commented samples. + +MAKETOPDIR = ../.. + +TARGET = libuser.a + +include $(MAKETOPDIR)/defaults.mk + + +# ifeq ($(ANIMATION_MY_SIMPLE_ANIM),y) +# SRC += my_simple_anim.c +# endif + +# ifeq ($(ANIMATION_MY_COMPLEX_ANIM),y) +# SRC += my_complex_anim.c +# endif + + +include $(MAKETOPDIR)/rules.mk + +include $(MAKETOPDIR)/depend.mk diff --git a/src/user/config.in b/src/user/config.in new file mode 100644 index 0000000..9820b48 --- /dev/null +++ b/src/user/config.in @@ -0,0 +1,18 @@ +# This file eases the integration of your personal animations which are not +# meant to be included in the official Borgware-2D repository. +# +# Just add configurations options for your animations here as shown in the +# commented samples. + +mainmenu_option next_comment +comment "User Animations" + comment "Insert config options for your own animations here!" + +# bool "A simple anim" ANIMATION_MY_SIMPLE_ANIM $RANDOM_SUPPORT + +# dep_bool_menu "A complex anim" ANIMATION_MY_COMPLEX_ANIM $RANDOM_SUPPORT +# int "Sample integer config value" MY_SAMPLE_INT 100 +# bool "Sample boolean config value" MY_SAMPLE_BOOL y +# endmenu + +endmenu diff --git a/src/user/user_loop.c b/src/user/user_loop.c new file mode 100644 index 0000000..ce083fc --- /dev/null +++ b/src/user/user_loop.c @@ -0,0 +1,22 @@ +/* This file eases the integration of your personal animations which are not + meant to be included in the official Borgware-2D repository. + + It is inserted at the middle of the big switch/case block of the + src/display_loop.c file. Please make sure that you use a mode number + 200<=n<=252 to avoid conflicts with newer upstream animations. + + Just add your case blocks (guarded by the config options you introduced in + config.in) as shown in the commented samples. */ + +// #ifdef ANIMATION_MY_SIMPLE_ANIM +// case 200: +// my_simple_animation(); +// break; +// #endif + +// #ifdef ANIMATION_MY_COMPLEX_ANIM +// case 201: +// my_complex_animation(MY_SAMPLE_INT, MY_SAMPLE_BOOL); +// break; +// #endif + diff --git a/src/user/user_loop.h b/src/user/user_loop.h new file mode 100644 index 0000000..3291a57 --- /dev/null +++ b/src/user/user_loop.h @@ -0,0 +1,16 @@ +#ifndef USER_LOOP_H_ +#define USER_LOOP_H_ + +/* This file eases the integration of your personal animations which are not + meant to be included in the official Borgware-2D repository. + + It is inserted at the beginning of the src/display_loop.c file. + + Just add your header #include directives as shown in the commented + samples. */ + +// #include "my_simple_animation.h" + +// #include "my_complex_animation.h" + +#endif // USER_LOOP_H_