diff --git a/LICENSE b/LICENSE index 94a9ed0..53d1f3d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found. GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. @@ -664,11 +664,12 @@ might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see -. +. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read -. +. + diff --git a/Makefile b/Makefile index b5b2f21..0b9e19a 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,23 @@ +## +# @file Makefile +# Script to build source files +# +# Copyright (C) 2018 Clyne Sullivan +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + CROSS = arm-none-eabi- CC = gcc AS = as diff --git a/README.md b/README.md index f2e4a04..60b714d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,10 @@ # calculator -An OS for an STM32-based calculator +A from-scratch operating system for a graphing calculator. -Trying to make an operating system for a calculator based on the STM32L476RG, using its associated Nucleo board. Starting from scratch because it's fun. +The goal of this project is to design a functional operating system for a +graphing calculator based on the STM32L476RG processor. This OS has been +designed from scratch to optimize for speed and code size, targeting the +features necessary for a graphing calculator application. Required packages: * arm-none-eabi toolchain @@ -10,4 +13,10 @@ Required packages: Use ```run.sh``` to upload the final output to the processor. -To make an initrd, add files to ```initrd/``` and then run ```./mkinitrd.sh```. + +## design overview +The core of the operating system is written entirely in C and assembly. This +project is paired with the [interpreter project](https://code.bitgloo.com/clyne/interpreter) +(licensed under the GPL), +which parses script from C strings. The operating system exposes calls to the +script parser, and then loads the text file at ```initrd/init```. diff --git a/include/clock.h b/include/clock.h index c12c41e..7446dd1 100644 --- a/include/clock.h +++ b/include/clock.h @@ -1,6 +1,21 @@ /** * @file clock.h * Basic clock utilities + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ #ifndef CLOCK_H_ @@ -9,7 +24,7 @@ #include /** - * Sets HCLK (system clock) to 80MHz, the maximum. + * Initializes clocks, setting HCLK (system clock) to 80MHz, the maximum. */ extern void clock_init(void); diff --git a/include/display.h b/include/display.h index 55f6974..b8afe38 100644 --- a/include/display.h +++ b/include/display.h @@ -1,6 +1,21 @@ /* * @file display.h - * Display library for ILI9481 display. + * Display library for ILI9481 display + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ #ifndef DISPLAY_H_ @@ -18,6 +33,11 @@ */ #define LCD_HEIGHT 320 +/** + * Initializes the display. Must be called before other display use. + */ +void dsp_init(void); + /** * Returns the color integer for the given RGB values. * Converts 8RGB to 5-6-5. @@ -52,9 +72,24 @@ void dsp_write_data(uint8_t data); */ uint8_t dsp_read_data(void); +/** + * Selects the area of pixels to draw to, from (x1, y1) inclusive to (x2, y2) + * exclusive. + * @param x1 starting x coordinate + * @param y1 starting y coordinate + * @param x2 ending x coordinate + * @param y2 ending y coordinate + */ void dsp_set_addr(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); -void dsp_set_addr_read(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); -void dsp_init(void); +/** + * Selects the area of pixels to read from, in the range (x1, y1) inclusive to + * (x2, y2) exclusive. + * @param x1 starting x coordinate + * @param y1 starting y coordinate + * @param x2 ending x coordinate + * @param y2 ending y coordinate + */ +void dsp_set_addr_read(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); #endif // DISPLAY_H_ diff --git a/include/display_draw.h b/include/display_draw.h index 9d86437..8db3e2c 100644 --- a/include/display_draw.h +++ b/include/display_draw.h @@ -1,6 +1,21 @@ /** * @file display_draw.h * Provides functions for drawing to the display + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ #ifndef DISPLAY_DRAW_H_ diff --git a/include/flash.h b/include/flash.h index 26fffd3..47daf8e 100644 --- a/include/flash.h +++ b/include/flash.h @@ -1,11 +1,49 @@ +/** + * @file flash.h + * Provides functionality for using an external SPI flash + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #ifndef FLASH_H_ #define FLASH_H_ #include +/** + * Initializes GPIO ports and variables for flash IO. Must be called before + * any reads or writes. + */ void flash_init(void); +/** + * Does a blocking read of the flash chip into a pre-allocated buffer. + * @param buf the buffer to read in to + * @param addr the address to read from in the flash chip + * @param count the number of bytes to read from the chip + */ void flash_read(char *buf, uint32_t addr, unsigned int count); + +/** + * Does a blocking write to the flash chip using data from a pre-allocated + * buffer. + * @param buf the buffer to read data from + * @param addr the address to write to in the flash chip + * @param count the number of bytes to write to the chip + */ void flash_write(const char *buf, uint32_t addr, unsigned int count); #endif // FLASH_H_ diff --git a/include/gpio.h b/include/gpio.h index 46a8e15..58ebaa7 100644 --- a/include/gpio.h +++ b/include/gpio.h @@ -1,6 +1,21 @@ /** * @file gpio.h * Abstracts gpio access, makes things easier + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ #ifndef GPIO_H_ diff --git a/include/heap.h b/include/heap.h index e8cd9c1..593ce09 100644 --- a/include/heap.h +++ b/include/heap.h @@ -1,6 +1,21 @@ /** * @file heap.h * A basic memory manager + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ #ifndef HEAP_H_ diff --git a/include/initrd.h b/include/initrd.h index de730f2..7bc34bb 100644 --- a/include/initrd.h +++ b/include/initrd.h @@ -4,6 +4,21 @@ * An archive file (made with ar) can be linked into the final executable to * allow files to be loaded in memory on boot. See mkinitrd.sh or the Makefile * for more info. + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ #ifndef INITRD_H_ @@ -16,7 +31,7 @@ */ typedef struct { - char signature[8]; /**< The archive's signature. */ + char signature[8]; /**< The archive's signature */ } __attribute__ ((packed)) initrd_header; /** @@ -24,10 +39,10 @@ typedef struct */ typedef struct { - char name[16]; /**< The name of the file. */ - uint8_t unused[32]; /**< Unused information. */ - char size[10]; /**< The file's size in bytes (as string). */ - char sig[2]; /**< A signature to start file data. */ + char name[16]; /**< The name of the file */ + uint8_t unused[32]; /**< Unused information */ + char size[10]; /**< The file's size in bytes (as string) */ + char sig[2]; /**< A signature to start file data */ } __attribute__ ((packed)) initrd_file; /** diff --git a/include/keypad.h b/include/keypad.h index 5eec1fc..2e5fa9c 100644 --- a/include/keypad.h +++ b/include/keypad.h @@ -1,3 +1,23 @@ +/** + * @file keypad.h + * Manages the GPIO keypad + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #ifndef KEYPAD_H_ #define KEYPAD_H_ @@ -16,9 +36,21 @@ #define KS (uint16_t)(1 << 10) #define KP (uint16_t)(1 << 11) +/** + * Initializes GPIO for the keypad. Must be called before any keypad reading. + */ void keypad_init(void); +/** + * Reads the state of the keypad and returns it. + * @return the keypad's state + */ uint16_t keypad_get(void); + +/** + * Tests if the given key is currently pressed, returning non-zero if it is. + * @return non-zero if pressed + */ uint8_t keypad_isdown(uint16_t); #endif // KEYPAD_H_ diff --git a/include/lcd.h b/include/lcd.h index 378aac4..c13ff97 100644 --- a/include/lcd.h +++ b/include/lcd.h @@ -1,6 +1,21 @@ /** * @file lcd.h * A basic library for writing a 16x2 text LCD. + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ #ifndef LCD_H_ diff --git a/include/random.h b/include/random.h index a1868f6..efb3726 100644 --- a/include/random.h +++ b/include/random.h @@ -1,6 +1,21 @@ /** * @file random.h * Provides true random number generation functionality + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ #ifndef RANDOM_H_ diff --git a/include/script.h b/include/script.h index ab5fa7e..971cccf 100644 --- a/include/script.h +++ b/include/script.h @@ -1,6 +1,21 @@ /** * @file script.h * Provides script library for using calculator hardware + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ #ifndef SCRIPT_H_ @@ -9,7 +24,7 @@ #include /** - * Loads the library for the given interpreter. + * Loads the library for the given interpreter instance. * @param it the interpreter to use */ void script_loadlib(instance *it); diff --git a/include/serial.h b/include/serial.h index 7192e17..b943c33 100644 --- a/include/serial.h +++ b/include/serial.h @@ -1,6 +1,21 @@ /** * @file serial.h * Provides basic serial IO (through STM debug stuff) + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ #ifndef SERIAL_H_ diff --git a/include/stdlib.h b/include/stdlib.h index c2658d6..ada39cd 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -1,8 +1,51 @@ +/** + * @file stdlib.h + * Provides missing C standard library functions + * The newlib versions of these calls are not being used due to dependence on + * unsupported system calls. + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #ifndef STDLIB_H_ #define STDLIB_H_ +/** + * Parses a formatted string, storing the result in the given buffer. + * @param buf the buffer to print the parsed string to + * @param max the maximum number of bytes to write to the buffer + * @param format the format string + * @return a pointer to the buffer + */ char *snprintf(char *buf, unsigned int max, const char *format, ...); + +/** + * Attempts to convert the given string to a float. + * @param s the string to convert + * @param endptr if not-null, set to the address of the character after the + * number + * @return the resulting float, or zero if an error occurred + */ float strtof(const char *s, char **endptr); + +/** + * Attempts to convert the given string to an integer. + * @param s the string to convert + * @return the resulting integer, or zero if an error occurred + */ int atoi(const char *s); #endif // STDLIB_H_ diff --git a/include/task.h b/include/task.h index 6456bdc..555a470 100644 --- a/include/task.h +++ b/include/task.h @@ -1,6 +1,21 @@ /** * @file task.h * Provides multitasking functionality + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ #ifndef TASK_H_ @@ -8,10 +23,13 @@ #include +/** + * A structure to contain task data. + */ typedef struct { - void *next; - uint32_t *stack; - uint32_t *sp; + void *next; /**< pointer to the next task_t instance */ + uint32_t *stack; /**< pointer to the task's stack */ + uint32_t *sp; /**< pointer to the task's last sp register value */ } task_t; /** diff --git a/initrd/init3 b/initrd/init3 deleted file mode 100644 index 4351743..0000000 --- a/initrd/init3 +++ /dev/null @@ -1 +0,0 @@ -print "Hello, world!" diff --git a/initrd/init2 b/initrd/keys similarity index 100% rename from initrd/init2 rename to initrd/keys diff --git a/initrd/lines b/initrd/lines new file mode 100644 index 0000000..f6b2a82 --- /dev/null +++ b/initrd/lines @@ -0,0 +1,29 @@ +print("Hello.\n") + +fg = 32767 + +# draw bg, lines +rect(50, 50, 380, 220, 6375) +line(50, 160, 430, 160, fg) +line(240, 50, 240, 270, fg) + +x = 50 +while (x <= 430) { + line(x, 170, x, 150, fg) + x = x + 20 +} + +y = 50 +while (y <= 270) { + line(230, y, 250, y, fg) + y = y + 20 +} + +while (1) { + x = rand(379) + 50 + y = rand(219) + 50 + i = 50 + rand(379) + j = 50 + rand(219) + + line(x, y, i, j, 511) +} diff --git a/libinterp.a b/libinterp.a index 08b52ec..123d9f4 100644 Binary files a/libinterp.a and b/libinterp.a differ diff --git a/link.ld b/link.ld index 4819a3c..be1c523 100644 --- a/link.ld +++ b/link.ld @@ -1,162 +1,82 @@ -/* -***************************************************************************** -** - -** File : LinkerScript.ld -** -** Abstract : Linker script for STM32L476RGTx Device with -** 1024KByte FLASH, 96KByte RAM -** -** Set heap size, stack size and stack location according -** to application requirements. -** -** Set memory bank area and size if external memory is used. -** -** Target : STMicroelectronics STM32 -** -** -** Distribution: The file is distributed as is, without any warranty -** of any kind. -** -** (c)Copyright Ac6. -** You may use this file as-is or modify it according to the needs of your -** project. Distribution of this file (unmodified or modified) is not -** permitted. Ac6 permit registered System Workbench for MCU users the -** rights to distribute the assembled, compiled & linked contents of this -** file as part of an application binary file, provided that it is built -** using the System Workbench for MCU toolchain. -** -***************************************************************************** -*/ - -/* Entry Point */ -ENTRY(Reset_Handler) - -/* Highest address of the user mode stack */ -_estack = 0x20018000; /* end of RAM */ - -/* Specify the memory areas */ -MEMORY -{ - FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K - RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K -} - -/* Define output sections */ -SECTIONS -{ - /* The startup code goes first into FLASH */ - .isr_vector : - { - . = ALIGN(8); - KEEP(*(.isr_vector)) /* Startup code */ - . = ALIGN(8); - } >FLASH - - /* The program code and other data goes into FLASH */ - .text : - { - . = ALIGN(8); - *(.text) /* .text sections (code) */ - *(.text*) /* .text* sections (code) */ - *(.glue_7) /* glue arm to thumb code */ - *(.glue_7t) /* glue thumb to arm code */ - *(.eh_frame) - - KEEP (*(.init)) - KEEP (*(.fini)) - - . = ALIGN(8); - _etext = .; /* define a global symbols at end of code */ - } >FLASH - - /* Constant data goes into FLASH */ - .rodata : - { - . = ALIGN(8); - *(.rodata) /* .rodata sections (constants, strings, etc.) */ - *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ - . = ALIGN(8); - } >FLASH - - .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH - .ARM : { - __exidx_start = .; - *(.ARM.exidx*) - __exidx_end = .; - } >FLASH - - .preinit_array : - { - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP (*(.preinit_array*)) - PROVIDE_HIDDEN (__preinit_array_end = .); - } >FLASH - .init_array : - { - PROVIDE_HIDDEN (__init_array_start = .); - KEEP (*(SORT(.init_array.*))) - KEEP (*(.init_array*)) - PROVIDE_HIDDEN (__init_array_end = .); - } >FLASH - .fini_array : - { - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP (*(SORT(.fini_array.*))) - KEEP (*(.fini_array*)) - PROVIDE_HIDDEN (__fini_array_end = .); - } >FLASH - - /* used by the startup to initialize data */ - _sidata = LOADADDR(.data); - - /* Initialized data sections goes into RAM, load LMA copy after code */ - .data : - { - . = ALIGN(8); - _sdata = .; /* create a global symbol at data start */ - *(.data) /* .data sections */ - *(.data*) /* .data* sections */ - - . = ALIGN(8); - _edata = .; /* define a global symbol at data end */ - } >RAM AT> FLASH - - - /* Uninitialized data section */ - . = ALIGN(4); - .bss : - { - /* This is used by the startup in order to initialize the .bss secion */ - _sbss = .; /* define a global symbol at bss start */ - __bss_start__ = _sbss; - *(.bss) - *(.bss*) - *(COMMON) - - . = ALIGN(4); - _ebss = .; /* define a global symbol at bss end */ - __bss_end__ = _ebss; - } >RAM - - /* User_heap_stack section, used to check that there is enough RAM left */ - ._user_heap_stack : - { - . = ALIGN(8); - *(._user_heap_stack) - . = ALIGN(8); - } >RAM - - - - /* Remove information from the standard libraries */ - /DISCARD/ : - { - libc.a ( * ) - libm.a ( * ) - libgcc.a ( * ) - } - - .ARM.attributes 0 : { *(.ARM.attributes) } -} - +/** + * @file linker.ld + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/* enter at the reset handler */ +ENTRY(Reset_Handler) + +/* description of memory regions */ +MEMORY { + FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 96K +} + +/* description of ELF sections */ +SECTIONS { + /* keep startup code at beginning */ + .isr_vector : { + . = ALIGN(8); + KEEP(*(.isr_vector)) + . = ALIGN(8); + } > FLASH + + /* code sections */ + .text : { + . = ALIGN(8); + *(.text) + . = ALIGN(8); + } > FLASH + + /* readonly data */ + .rodata : { + . = ALIGN(8); + *(.rodata) + . = ALIGN(8); + } > FLASH + + /* init_array/fini_array (TODO understand this) */ + .init_array : { + PROVIDE_HIDDEN(__init_array_start = .); + KEEP(*(.init_array)) + PROVIDE_HIDDEN(__init_array_end = .); + } > FLASH + + .fini_array : { + PROVIDE_HIDDEN(__fini_array_start = .); + KEEP(*(.fini_array)) + PROVIDE_HIDDEN(__fini_array_end = .); + } > FLASH + + /* initialized data */ + _sidata = LOADADDR(.data); + .data : { + . = ALIGN(8); + _sdata = .; + *(.data) + . = ALIGN(8); + _edata = .; + } > RAM AT > FLASH + + /* uninitialized data */ + .bss : { + . = ALIGN(8); + __bss_start__ = .; + *(.bss) + __bss_end__ = .; + } > RAM +} diff --git a/run.sh b/run.sh index f628d56..79b7c7e 100755 --- a/run.sh +++ b/run.sh @@ -1,4 +1,23 @@ #!/bin/bash +# +# @file run.sh +# Starts openocd and connects gdb to the target, for programming/debugging +# +# Copyright (C) 2018 Clyne Sullivan +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# openocd -f /usr/share/openocd/scripts/board/st_nucleo_l476rg.cfg > /dev/null & gdb-multiarch -iex "target remote localhost:3333" out/main.elf diff --git a/src/clock.c b/src/clock.c index 0c8ca7c..284573c 100644 --- a/src/clock.c +++ b/src/clock.c @@ -1,3 +1,23 @@ +/** + * @file clock.c + * Basic clock utilities + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include #include diff --git a/src/display.c b/src/display.c index 163a742..e961299 100644 --- a/src/display.c +++ b/src/display.c @@ -1,3 +1,23 @@ +/* + * @file display.c + * Display library for ILI9481 display + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include #include diff --git a/src/display_draw.c b/src/display_draw.c index f58dda7..269f76c 100644 --- a/src/display_draw.c +++ b/src/display_draw.c @@ -1,3 +1,23 @@ +/** + * @file display_draw.c + * Provides functions for drawing to the display + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include #include #include @@ -41,6 +61,7 @@ void dsp_putchar(int c) dsp_rect(0, 0, LCD_WIDTH, LCD_HEIGHT, 0); cury = 0; } + UNLOCK; return; } else if (c == '\b') { if (curx > 0) diff --git a/src/flash.c b/src/flash.c index 6b3ee00..e3de420 100644 --- a/src/flash.c +++ b/src/flash.c @@ -1,3 +1,23 @@ +/** + * @file flash.c + * Provides functionality for using an external SPI flash + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include #include #include diff --git a/src/flash.c.bak b/src/flash.c.bak new file mode 100644 index 0000000..037eeae --- /dev/null +++ b/src/flash.c.bak @@ -0,0 +1,110 @@ +#include +#include +#include + +#define READ 0x03 +#define WRITE 0x02 +#define WREN 0x06 +#define WRDS 0x04 + +#define SCK GPIO_PORT(C, 9) +#define SI GPIO_PORT(B, 8) +#define SO GPIO_PORT(B, 9) +#define CS GPIO_PORT(C, 4) + +void flash_out(uint8_t); +uint8_t flash_in(void); + +void flash_init(void) +{ + gpio_mode(SCK, OUTPUT); + gpio_mode(SI, OUTPUT); + gpio_mode(CS, OUTPUT); + gpio_mode(SO, OUTPUT); + gpio_dout(SO, 0); + gpio_mode(SO, INPUT); + gpio_dout(CS, 1); + gpio_dout(SCK, 0); + gpio_dout(SI, 0); + + //RCC->AHB3ENR |= RCC_AHB3ENR_QSPIEN; + + //// 10MHz operation, per datasheet + //QUADSPI->CR &= ~(0xFF << QUADSPI_CR_PRESCALER_Pos); + //QUADSPI->CR |= 7 << QUADSPI_CR_PRESCALER_Pos; + + //// pick FSEL! 0=1, 1=2 + + //// FSIZE = 16, 2^17 bits = 1Mb + //QUADSPI->DCR = (16 << QUADSPI_DCR_FSIZE_Pos); + + //// Memmap mode, single-spi + //QUADSPI->CCR = (3 << QUADSPI_CCR_FMODE_Pos) | (1 << QUADSPI_CCR_DMODE_Pos) + // | (2 << QUADSPI_CCR_ADSIZE_Pos) | (1 << QUADSPI_CCR_ADMODE_Pos) + // | (1 << QUADSPI_CCR_IMODE_Pos); + //// TODO CCR also takes instruction byte + //QUADSPI->CCR |= (READ << QUADSPI_CCR_INSTRUCTION_Pos); + + //QUADSPI->CR |= QUADSPI_CR_EN; +} + +void flash_out(uint8_t byte) +{ + for (uint8_t i = 0; i < 8; i++) { + gpio_dout(SI, (byte & (1 << (7 - i)))); + gpio_dout(SCK, 1); + gpio_dout(SCK, 0); + } +} + +void flash_addr(uint32_t addr) +{ + for (uint8_t i = 0; i < 24; i++) { + gpio_dout(SI, (addr & (1 << (23 - i)))); + gpio_dout(SCK, 1); + gpio_dout(SCK, 0); + } +} + +uint8_t flash_in(void) +{ + uint8_t byte = 0; + for (uint8_t i = 0; i < 8; i++) { + gpio_dout(SCK, 1); + gpio_dout(SCK, 0); + if (gpio_din(SO)) + byte |= (1 << (7 - i)); + } + return byte; +} + +void flash_read(char *buf, uint32_t addr, unsigned int count) +{ + if (buf == 0) + return; + gpio_dout(CS, 0); + flash_out(READ); + flash_addr(addr); + for (unsigned int i = 0; i < count; i++) + buf[i] = flash_in(); + gpio_dout(CS, 1); +} + +void flash_write(const char *buf, uint32_t addr, unsigned int count) +{ + if (buf == 0) + return; + gpio_dout(CS, 0); + flash_out(WREN); + gpio_dout(CS, 1); + gpio_dout(CS, 0); + flash_out(WRITE); + flash_addr(addr); + for (unsigned int i = 0; i < count; i++) + flash_out(buf[i]); + gpio_dout(CS, 1); + delay(100); + //gpio_dout(CS, 0); + //flash_out(WRDS); + //gpio_dout(CS, 1); +} diff --git a/src/gpio.c b/src/gpio.c index 900a3f1..2e50e88 100644 --- a/src/gpio.c +++ b/src/gpio.c @@ -1,3 +1,23 @@ +/** + * @file gpio.c + * Abstracts gpio access, makes things easier + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include void gpio_init(void) diff --git a/src/heap.c b/src/heap.c index 9a11cba..c2293fa 100644 --- a/src/heap.c +++ b/src/heap.c @@ -1,3 +1,23 @@ +/** + * @file heap.c + * A basic memory manager + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include #define HEAP_ALIGN 4 diff --git a/src/initrd.c b/src/initrd.c index 948811f..37e3764 100644 --- a/src/initrd.c +++ b/src/initrd.c @@ -1,3 +1,26 @@ +/** + * @file initrd.c + * Initrd image support + * An archive file (made with ar) can be linked into the final executable to + * allow files to be loaded in memory on boot. See mkinitrd.sh or the Makefile + * for more info. + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include extern uint8_t _binary_initrd_img_start[]; diff --git a/src/keypad.c b/src/keypad.c index 06e0b6a..fad774a 100644 --- a/src/keypad.c +++ b/src/keypad.c @@ -1,3 +1,23 @@ +/** + * @file keypad.c + * Manages the GPIO keypad + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include #include diff --git a/src/keypad.c.bak b/src/keypad.c.bak index f25d46f..2fbefff 100644 --- a/src/keypad.c.bak +++ b/src/keypad.c.bak @@ -1,3 +1,23 @@ +/** + * @file keypad.c + * Manages the GPIO keypad using IO expanders + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include #include diff --git a/src/lcd.c.bak b/src/lcd.c.bak index a2a8ca7..8229041 100644 --- a/src/lcd.c.bak +++ b/src/lcd.c.bak @@ -1,3 +1,23 @@ +/** + * @file lcd.c + * A basic library for writing a 16x2 text LCD. + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include #include #include diff --git a/src/main.c b/src/main.c index fc64edd..9844199 100644 --- a/src/main.c +++ b/src/main.c @@ -1,3 +1,23 @@ +/** + * @file main.c + * Entry point for operating system + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include #include #include @@ -15,7 +35,7 @@ #include #include -extern uint8_t _ebss; +extern uint8_t __bss_end__; extern char *itoa(int, char *, int); void kmain(void); @@ -32,7 +52,7 @@ int main(void) FLASH->ACR |= FLASH_ACR_LATENCY_4WS; clock_init(); - heap_init(&_ebss); + heap_init(&__bss_end__); gpio_init(); keypad_init(); serial_init(); diff --git a/src/random.c b/src/random.c index 9c1e0d1..002b862 100644 --- a/src/random.c +++ b/src/random.c @@ -1,3 +1,23 @@ +/** + * @file random.c + * Provides true random number generation functionality + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include #include diff --git a/src/script.c b/src/script.c index b69b023..be0fa37 100644 --- a/src/script.c +++ b/src/script.c @@ -1,3 +1,23 @@ +/** + * @file script.c + * Provides script library for using calculator hardware + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include #include @@ -24,19 +44,41 @@ int script_color(instance *it); int script_rand(instance *it); int script_getkey(instance *it); int script_pixel(instance *it); +int script_menu(instance *it); void script_loadlib(instance *it) { inew_cfunc(it, "print", script_puts); inew_cfunc(it, "gets", script_gets); - inew_cfunc(it, "delay", script_delay); - inew_cfunc(it, "rect", script_rect); + inew_cfunc(it, "getkey", script_getkey); inew_cfunc(it, "ppos", script_ppos); + + inew_cfunc(it, "pixel", script_pixel); inew_cfunc(it, "line", script_line); + inew_cfunc(it, "rect", script_rect); inew_cfunc(it, "color", script_color); + inew_cfunc(it, "rand", script_rand); - inew_cfunc(it, "getkey", script_getkey); - inew_cfunc(it, "pixel", script_pixel); + inew_cfunc(it, "delay", script_delay); + + inew_cfunc(it, "menu", script_menu); +} + +int script_menu(instance *it) +{ + char listbuf[4]; + int nargs = igetarg_integer(it, 0); + float *resps = (float *)calloc(nargs, sizeof(float)); + strncpy(listbuf, " : \0", 4); + for (int i = 0; i < nargs; i++) { + listbuf[0] = i + '0'; + dsp_puts(listbuf); + dsp_puts((char *)igetarg(it, 1 + i * 2)->value.p); + dsp_puts("\n"); + resps[i] = igetarg(it, 2 + i * 2)->value.f; + } + free(resps); + return 0; } int script_puts(instance *it) @@ -125,7 +167,7 @@ int script_rand(instance *it) { unsigned int mod = igetarg_integer(it, 0); unsigned int val = random_get(); - variable *v = make_varf(0, (float)(mod % val)); + variable *v = make_varf(0, (float)(val % mod)); ipush(it, (uint32_t)v); return 0; } diff --git a/src/serial.c b/src/serial.c index de28275..31c7744 100644 --- a/src/serial.c +++ b/src/serial.c @@ -1,3 +1,23 @@ +/** + * @file serial.c + * Provides basic serial IO (through STM debug stuff) + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include #include #include diff --git a/src/startup_stm32l476xx.s b/src/startup_stm32l476xx.s index f7e18a4..b26ced5 100644 --- a/src/startup_stm32l476xx.s +++ b/src/startup_stm32l476xx.s @@ -57,10 +57,8 @@ defined in linker script */ .word _sdata /* end address for the .data section. defined in linker script */ .word _edata -/* start address for the .bss section. defined in linker script */ -.word _sbss -/* end address for the .bss section. defined in linker script */ -.word _ebss + +.equ _estack, 0x20018000 .equ BootRAM, 0xF1E0F85F /** @@ -94,7 +92,7 @@ LoopCopyDataInit: adds r2, r0, r1 cmp r2, r3 bcc CopyDataInit - ldr r2, =_sbss + ldr r2, =__bss_start__ b LoopFillZerobss /* Zero fill the bss segment. */ FillZerobss: @@ -102,7 +100,7 @@ FillZerobss: str r3, [r2], #4 LoopFillZerobss: - ldr r3, = _ebss + ldr r3, = __bss_end__ cmp r2, r3 bcc FillZerobss diff --git a/src/stdlib.c b/src/stdlib.c index e34d2a0..f5f9cc8 100644 --- a/src/stdlib.c +++ b/src/stdlib.c @@ -1,3 +1,25 @@ +/** + * @file stdlib.c + * Provides missing C standard library functions + * The newlib versions of these calls are not being used due to dependence on + * unsupported system calls. + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include #include diff --git a/src/task.c b/src/task.c index 537785d..9e99ab6 100644 --- a/src/task.c +++ b/src/task.c @@ -1,3 +1,23 @@ +/** + * @file task.c + * Provides multitasking functionality + * + * Copyright (C) 2018 Clyne Sullivan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include #include #include diff --git a/xinitrd/init b/xinitrd/init deleted file mode 100644 index 4fd74dd..0000000 --- a/xinitrd/init +++ /dev/null @@ -1,33 +0,0 @@ -print "Hello." - -set fg 32767 - -# draw bg, lines -rect 50 50 380 220 6375 -line 50 160 430 160 fg -line 240 50 240 270 fg - -set x 50 -do - line x 170 x 150 fg - set x (x + 20) -while (x < 431) - -set y 50 -do - line 230 y 250 y fg - set y (y + 20) -while (y < 271) - -do - rand 379 > x - rand 219 > y - rand 379 > i - rand 219 > j - set x (x + 50) - set y (y + 50) - set i (i + 50) - set j (j + 50) - - line x y i j 511 -while (1) diff --git a/xinitrd/init2 b/xinitrd/init2 deleted file mode 100644 index 47dbae1..0000000 --- a/xinitrd/init2 +++ /dev/null @@ -1,21 +0,0 @@ -do - getkey > input - print input - delay 1000 -while (1) - -#do -# getkey > input -# if (input & 4) -# rand 479 > x -# rand 319 > y -# rand 479 > i -# rand 319 > j -# rand 32767 > purple -# -# line x y i j purple -# end -#while (1) -# -#print "done" -