Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
163dcbd961 | ||
|
|
7e4b86d135 |
27
LICENSE
27
LICENSE
@@ -1,27 +0,0 @@
|
||||
Copyright (c) 2014, RetroBSD
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of the {organization} nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
205
Makefile
205
Makefile
@@ -11,36 +11,27 @@
|
||||
#
|
||||
# Supported boards
|
||||
#
|
||||
MAX32 = sys/pic32/max32/MAX32
|
||||
FUBARINO = sys/pic32/fubarino/FUBARINO
|
||||
FUBARINOBIG = sys/pic32/fubarino/FUBARINO-UART2CONS-UART1-SRAMC
|
||||
SDXL = sys/pic32/sdxl/SDXL
|
||||
MAXIMITE = sys/pic32/maximite/MAXIMITE
|
||||
MAXCOLOR = sys/pic32/maximite-color/MAXCOLOR
|
||||
DUINOMITE = sys/pic32/duinomite/DUINOMITE
|
||||
DUINOMITEUART = sys/pic32/duinomite-uart/DUINOMITE-UART
|
||||
DUINOMITEE = sys/pic32/duinomite-e/DUINOMITE-E
|
||||
DUINOMITEEUART = sys/pic32/duinomite-e-uart/DUINOMITE-E-UART
|
||||
MMBMX7 = sys/pic32/mmb-mx7/MMB-MX7
|
||||
WF32 = sys/pic32/wf32/WF32
|
||||
UBW32 = sys/pic32/ubw32/UBW32
|
||||
UBW32UART = sys/pic32/ubw32-uart/UBW32-UART
|
||||
UBW32UARTSDRAM = sys/pic32/ubw32-uart-sdram/UBW32-UART-SDRAM
|
||||
EXPLORER16 = sys/pic32/explorer16/EXPLORER16
|
||||
STARTERKIT = sys/pic32/starter-kit/STARTER-KIT
|
||||
BAREMETAL = sys/pic32/baremetal/BAREMETAL
|
||||
RETROONE = sys/pic32/retroone/RETROONE
|
||||
MAX32 = pic32/max32
|
||||
UBW32 = pic32/ubw32
|
||||
UBW32UART = pic32/ubw32-uart
|
||||
MAXIMITE = pic32/maximite
|
||||
EXPLORER16 = pic32/explorer16
|
||||
STARTERKIT = pic32/starter-kit
|
||||
DUINOMITE = pic32/duinomite
|
||||
PINGUINO = pic32/pinguino-micro
|
||||
DIP = pic32/dip
|
||||
BAREMETAL = pic32/baremetal
|
||||
RETROONE = pic32/retroone
|
||||
|
||||
# Select target board
|
||||
TARGET ?= $(MAX32)
|
||||
|
||||
# Filesystem and swap sizes.
|
||||
FS_MBYTES = 100
|
||||
U_MBYTES = 100
|
||||
SWAP_MBYTES = 2
|
||||
FS_KBYTES = 16384
|
||||
SWAP_KBYTES = 2048
|
||||
|
||||
# Set this to the device name for your SD card. With this
|
||||
# enabled you can use "make installfs" to copy the sdcard.img
|
||||
# enabled you can use "make installfs" to copy the filesys.img
|
||||
# to the SD card.
|
||||
|
||||
#SDCARD = /dev/sdb
|
||||
@@ -53,71 +44,141 @@ DEFS =
|
||||
|
||||
FSUTIL = tools/fsutil/fsutil
|
||||
|
||||
-include Makefile.user
|
||||
#
|
||||
# Filesystem contents.
|
||||
#
|
||||
BIN_FILES := $(wildcard bin/*)
|
||||
SBIN_FILES := $(wildcard sbin/*)
|
||||
UFLASH_FILES := $(wildcard uflash/*)
|
||||
GAMES_FILES := $(shell find games -type f ! -path '*/.*')
|
||||
LIB_FILES := $(wildcard lib/*)
|
||||
LIBEXEC_FILES := $(wildcard libexec/*)
|
||||
ETC_FILES = etc/rc etc/rc.local etc/ttys etc/gettytab etc/group \
|
||||
etc/passwd etc/shadow etc/fstab etc/motd etc/shells \
|
||||
etc/termcap
|
||||
INC_FILES = include/stdio.h include/syscall.h include/sys/types.h \
|
||||
include/sys/select.h
|
||||
SHARE_FILES = share/re.help share/example/Makefile \
|
||||
share/example/ashello.S share/example/chello.c \
|
||||
share/example/blkjack.bas share/example/hilow.bas \
|
||||
share/example/stars.bas share/example/prime.scm \
|
||||
share/example/fact.fth share/example/echo.S \
|
||||
share/smallc/lib.c share/smallc/Makefile share/smallc/primelist.c \
|
||||
share/smallc/primesum.c share/smallc/sys.s share/smallc/test1.c \
|
||||
share/smallc/test2.c $(wildcard share/lccom/*)
|
||||
ALLFILES = $(SBIN_FILES) $(ETC_FILES) $(BIN_FILES) $(LIB_FILES) $(LIBEXEC_FILES) \
|
||||
$(INC_FILES) $(SHARE_FILES) $(GAMES_FILES) $(UFLASH_FILES) \
|
||||
var/log/messages var/log/wtmp .profile
|
||||
ALLDIRS = sbin/ bin/ dev/ etc/ tmp/ lib/ libexec/ share/ share/example/ \
|
||||
share/lccom/ share/misc/ share/smallc/ var/ var/run/ var/log/ u/ include/ include/sys/ \
|
||||
games/ games/lib/ uflash/
|
||||
BDEVS = dev/sd0!b0:0 dev/sd1!b0:1 dev/sw0!b1:0
|
||||
CDEVS = dev/console!c0:0 \
|
||||
dev/mem!c1:0 dev/kmem!c1:1 dev/null!c1:2 dev/zero!c1:3 \
|
||||
dev/tty!c2:0 \
|
||||
dev/rsd0!c3:0 dev/rsd1!c3:1 dev/swap!c3:0 \
|
||||
dev/klog!c4:0 \
|
||||
dev/stdin!c5:0 dev/stdout!c5:1 dev/stderr!c5:2 \
|
||||
dev/rsw0!c6:0 \
|
||||
dev/porta!c7:0 dev/portb!c7:1 dev/portc!c7:2 \
|
||||
dev/portd!c7:3 dev/porte!c7:4 dev/portf!c7:5 dev/portg!c7:6 \
|
||||
dev/confa!c7:64 dev/confb!c7:65 dev/confc!c7:66 \
|
||||
dev/confd!c7:67 dev/confe!c7:68 dev/conff!c7:69 dev/confg!c7:70 \
|
||||
dev/spi1!c9:0 dev/spi2!c9:1 dev/spi3!c9:2 dev/spi4!c9:3 \
|
||||
dev/glcd0!c10:0 dev/uflash!c12:0
|
||||
FDDEVS = dev/fd/ dev/fd/0!c5:0 dev/fd/1!c5:1 dev/fd/2!c5:2 \
|
||||
dev/fd/3!c5:3 dev/fd/4!c5:4 dev/fd/5!c5:5 dev/fd/6!c5:6 \
|
||||
dev/fd/7!c5:7 dev/fd/8!c5:8 dev/fd/9!c5:9 dev/fd/10!c5:10 \
|
||||
dev/fd/11!c5:11 dev/fd/12!c5:12 dev/fd/13!c5:13 \
|
||||
dev/fd/14!c5:14 dev/fd/15!c5:15 dev/fd/16!c5:16 \
|
||||
dev/fd/17!c5:17 dev/fd/18!c5:18 dev/fd/19!c5:19 \
|
||||
dev/fd/20!c5:20 dev/fd/21!c5:21 dev/fd/22!c5:22 \
|
||||
dev/fd/23!c5:23 dev/fd/24!c5:24 dev/fd/25!c5:25 \
|
||||
dev/fd/26!c5:26 dev/fd/27!c5:27 dev/fd/28!c5:28 \
|
||||
dev/fd/29!c5:29
|
||||
ADCDEVS = dev/adc0!c8:0 dev/adc1!c8:1 dev/adc2!c8:2 dev/adc3!c8:3 \
|
||||
dev/adc4!c8:4 dev/adc5!c8:5 dev/adc6!c8:6 dev/adc7!c8:7 \
|
||||
dev/adc8!c8:8 dev/adc9!c8:9 dev/adc10!c8:10 dev/adc11!c8:11 \
|
||||
dev/adc12!c8:12 dev/adc13!c8:13 dev/adc14!c8:14 dev/adc15!c8:15
|
||||
OCDEVS = dev/oc0!c11:0 dev/oc1!c11:1 dev/oc2!c11:2 dev/oc3!c11:3 dev/oc4!c11:4
|
||||
|
||||
TARGETDIR = $(shell dirname $(TARGET))
|
||||
TARGETNAME = $(shell basename $(TARGET))
|
||||
TOPSRC = $(shell pwd)
|
||||
CONFIG = $(TOPSRC)/tools/configsys/config
|
||||
|
||||
all: .profile
|
||||
$(MAKE) -C tools
|
||||
$(MAKE) -C lib
|
||||
$(MAKE) -C src install
|
||||
$(MAKE) kernel
|
||||
all: build kernel
|
||||
$(MAKE) fs
|
||||
|
||||
kernel: $(TARGETDIR)/Makefile
|
||||
$(MAKE) -C $(TARGETDIR)
|
||||
fs: filesys.img user.img
|
||||
|
||||
$(TARGETDIR)/Makefile: $(CONFIG) $(TARGETDIR)/$(TARGETNAME)
|
||||
cd $(TARGETDIR) && ../../../tools/configsys/config $(TARGETNAME)
|
||||
kernel:
|
||||
$(MAKE) -C sys/$(TARGET)
|
||||
|
||||
fs: sdcard.img
|
||||
build:
|
||||
$(MAKE) -C tools
|
||||
$(MAKE) -C src install
|
||||
|
||||
.PHONY: sdcard.img
|
||||
sdcard.img: $(FSUTIL) rootfs.manifest userfs.manifest
|
||||
filesys.img: $(FSUTIL) $(ALLFILES)
|
||||
rm -f $@
|
||||
$(FSUTIL) --repartition=fs=$(FS_MBYTES)M:swap=$(SWAP_MBYTES)M:fs=$(U_MBYTES)M $@
|
||||
$(FSUTIL) --new --partition=1 --manifest=rootfs.manifest $@ .
|
||||
$(FSUTIL) --new --partition=3 --manifest=userfs.manifest $@ u
|
||||
$(FSUTIL) -n$(FS_KBYTES) -s$(SWAP_KBYTES) $@
|
||||
$(FSUTIL) -a $@ $(ALLDIRS) $(ALLFILES)
|
||||
$(FSUTIL) -a $@ $(CDEVS)
|
||||
$(FSUTIL) -a $@ $(BDEVS)
|
||||
$(FSUTIL) -a $@ $(ADCDEVS)
|
||||
$(FSUTIL) -a $@ $(OCDEVS)
|
||||
# $(FSUTIL) -a $@ $(FDDEVS)
|
||||
|
||||
user.img: $(FSUTIL)
|
||||
rm -f $@
|
||||
$(FSUTIL) -n$(FS_KBYTES) $@
|
||||
|
||||
$(FSUTIL):
|
||||
cd tools/fsutil; $(MAKE)
|
||||
|
||||
$(CONFIG):
|
||||
make -C tools/configsys
|
||||
|
||||
clean:
|
||||
rm -f *~
|
||||
for dir in tools lib src sys/pic32; do $(MAKE) -C $$dir -k clean; done
|
||||
for dir in tools src sys/pic32; do $(MAKE) -C $$dir -k clean; done
|
||||
|
||||
cleanall: clean
|
||||
$(MAKE) -C lib clean
|
||||
rm -f sys/pic32/*/unix.hex bin/* sbin/* libexec/*
|
||||
rm -f games/[a-k]* games/[m-z]* share/man/cat*/*
|
||||
rm -f games/lib/adventure.dat games/lib/cfscores
|
||||
rm -f share/re.help share/emg.keys share/misc/more.help
|
||||
rm -f etc/termcap etc/remote etc/phones
|
||||
rm -f tools/configsys/.depend
|
||||
rm -f var/log/aculog
|
||||
rm -rf var/lock share/unixbench
|
||||
rm -f sys/pic32/*/unix.hex bin/* sbin/* lib/* games/[a-k]* games/[m-z]* libexec/* share/man/cat*/*
|
||||
rm -f games/lib/adventure.dat
|
||||
rm -f games/lib/cfscores
|
||||
rm -f share/re.help
|
||||
rm -f share/misc/more.help
|
||||
rm -f etc/termcap
|
||||
rm -f uflash/*
|
||||
|
||||
installfs:
|
||||
|
||||
# TODO
|
||||
buildlib:
|
||||
@echo installing /usr/include
|
||||
# cd include; $(MAKE) DESTDIR=$(DESTDIR) install
|
||||
@echo
|
||||
@echo compiling libc.a
|
||||
cd lib/libc; $(MAKE) $(LIBCDEFS)
|
||||
@echo installing /lib/libc.a
|
||||
cd lib/libc; $(MAKE) DESTDIR=$(DESTDIR) install
|
||||
@echo
|
||||
@echo compiling C compiler
|
||||
cd lib; $(MAKE) ccom cpp c2
|
||||
@echo installing C compiler
|
||||
cd lib/ccom; $(MAKE) DESTDIR=$(DESTDIR) install
|
||||
cd lib/cpp; $(MAKE) DESTDIR=$(DESTDIR) install
|
||||
cd lib/c2; $(MAKE) DESTDIR=$(DESTDIR) install
|
||||
cd lib; $(MAKE) clean
|
||||
@echo
|
||||
@echo re-compiling libc.a
|
||||
cd lib/libc; $(MAKE) $(LIBCDEFS)
|
||||
@echo re-installing /lib/libc.a
|
||||
cd lib/libc; $(MAKE) DESTDIR=$(DESTDIR) install
|
||||
@echo
|
||||
@echo re-compiling C compiler
|
||||
cd lib; $(MAKE) ccom cpp c2
|
||||
@echo re-installing C compiler
|
||||
cd lib/ccom; $(MAKE) DESTDIR=$(DESTDIR) install
|
||||
cd lib/cpp; $(MAKE) DESTDIR=$(DESTDIR) install
|
||||
cd lib/c2; $(MAKE) DESTDIR=$(DESTDIR) install
|
||||
@echo
|
||||
|
||||
installfs: filesys.img
|
||||
ifdef SDCARD
|
||||
@[ -f sdcard.img ] || $(MAKE) sdcard.img
|
||||
sudo dd bs=32k if=sdcard.img of=$(SDCARD)
|
||||
sudo dd bs=16k if=filesys.img of=$(SDCARD)
|
||||
else
|
||||
@echo "Error: No SDCARD defined."
|
||||
@echo "Error: No SDCARD defined."
|
||||
endif
|
||||
|
||||
# TODO: make it relative to Target
|
||||
installflash:
|
||||
sudo pic32prog sys/pic32/fubarino/unix.hex
|
||||
|
||||
# TODO: make it relative to Target
|
||||
installboot:
|
||||
sudo pic32prog sys/pic32/fubarino/bootloader.hex
|
||||
|
||||
.profile: etc/root/dot.profile
|
||||
cp etc/root/dot.profile .profile
|
||||
|
||||
129
README
Normal file
129
README
Normal file
@@ -0,0 +1,129 @@
|
||||
This is the RetroBSD source directory.
|
||||
|
||||
|
||||
Source Roadmap
|
||||
~~~~~~~~~~~~~~
|
||||
bin User commands.
|
||||
etc Template files for /etc.
|
||||
include System include files.
|
||||
lib System libraries.
|
||||
libexec System binaries.
|
||||
sbin System administration commands.
|
||||
share Shared resources.
|
||||
sys Kernel sources.
|
||||
tools Build tools and simulators.
|
||||
|
||||
|
||||
Supported hardware
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
* chipKIT Max32 board.
|
||||
* Sparkfun UBW32 board.
|
||||
* Maximite computer.
|
||||
* Microchip Explorer 16 board, with PIC32 CAN-USB plug-in module and SD & MMC pictail.
|
||||
* Microchip PIC32 USB or Ethernet Starter Kit, with I/O Expansion board and SD & MMC pictail.
|
||||
* Olimex Duinomite, Duinomite-Mini and Duinomite-Mega boards.
|
||||
* Olimex Pinguino-Micro board with PIC32MX795F512H microcontroller.
|
||||
* eflightworks DIP board.
|
||||
|
||||
|
||||
Build
|
||||
~~~~~
|
||||
By default, the system is configured for the Max32 board.
|
||||
To select another target board, edit a top-level Makefile
|
||||
and change a TARGET value under section "Select target board":
|
||||
|
||||
TARGET = $(UBW32) # for the UBW32 board with USB console
|
||||
TARGET = $(UBW32UART) # for the UBW32 board with UART console
|
||||
TARGET = $(MAXIMITE) # for the Maximite board
|
||||
TARGET = $(EXPLORER16) # for the Explorer 16 board
|
||||
TARGET = $(STARTERKIT) # for the PIC32 USB or Ethernet Starter Kit
|
||||
TARGET = $(MAX32) # default
|
||||
TARGET = $(DUINOMITE) # for the Duinomite board
|
||||
TARGET = $(PINGUINO) # for the Pinguino-Micro board
|
||||
TARGET = $(DIP) # for the DIP board
|
||||
|
||||
You can also change a desired filesystem size and swap area size,
|
||||
as required. Default is:
|
||||
|
||||
FS_KBYTES = 16384
|
||||
SWAP_KBYTES = 2048
|
||||
|
||||
To compile the kernel and build a filesystem image, run:
|
||||
|
||||
make
|
||||
|
||||
A resulting root filesystem image is in file `filesys.img`.
|
||||
A kernel is in file `unix.hex` in your target board subdirectory.
|
||||
|
||||
|
||||
Filesystem image
|
||||
~~~~~~~~~~~~~~~~
|
||||
You need to put a filesystem image on a SD card. On Windows, use
|
||||
Win32DiskImager utility (https://launchpad.net/win32-image-writer/+download).
|
||||
On Linux, run:
|
||||
|
||||
sudo dd if=filesys.img of=/dev/XYZ
|
||||
|
||||
Here `XYZ` is a device name of SD card, as recognized by Linux (sdb in my case).
|
||||
|
||||
|
||||
Install kernel
|
||||
~~~~~~~~~~~~~~
|
||||
Kernel image should be written to PIC32 flash memory. The procedure depends
|
||||
on a board used.
|
||||
|
||||
Max32 board:
|
||||
cd sys/pic32/ubw32
|
||||
AVRTOOLS=/Applications/Mpide.app/Contents/Resources/Java/hardware/tools
|
||||
$AVRTOOLS/bin/avrdude -C$AVRTOOLS/etc/avrdude.conf -c stk500v2 -p pic32 \
|
||||
-P /dev/tty.usbserial-* -b 115200 -v -U flash:w:unix.hex:i
|
||||
|
||||
Here you need to change AVRTOOLS path and tty name according to your system.
|
||||
|
||||
UBW32 board:
|
||||
Use a pic32prog utility (http://code.google.com/p/pic32prog/)
|
||||
and a USB cable to install a kernel:
|
||||
|
||||
pic32prog sys/pic32/ubw32/unix.hex
|
||||
|
||||
Maximite:
|
||||
Use the bootload program for Windows, available for download by link:
|
||||
http://geoffg.net/Downloads/Maximite/Maximite_Update_V2.7B.zip
|
||||
|
||||
Explorer 16 board:
|
||||
There is an auxiliary PIC18 chip on the Explorer 16 board, which can be
|
||||
used as a built-in programmer device. You will need a PICkit 2 adapter
|
||||
to install a needed firmware, as described in article:
|
||||
http://www.paintyourdragon.com/?p=51
|
||||
(section "Hack #2: Lose the PICkit 2, Save $35").
|
||||
This should be done only once.
|
||||
|
||||
Then, you can use a pic32prog utility (http://code.google.com/p/pic32prog/)
|
||||
and a USB cable to install a kernel:
|
||||
|
||||
pic32prog sys/pic32/explorer16/unix.hex
|
||||
|
||||
PIC32 Starter Kit:
|
||||
Use PICkit 2 adapter and software to install a boot loader from
|
||||
file `sys/pic32/starter-kit/boot.hex`. This should be done only once.
|
||||
|
||||
Then, you can use a pic32prog utility (http://code.google.com/p/pic32prog/)
|
||||
and a USB cable to install a kernel:
|
||||
|
||||
pic32prog sys/pic32/starter-kit/unix.hex
|
||||
|
||||
|
||||
Simulator
|
||||
~~~~~~~~~
|
||||
You can use a MIPS32 simulator to develop a debug a RetroBSD software,
|
||||
without a need for hardware board. By default, a simulator is configured
|
||||
to imitate a Max32 board. To build it:
|
||||
|
||||
cd tools/virtualmips
|
||||
make
|
||||
|
||||
Run it:
|
||||
|
||||
./pic32
|
||||
|
||||
Configuration of simulated board is stored in file `pic32_max32.conf`.
|
||||
161
README.md
161
README.md
@@ -1,161 +0,0 @@
|
||||
# This is the RetroBSD source directory.
|
||||
|
||||
## Source Roadmap
|
||||
|
||||
bin User commands.
|
||||
etc Template files for /etc.
|
||||
include System include files.
|
||||
lib System libraries.
|
||||
libexec System binaries.
|
||||
sbin System administration commands.
|
||||
share Shared resources.
|
||||
sys Kernel sources.
|
||||
tools Build tools and simulators.
|
||||
|
||||
|
||||
## Supported hardware
|
||||
|
||||
* chipKIT Max32 board.
|
||||
* Sparkfun UBW32 board.
|
||||
* Maximite and Colour Maximite computers.
|
||||
* Microchip Explorer 16 board, with PIC32 CAN-USB plug-in module and SD & MMC pictail.
|
||||
* Microchip PIC32 USB or Ethernet Starter Kit, with I/O Expansion board and SD & MMC pictail.
|
||||
* Olimex Duinomite, Duinomite-Mini and Duinomite-Mega boards.
|
||||
* Olimex Pinguino-Micro board with PIC32MX795F512H microcontroller.
|
||||
* eflightworks DIP board.
|
||||
|
||||
|
||||
## Build
|
||||
|
||||
To compile everything from sources, you'll need some packages installed, namely:
|
||||
Berkeley YACC, GNU bison and flex, ELF library and FUSE library.
|
||||
Under Ubuntu, for example, you can do it by command:
|
||||
|
||||
```shell
|
||||
$ sudo apt-get install bison byacc flex libelf-dev libfuse-dev
|
||||
```
|
||||
|
||||
By default, the system is configured for the Max32 board.
|
||||
To select another target board, edit a top-level user-specific Makefile called "Makefile.user"
|
||||
and set a TARGET value:
|
||||
|
||||
```Makefile
|
||||
TARGET = $(MAX32) # for the chipKIT Max32 board with SD card shield (default)
|
||||
TARGET = $(FUBARINO) # Fubarino SD board
|
||||
TARGET = $(FUBARINOBIG) # Fubarino SD board with 8MB SRAM RAMDISK
|
||||
TARGET = $(MAXIMITE) # for the Maximite board
|
||||
TARGET = $(MAXCOLOR) # for the Colour Maximite board
|
||||
TARGET = $(DUINOMITE) # for the Duinomite board with USB console
|
||||
TARGET = $(DUINOMITEUART) # for the Duinomite board with UART console
|
||||
TARGET = $(DUINOMITEE) # for the Duinomite E board with USB console
|
||||
TARGET = $(DUINOMITEEUART) # for the Duinomite E board with UART console
|
||||
TARGET = $(MMBMX7) # MMB MX7 board
|
||||
TARGET = $(UBW32) # for the UBW32 board with USB console
|
||||
TARGET = $(UBW32UART) # for the UBW32 board with UART console
|
||||
TARGET = $(UBW32UARTSDRAM) # for the UBW32 boars with UART console and 8MB SRAM ramdisk
|
||||
TARGET = $(EXPLORER16) # for the Explorer 16 board
|
||||
TARGET = $(STARTERKIT) # for the PIC32 USB or Ethernet Starter Kit
|
||||
TARGET = $(BAREMETAL) # Bare PIC32 chip on a breakout board
|
||||
```
|
||||
|
||||
You can also change a desired filesystem size and swap area size,
|
||||
as required. Default is:
|
||||
```Makefile
|
||||
FS_KBYTES = 16384
|
||||
SWAP_KBYTES = 2048
|
||||
```
|
||||
To compile the kernel and build a filesystem image, run:
|
||||
|
||||
```shell
|
||||
$ make
|
||||
```
|
||||
|
||||
A resulting root filesystem image is in file `sdcard.img`.
|
||||
A kernel is in file `unix.hex` in your target board subdirectory.
|
||||
|
||||
|
||||
### Filesystem image
|
||||
|
||||
You need to put a filesystem image on a SD card. On Windows, use
|
||||
Win32DiskImager utility (https://launchpad.net/win32-image-writer/+download).
|
||||
On Linux, run:
|
||||
|
||||
```shell
|
||||
$ sudo dd if=sdcard.img of=/dev/XYZ
|
||||
```
|
||||
|
||||
Here `XYZ` is a device name of SD card, as recognized by Linux (sdb in my case).
|
||||
|
||||
|
||||
### Install kernel
|
||||
|
||||
Kernel image should be written to PIC32 flash memory. The procedure depends
|
||||
on a board used.
|
||||
|
||||
#### Max32 board:
|
||||
Use a pic32prog utility (http://code.google.com/p/pic32prog/)
|
||||
and a USB cable to install a kernel:
|
||||
|
||||
```shell
|
||||
$ pic32prog -d /dev/ttyUSB0 sys/pic32/max32/unix.hex
|
||||
```
|
||||
|
||||
Here you need to change AVRTOOLS path and tty name according to your system.
|
||||
|
||||
#### UBW32 board:
|
||||
Use a pic32prog utility (http://code.google.com/p/pic32prog/)
|
||||
and a USB cable to install a kernel:
|
||||
|
||||
```shell
|
||||
$ pic32prog sys/pic32/ubw32/unix.hex
|
||||
```
|
||||
|
||||
#### Maximite:
|
||||
Use the bootload program for Windows, available for download by link:
|
||||
http://geoffg.net/Downloads/Maximite/Maximite_Update_V2.7B.zip
|
||||
|
||||
#### Explorer 16 board:
|
||||
There is an auxiliary PIC18 chip on the Explorer 16 board, which can be
|
||||
used as a built-in programmer device. You will need a PICkit 2 adapter
|
||||
to install a needed firmware, as described in article:
|
||||
http://www.paintyourdragon.com/?p=51
|
||||
(section "Hack #2: Lose the PICkit 2, Save $35").
|
||||
This should be done only once.
|
||||
|
||||
Then, you can use a pic32prog utility (http://code.google.com/p/pic32prog/)
|
||||
and a USB cable to install a kernel:
|
||||
|
||||
``` shell
|
||||
$ pic32prog sys/pic32/explorer16/unix.hex
|
||||
```
|
||||
|
||||
#### PIC32 Starter Kit:
|
||||
Use PICkit 2 adapter and software to install a boot loader from
|
||||
file `sys/pic32/starter-kit/boot.hex`. This should be done only once.
|
||||
|
||||
Then, you can use a pic32prog utility (http://code.google.com/p/pic32prog/)
|
||||
and a USB cable to install a kernel:
|
||||
|
||||
```shell
|
||||
$ pic32prog sys/pic32/starter-kit/unix.hex
|
||||
```
|
||||
|
||||
|
||||
## Simulator
|
||||
|
||||
You can use a MIPS32 simulator to develop a debug a RetroBSD software,
|
||||
without a need for hardware board. By default, a simulator is configured
|
||||
to imitate a Max32 board. To build it:
|
||||
|
||||
```shell
|
||||
$ cd tools/virtualmips
|
||||
$ make
|
||||
```
|
||||
|
||||
Run it:
|
||||
|
||||
```shell
|
||||
$ ./pic32
|
||||
```
|
||||
|
||||
Configuration of simulated board is stored in file `pic32_max32.conf`.
|
||||
1
bin/.gitignore
vendored
1
bin/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
*
|
||||
12
cross.mk
12
cross.mk
@@ -1,7 +1,7 @@
|
||||
DESTDIR = /usr/local/retrobsd
|
||||
MACHINE = mips
|
||||
|
||||
CC = gcc -m32
|
||||
CC = gcc
|
||||
|
||||
AS = $(CC) -x assembler-with-cpp
|
||||
LD = ld
|
||||
@@ -18,14 +18,6 @@ TAGSFILE = tags
|
||||
MANROFF = nroff -man -h
|
||||
ELF2AOUT = cp
|
||||
|
||||
CFLAGS = -O -DCROSS
|
||||
CFLAGS = -O -DCROSS -I/usr/include -I$(TOPSRC)/include
|
||||
LDFLAGS =
|
||||
LIBS =
|
||||
|
||||
# Add system include path
|
||||
ifeq (,$(wildcard /usr/include/i386-linux-gnu))
|
||||
CFLAGS += -I/usr/include
|
||||
else
|
||||
CFLAGS += -I/usr/include/i386-linux-gnu
|
||||
endif
|
||||
CFLAGS += -I$(TOPSRC)/include
|
||||
|
||||
4
etc/.gitignore
vendored
4
etc/.gitignore
vendored
@@ -1,4 +0,0 @@
|
||||
phones
|
||||
remote
|
||||
termcap
|
||||
termcap.full
|
||||
380
etc/MAKEDEV
380
etc/MAKEDEV
@@ -52,13 +52,16 @@ do
|
||||
case $i in
|
||||
|
||||
std)
|
||||
mknod console c 0 0
|
||||
mknod mem c 1 0 ; chmod 640 mem ; chgrp kmem mem
|
||||
mknod console c 0 0
|
||||
# mknod kUmem c 1 3 ; chmod 600 kUmem ;: untested
|
||||
mknod kmem c 1 1 ; chmod 640 kmem ; chgrp kmem kmem
|
||||
mknod mem c 1 0 ; chmod 640 mem ; chgrp kmem mem
|
||||
mknod null c 1 2 ; chmod 666 null
|
||||
mknod zero c 1 3 ; chmod 444 zero
|
||||
mknod tty c 2 0 ; chmod 666 tty
|
||||
mknod klog c 3 0 ; chmod 600 klog
|
||||
mknod tty c 9 0 ; chmod 666 tty
|
||||
mknod klog c 22 0 ; chmod 600 klog
|
||||
mknod errlog c 22 1 ; chmod 600 errlog
|
||||
mknod acctlog c 22 2 ; chmod 600 acctlog
|
||||
;;
|
||||
|
||||
fd)
|
||||
@@ -67,105 +70,304 @@ fd)
|
||||
rm -f stdin stdout stderr
|
||||
mkdir fd
|
||||
chmod 755 fd
|
||||
mknod stdin c 4 0
|
||||
mknod stdout c 4 1
|
||||
mknod stderr c 4 2
|
||||
mknod stdin c 26 0
|
||||
mknod stdout c 26 1
|
||||
mknod stderr c 26 2
|
||||
eval `echo "" | awk '{ for (i = 0; i < 32; i++)
|
||||
printf("mknod fd/%d c 4 %d; ",i,i); }'`
|
||||
printf("mknod fd/%d c 26 %d; ",i,i); }'`
|
||||
;;
|
||||
|
||||
rd)
|
||||
ht*|tm*|ts*|tu*)
|
||||
umask 0 ; ctlr=`expr $i : '..\(.*\)'`
|
||||
ctlr=`expr $ctlr '*' 64`
|
||||
case $i in
|
||||
ht*) blk=0; chr=6;;
|
||||
tm*) blk=1; chr=7;;
|
||||
ts*) blk=2; chr=8;;
|
||||
tu*) blk=12; chr=23;;
|
||||
esac
|
||||
# Maximum of 4 controllers in a system
|
||||
case $ctlr in
|
||||
0|64|128|192)
|
||||
# Maximum of 4 units per controller
|
||||
# for unit in 0 1 2 3
|
||||
for unit in 0 1
|
||||
do
|
||||
zero=`expr $ctlr + $unit + 0`
|
||||
four=`expr $zero + 4` ; eight=`expr $zero + 8`
|
||||
twelve=`expr $zero + 12`
|
||||
sixteen=`expr $zero + 16`
|
||||
twenty=`expr $zero + 20`
|
||||
twentyfour=`expr $zero + 24`
|
||||
twentyeight=`expr $zero + 28`
|
||||
mknod mt$zero b $blk $zero
|
||||
mknod mt$four b $blk $four
|
||||
mknod mt$eight b $blk $eight
|
||||
mknod mt$twelve b $blk $twelve
|
||||
mknod nmt$zero b $blk $four ;: v7 compatibility
|
||||
mknod nmt$eight b $blk $twelve ;: ditto
|
||||
mknod nrmt$zero c $chr $four ;: ditto
|
||||
mknod nrmt$eight c $chr $twelve ;: ditto
|
||||
mknod rmt$zero c $chr $zero
|
||||
mknod rmt$four c $chr $four
|
||||
mknod rmt$eight c $chr $eight
|
||||
mknod rmt$twelve c $chr $twelve
|
||||
if [ `expr $i : '\(..\)'` = tu ]
|
||||
then
|
||||
mknod mt$sixteen b $blk $sixteen
|
||||
mknod mt$twenty b $blk $twenty
|
||||
mknod mt$twentyfour b $blk $twentyfour
|
||||
mknod mt$twentyeight b $blk $twentyeight
|
||||
mknod nmt$sixteen b $blk $twenty ;: v7 compatibility
|
||||
mknod nmt$twentyfour b $blk $twentyeight ;: ditto
|
||||
mknod nrmt$sixteen c $chr $twenty ;: ditto
|
||||
mknod nrmt$twentyfour c $chr $twentyeight ;: ditto
|
||||
mknod rmt$sixteen c $chr $sixteen
|
||||
mknod rmt$twenty c $chr $twenty
|
||||
mknod rmt$twentyfour c $chr $twentyfour
|
||||
mknod rmt$twentyeight c $chr $twentyeight
|
||||
fi
|
||||
if [ `expr $i : '\(..\)'` = ut ]
|
||||
then
|
||||
mknod mt$twenty b $blk $twenty
|
||||
mknod rmt$twenty c $chr $twenty
|
||||
fi
|
||||
done
|
||||
;;
|
||||
*)
|
||||
echo bad controller for tape in: $1
|
||||
;;
|
||||
esac
|
||||
umask 77
|
||||
;;
|
||||
|
||||
rk*)
|
||||
# The 2.11BSD rk driver doesn't support partitions. We create
|
||||
# a single block and charater inode pair for each unit and
|
||||
# call it rkNh.
|
||||
umask 2 ; unit=`expr $i : '..\(.*\)'`
|
||||
case $i in
|
||||
rk*) name=rk; blk=6; chr=15;;
|
||||
esac
|
||||
mknod ${name}${unit}h b ${blk} ${unit}
|
||||
mknod r${name}${unit}h c ${chr} ${unit}
|
||||
chgrp operator ${name}${unit}h r${name}${unit}h
|
||||
chmod 640 ${name}${unit}h r${name}${unit}h
|
||||
;;
|
||||
|
||||
rx*)
|
||||
umask 2
|
||||
rm -f rd[0123] rd[0123][abcd]
|
||||
mknod rd0 b 0 0
|
||||
mknod rd0a b 0 1
|
||||
mknod rd0b b 0 2
|
||||
mknod rd0c b 0 2
|
||||
mknod rd0d b 0 2
|
||||
mknod rd1 b 1 0
|
||||
mknod rd1a b 1 1
|
||||
mknod rd1b b 1 2
|
||||
mknod rd1c b 1 2
|
||||
mknod rd1d b 1 2
|
||||
mknod rd2 b 2 0
|
||||
mknod rd2a b 2 1
|
||||
mknod rd2b b 2 2
|
||||
mknod rd2c b 2 2
|
||||
mknod rd2d b 2 2
|
||||
mknod rd3 b 3 0
|
||||
mknod rd3a b 3 1
|
||||
mknod rd3b b 3 2
|
||||
mknod rd3c b 3 2
|
||||
mknod rd3d b 3 2
|
||||
chgrp operator rd[0123]
|
||||
chgrp operator rd[0123][abcd]
|
||||
chmod 640 rd[0123][abcd]
|
||||
chmod 640 rd[0123]
|
||||
name=rx; blk=8; chr=17
|
||||
mknod ${name}0a b ${blk} 0
|
||||
mknod ${name}1a b ${blk} 1
|
||||
mknod ${name}0b b ${blk} 2
|
||||
mknod ${name}1b b ${blk} 3
|
||||
mknod r${name}0a c ${chr} 0
|
||||
mknod r${name}1a c ${chr} 1
|
||||
mknod r${name}0b c ${chr} 2
|
||||
mknod r${name}1b c ${chr} 3
|
||||
chgrp operator ${name}[01][ab] r${name}[01][ab]
|
||||
chmod 640 ${name}[01][ab] r${name}[01][ab]
|
||||
;;
|
||||
|
||||
gpio)
|
||||
umask 0
|
||||
rm -f port[abcdefg] conf[abcdef]
|
||||
mknod porta c 5 0
|
||||
mknod portb c 5 1
|
||||
mknod portc c 5 2
|
||||
mknod portd c 5 3
|
||||
mknod porte c 5 4
|
||||
mknod portf c 5 5
|
||||
mknod portg c 5 6
|
||||
mknod confa c 5 64
|
||||
mknod confb c 5 65
|
||||
mknod confc c 5 66
|
||||
mknod confd c 5 67
|
||||
mknod confe c 5 68
|
||||
mknod conff c 5 69
|
||||
mknod confg c 5 70
|
||||
ram*)
|
||||
# Note, this must come *before* the "ra*". The entry "rram" is for
|
||||
# auto fscks when ram is mentioned in /etc/fstab.
|
||||
umask 2
|
||||
mknod ram b 3 0
|
||||
ln ram rram
|
||||
chgrp operator ram
|
||||
chmod 640 ram
|
||||
umask 77
|
||||
;;
|
||||
|
||||
adc)
|
||||
umask 0
|
||||
rm -f adc[0123456789] adc1[012345]
|
||||
mknod adc0 c 6 0
|
||||
mknod adc1 c 6 1
|
||||
mknod adc2 c 6 2
|
||||
mknod adc3 c 6 3
|
||||
mknod adc4 c 6 4
|
||||
mknod adc5 c 6 5
|
||||
mknod adc6 c 6 6
|
||||
mknod adc7 c 6 7
|
||||
mknod adc8 c 6 8
|
||||
mknod adc9 c 6 9
|
||||
mknod adc10 c 6 10
|
||||
mknod adc11 c 6 11
|
||||
mknod adc12 c 6 12
|
||||
mknod adc13 c 6 13
|
||||
mknod adc14 c 6 14
|
||||
mknod adc15 c 6 15
|
||||
br*|hk*|ra*|si*|xp*|rl*)
|
||||
umask 2 ; unit=`expr $i : '..\(.*\)'`
|
||||
case $i in
|
||||
br*) name=rp; blk=11; chr=20;;
|
||||
hk*) name=hk; blk=4; chr=13;;
|
||||
ra*) name=ra; blk=5; chr=14;;
|
||||
si*) name=si; blk=9; chr=18;;
|
||||
xp*) name=xp; blk=10; chr=19;;
|
||||
rl*) name=rl; blk=7; chr=16;;
|
||||
esac
|
||||
case $unit in
|
||||
0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|\
|
||||
17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)
|
||||
mknod ${name}${unit}a b $blk `expr $unit '*' 8 + 0`
|
||||
mknod ${name}${unit}b b $blk `expr $unit '*' 8 + 1`
|
||||
mknod ${name}${unit}c b $blk `expr $unit '*' 8 + 2`
|
||||
mknod ${name}${unit}d b $blk `expr $unit '*' 8 + 3`
|
||||
mknod ${name}${unit}e b $blk `expr $unit '*' 8 + 4`
|
||||
mknod ${name}${unit}f b $blk `expr $unit '*' 8 + 5`
|
||||
mknod ${name}${unit}g b $blk `expr $unit '*' 8 + 6`
|
||||
mknod ${name}${unit}h b $blk `expr $unit '*' 8 + 7`
|
||||
mknod r${name}${unit}a c $chr `expr $unit '*' 8 + 0`
|
||||
mknod r${name}${unit}b c $chr `expr $unit '*' 8 + 1`
|
||||
mknod r${name}${unit}c c $chr `expr $unit '*' 8 + 2`
|
||||
mknod r${name}${unit}d c $chr `expr $unit '*' 8 + 3`
|
||||
mknod r${name}${unit}e c $chr `expr $unit '*' 8 + 4`
|
||||
mknod r${name}${unit}f c $chr `expr $unit '*' 8 + 5`
|
||||
mknod r${name}${unit}h c $chr `expr $unit '*' 8 + 7`
|
||||
mknod r${name}${unit}g c $chr `expr $unit '*' 8 + 6`
|
||||
chgrp operator ${name}${unit}[a-h] r${name}${unit}[a-h]
|
||||
chmod 640 ${name}${unit}[a-h] r${name}${unit}[a-h]
|
||||
;;
|
||||
*)
|
||||
echo bad unit for disk in: $i
|
||||
;;
|
||||
esac
|
||||
umask 77
|
||||
;;
|
||||
|
||||
spi)
|
||||
umask 0
|
||||
rm -f spi[1234]
|
||||
mknod spi1 c 7 0
|
||||
mknod spi2 c 7 1
|
||||
mknod spi3 c 7 2
|
||||
mknod spi4 c 7 3
|
||||
dz*)
|
||||
unit=`expr $i : 'dz\(.*\)'`
|
||||
case $unit in
|
||||
0|1|2|3|4|5|6|7)
|
||||
eval `echo $unit | awk ' { u = $1 } END {
|
||||
for (i = 0; i < 8; i++)
|
||||
printf("mknod tty%02d c 2 %d; ",u*8+i,u*8+i); }'`
|
||||
;;
|
||||
*)
|
||||
echo bad unit for dz in: $i
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
glcd)
|
||||
umask 0
|
||||
rm -f glcd0
|
||||
mknod glcd0 c 8 0
|
||||
#
|
||||
# we may want dmz and dmf someday...
|
||||
# dhu*|dh*|dmf*|dmz*)
|
||||
dhv*|dhu*|dh*)
|
||||
case $i in
|
||||
# dmz*) name=dmz; major=37; count=24;
|
||||
# unit=`expr $i : "$name\(.*\)"`
|
||||
# case $unit in
|
||||
# 0) ch=a ;; 1) ch=b ;; 2) ch=c ;; 3) ch=e ;;
|
||||
# 4) ch=f ;; 5) ch=g ;;
|
||||
# *) echo bad unit for $name in: $i ;;
|
||||
# esac;;
|
||||
# dmf*) name=dmf; major=22; count=8;
|
||||
# unit=`expr $i : "$name\(.*\)"`
|
||||
# case $unit in
|
||||
# 0) ch=A ;; 1) ch=B ;; 2) ch=C ;; 3) ch=E ;;
|
||||
# 4) ch=F ;; 5) ch=G ;; 6) ch=H ;; 7) ch=I ;;
|
||||
# *) echo bad unit for $name in: $i ;;
|
||||
# esac;;
|
||||
dhv*) name=dhv; major=24; count=8;
|
||||
unit=`expr $i : "$name\(.*\)"`;
|
||||
case $unit in
|
||||
0) ch=S ;; 1) ch=T ;; 2) ch=U ;; 3) ch=V ;;
|
||||
4) ch=W ;; 5) ch=X ;; 6) ch=Y ;; 7) ch=Z ;;
|
||||
*) echo bad unit for $name in: $i ;;
|
||||
esac;;
|
||||
dhu*) name=dhu; major=4; count=16;
|
||||
unit=`expr $i : "$name\(.*\)"`;
|
||||
case $unit in
|
||||
0) ch=S ;; 1) ch=T ;; 2) ch=U ;; 3) ch=V ;;
|
||||
4) ch=W ;; 5) ch=X ;; 6) ch=Y ;; 7) ch=Z ;;
|
||||
*) echo bad unit for $name in: $i ;;
|
||||
esac;;
|
||||
dh*) name=dh; major=3; count=16;
|
||||
unit=`expr $i : "$name\(.*\)"`
|
||||
case $unit in
|
||||
0) ch=h ;; 1) ch=i ;; 2) ch=j ;; 3) ch=k ;;
|
||||
*) echo bad unit for $name in: $i ;;
|
||||
esac;;
|
||||
esac
|
||||
eval `echo $ch $unit $major $count |
|
||||
awk ' { ch = $1; u = $4 * $2; m = $3; cnt = $4 } END {
|
||||
for (i = 0; i < cnt; i++)
|
||||
if (i < 10)
|
||||
printf("mknod tty%s%x c %d %d; ",ch,i,m,u+i);
|
||||
else
|
||||
printf("mknod tty%s%c c %d %d; ",ch,87+i,m,u+i); }'`
|
||||
;;
|
||||
|
||||
oc)
|
||||
umask 0
|
||||
rm -f oc[12345]
|
||||
mknod oc1 c 9 0
|
||||
mknod oc2 c 9 1
|
||||
mknod oc3 c 9 2
|
||||
mknod oc4 c 9 3
|
||||
mknod oc5 c 9 4
|
||||
# extra DL-11 units not including the console. unit numbers start at 1 because
|
||||
# the console is always unit 0. Seven units (1 - 7) are defined for the 11/93
|
||||
# and 11/94. Device name is "ttyl?". The DH range was restricted from 'h'-'o'
|
||||
# to 'h' - 'k' (very unlikely that more than 64 channels of DH-11 will or could
|
||||
# be put on an 11.
|
||||
|
||||
dl*)
|
||||
name=dl; major=0; ch=l
|
||||
unit=`expr $i : "$name\(.*\)"`
|
||||
case $unit in
|
||||
1|2|3|4|5|6|7)
|
||||
mknod tty${ch}${unit} c $major $unit;
|
||||
;;
|
||||
*)
|
||||
echo bad unit for $name in: $i
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
# we may want va and vp someday...
|
||||
# lp*|va*|vp*)
|
||||
lp*|dn*)
|
||||
case $i in
|
||||
lp*) name=lp; major=5;;
|
||||
dn*) name=dn; major=21;;
|
||||
# va*) name=va; major=10;;
|
||||
# vp*) name=vp; major=6;;
|
||||
esac
|
||||
unit=`expr $i : "$name\(.*\)"`
|
||||
case $unit in
|
||||
0|1|2|3|4|5|6|7)
|
||||
mknod $i c $major $unit;
|
||||
chmod 666 $i
|
||||
;;
|
||||
*)
|
||||
echo bad unit for $name in: $i
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
pty*)
|
||||
class=`expr $i : 'pty\(.*\)'`
|
||||
case $class in
|
||||
0) offset=0 name=p;;
|
||||
1) offset=16 name=q;;
|
||||
2) offset=32 name=r;;
|
||||
3) offset=48 name=s;;
|
||||
4) offset=64 name=t;;
|
||||
5) offset=80 name=u;;
|
||||
*) echo bad unit for pty in: $i;;
|
||||
esac
|
||||
case $class in
|
||||
0|1|2|3|4|5)
|
||||
umask 0
|
||||
eval `echo $offset $name | awk ' { b=$1; n=$2 } END {
|
||||
for (i = 0; i < 16; i++)
|
||||
printf("mknod tty%s%x c 11 %d; \
|
||||
mknod pty%s%x c 10 %d; ", \
|
||||
n, i, b+i, n, i, b+i); }'`
|
||||
umask 77
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
dr*)
|
||||
unit=`expr $i : '..\(.*\)'`
|
||||
case $i in
|
||||
dr*) name=dr; chr=12;;
|
||||
esac
|
||||
case $unit in
|
||||
0|1|2|3|4|5|6|7)
|
||||
umask 0
|
||||
mknod ${name}${unit} c ${chr} ${unit}
|
||||
umask 77
|
||||
;;
|
||||
*)
|
||||
echo bad unit for ${name} in: $i
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
ingreslock)
|
||||
mknod ingreslock c 25 0
|
||||
chown ingres ingreslock
|
||||
chmod 200 ingreslock
|
||||
;;
|
||||
|
||||
local)
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
/dev/rd0a / ufs rw,async 1 1
|
||||
#/dev/rd0c /u ufs rw,async 1 2
|
||||
/dev/sd0 / ufs rw,async 1 1
|
||||
#/dev/sd1 /u ufs rw,async 1 2
|
||||
|
||||
@@ -80,8 +80,6 @@ v|std.3500000|3500000-baud:\
|
||||
:sp#3500000:
|
||||
w|std.4000000|4000000-baud:\
|
||||
:sp#4000000:
|
||||
x|std.default|default-baud:\
|
||||
:sp#0:
|
||||
|
||||
|
||||
#
|
||||
|
||||
3
etc/rc
3
etc/rc
@@ -3,8 +3,6 @@ HOME=/; export HOME
|
||||
PATH=/bin:/sbin; export PATH
|
||||
exec >/dev/console 2>&1
|
||||
|
||||
/sbin/devupdate
|
||||
|
||||
if test "$1" != "autoboot"; then
|
||||
#
|
||||
# Switch from single-user to multi-user mode.
|
||||
@@ -66,7 +64,6 @@ rm -f /etc/nologin
|
||||
|
||||
echo -n "Starting daemons:"
|
||||
update && echo -n "update"
|
||||
cron && echo -n "cron"
|
||||
echo
|
||||
|
||||
#/etc/rc.local
|
||||
|
||||
14
etc/ttys
14
etc/ttys
@@ -1,16 +1,4 @@
|
||||
#
|
||||
# name getty type status comments
|
||||
#
|
||||
console "/libexec/getty std.default" xterm on secure #special
|
||||
|
||||
# Enable some of these for additional logins. Do NOT enable the same one as the
|
||||
# console port, or strange things will happen. You can turn off the console port
|
||||
# if you would rather use the getty on the real tty - it's up to you.
|
||||
|
||||
tty0 "/libexec/getty std.default" xterm off secure
|
||||
tty1 "/libexec/getty std.default" xterm off secure
|
||||
tty2 "/libexec/getty std.default" xterm off secure
|
||||
tty3 "/libexec/getty std.default" xterm off secure
|
||||
tty4 "/libexec/getty std.default" xterm off secure
|
||||
tty5 "/libexec/getty std.default" xterm off secure
|
||||
ttyUSB0 "/libexec/getty std.default" xterm off secure
|
||||
console "/libexec/getty std.115200" vt100 on secure #special
|
||||
|
||||
1
games/.gitignore
vendored
1
games/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
*
|
||||
Binary file not shown.
@@ -33,36 +33,48 @@
|
||||
#ifndef _AOUT_H_
|
||||
#define _AOUT_H_
|
||||
|
||||
#include <sys/exec_aout.h>
|
||||
#include <sys/exec.h>
|
||||
|
||||
/* Valid magic number check. */
|
||||
#define N_BADMAG(x) (((x).a_magic) != RMAGIC && \
|
||||
((x).a_magic) != OMAGIC && \
|
||||
((x).a_magic) != NMAGIC)
|
||||
|
||||
/* Text segment offset. */
|
||||
#define N_TXTOFF(x) sizeof(struct exec)
|
||||
|
||||
/* Data segment offset. */
|
||||
#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
|
||||
|
||||
/* Text relocation table offset. */
|
||||
#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
|
||||
|
||||
/* Data relocation table offset. */
|
||||
#define N_DRELOFF(x) (N_TRELOFF(x) + (x).a_reltext)
|
||||
|
||||
/* Symbol table offset. */
|
||||
#define N_SYMOFF(x) ((x).a_magic == RMAGIC ? \
|
||||
N_DRELOFF(x) + (x).a_reldata : \
|
||||
N_DATOFF(x) + (x).a_data)
|
||||
|
||||
#define _AOUT_INCLUDE_
|
||||
#include <nlist.h>
|
||||
|
||||
/* Relocations */
|
||||
struct reloc {
|
||||
unsigned flags;
|
||||
#define RSMASK 0x70 /* bitmask for segments */
|
||||
#define RABS 0
|
||||
#define RTEXT 0x20
|
||||
#define RDATA 0x30
|
||||
#define RBSS 0x40
|
||||
#define RSTRNG 0x60 /* for assembler */
|
||||
#define REXT 0x70 /* externals and bitmask */
|
||||
|
||||
#define RGPREL 0x08 /* gp relative */
|
||||
#define RABS 0
|
||||
#define RTEXT 0x20
|
||||
#define RDATA 0x30
|
||||
#define RBSS 0x40
|
||||
#define RSTRNG 0x60 /* for assembler */
|
||||
#define REXT 0x70 /* externals and bitmask */
|
||||
|
||||
#define RFMASK 0x07 /* bitmask for format */
|
||||
#define RBYTE16 0x00 /* low part of byte address: bits 15:0 */
|
||||
#define RBYTE32 0x01 /* 32-bit byte address */
|
||||
#define RHIGH16 0x02 /* upper part of byte address: bits 31:16 */
|
||||
#define RHIGH16S 0x03 /* upper part of address with signed offset */
|
||||
#define RWORD16 0x04 /* word address: bits 17:2 */
|
||||
#define RWORD26 0x05 /* word address: bits 27:2 */
|
||||
#define RHIGH16 0x02 /* upper part of byte address: bits 31:16 */
|
||||
#define RWORD16 0x03 /* word address: bits 17:2 */
|
||||
#define RWORD26 0x04 /* word address: bits 27:2 */
|
||||
|
||||
unsigned index; /* 24-bit index in symbol table,
|
||||
* for REXT */
|
||||
unsigned offset; /* 16-bit offset,
|
||||
* for RIGH16 and RIGH16S */
|
||||
};
|
||||
#define RINDEX(h) ((h) >> 8)
|
||||
#define RSETINDEX(h) ((h) << 8)
|
||||
|
||||
#endif /* !_AOUT_H_ */
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
/* alloca.h - Allocate memory on stack */
|
||||
|
||||
#ifndef ALLOCA_H
|
||||
#define ALLOCA_H
|
||||
|
||||
#undef alloca
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define alloca(size) __builtin_alloca(size)
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
void *alloca(size_t);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <sgtty.h>
|
||||
#include <term.h>
|
||||
|
||||
#define bool int
|
||||
#define bool char
|
||||
#define reg register
|
||||
|
||||
#define TRUE (1)
|
||||
@@ -149,7 +149,7 @@ int __void__;
|
||||
#define noecho() (_tty.sg_flags &= ~ECHO, _echoit = FALSE, ioctl(_tty_ch, TIOCSETP, &_tty))
|
||||
#define nl() (_tty.sg_flags |= CRMOD, _pfast = _rawmode,ioctl(_tty_ch, TIOCSETP, &_tty))
|
||||
#define nonl() (_tty.sg_flags &= ~CRMOD,_pfast = TRUE, ioctl(_tty_ch, TIOCSETP,&_tty))
|
||||
#define savetty() ((void) ioctl(_tty_ch, TIOCGETP, &_tty), _res_flg = _tty.sg_flags)
|
||||
#define savetty() ((void) gtty(_tty_ch, &_tty), _res_flg = _tty.sg_flags)
|
||||
#define resetty() (_tty.sg_flags = _res_flg, (void) ioctl(_tty_ch, TIOCSETP, &_tty))
|
||||
|
||||
#define erasechar() (_tty.sg_erase)
|
||||
@@ -167,24 +167,11 @@ int wgetch (WINDOW *);
|
||||
char *wstandout (WINDOW *);
|
||||
char *wstandend (WINDOW *);
|
||||
int touchwin (WINDOW *);
|
||||
int touchline (WINDOW *, int, int, int);
|
||||
void box (WINDOW *, char, char);
|
||||
int touchline (WINDOW *, int, int);
|
||||
int box (WINDOW *, char, char);
|
||||
void endwin (void);
|
||||
int printw (char *, ...);
|
||||
int wprintw (WINDOW *, char *, ...);
|
||||
int scroll (WINDOW *);
|
||||
void wclrtoeol (WINDOW *);
|
||||
void werase (WINDOW *);
|
||||
int setterm (char *);
|
||||
int delwin (WINDOW *);
|
||||
int waddstr (WINDOW *, char *);
|
||||
int wgetstr (WINDOW *, char *);
|
||||
int wdeleteln (WINDOW *);
|
||||
void mvcur(int ly, int lx, int y, int x);
|
||||
void overwrite(WINDOW *win1, WINDOW *win2);
|
||||
void wclrtobot(WINDOW *win);
|
||||
int mvprintw(int y, int x, char *fmt, ...);
|
||||
int mvwprintw(WINDOW *win, int y, int x, char *fmt, ...);
|
||||
int printw (char *fmt, ...);
|
||||
int wprintw (WINDOW *win, char *fmt, ...);
|
||||
|
||||
/*
|
||||
* Used to be in unctrl.h.
|
||||
|
||||
@@ -7,9 +7,4 @@ struct group { /* see getgrent(3) */
|
||||
char **gr_mem;
|
||||
};
|
||||
|
||||
struct group *getgrent(void);
|
||||
struct group *getgrnam(const char *name);
|
||||
struct group *getgrgid(gid_t gid);
|
||||
void setgrent(void);
|
||||
void endgrent(void);
|
||||
int setgroups(size_t size, const gid_t *list);
|
||||
struct group *getgrent(), *getgrgid(), *getgrnam();
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#ifndef _KMEM_H
|
||||
#define _KMEM_H
|
||||
|
||||
extern dev_t kmemdev();
|
||||
|
||||
#endif
|
||||
@@ -35,7 +35,8 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
/*
|
||||
* Symbol table entry format.
|
||||
* Symbol table entry format. The #ifdef's are so that programs including
|
||||
* nlist.h can initialize nlist structures statically.
|
||||
*/
|
||||
struct nlist {
|
||||
char *n_name; /* In memory address of symbol name,
|
||||
@@ -55,12 +56,13 @@ struct nlist {
|
||||
#define N_BSS 0x04 /* bss segment */
|
||||
#define N_STRNG 0x05 /* string segment (for assembler) */
|
||||
#define N_COMM 0x06 /* .comm segment (for assembler) */
|
||||
#define N_REG 0x14 /* register symbol */
|
||||
#define N_FN 0x1f /* file name */
|
||||
|
||||
#define N_TYPE 0x1f /* mask for all the type bits */
|
||||
#define N_EXT 0x20 /* external (global) bit, OR'ed in */
|
||||
#define N_WEAK 0x40 /* weak reference bit, OR'ed in */
|
||||
#define N_LOC 0x80 /* local, for assembler */
|
||||
#define N_TYPE 0x1f /* mask for all the type bits */
|
||||
|
||||
#define N_FORMAT "%06o" /* namelist value format; XXX */
|
||||
|
||||
/*
|
||||
* Get symbols from a file.
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
struct ranlib {
|
||||
int ran_len; /* 1 byte - name length in bytes */
|
||||
unsigned ran_off; /* 4 bytes - file offset */
|
||||
off_t ran_off; /* 4 bytes - file offset */
|
||||
char *ran_name; /* in memory symbol name */
|
||||
};
|
||||
|
||||
|
||||
@@ -14,29 +14,9 @@
|
||||
* 9 - $ra - return address
|
||||
* 10 - $gp - global data pointer
|
||||
* 11 - $sp - stack pointer
|
||||
* 12 - signal mask saved
|
||||
* 13 - signal mask
|
||||
*/
|
||||
typedef int jmp_buf [14];
|
||||
typedef jmp_buf sigjmp_buf;
|
||||
typedef int jmp_buf [12];
|
||||
|
||||
/*
|
||||
* Save and restore only CPU state.
|
||||
* Signal mask is not saved.
|
||||
*/
|
||||
int _setjmp (jmp_buf env);
|
||||
void _longjmp (jmp_buf env, int val);
|
||||
|
||||
/*
|
||||
* Save and restore CPU state and signal mask.
|
||||
*/
|
||||
int setjmp (jmp_buf env);
|
||||
void longjmp (jmp_buf env, int val);
|
||||
|
||||
/*
|
||||
* Save and restore CPU state and optionally a signal mask.
|
||||
* Signal mask is saved only when savesigs is nonzero.
|
||||
*/
|
||||
int sigsetjmp (sigjmp_buf env, int savesigs);
|
||||
void siglongjmp (sigjmp_buf env, int val);
|
||||
#endif
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
/*
|
||||
* SmallC: interface to curses library.
|
||||
*/
|
||||
#define WINDOW int
|
||||
|
||||
extern WINDOW *stdscr, *curscr;
|
||||
|
||||
extern int LINES, COLS;
|
||||
|
||||
/*
|
||||
* pseudo functions for standard screen
|
||||
*/
|
||||
#define addch(ch) waddch(stdscr, ch)
|
||||
#define getch() wgetch(stdscr)
|
||||
#define addstr(str) waddstr(stdscr, str)
|
||||
#define getstr(str) wgetstr(stdscr, str)
|
||||
#define move(y, x) wmove(stdscr, y, x)
|
||||
#define clear() wclear(stdscr)
|
||||
#define erase() werase(stdscr)
|
||||
#define clrtobot() wclrtobot(stdscr)
|
||||
#define clrtoeol() wclrtoeol(stdscr)
|
||||
#define insertln() winsertln(stdscr)
|
||||
#define deleteln() wdeleteln(stdscr)
|
||||
#define refresh() wrefresh(stdscr)
|
||||
#define inch() winch(stdscr)
|
||||
#define insch(c) winsch(stdscr,c)
|
||||
#define delch() wdelch(stdscr)
|
||||
#define standout() wstandout(stdscr)
|
||||
#define standend() wstandend(stdscr)
|
||||
|
||||
/*
|
||||
* mv functions
|
||||
*/
|
||||
#define mvwaddch(win,y,x,ch) wmove(win,y,x) == 0 ? 0 : waddch(win,ch)
|
||||
#define mvwgetch(win,y,x) wmove(win,y,x) == 0 ? 0 : wgetch(win)
|
||||
#define mvwaddstr(win,y,x,str) wmove(win,y,x) == 0 ? 0 : waddstr(win,str)
|
||||
#define mvwgetstr(win,y,x,str) wmove(win,y,x) == 0 ? 0 : wgetstr(win,str)
|
||||
#define mvwinch(win,y,x) wmove(win,y,x) == 0 ? 0 : winch(win)
|
||||
#define mvwdelch(win,y,x) wmove(win,y,x) == 0 ? 0 : wdelch(win)
|
||||
#define mvwinsch(win,y,x,c) wmove(win,y,x) == 0 ? 0 : winsch(win,c)
|
||||
#define mvaddch(y,x,ch) mvwaddch(stdscr,y,x,ch)
|
||||
#define mvgetch(y,x) mvwgetch(stdscr,y,x)
|
||||
#define mvaddstr(y,x,str) mvwaddstr(stdscr,y,x,str)
|
||||
#define mvgetstr(y,x,str) mvwgetstr(stdscr,y,x,str)
|
||||
#define mvinch(y,x) mvwinch(stdscr,y,x)
|
||||
#define mvdelch(y,x) mvwdelch(stdscr,y,x)
|
||||
#define mvinsch(y,x,c) mvwinsch(stdscr,y,x,c)
|
||||
|
||||
#ifdef TODO
|
||||
|
||||
#define TRUE (1)
|
||||
#define FALSE (0)
|
||||
#define ERR (0)
|
||||
#define OK (1)
|
||||
|
||||
/*
|
||||
* Capabilities from termcap
|
||||
*/
|
||||
extern int AM, BS, CA, DA, DB, EO, HC, HZ, IN, MI, MS, NC, NS, OS, UL,
|
||||
XB, XN, XT, XS, XX;
|
||||
extern char *AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL,
|
||||
*DM, *DO, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5, *K6,
|
||||
*K7, *K8, *K9, *HO, *IC, *IM, *IP, *KD, *KE, *KH, *KL,
|
||||
*KR, *KS, *KU, *LL, *MA, *ND, *NL, *RC, *SC, *SE, *SF,
|
||||
*SO, *SR, *TA, *TE, *TI, *UC, *UE, *UP, *US, *VB, *VS,
|
||||
*VE, *AL_PARM, *DL_PARM, *UP_PARM, *DOWN_PARM,
|
||||
*LEFT_PARM, *RIGHT_PARM;
|
||||
extern char PC;
|
||||
|
||||
/*
|
||||
* From the tty modes...
|
||||
*/
|
||||
extern int GT, NONL, UPPERCASE, normtty, _pfast;
|
||||
|
||||
extern int My_term, _echoit, _rawmode, _endwin;
|
||||
|
||||
extern char *Def_term, ttytype[];
|
||||
|
||||
extern int _tty_ch, _res_flg;
|
||||
|
||||
extern SGTTY _tty;
|
||||
|
||||
/*
|
||||
* pseudo functions
|
||||
*/
|
||||
#define clearok(win,bf) (win->_clear = bf)
|
||||
#define leaveok(win,bf) (win->_leave = bf)
|
||||
#define scrollok(win,bf) (win->_scroll = bf)
|
||||
#define flushok(win,bf) (bf ? (win->_flags |= _FLUSH):(win->_flags &= ~_FLUSH))
|
||||
#define getyx(win,y,x) y = win->_cury, x = win->_curx
|
||||
#define winch(win) (win->_y[win->_cury][win->_curx] & 0177)
|
||||
|
||||
#define raw() (_tty.sg_flags|=RAW, _pfast=_rawmode=TRUE, ioctl(_tty_ch,TIOCSETP,&_tty))
|
||||
#define noraw() (_tty.sg_flags&=~RAW,_rawmode=FALSE,_pfast=!(_tty.sg_flags&CRMOD),ioctl(_tty_ch,TIOCSETP,&_tty))
|
||||
#define cbreak() (_tty.sg_flags |= CBREAK, _rawmode = TRUE, ioctl(_tty_ch,TIOCSETP,&_tty))
|
||||
#define nocbreak() (_tty.sg_flags &= ~CBREAK,_rawmode=FALSE,ioctl(_tty_ch,TIOCSETP,&_tty))
|
||||
#define echo() (_tty.sg_flags |= ECHO, _echoit = TRUE, ioctl(_tty_ch, TIOCSETP, &_tty))
|
||||
#define noecho() (_tty.sg_flags &= ~ECHO, _echoit = FALSE, ioctl(_tty_ch, TIOCSETP, &_tty))
|
||||
#define nl() (_tty.sg_flags |= CRMOD, _pfast = _rawmode,ioctl(_tty_ch, TIOCSETP, &_tty))
|
||||
#define nonl() (_tty.sg_flags &= ~CRMOD,_pfast = TRUE, ioctl(_tty_ch, TIOCSETP,&_tty))
|
||||
#define savetty() ((void) ioctl(_tty_ch, TIOCGETP, &_tty), _res_flg = _tty.sg_flags)
|
||||
#define resetty() (_tty.sg_flags = _res_flg, (void) ioctl(_tty_ch, TIOCSETP, &_tty))
|
||||
|
||||
#define erasechar() (_tty.sg_erase)
|
||||
#define killchar() (_tty.sg_kill)
|
||||
#define baudrate() (_tty.sg_ospeed)
|
||||
|
||||
/*
|
||||
* Used to be in unctrl.h.
|
||||
*/
|
||||
#define unctrl(c) _unctrl[(c) & 0177]
|
||||
extern char *_unctrl[];
|
||||
|
||||
#endif
|
||||
@@ -1,38 +0,0 @@
|
||||
|
||||
/* open-only flags */
|
||||
#define O_RDONLY 0x0000 /* open for reading only */
|
||||
#define O_WRONLY 0x0001 /* open for writing only */
|
||||
#define O_RDWR 0x0002 /* open for reading and writing */
|
||||
#define O_ACCMODE 0x0003 /* mask for above modes */
|
||||
|
||||
#define O_NONBLOCK 0x0004 /* no delay */
|
||||
#define O_APPEND 0x0008 /* set append mode */
|
||||
#define O_SHLOCK 0x0010 /* open with shared file lock */
|
||||
#define O_EXLOCK 0x0020 /* open with exclusive file lock */
|
||||
#define O_ASYNC 0x0040 /* signal pgrp when data ready */
|
||||
#define O_FSYNC 0x0080 /* synchronous writes */
|
||||
#define O_CREAT 0x0200 /* create if nonexistant */
|
||||
#define O_TRUNC 0x0400 /* truncate to zero length */
|
||||
#define O_EXCL 0x0800 /* error if already exists */
|
||||
|
||||
/*
|
||||
* Constants used for fcntl(2)
|
||||
*/
|
||||
|
||||
/* command values */
|
||||
#define F_DUPFD 0 /* duplicate file descriptor */
|
||||
#define F_GETFD 1 /* get file descriptor flags */
|
||||
#define F_SETFD 2 /* set file descriptor flags */
|
||||
#define F_GETFL 3 /* get file status flags */
|
||||
#define F_SETFL 4 /* set file status flags */
|
||||
#define F_GETOWN 5 /* get SIGIO/SIGURG proc/pgrp */
|
||||
#define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */
|
||||
|
||||
/* file descriptor flags (F_GETFD, F_SETFD) */
|
||||
#define FD_CLOEXEC 1 /* close-on-exec flag */
|
||||
|
||||
/* lock operations for flock() */
|
||||
#define LOCK_SH 1 /* shared file lock */
|
||||
#define LOCK_EX 2 /* exclusive file lock */
|
||||
#define LOCK_NB 4 /* don't block when locking */
|
||||
#define LOCK_UN 8 /* unlock file */
|
||||
@@ -1,77 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1986 Regents of the University of California.
|
||||
* All rights reserved. The Berkeley software License Agreement
|
||||
* specifies the terms and conditions for redistribution.
|
||||
*/
|
||||
#ifndef NSIG
|
||||
|
||||
#define NSIG 32
|
||||
|
||||
#define SIGHUP 1 /* hangup */
|
||||
#define SIGINT 2 /* interrupt */
|
||||
#define SIGQUIT 3 /* quit */
|
||||
#define SIGILL 4 /* illegal instruction (not reset when caught) */
|
||||
#define SIGTRAP 5 /* trace trap (not reset when caught) */
|
||||
#define SIGIOT 6 /* IOT instruction */
|
||||
#define SIGABRT SIGIOT /* compatibility */
|
||||
#define SIGEMT 7 /* EMT instruction */
|
||||
#define SIGFPE 8 /* floating point exception */
|
||||
#define SIGKILL 9 /* kill (cannot be caught or ignored) */
|
||||
#define SIGBUS 10 /* bus error */
|
||||
#define SIGSEGV 11 /* segmentation violation */
|
||||
#define SIGSYS 12 /* bad argument to system call */
|
||||
#define SIGPIPE 13 /* write on a pipe with no one to read it */
|
||||
#define SIGALRM 14 /* alarm clock */
|
||||
#define SIGTERM 15 /* software termination signal from kill */
|
||||
#define SIGURG 16 /* urgent condition on IO channel */
|
||||
#define SIGSTOP 17 /* sendable stop signal not from tty */
|
||||
#define SIGTSTP 18 /* stop signal from tty */
|
||||
#define SIGCONT 19 /* continue a stopped process */
|
||||
#define SIGCHLD 20 /* to parent on child stop or exit */
|
||||
#define SIGCLD SIGCHLD /* compatibility */
|
||||
#define SIGTTIN 21 /* to readers pgrp upon background tty read */
|
||||
#define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */
|
||||
#define SIGIO 23 /* input/output possible signal */
|
||||
#define SIGXCPU 24 /* exceeded CPU time limit */
|
||||
#define SIGXFSZ 25 /* exceeded file size limit */
|
||||
#define SIGVTALRM 26 /* virtual time alarm */
|
||||
#define SIGPROF 27 /* profiling time alarm */
|
||||
#define SIGWINCH 28 /* window size changes */
|
||||
#define SIGUSR1 30 /* user defined signal 1 */
|
||||
#define SIGUSR2 31 /* user defined signal 2 */
|
||||
|
||||
#define SIG_ERR -1
|
||||
#define SIG_DFL 0
|
||||
#define SIG_IGN 1
|
||||
#define BADSIG SIG_ERR
|
||||
|
||||
#define SA_ONSTACK 0x0001 /* take signal on signal stack */
|
||||
#define SA_RESTART 0x0002 /* restart system on signal return */
|
||||
#define SA_DISABLE 0x0004 /* disable taking signals on alternate stack */
|
||||
#define SA_NOCLDSTOP 0x0008 /* do not generate SIGCHLD on child stop */
|
||||
|
||||
/*
|
||||
* Flags for sigprocmask:
|
||||
*/
|
||||
#define SIG_BLOCK 1 /* block specified signal set */
|
||||
#define SIG_UNBLOCK 2 /* unblock specified signal set */
|
||||
#define SIG_SETMASK 3 /* set specified signal set */
|
||||
|
||||
#define MINSIGSTKSZ 128 /* minimum allowable stack */
|
||||
#define SIGSTKSZ (MINSIGSTKSZ + 384) /* recommended stack size */
|
||||
|
||||
#define SV_ONSTACK SA_ONSTACK /* take signal on signal stack */
|
||||
#define SV_INTERRUPT SA_RESTART /* same bit, opposite sense */
|
||||
|
||||
/*
|
||||
* Macro for converting signal number to a mask suitable for
|
||||
* sigblock().
|
||||
*/
|
||||
#define sigmask(m) (1L << ((m)-1))
|
||||
#define sigaddset(set, signo) (*(set) |= 1L << ((signo) - 1), 0)
|
||||
#define sigdelset(set, signo) (*(set) &= ~(1L << ((signo) - 1)), 0)
|
||||
#define sigemptyset(set) (*(set) = (sigset_t)0, (int)0)
|
||||
#define sigfillset(set) (*(set) = ~(sigset_t)0, (int)0)
|
||||
#define sigismember(set, signo) ((*(set) & (1L << ((signo) - 1))) != 0)
|
||||
|
||||
#endif /* NSIG */
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* SmallC: interface to stdio library.
|
||||
*/
|
||||
#define BUFSIZ 1024
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#define FILE int
|
||||
#define EOF (-1)
|
||||
|
||||
extern int _iob[];
|
||||
|
||||
#define stdin (&_iob[0])
|
||||
#define stdout (&_iob[5])
|
||||
#define stderr (&_iob[10])
|
||||
|
||||
#define SEEK_SET 0 /* set file offset to offset */
|
||||
#define SEEK_CUR 1 /* set file offset to current plus offset */
|
||||
#define SEEK_END 2 /* set file offset to EOF plus offset */
|
||||
|
||||
#define getc fgetc
|
||||
#define putc fputc
|
||||
@@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Ioctl definitions for GPIO driver.
|
||||
*/
|
||||
#define GPIO_PORT(n) (n) /* port number */
|
||||
#define GPIO_PORTA 0
|
||||
#define GPIO_PORTB 1
|
||||
#define GPIO_PORTC 2
|
||||
#define GPIO_PORTD 3
|
||||
#define GPIO_PORTE 4
|
||||
#define GPIO_PORTF 5
|
||||
#define GPIO_PORTG 6
|
||||
|
||||
#define GPIO_CONFIN 0x20016700 /* configure as input */
|
||||
#define GPIO_CONFOUT 0x20026700 /* configure as output */
|
||||
#define GPIO_CONFOD 0x20046700 /* configure as open drain */
|
||||
#define GPIO_DECONF 0x20086700 /* deconfigure */
|
||||
#define GPIO_STORE 0x20106700 /* store all outputs */
|
||||
#define GPIO_SET 0x20206700 /* set to 1 by mask */
|
||||
#define GPIO_CLEAR 0x20406700 /* set to 0 by mask */
|
||||
#define GPIO_INVERT 0x20806700 /* invert by mask */
|
||||
#define GPIO_POLL 0x21006700 /* poll */
|
||||
#define GPIO_LOL 0x82006700 /* display lol picture */
|
||||
@@ -1,9 +0,0 @@
|
||||
/*
|
||||
* Ioctl definitions for SPI driver.
|
||||
*/
|
||||
#define SPICTL_SETMODE 0x20007000 /* set SPI mode */
|
||||
#define SPICTL_SETRATE 0x20007001 /* set clock rate, kHz */
|
||||
#define SPICTL_SETSELPIN 0x20007002 /* set select pin */
|
||||
#define SPICTL_IO8(n) (0xc0007003 | (n)<<16) /* transfer n*8 bits */
|
||||
#define SPICTL_IO16(n) (0xc0007004 | (n)<<16) /* transfer n*16 bits */
|
||||
#define SPICTL_IO32(n) (0xc0007005 | (n)<<16) /* transfer n*32 bits */
|
||||
@@ -1,12 +0,0 @@
|
||||
/*
|
||||
* SmallC: interface to wiznet library.
|
||||
*/
|
||||
#define MAX_SOCK_NUM 4 /* Max number of sockets per chip */
|
||||
#define CLIENT_SIZE 3 /* Size of client structure in words */
|
||||
#define UDP_SIZE 2 /* Size of UDP structure in words */
|
||||
|
||||
extern unsigned _socket_port[];
|
||||
|
||||
extern unsigned _client_srcport;
|
||||
|
||||
extern unsigned _server_port;
|
||||
@@ -4,49 +4,27 @@
|
||||
#ifndef _STDARG_H
|
||||
#define _STDARG_H
|
||||
|
||||
/*
|
||||
* Define va_start, va_arg, va_end, va_copy.
|
||||
*/
|
||||
#if defined(__GNUC__) /* Gnu C */
|
||||
# define va_start(ap, last) __builtin_va_start((ap), last)
|
||||
# define va_arg(ap, type) __builtin_va_arg((ap), type)
|
||||
# define va_end(ap) __builtin_va_end((ap))
|
||||
# define va_copy(dest, src) __builtin_va_copy((dest), (src))
|
||||
/* Define __gnuc_va_list. */
|
||||
|
||||
#elif defined(__PCC__) /* PCC */
|
||||
# define va_start(ap, last) __builtin_stdarg_start((ap), last)
|
||||
# define va_arg(ap, type) __builtin_va_arg((ap), type)
|
||||
# define va_end(ap) __builtin_va_end((ap))
|
||||
# define va_copy(dest, src) __builtin_va_copy((dest), (src))
|
||||
|
||||
#else /* SmallerC, LCC */
|
||||
# define va_start(ap, last) (ap = ((char*)&(last) + \
|
||||
(((sizeof(last) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))))
|
||||
# define va_arg(ap, type) ((type*)(ap += \
|
||||
sizeof(type) == sizeof(int) ? sizeof(type) : \
|
||||
(-(int)(ap) & (sizeof(type) - 1)) + sizeof(type)))[-1]
|
||||
# define va_end(ap)
|
||||
# define va_copy(dest, src) (dest = (src))
|
||||
#ifndef __GNUC_VA_LIST
|
||||
#define __GNUC_VA_LIST
|
||||
typedef __builtin_va_list __gnuc_va_list;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define va_list.
|
||||
*/
|
||||
#ifndef _VA_LIST_T
|
||||
# define _VA_LIST_T
|
||||
# if defined(__GNUC__) || defined(__PCC__)
|
||||
typedef __builtin_va_list va_list;
|
||||
# else
|
||||
typedef char *va_list;
|
||||
# endif
|
||||
#ifdef __GNUC__
|
||||
# define va_start(ap, last) __builtin_va_start((ap), last)
|
||||
#endif
|
||||
#ifdef __PCC__
|
||||
# define va_start(ap, last) __builtin_stdarg_start((ap), last)
|
||||
#endif
|
||||
#define va_arg(ap, type) __builtin_va_arg((ap), type)
|
||||
#define va_end(ap) __builtin_va_end((ap))
|
||||
#define va_copy(dest, src) __builtin_va_copy((dest), (src))
|
||||
|
||||
/*
|
||||
* Define __gnuc_va_list.
|
||||
*/
|
||||
#if defined(__GNUC__) && !defined(__GNUC_VA_LIST)
|
||||
# define __GNUC_VA_LIST
|
||||
typedef __builtin_va_list __gnuc_va_list;
|
||||
|
||||
#ifndef _VA_LIST
|
||||
#define _VA_LIST
|
||||
typedef __gnuc_va_list va_list;
|
||||
#endif
|
||||
|
||||
#endif /* not _STDARG_H */
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
|
||||
/* Offset of member MEMBER in a struct of type TYPE. */
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ > 3
|
||||
#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
|
||||
#else
|
||||
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE*)0)->MEMBER)
|
||||
#endif
|
||||
@@ -14,7 +14,7 @@ extern struct _iobuf {
|
||||
char *_base; /* ditto */
|
||||
int _bufsiz;
|
||||
short _flag;
|
||||
short _file;
|
||||
char _file; /* should be short */
|
||||
} _iob[];
|
||||
|
||||
#define _IOREAD 01
|
||||
@@ -73,7 +73,6 @@ FILE *fopen (const char *, const char *);
|
||||
FILE *fdopen (int, const char *);
|
||||
FILE *freopen (const char *, const char *, FILE *);
|
||||
FILE *popen (const char *, const char *);
|
||||
FILE *tmpfile (void);
|
||||
int fclose (FILE *);
|
||||
long ftell (FILE *);
|
||||
int fflush (FILE *);
|
||||
@@ -94,8 +93,6 @@ int setvbuf (FILE *, char *, int, size_t);
|
||||
int fseek (FILE *, long, int);
|
||||
void rewind (FILE *);
|
||||
int remove (const char *);
|
||||
int getw(FILE *stream);
|
||||
int putw(int w, FILE *stream);
|
||||
|
||||
size_t fread (void *, size_t, size_t, FILE *);
|
||||
size_t fwrite (const void *, size_t, size_t, FILE *);
|
||||
@@ -110,12 +107,7 @@ int scanf (const char *, ...);
|
||||
int sscanf (const char *, const char *, ...);
|
||||
|
||||
#ifndef _VA_LIST_
|
||||
# ifdef __GNUC__
|
||||
# define va_list __builtin_va_list /* For Gnu C */
|
||||
# endif
|
||||
# ifdef __SMALLER_C__
|
||||
# define va_list char * /* For Smaller C */
|
||||
# endif
|
||||
#define va_list __builtin_va_list /* For GCC */
|
||||
#endif
|
||||
|
||||
int vfprintf (FILE *, const char *, va_list);
|
||||
@@ -131,7 +123,7 @@ int _doprnt (const char *, va_list, FILE *);
|
||||
int _doscan (FILE *, const char *, va_list);
|
||||
|
||||
#ifndef _VA_LIST_
|
||||
# undef va_list
|
||||
#undef va_list
|
||||
#endif
|
||||
|
||||
void perror (const char *);
|
||||
|
||||
@@ -54,51 +54,48 @@
|
||||
|
||||
#define RAND_MAX 0x7fff
|
||||
|
||||
void abort (void);
|
||||
void abort();
|
||||
int abs (int);
|
||||
int atexit (void (*)(void));
|
||||
int atoi (const char *);
|
||||
long atol (const char *);
|
||||
double atof();
|
||||
int atoi();
|
||||
long atol();
|
||||
void *calloc (size_t, size_t);
|
||||
void exit (int);
|
||||
void free (void *);
|
||||
char *getenv (const char *);
|
||||
long labs (long);
|
||||
char *getenv();
|
||||
void *malloc (size_t);
|
||||
char *mktemp (char *);
|
||||
int mkstemp (char *);
|
||||
void qsort (void *, size_t, size_t, int (*)(const void *, const void *));
|
||||
int rand (void);
|
||||
void qsort();
|
||||
int rand();
|
||||
void *realloc (void*, size_t);
|
||||
void srand (unsigned);
|
||||
long strtol (const char *, char **, int);
|
||||
unsigned long strtoul (const char *, char **, int);
|
||||
int system (const char *);
|
||||
void srand();
|
||||
double strtod();
|
||||
long strtol();
|
||||
unsigned long strtoul();
|
||||
int system();
|
||||
|
||||
int putenv (char *string);
|
||||
int setenv (const char *name, const char *value, int overwrite);
|
||||
int unsetenv (const char *name);
|
||||
char *_findenv (const char *name, int *offset);
|
||||
|
||||
void *alloca (size_t size);
|
||||
void *alloca();
|
||||
|
||||
int daemon (int, int);
|
||||
char *devname (dev_t dev, mode_t type);
|
||||
int getloadavg (unsigned loadavg[], int nelem);
|
||||
int daemon();
|
||||
char *devname();
|
||||
int getloadavg(unsigned loadavg[], int nelem);
|
||||
|
||||
extern char *suboptarg; /* getsubopt(3) external variable */
|
||||
int getsubopt (char **, char **, char **);
|
||||
int getsubopt();
|
||||
|
||||
long random (void);
|
||||
char *setstate (char *);
|
||||
void srandom (unsigned);
|
||||
|
||||
#ifndef __SMALLER_C__
|
||||
double atof (const char *);
|
||||
double strtod (const char *, char **);
|
||||
char *ecvt (double, int, int *, int *);
|
||||
char *fcvt (double, int, int *, int *);
|
||||
char *gcvt (double, int, char *);
|
||||
#endif
|
||||
char *ecvt (double, int, int *, int *);
|
||||
char *fcvt (double, int, int *, int *);
|
||||
char *gcvt (double, int, char *);
|
||||
|
||||
#endif /* _STDLIB_H_ */
|
||||
|
||||
@@ -39,5 +39,5 @@ char *strtok_r (char *, const char *, char **);
|
||||
size_t strcspn (const char *, const char *);
|
||||
size_t strspn (const char *, const char *);
|
||||
|
||||
char *strerror (int);
|
||||
const char *strerror (int);
|
||||
const char *syserrlst (int);
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
int bcmp(const void *, const void *, size_t);
|
||||
void bcopy(const void *, void *, size_t);
|
||||
void bzero(void *, unsigned long);
|
||||
void bzero(void *, size_t);
|
||||
int ffs(int);
|
||||
char *index(const char *, int);
|
||||
char *rindex(const char *, int);
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
#define SYS_getegid 48
|
||||
#define SYS_setgid 49
|
||||
#define SYS_setegid 50
|
||||
#define SYS_kmemdev 51
|
||||
/* 51 is old; acct */
|
||||
#define SYS_phys 52
|
||||
#define SYS_lock 53
|
||||
#define SYS_ioctl 54
|
||||
@@ -81,7 +81,7 @@
|
||||
#define SYS_rdglob 70
|
||||
#define SYS_wrglob 71
|
||||
/* 71 is unused 4.3: mmap */
|
||||
#define SYS_msec 72 /* 72 is unused 4.3: vadvise */
|
||||
/* 72 is unused 4.3: vadvise */
|
||||
/* 73 is unused 4.3: munmap */
|
||||
/* 74 is unused 4.3: mprotect */
|
||||
/* 75 is unused 4.3: madvise */
|
||||
|
||||
@@ -2,9 +2,13 @@
|
||||
#define _TERM_H
|
||||
|
||||
extern int tgetent(char *, char *);
|
||||
extern int tnchktc();
|
||||
extern int tnamatch(char *);
|
||||
extern char *tskip(register char *);
|
||||
extern int tgetnum(char *);
|
||||
extern int tgetflag(char *);
|
||||
extern char *tgetstr(char *, char **);
|
||||
extern char *tdecode(register char *, char **);
|
||||
extern char *tgoto(char *, int, int);
|
||||
extern int tputs(register char *, int, int (*)());
|
||||
|
||||
|
||||
@@ -18,5 +18,5 @@ struct ttyent { /* see getttyent(3) */
|
||||
|
||||
struct ttyent *getttyent (void);
|
||||
struct ttyent *getttynam (const char *name);
|
||||
void setttyent (void);
|
||||
void endttyent (void);
|
||||
int setttyent (void);
|
||||
int endttyent (void);
|
||||
|
||||
@@ -97,4 +97,4 @@ struct tzhead {
|
||||
** that will probably do.
|
||||
*/
|
||||
|
||||
#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
|
||||
#define isleap(y) (((y) % 4) == 0 && ((y) % 100) != 0 || ((y) % 400) == 0)
|
||||
|
||||
@@ -94,7 +94,6 @@ void setusershell();
|
||||
void sync();
|
||||
unsigned int ualarm();
|
||||
void usleep();
|
||||
int pause (void);
|
||||
pid_t vfork();
|
||||
|
||||
int pipe (int pipefd[2]);
|
||||
@@ -108,18 +107,11 @@ int chown (const char *path, uid_t owner, gid_t group);
|
||||
int nice (int inc);
|
||||
int setuid (uid_t uid);
|
||||
int setgid (gid_t gid);
|
||||
int seteuid (uid_t euid);
|
||||
int setegid (gid_t egid);
|
||||
int setreuid (uid_t ruid, uid_t euid);
|
||||
int setregid (gid_t rgid, gid_t egid);
|
||||
int isatty (int fd);
|
||||
int chdir (const char *path);
|
||||
int fchdir (int fd);
|
||||
int chflags (const char *path, u_long flags);
|
||||
int fchflags (int fd, u_long flags);
|
||||
int getgroups (int size, gid_t list[]);
|
||||
int getdtablesize (void);
|
||||
int rmdir (const char *pathname);
|
||||
|
||||
struct stat;
|
||||
int stat (const char *path, struct stat *buf);
|
||||
@@ -143,12 +135,7 @@ extern char *optarg; /* getopt(3) external variables */
|
||||
extern int opterr, optind, optopt;
|
||||
|
||||
#ifndef _VA_LIST_
|
||||
# ifdef __GNUC__
|
||||
# define va_list __builtin_va_list /* For Gnu C */
|
||||
# endif
|
||||
# ifdef __SMALLER_C__
|
||||
# define va_list char * /* For Smaller C */
|
||||
# endif
|
||||
#define va_list __builtin_va_list /* For GCC */
|
||||
#endif
|
||||
|
||||
void err (int eval, const char *fmt, ...);
|
||||
@@ -161,6 +148,6 @@ void vwarn (const char *fmt, va_list ap);
|
||||
void vwarnx (const char *fmt, va_list ap);
|
||||
|
||||
#ifndef _VA_LIST_
|
||||
# undef va_list
|
||||
#undef va_list
|
||||
#endif
|
||||
#endif /* !_UNISTD_H_ */
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "w5100.h"
|
||||
|
||||
extern unsigned _socket_port [MAX_SOCK_NUM];
|
||||
extern uint16_t _socket_port [MAX_SOCK_NUM];
|
||||
|
||||
/*
|
||||
* Opens a socket(TCP or UDP or IP_RAW mode)
|
||||
|
||||
@@ -62,13 +62,13 @@ void udp_stop (udp_t *u);
|
||||
/*
|
||||
* Send a packet to specified peer.
|
||||
*/
|
||||
unsigned udp_send_packet (udp_t *u, const uint8_t *data, unsigned len,
|
||||
uint16_t udp_send_packet (udp_t *u, const uint8_t *data, unsigned len,
|
||||
uint8_t *ip, unsigned port);
|
||||
|
||||
/*
|
||||
* Send a zero-terminated string to specified peer.
|
||||
*/
|
||||
unsigned udp_send_string (udp_t *u, const char *data,
|
||||
uint16_t udp_send_string (udp_t *u, const char *data,
|
||||
uint8_t *ip, unsigned port);
|
||||
|
||||
/*
|
||||
|
||||
14
lib/.gitignore
vendored
14
lib/.gitignore
vendored
@@ -1,14 +0,0 @@
|
||||
a.out.h
|
||||
aout
|
||||
ar
|
||||
ar.h
|
||||
as
|
||||
ld
|
||||
nlist.h
|
||||
nm
|
||||
ranlib
|
||||
ranlib.h
|
||||
retroImage
|
||||
size
|
||||
strip
|
||||
gccdump.s
|
||||
66
lib/Makefile
66
lib/Makefile
@@ -1,66 +0,0 @@
|
||||
TOPSRC = $(shell cd ..; pwd)
|
||||
SUBDIR = startup libc libcurses libtermlib libwiznet
|
||||
PROG = ar as aout ld nm ranlib size strip
|
||||
|
||||
# Build a list of the host include directories.
|
||||
CPP = $(shell gcc -print-prog-name=cc1)
|
||||
HOSTINC = $(addprefix -I,$(shell echo | $(CPP) -v 2>&1 | grep '^ /.*include'))
|
||||
|
||||
# Add system include path
|
||||
ifeq (,$(wildcard /usr/include/i386-linux-gnu))
|
||||
HOSTINC += -I/usr/include
|
||||
else
|
||||
HOSTINC += -I/usr/include/i386-linux-gnu
|
||||
endif
|
||||
|
||||
CFLAGS += -nostdinc -fno-builtin -g -Werror -Wall -DCROSS -I. $(HOSTINC) \
|
||||
-I$(TOPSRC)/include -I$(TOPSRC)/src/cmd/ar \
|
||||
-I$(TOPSRC)/src/cmd/as
|
||||
LDFLAGS += -g
|
||||
|
||||
AR_OBJS = ar.o append.o archive.o contents.o delete.o extract.o \
|
||||
misc.o move.o print.o replace.o strmode.o
|
||||
AOUT_OBJS = aout.o mips-dis.o
|
||||
RANLIB_OBJS = ranlib.o archive.o
|
||||
HEADERS = a.out.h ar.h nlist.h ranlib.h
|
||||
|
||||
vpath %.c $(TOPSRC)/src/cmd/aout $(TOPSRC)/src/cmd/ar $(TOPSRC)/src/cmd/as \
|
||||
$(TOPSRC)/src/cmd/ld $(TOPSRC)/src/cmd/nm $(TOPSRC)/src/cmd/ranlib \
|
||||
$(TOPSRC)/src/cmd
|
||||
|
||||
all install depend: $(HEADERS) $(SUBDIR) $(PROG)
|
||||
-for i in $(SUBDIR); do $(MAKE) -C $$i $(MFLAGS) DESTDIR=$(DESTDIR) $@; done
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o *.a *.h $(PROG) retroImage gccdump.s
|
||||
for i in $(SUBDIR); do $(MAKE) -C $$i $(MFLAGS) clean; done
|
||||
|
||||
ar: $(AR_OBJS)
|
||||
$(CC) $(LDFLAGS) -o $@ $(AR_OBJS) $(LIBS)
|
||||
|
||||
as: as.o
|
||||
$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
|
||||
|
||||
aout: $(AOUT_OBJS)
|
||||
$(CC) $(LDFLAGS) -o $@ $(AOUT_OBJS) $(LIBS)
|
||||
|
||||
ld: ld.o
|
||||
$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
|
||||
|
||||
nm: nm.o
|
||||
$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
|
||||
|
||||
ranlib: $(RANLIB_OBJS)
|
||||
$(CC) $(LDFLAGS) -o $@ $(RANLIB_OBJS) $(LIBS)
|
||||
|
||||
size: size.o
|
||||
$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
|
||||
|
||||
strip: strip.o
|
||||
$(CC) $(LDFLAGS) -o $@ $< $(LIBS)
|
||||
|
||||
$(HEADERS):
|
||||
-ln -s -f ../include/a.out.h .
|
||||
-ln -s -f ../include/ar.h .
|
||||
-ln -s -f ../include/nlist.h .
|
||||
-ln -s -f ../include/ranlib.h .
|
||||
@@ -1,111 +0,0 @@
|
||||
TOPSRC = $(shell cd ../..; pwd)
|
||||
include $(TOPSRC)/target.mk
|
||||
|
||||
LIBCDIR = $(TOPSRC)/src/libc
|
||||
vpath %.S $(LIBCDIR)/mips/sys $(LIBCDIR)/mips/string $(LIBCDIR)/mips/gen \
|
||||
$(LIBCDIR)/runtime
|
||||
vpath %.c $(LIBCDIR)/mips/sys $(LIBCDIR)/gen $(LIBCDIR)/stdio \
|
||||
$(LIBCDIR)/stdlib $(LIBCDIR)/string $(LIBCDIR)/inet \
|
||||
$(LIBCDIR)/compat $(LIBCDIR)/runtime
|
||||
|
||||
CFLAGS += -B$(TOPSRC)/lib/ $(DEFS) -Wa,-x -Wall -Werror
|
||||
ASFLAGS += -B$(TOPSRC)/lib/ $(DEFS) -Wa,-x -I$(LIBCDIR)/mips/sys
|
||||
|
||||
# modules which can not use SYSCALL and must be assembled from sources. The
|
||||
# rest of the system calls are generated with printf(1) and do not have
|
||||
# source files associated with them.
|
||||
|
||||
# libc/mips/sys
|
||||
SYSOBJS = __sysctl.o accept.o access.o adjtime.o bind.o chdir.o \
|
||||
chflags.o chmod.o chown.o chroot.o close.o connect.o dup.o \
|
||||
dup2.o execve.o fchdir.o fchflags.o fchmod.o fchown.o \
|
||||
fcntl.o flock.o fork.o fstat.o fsync.o ftruncate.o \
|
||||
getdtablesize.o getgroups.o getitimer.o getsockname.o \
|
||||
getpeername.o getpriority.o getrlimit.o getrusage.o \
|
||||
getsockopt.o gettimeofday.o ioctl.o kill.o killpg.o link.o \
|
||||
listen.o lstat.o mkdir.o mknod.o mount.o open.o pselect.o \
|
||||
quota.o read.o readlink.o readv.o reboot.o recv.o \
|
||||
recvfrom.o recvmsg.o rename.o rmdir.o select.o send.o \
|
||||
sendmsg.o sendto.o setgroups.o setitimer.o setpgrp.o \
|
||||
setpriority.o setquota.o setuid.o seteuid.o setgid.o \
|
||||
setegid.o setrlimit.o setsockopt.o settimeofday.o \
|
||||
shutdown.o sigaltstack.o socket.o socketpair.o stat.o \
|
||||
symlink.o sigprocmask.o sigstack.o sigwait.o statfs.o \
|
||||
fstatfs.o getfsstat.o truncate.o umount.o unlink.o \
|
||||
utimes.o wait4.o write.o writev.o lseek.o sigsuspend.o \
|
||||
getgid.o getegid.o getpgrp.o getpid.o getppid.o getuid.o \
|
||||
geteuid.o profil.o sigpending.o sync.o ufetch.o ustore.o \
|
||||
ucall.o umask.o vfork.o vhangup.o rdglob.o wrglob.o
|
||||
|
||||
OBJS = $(SYSOBJS) sbrk.o execl.o execle.o execv.o \
|
||||
_exit.o _brk.o pipe.o ptrace.o sigaction.o
|
||||
|
||||
# libc/mips/string
|
||||
ASFLAGS += -DLWHI=lwr -DLWLO=lwl -DSWHI=swr -DSWLO=swl
|
||||
OBJS += bcopy.o bzero.o ffs.o memcpy.o memmove.o memset.o \
|
||||
strlen.o bcmp.o index.o rindex.o strcmp.o
|
||||
|
||||
# libc/mips/gen
|
||||
OBJS += _setjmp.o htonl.o htons.o
|
||||
|
||||
# libc/gen
|
||||
OBJS += abort.o alarm.o atof.o atoi.o atol.o calloc.o closedir.o crypt.o \
|
||||
ctime.o ctype_.o daemon.o devname.o ecvt.o err.o \
|
||||
execvp.o fakcu.o frexp.o fstab.o gcvt.o getenv.o getgrent.o \
|
||||
getgrgid.o getgrnam.o getlogin.o \
|
||||
getgrouplist.o gethostname.o getpagesize.o \
|
||||
getpass.o getpwent.o getloadavg.o getmntinfo.o \
|
||||
getttyent.o getttynam.o getusershell.o getwd.o \
|
||||
initgroups.o isatty.o isinff.o isnanf.o ldexp.o malloc.o mktemp.o \
|
||||
modff.o ndbm.o nlist.o knlist.o opendir.o perror.o popen.o \
|
||||
psignal.o qsort.o random.o readdir.o regex.o scandir.o \
|
||||
seekdir.o setmode.o sethostname.o setenv.o siglist.o \
|
||||
signal.o siginterrupt.o sigsetops.o \
|
||||
sleep.o strcasecmp.o strftime.o swab.o sysctl.o syslog.o system.o \
|
||||
strcat.o strncat.o strcpy.o strncpy.o strncmp.o \
|
||||
telldir.o time.o timezone.o ttyname.o ttyslot.o ualarm.o usleep.o \
|
||||
strdup.o uname.o wait.o wait3.o waitpid.o
|
||||
|
||||
# libc/stdio
|
||||
OBJS += fgetc.o fgets.o fputc.o fputs.o gets.o puts.o \
|
||||
clrerr.o doscan.o exit.o fdopen.o filbuf.o findiop.o \
|
||||
flsbuf.o fopen.o fprintf.o fread.o freopen.o fseek.o \
|
||||
ftell.o fwrite.o getchar.o getw.o printf.o putchar.o putw.o \
|
||||
rew.o scanf.o setbuf.o setbuffer.o setvbuf.o snprintf.o sprintf.o \
|
||||
strout.o ungetc.o vfprintf.o vprintf.o vsprintf.o doprnt.o \
|
||||
remove.o feof.o ferror.o fileno.o
|
||||
|
||||
# libc/stdlib
|
||||
OBJS += getopt.o getsubopt.o strtol.o strtoul.o strtod.o
|
||||
|
||||
# libc/string
|
||||
OBJS += strcspn.o strpbrk.o strerror.o strsep.o strspn.o \
|
||||
strstr.o strtok.o strtok_r.o
|
||||
|
||||
# libc/inet
|
||||
OBJS += inet_addr.o inet_network.o inet_netof.o \
|
||||
inet_ntoa.o inet_lnaof.o inet_maddr.o
|
||||
|
||||
# libc/compat
|
||||
OBJS += creat.o ftime.o gethostid.o gtty.o memccpy.o memchr.o \
|
||||
memcmp.o memcpy.o memset.o nice.o pause.o rand.o \
|
||||
sethostid.o setregid.o setreuid.o setrgid.o setruid.o \
|
||||
sigcompat.o strchr.o strrchr.o stty.o times.o tmpnam.o \
|
||||
utime.o
|
||||
|
||||
# libc/runtime
|
||||
OBJS += addsf3.o comparesf2.o divsf3.o fixsfsi.o floatsisf.o \
|
||||
mulsf3.o negsf2.o subsf3.o sc_case.o
|
||||
|
||||
all: ../libc.a
|
||||
|
||||
../libc.a: ../ar ../ranlib $(OBJS)
|
||||
../ar rc $@ $(OBJS)
|
||||
../ranlib $@
|
||||
|
||||
$(SYSOBJS): $(LIBCDIR)/mips/sys/SYS.h
|
||||
@echo creating $*.o
|
||||
@printf '#include "SYS.h"\nSYS($*)\n' | $(AS) $(ASFLAGS) - -c -o $*.o
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o a.out *.a
|
||||
@@ -1,22 +0,0 @@
|
||||
TOPSRC = $(shell cd ../..; pwd)
|
||||
include $(TOPSRC)/target.mk
|
||||
|
||||
vpath %.c $(TOPSRC)/src/libcurses
|
||||
|
||||
CFLAGS += -B$(TOPSRC)/lib/ $(DEFS) -Wa,-x -Wall -Werror
|
||||
|
||||
OBJS = addch.o addstr.o box.o clear.o clrtobot.o clrtoeol.o cr_put.o \
|
||||
cr_tty.o curses.o delch.o deleteln.o delwin.o endwin.o erase.o \
|
||||
fullname.o getch.o getstr.o idlok.o id_subwins.o initscr.o insch.o \
|
||||
insertln.o longname.o move.o mvprintw.o mvscanw.o mvwin.o newwin.o \
|
||||
overlay.o overwrite.o printw.o putchar.o refresh.o scanw.o scroll.o \
|
||||
toucholap.o standout.o touchwin.o tstp.o unctrl.o
|
||||
|
||||
all: ../libcurses.a
|
||||
|
||||
../libcurses.a: ../ar ../ranlib $(OBJS)
|
||||
../ar rc $@ $(OBJS)
|
||||
../ranlib $@
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o a.out *.a
|
||||
@@ -1,17 +0,0 @@
|
||||
TOPSRC = $(shell cd ../..; pwd)
|
||||
include $(TOPSRC)/target.mk
|
||||
|
||||
vpath %.c $(TOPSRC)/src/libtermlib
|
||||
|
||||
CFLAGS += -B$(TOPSRC)/lib/ $(DEFS) -Wa,-x -Wall -Werror
|
||||
|
||||
OBJS = termcap.o tgoto.o tputs.o tcattr.o
|
||||
|
||||
all: ../libtermlib.a
|
||||
|
||||
../libtermlib.a: ../ar ../ranlib $(OBJS)
|
||||
../ar rc $@ $(OBJS)
|
||||
../ranlib $@
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o a.out *.a
|
||||
@@ -1,17 +0,0 @@
|
||||
TOPSRC = $(shell cd ../..; pwd)
|
||||
include $(TOPSRC)/target.mk
|
||||
|
||||
vpath %.c $(TOPSRC)/src/libwiznet
|
||||
|
||||
CFLAGS += -B$(TOPSRC)/lib/ $(DEFS) -Wa,-x -Wall -Werror
|
||||
|
||||
OBJS = w5100.o socket.o ethernet.o client.o server.o udp.o
|
||||
|
||||
all: ../libwiznet.a
|
||||
|
||||
../libwiznet.a: ../ar ../ranlib $(OBJS)
|
||||
../ar rc $@ $(OBJS)
|
||||
../ranlib $@
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o a.out *.a
|
||||
@@ -1,22 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 1987 Regents of the University of California.
|
||||
# All rights reserved. The Berkeley software License Agreement
|
||||
# specifies the terms and conditions for redistribution.
|
||||
#
|
||||
# crt0 Normal C run time startoff
|
||||
#
|
||||
TOPSRC = $(shell cd ../..; pwd)
|
||||
include $(TOPSRC)/target.mk
|
||||
vpath %.c $(TOPSRC)/src/startup-mips
|
||||
|
||||
CFLAGS = -B$(TOPSRC)/lib/ -O -Wa,-x $(DEFS)
|
||||
|
||||
OBJS = ../crt0.o
|
||||
|
||||
all: $(OBJS)
|
||||
|
||||
../crt0.o: crt0.c
|
||||
$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS) *~
|
||||
1
libexec/.gitignore
vendored
1
libexec/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
*
|
||||
862
rootfs.manifest
862
rootfs.manifest
@@ -1,862 +0,0 @@
|
||||
#
|
||||
# Manifest file for RetroBSD root filesystem.
|
||||
#
|
||||
default
|
||||
owner 0
|
||||
group 0
|
||||
dirmode 0775
|
||||
filemode 0664
|
||||
|
||||
#
|
||||
# Directories.
|
||||
#
|
||||
dir /bin
|
||||
dir /dev
|
||||
dir /etc
|
||||
dir /lib
|
||||
dir /libexec
|
||||
dir /sbin
|
||||
dir /tmp
|
||||
dir /u
|
||||
|
||||
#
|
||||
# Character devices.
|
||||
#
|
||||
cdev /dev/console
|
||||
major 0
|
||||
minor 0
|
||||
cdev /dev/mem
|
||||
major 1
|
||||
minor 0
|
||||
cdev /dev/kmem
|
||||
major 1
|
||||
minor 1
|
||||
cdev /dev/null
|
||||
major 1
|
||||
minor 2
|
||||
mode 666
|
||||
cdev /dev/zero
|
||||
major 1
|
||||
minor 3
|
||||
mode 666
|
||||
cdev /dev/tty
|
||||
major 2
|
||||
minor 0
|
||||
mode 666
|
||||
cdev /dev/stdin
|
||||
major 3
|
||||
minor 0
|
||||
cdev /dev/stdout
|
||||
major 3
|
||||
minor 1
|
||||
cdev /dev/stderr
|
||||
major 3
|
||||
minor 2
|
||||
cdev /dev/temp0
|
||||
major 4
|
||||
minor 0
|
||||
cdev /dev/temp1
|
||||
major 4
|
||||
minor 1
|
||||
cdev /dev/temp2
|
||||
major 4
|
||||
minor 2
|
||||
|
||||
#
|
||||
# Block devices.
|
||||
#
|
||||
bdev /dev/rd0
|
||||
major 0
|
||||
minor 0
|
||||
bdev /dev/rd0a
|
||||
major 0
|
||||
minor 1
|
||||
bdev /dev/rd0b
|
||||
major 0
|
||||
minor 2
|
||||
bdev /dev/rd0c
|
||||
major 0
|
||||
minor 3
|
||||
bdev /dev/rd0d
|
||||
major 0
|
||||
minor 4
|
||||
bdev /dev/rd1
|
||||
major 1
|
||||
minor 0
|
||||
bdev /dev/rd1a
|
||||
major 1
|
||||
minor 1
|
||||
bdev /dev/rd1b
|
||||
major 1
|
||||
minor 2
|
||||
bdev /dev/rd1c
|
||||
major 1
|
||||
minor 3
|
||||
bdev /dev/rd1d
|
||||
major 1
|
||||
minor 4
|
||||
bdev /dev/rd2
|
||||
major 2
|
||||
minor 0
|
||||
bdev /dev/rd2a
|
||||
major 2
|
||||
minor 1
|
||||
bdev /dev/rd2b
|
||||
major 2
|
||||
minor 2
|
||||
bdev /dev/rd2c
|
||||
major 2
|
||||
minor 3
|
||||
bdev /dev/rd2d
|
||||
major 2
|
||||
minor 4
|
||||
bdev /dev/rd3
|
||||
major 3
|
||||
minor 0
|
||||
bdev /dev/rd3a
|
||||
major 3
|
||||
minor 1
|
||||
bdev /dev/rd3b
|
||||
major 3
|
||||
minor 2
|
||||
bdev /dev/rd3c
|
||||
major 3
|
||||
minor 3
|
||||
bdev /dev/rd3d
|
||||
major 3
|
||||
minor 4
|
||||
bdev /dev/swap
|
||||
major 4
|
||||
minor 64
|
||||
bdev /dev/swap0
|
||||
major 4
|
||||
minor 0
|
||||
bdev /dev/swap1
|
||||
major 4
|
||||
minor 1
|
||||
bdev /dev/swap2
|
||||
major 4
|
||||
minor 2
|
||||
|
||||
#
|
||||
# Files: /
|
||||
#
|
||||
file /.profile
|
||||
|
||||
#
|
||||
# Files: /etc
|
||||
#
|
||||
file /etc/fstab
|
||||
file /etc/gettytab
|
||||
file /etc/group
|
||||
file /etc/MAKEDEV
|
||||
mode 0775
|
||||
file /etc/motd
|
||||
file /etc/passwd
|
||||
file /etc/phones
|
||||
file /etc/rc
|
||||
mode 0775
|
||||
file /etc/rc.local
|
||||
mode 0775
|
||||
file /etc/remote
|
||||
file /etc/shadow
|
||||
file /etc/shells
|
||||
file /etc/termcap
|
||||
mode 0444
|
||||
file /etc/ttys
|
||||
|
||||
#
|
||||
# Files: /bin
|
||||
#
|
||||
default
|
||||
filemode 0775
|
||||
file /bin/adb
|
||||
file /bin/adc-demo
|
||||
file /bin/aout
|
||||
file /bin/apropos
|
||||
file /bin/ar
|
||||
file /bin/as
|
||||
file /bin/awk
|
||||
file /bin/basename
|
||||
file /bin/basic
|
||||
file /bin/bc
|
||||
file /bin/cal
|
||||
file /bin/cat
|
||||
file /bin/cb
|
||||
file /bin/cc
|
||||
file /bin/chat-server
|
||||
file /bin/chflags
|
||||
file /bin/chgrp
|
||||
file /bin/chmod
|
||||
file /bin/chpass
|
||||
mode 04755
|
||||
file /bin/cmp
|
||||
file /bin/col
|
||||
file /bin/comm
|
||||
file /bin/compress
|
||||
file /bin/cp
|
||||
file /bin/cpp
|
||||
file /bin/crontab
|
||||
file /bin/date
|
||||
file /bin/dc
|
||||
file /bin/dd
|
||||
file /bin/df
|
||||
mode 02755
|
||||
file /bin/diff
|
||||
file /bin/diskspeed
|
||||
file /bin/du
|
||||
file /bin/echo
|
||||
file /bin/ed
|
||||
file /bin/egrep
|
||||
file /bin/emg
|
||||
file /bin/env
|
||||
file /bin/expr
|
||||
file /bin/false
|
||||
file /bin/fgrep
|
||||
file /bin/file
|
||||
file /bin/find
|
||||
file /bin/forth
|
||||
file /bin/fstat
|
||||
mode 02755
|
||||
file /bin/glcdtest
|
||||
file /bin/globdump
|
||||
file /bin/globread
|
||||
file /bin/globwrite
|
||||
file /bin/grep
|
||||
file /bin/groups
|
||||
file /bin/head
|
||||
file /bin/hostid
|
||||
file /bin/hostname
|
||||
file /bin/id
|
||||
file /bin/iostat
|
||||
mode 02755
|
||||
file /bin/join
|
||||
file /bin/kill
|
||||
file /bin/la
|
||||
file /bin/last
|
||||
file /bin/lcc
|
||||
file /bin/lcpp
|
||||
file /bin/ld
|
||||
file /bin/ln
|
||||
file /bin/login
|
||||
mode 04755
|
||||
file /bin/lol
|
||||
file /bin/ls
|
||||
file /bin/mail
|
||||
mode 04755
|
||||
file /bin/make
|
||||
file /bin/man
|
||||
file /bin/med
|
||||
file /bin/mesg
|
||||
file /bin/mkdir
|
||||
file /bin/more
|
||||
file /bin/msec
|
||||
file /bin/mv
|
||||
file /bin/nice
|
||||
file /bin/nm
|
||||
file /bin/nohup
|
||||
file /bin/ntpdate
|
||||
file /bin/od
|
||||
file /bin/pagesize
|
||||
file /bin/passwd
|
||||
mode 04755
|
||||
file /bin/picoc
|
||||
file /bin/portio
|
||||
file /bin/pr
|
||||
file /bin/printenv
|
||||
file /bin/printf
|
||||
file /bin/ps
|
||||
mode 02755
|
||||
file /bin/pwd
|
||||
file /bin/pwm
|
||||
file /bin/ranlib
|
||||
file /bin/re
|
||||
file /bin/renice
|
||||
file /bin/renumber
|
||||
file /bin/retroforth
|
||||
file /bin/rev
|
||||
file /bin/rm
|
||||
file /bin/rmail
|
||||
file /bin/rmdir
|
||||
file /bin/rz
|
||||
file /bin/scc
|
||||
file /bin/scm
|
||||
file /bin/sed
|
||||
file /bin/setty
|
||||
file /bin/sh
|
||||
file /bin/size
|
||||
file /bin/sl
|
||||
file /bin/sleep
|
||||
file /bin/smux
|
||||
file /bin/sort
|
||||
file /bin/split
|
||||
file /bin/strip
|
||||
file /bin/stty
|
||||
file /bin/su
|
||||
mode 04755
|
||||
file /bin/sum
|
||||
file /bin/sync
|
||||
file /bin/sysctl
|
||||
file /bin/sz
|
||||
file /bin/tail
|
||||
file /bin/tar
|
||||
file /bin/tee
|
||||
file /bin/telnet
|
||||
file /bin/test
|
||||
file /bin/time
|
||||
file /bin/tip
|
||||
file /bin/touch
|
||||
file /bin/tr
|
||||
file /bin/true
|
||||
file /bin/tsort
|
||||
file /bin/tty
|
||||
file /bin/uname
|
||||
file /bin/uncompress
|
||||
file /bin/uniq
|
||||
file /bin/uucico
|
||||
file /bin/uuclean
|
||||
file /bin/uucp
|
||||
file /bin/uudecode
|
||||
file /bin/uuencode
|
||||
file /bin/uulog
|
||||
file /bin/uuname
|
||||
file /bin/uupoll
|
||||
file /bin/uuq
|
||||
file /bin/uusend
|
||||
file /bin/uusnap
|
||||
file /bin/uux
|
||||
file /bin/uuxqt
|
||||
file /bin/vi
|
||||
file /bin/vmstat
|
||||
mode 02755
|
||||
file /bin/w
|
||||
file /bin/wall
|
||||
mode 02755
|
||||
file /bin/wc
|
||||
file /bin/web-client
|
||||
file /bin/web-server
|
||||
file /bin/whereis
|
||||
file /bin/who
|
||||
file /bin/whoami
|
||||
file /bin/write
|
||||
mode 02755
|
||||
file /bin/xargs
|
||||
file /bin/zcat
|
||||
|
||||
link /bin/[
|
||||
target /bin/test
|
||||
|
||||
link /bin/whatis
|
||||
target /bin/apropos
|
||||
|
||||
link /bin/chfn
|
||||
target /bin/chpass
|
||||
link /bin/chsh
|
||||
target /bin/chpass
|
||||
|
||||
link /bin/rb
|
||||
target /bin/rz
|
||||
link /bin/rx
|
||||
target /bin/rz
|
||||
|
||||
link /bin/sb
|
||||
target /bin/sz
|
||||
link /bin/sx
|
||||
target /bin/sz
|
||||
|
||||
#
|
||||
# Files: /sbin
|
||||
#
|
||||
file /sbin/chown
|
||||
file /sbin/chroot
|
||||
mode 04755
|
||||
file /sbin/cron
|
||||
file /sbin/devupdate
|
||||
file /sbin/disktool
|
||||
file /sbin/fdisk
|
||||
file /sbin/fsck
|
||||
file /sbin/init
|
||||
mode 0700
|
||||
file /sbin/mkfs
|
||||
file /sbin/mknod
|
||||
file /sbin/mkpasswd
|
||||
file /sbin/mount
|
||||
file /sbin/pstat
|
||||
mode 02755
|
||||
file /sbin/rdprof
|
||||
file /sbin/reboot
|
||||
file /sbin/shutdown
|
||||
mode 04750
|
||||
file /sbin/talloc
|
||||
file /sbin/umount
|
||||
file /sbin/update
|
||||
file /sbin/updatedb
|
||||
file /sbin/vipw
|
||||
|
||||
link /sbin/bootloader
|
||||
target /sbin/reboot
|
||||
link /sbin/fastboot
|
||||
target /sbin/reboot
|
||||
link /sbin/halt
|
||||
target /sbin/reboot
|
||||
link /sbin/poweroff
|
||||
target /sbin/reboot
|
||||
|
||||
#
|
||||
# Files: /games
|
||||
#
|
||||
default
|
||||
filemode 0775
|
||||
dir /games
|
||||
file /games/adventure
|
||||
file /games/arithmetic
|
||||
file /games/atc
|
||||
file /games/backgammon
|
||||
file /games/banner
|
||||
file /games/battlestar
|
||||
file /games/bcd
|
||||
file /games/boggle
|
||||
file /games/btlgammon
|
||||
file /games/canfield
|
||||
file /games/cfscores
|
||||
file /games/cribbage
|
||||
file /games/factor
|
||||
file /games/fish
|
||||
file /games/fortune
|
||||
file /games/hangman
|
||||
file /games/mille
|
||||
file /games/monop
|
||||
file /games/morse
|
||||
file /games/number
|
||||
file /games/ppt
|
||||
file /games/primes
|
||||
file /games/quiz
|
||||
file /games/rain
|
||||
file /games/robots
|
||||
file /games/rogue
|
||||
file /games/sail
|
||||
file /games/snake
|
||||
file /games/snscore
|
||||
file /games/teachgammon
|
||||
file /games/trek
|
||||
file /games/worm
|
||||
file /games/worms
|
||||
file /games/wump
|
||||
|
||||
#
|
||||
# Files: /games/lib
|
||||
#
|
||||
default
|
||||
filemode 0444
|
||||
dir /games/lib
|
||||
file /games/lib/adventure.dat
|
||||
file /games/lib/battle_strings
|
||||
file /games/lib/backrules
|
||||
file /games/lib/bogdict
|
||||
file /games/lib/cfscores
|
||||
file /games/lib/crib.instr
|
||||
mode 0666
|
||||
file /games/lib/fortunes.dat
|
||||
file /games/lib/cards.pck
|
||||
file /games/lib/robots_roll
|
||||
mode 0666
|
||||
file /games/lib/snakerawscores
|
||||
mode 0666
|
||||
dir /games/lib/atc
|
||||
file /games/lib/atc/ATC_scores
|
||||
file /games/lib/atc/crossover
|
||||
file /games/lib/atc/default
|
||||
file /games/lib/atc/easy
|
||||
file /games/lib/atc/game_2
|
||||
file /games/lib/atc/Game_List
|
||||
file /games/lib/atc/Killer
|
||||
dir /games/lib/quiz.k
|
||||
file /games/lib/quiz.k/africa
|
||||
file /games/lib/quiz.k/america
|
||||
file /games/lib/quiz.k/areas
|
||||
file /games/lib/quiz.k/arith
|
||||
file /games/lib/quiz.k/asia
|
||||
file /games/lib/quiz.k/babies
|
||||
file /games/lib/quiz.k/bard
|
||||
file /games/lib/quiz.k/chinese
|
||||
file /games/lib/quiz.k/collectives
|
||||
file /games/lib/quiz.k/ed
|
||||
file /games/lib/quiz.k/elements
|
||||
file /games/lib/quiz.k/europe
|
||||
file /games/lib/quiz.k/greek
|
||||
file /games/lib/quiz.k/inca
|
||||
file /games/lib/quiz.k/index
|
||||
file /games/lib/quiz.k/latin
|
||||
file /games/lib/quiz.k/locomotive
|
||||
file /games/lib/quiz.k/midearth
|
||||
file /games/lib/quiz.k/morse
|
||||
file /games/lib/quiz.k/murders
|
||||
file /games/lib/quiz.k/poetry
|
||||
file /games/lib/quiz.k/posneg
|
||||
file /games/lib/quiz.k/pres
|
||||
file /games/lib/quiz.k/province
|
||||
file /games/lib/quiz.k/seq-easy
|
||||
file /games/lib/quiz.k/seq-hard
|
||||
file /games/lib/quiz.k/sexes
|
||||
file /games/lib/quiz.k/sov
|
||||
file /games/lib/quiz.k/spell
|
||||
file /games/lib/quiz.k/state
|
||||
file /games/lib/quiz.k/trek
|
||||
file /games/lib/quiz.k/ucc
|
||||
|
||||
#
|
||||
# Files: /include
|
||||
#
|
||||
default
|
||||
filemode 0664
|
||||
dir /include
|
||||
dir /include/arpa
|
||||
dir /include/machine
|
||||
dir /include/smallc
|
||||
dir /include/smallc/sys
|
||||
dir /include/sys
|
||||
file /include/alloca.h
|
||||
file /include/a.out.h
|
||||
file /include/ar.h
|
||||
file /include/arpa/inet.h
|
||||
file /include/assert.h
|
||||
file /include/ctype.h
|
||||
file /include/curses.h
|
||||
file /include/dbm.h
|
||||
file /include/fcntl.h
|
||||
file /include/float.h
|
||||
file /include/fstab.h
|
||||
file /include/grp.h
|
||||
file /include/kmem.h
|
||||
file /include/lastlog.h
|
||||
file /include/limits.h
|
||||
file /include/machine/cpu.h
|
||||
file /include/machine/elf_machdep.h
|
||||
file /include/machine/float.h
|
||||
file /include/machine/io.h
|
||||
file /include/machine/limits.h
|
||||
file /include/machine/machparam.h
|
||||
file /include/machine/pic32mx.h
|
||||
file /include/machine/rd_sdramp_config.h
|
||||
file /include/machine/sdram.h
|
||||
file /include/machine/ssd1926.h
|
||||
file /include/machine/usb_ch9.h
|
||||
file /include/machine/usb_device.h
|
||||
file /include/machine/usb_function_cdc.h
|
||||
file /include/machine/usb_function_hid.h
|
||||
file /include/machine/usb_hal_pic32.h
|
||||
file /include/math.h
|
||||
file /include/mtab.h
|
||||
file /include/ndbm.h
|
||||
file /include/nlist.h
|
||||
file /include/paths.h
|
||||
file /include/pcc.h
|
||||
file /include/psout.h
|
||||
file /include/pwd.h
|
||||
file /include/ranlib.h
|
||||
file /include/regexp.h
|
||||
file /include/setjmp.h
|
||||
file /include/sgtty.h
|
||||
file /include/smallc/curses.h
|
||||
file /include/smallc/fcntl.h
|
||||
file /include/smallc/signal.h
|
||||
file /include/smallc/stdio.h
|
||||
file /include/smallc/sys/gpio.h
|
||||
file /include/smallc/sys/spi.h
|
||||
file /include/smallc/wiznet.h
|
||||
file /include/stab.h
|
||||
file /include/stdarg.h
|
||||
file /include/stddef.h
|
||||
file /include/stdint.h
|
||||
file /include/stdio.h
|
||||
file /include/stdlib.h
|
||||
file /include/string.h
|
||||
file /include/strings.h
|
||||
file /include/struct.h
|
||||
file /include/sys/adc.h
|
||||
file /include/sys/buf.h
|
||||
file /include/syscall.h
|
||||
file /include/sys/callout.h
|
||||
file /include/sys/clist.h
|
||||
file /include/sys/conf.h
|
||||
file /include/sys/debug.h
|
||||
file /include/sys/dir.h
|
||||
file /include/sys/disk.h
|
||||
file /include/sys/dkbad.h
|
||||
file /include/sys/dk.h
|
||||
file /include/sys/errno.h
|
||||
file /include/sys/exec_aout.h
|
||||
file /include/sys/exec_elf.h
|
||||
file /include/sys/exec.h
|
||||
file /include/sysexits.h
|
||||
file /include/sys/fcntl.h
|
||||
file /include/sys/file.h
|
||||
file /include/sys/fs.h
|
||||
file /include/sys/glcd.h
|
||||
file /include/sys/glob.h
|
||||
file /include/sys/gpio.h
|
||||
file /include/sys/inode.h
|
||||
file /include/sys/ioctl.h
|
||||
file /include/sys/kernel.h
|
||||
file /include/sys/map.h
|
||||
file /include/sys/mount.h
|
||||
file /include/sys/msgbuf.h
|
||||
file /include/sys/mtio.h
|
||||
file /include/sys/namei.h
|
||||
file /include/sys/oc.h
|
||||
file /include/sys/param.h
|
||||
file /include/sys/picga.h
|
||||
file /include/sys/proc.h
|
||||
file /include/sys/ptrace.h
|
||||
file /include/sys/pty.h
|
||||
file /include/sys/rd_flash.h
|
||||
file /include/sys/rdisk.h
|
||||
file /include/sys/rd_mrams.h
|
||||
file /include/sys/rd_sdramp.h
|
||||
file /include/sys/rd_sramc.h
|
||||
file /include/sys/reboot.h
|
||||
file /include/sys/resource.h
|
||||
file /include/sys/select.h
|
||||
file /include/sys/signal.h
|
||||
file /include/sys/signalvar.h
|
||||
file /include/sys/spi_bus.h
|
||||
file /include/sys/spi.h
|
||||
file /include/sys/stat.h
|
||||
file /include/sys/swap.h
|
||||
file /include/sys/sysctl.h
|
||||
file /include/sys/syslog.h
|
||||
file /include/sys/systm.h
|
||||
file /include/sys/time.h
|
||||
file /include/sys/times.h
|
||||
file /include/sys/trace.h
|
||||
file /include/sys/ttychars.h
|
||||
file /include/sys/ttydev.h
|
||||
file /include/sys/tty.h
|
||||
file /include/sys/types.h
|
||||
file /include/sys/uart.h
|
||||
file /include/sys/uio.h
|
||||
file /include/sys/usb_uart.h
|
||||
file /include/sys/user.h
|
||||
file /include/sys/utsname.h
|
||||
file /include/sys/vm.h
|
||||
file /include/sys/vmmac.h
|
||||
file /include/sys/vmmeter.h
|
||||
file /include/sys/vmparam.h
|
||||
file /include/sys/vmsystm.h
|
||||
file /include/sys/wait.h
|
||||
file /include/term.h
|
||||
file /include/termios-todo.h
|
||||
file /include/time.h
|
||||
file /include/ttyent.h
|
||||
file /include/tzfile.h
|
||||
file /include/unistd.h
|
||||
file /include/utmp.h
|
||||
file /include/vmf.h
|
||||
|
||||
symlink /include/errno.h
|
||||
target sys/errno.h
|
||||
|
||||
symlink /include/signal.h
|
||||
target sys/signal.h
|
||||
|
||||
symlink /include/syslog.h
|
||||
target sys/syslog.h
|
||||
|
||||
#
|
||||
# Files: /lib
|
||||
#
|
||||
file /lib/crt0.o
|
||||
file /lib/libc.a
|
||||
file /lib/libcurses.a
|
||||
file /lib/libtermlib.a
|
||||
file /lib/libwiznet.a
|
||||
file /lib/retroImage
|
||||
|
||||
#
|
||||
# Files: /libexec
|
||||
#
|
||||
default
|
||||
filemode 0775
|
||||
file /libexec/bigram
|
||||
file /libexec/code
|
||||
file /libexec/diffh
|
||||
file /libexec/getty
|
||||
file /libexec/smallc
|
||||
file /libexec/smlrc
|
||||
|
||||
#
|
||||
# Files: /share
|
||||
#
|
||||
default
|
||||
filemode 0444
|
||||
dir /share
|
||||
dir /share/dict
|
||||
dir /share/misc
|
||||
file /share/emg.keys
|
||||
file /share/re.help
|
||||
file /share/dict/words
|
||||
file /share/misc/more.help
|
||||
|
||||
#
|
||||
# Files: /share/example
|
||||
#
|
||||
default
|
||||
filemode 0664
|
||||
dir /share/example
|
||||
file /share/example/ashello.S
|
||||
file /share/example/blkjack.bas
|
||||
file /share/example/chello.c
|
||||
file /share/example/echo.S
|
||||
file /share/example/fact.fth
|
||||
file /share/example/hilow.bas
|
||||
file /share/example/Makefile
|
||||
file /share/example/prime.scm
|
||||
file /share/example/skeleton.c
|
||||
file /share/example/stars.bas
|
||||
file /share/example/stdarg.c
|
||||
|
||||
#
|
||||
# Files: /share/smallc
|
||||
#
|
||||
dir /share/smallc
|
||||
file /share/smallc/adc.c
|
||||
file /share/smallc/gpio.c
|
||||
file /share/smallc/hello.c
|
||||
file /share/smallc/Makefile
|
||||
file /share/smallc/primelist.c
|
||||
file /share/smallc/primesum.c
|
||||
file /share/smallc/q8.c
|
||||
file /share/smallc/rain.c
|
||||
file /share/smallc/test1.c
|
||||
file /share/smallc/test2.c
|
||||
file /share/smallc/test3.c
|
||||
file /share/smallc/webserver.c
|
||||
|
||||
#
|
||||
# Files: /share/smallerc
|
||||
#
|
||||
dir /share/smallerc
|
||||
file /share/smallerc/adc.c
|
||||
file /share/smallerc/gpio.c
|
||||
file /share/smallerc/hello.c
|
||||
file /share/smallerc/Makefile
|
||||
file /share/smallerc/primelist.c
|
||||
file /share/smallerc/primesum.c
|
||||
file /share/smallerc/q8.c
|
||||
file /share/smallerc/rain.c
|
||||
file /share/smallerc/test1.c
|
||||
file /share/smallerc/test2.c
|
||||
file /share/smallerc/test3.c
|
||||
|
||||
#
|
||||
# Files: /var
|
||||
#
|
||||
dir /var
|
||||
dir /var/lock
|
||||
dir /var/log
|
||||
dir /var/run
|
||||
file /var/log/messages
|
||||
file /var/log/wtmp
|
||||
|
||||
#
|
||||
# Files: /share/man
|
||||
#
|
||||
dir /share/man
|
||||
dir /share/man/cat1
|
||||
dir /share/man/cat2
|
||||
dir /share/man/cat3
|
||||
dir /share/man/cat4
|
||||
dir /share/man/cat5
|
||||
dir /share/man/cat6
|
||||
dir /share/man/cat7
|
||||
dir /share/man/cat8
|
||||
file /share/man/cat1/ar.0
|
||||
file /share/man/cat1/chflags.0
|
||||
file /share/man/cat1/chpass.0
|
||||
file /share/man/cat1/cpp.0
|
||||
file /share/man/cat1/crontab.0
|
||||
file /share/man/cat1/emg.0
|
||||
file /share/man/cat1/groups.0
|
||||
file /share/man/cat1/hostname.0
|
||||
file /share/man/cat1/id.0
|
||||
file /share/man/cat1/la.0
|
||||
file /share/man/cat1/lcc.0
|
||||
file /share/man/cat1/ld.0
|
||||
file /share/man/cat1/passwd.0
|
||||
file /share/man/cat1/printf.0
|
||||
file /share/man/cat1/ranlib.0
|
||||
file /share/man/cat1/rz.0
|
||||
file /share/man/cat1/stty.0
|
||||
file /share/man/cat1/sz.0
|
||||
file /share/man/cat1/test.0
|
||||
file /share/man/cat1/uname.0
|
||||
file /share/man/cat1/whoami.0
|
||||
file /share/man/cat1/xargs.0
|
||||
file /share/man/cat3/vmf.0
|
||||
file /share/man/cat5/ar.0
|
||||
file /share/man/cat5/crontab.0
|
||||
file /share/man/cat5/ranlib.0
|
||||
file /share/man/cat6/adventure.0
|
||||
file /share/man/cat6/arithmetic.0
|
||||
file /share/man/cat6/atc.0
|
||||
file /share/man/cat6/backgammon.0
|
||||
file /share/man/cat6/banner.0
|
||||
file /share/man/cat6/battlestar.0
|
||||
file /share/man/cat6/bcd.0
|
||||
file /share/man/cat6/canfield.0
|
||||
file /share/man/cat6/cribbage.0
|
||||
file /share/man/cat6/fish.0
|
||||
file /share/man/cat6/fortune.0
|
||||
file /share/man/cat6/hangman.0
|
||||
file /share/man/cat6/mille.0
|
||||
file /share/man/cat6/monop.0
|
||||
file /share/man/cat6/number.0
|
||||
file /share/man/cat6/quiz.0
|
||||
file /share/man/cat6/rain.0
|
||||
file /share/man/cat6/robots.0
|
||||
file /share/man/cat6/rogue.0
|
||||
file /share/man/cat6/sail.0
|
||||
file /share/man/cat6/snake.0
|
||||
file /share/man/cat6/trek.0
|
||||
file /share/man/cat6/worm.0
|
||||
file /share/man/cat6/worms.0
|
||||
file /share/man/cat6/wump.0
|
||||
file /share/man/cat8/chown.0
|
||||
file /share/man/cat8/chroot.0
|
||||
file /share/man/cat8/cron.0
|
||||
file /share/man/cat8/fdisk.0
|
||||
file /share/man/cat8/fstat.0
|
||||
file /share/man/cat8/init.0
|
||||
file /share/man/cat8/mkfs.0
|
||||
file /share/man/cat8/mknod.0
|
||||
file /share/man/cat8/mkpasswd.0
|
||||
file /share/man/cat8/mount.0
|
||||
file /share/man/cat8/pstat.0
|
||||
file /share/man/cat8/reboot.0
|
||||
file /share/man/cat8/renice.0
|
||||
file /share/man/cat8/shutdown.0
|
||||
file /share/man/cat8/sysctl.0
|
||||
#file /share/man/cat8/talloc.0
|
||||
file /share/man/cat8/umount.0
|
||||
file /share/man/cat8/update.0
|
||||
file /share/man/cat8/vipw.0
|
||||
|
||||
link /share/man/cat1/rb.0
|
||||
target /share/man/cat1/rz.0
|
||||
link /share/man/cat1/rx.0
|
||||
target /share/man/cat1/rz.0
|
||||
|
||||
link /share/man/cat1/sb.0
|
||||
target /share/man/cat1/sz.0
|
||||
link /share/man/cat1/sx.0
|
||||
target /share/man/cat1/sz.0
|
||||
|
||||
link /share/man/cat8/fastboot.0
|
||||
target /share/man/cat8/reboot.0
|
||||
link /share/man/cat8/halt.0
|
||||
target /share/man/cat8/reboot.0
|
||||
|
||||
link /share/man/cat1/chfn.0
|
||||
target /share/man/cat1/chpass.0
|
||||
link /share/man/cat1/chsh.0
|
||||
target /share/man/cat1/chpass.0
|
||||
1
sbin/.gitignore
vendored
1
sbin/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
*
|
||||
4
share/.gitignore
vendored
4
share/.gitignore
vendored
@@ -1,4 +0,0 @@
|
||||
re.help
|
||||
misc
|
||||
unixbench
|
||||
emg.keys
|
||||
25486
share/dict/words
25486
share/dict/words
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
|
||||
all: ashello echo chello stdarg skeleton
|
||||
all: ashello echo
|
||||
|
||||
ashello: ashello.o
|
||||
$(LD) ashello.o -o $@
|
||||
@@ -10,11 +10,5 @@ chello: chello.o
|
||||
echo: echo.o
|
||||
$(LD) $@.o -o $@
|
||||
|
||||
stdarg: stdarg.o
|
||||
$(CC) stdarg.o -o $@
|
||||
|
||||
skeleton: skeleton.o
|
||||
$(CC) skeleton.o -o $@
|
||||
|
||||
clean:
|
||||
rm -f *.o ashello echo chello stdarg skeleton *.dis *~
|
||||
rm -f *.o ashello echo *.dis *~
|
||||
|
||||
@@ -5,13 +5,13 @@ CFLAGS += -Werror
|
||||
ASFLAGS += -DCROSS
|
||||
ASLDFLAGS = --oformat=elf32-tradlittlemips -N -nostartfiles -T $(TOPSRC)/src/elf32-mips.ld
|
||||
|
||||
all: chello cplus echo stdarg
|
||||
all: hello cplus
|
||||
|
||||
chello: chello.o
|
||||
${CC} ${LDFLAGS} -o chello.elf chello.o ${LIBS}
|
||||
${OBJDUMP} -S chello.elf > chello.dis
|
||||
${SIZE} chello.elf
|
||||
${ELF2AOUT} chello.elf $@
|
||||
hello: hello.o
|
||||
${CC} ${LDFLAGS} -o hello.elf hello.o ${LIBS}
|
||||
${OBJDUMP} -S hello.elf > hello.dis
|
||||
${SIZE} hello.elf
|
||||
${ELF2AOUT} hello.elf $@
|
||||
|
||||
cplus: cplus.o
|
||||
${CXX} ${LDFLAGS} -nostdlib -o cplus.elf cplus.o ${LIBS}
|
||||
@@ -24,6 +24,7 @@ echo: echo.o
|
||||
${OBJDUMP} -S $@.elf > $@.dis
|
||||
${SIZE} $@.elf
|
||||
${ELF2AOUT} $@.elf $@
|
||||
./aout $@ > $@.dis
|
||||
|
||||
clean:
|
||||
rm -f *.o *.elf ${MAN} chello cplus echo stdarg *.elf *.dis tags *~
|
||||
rm -f *.o *.elf ${MAN} hello cplus *.elf *.dis tags *~
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
printf ("Hello, C World!\n");
|
||||
return 0;
|
||||
printf ("Hello, C World!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
/*
|
||||
* Generic skeleton for a C program.
|
||||
* When you create your own program based on this skeleton,
|
||||
* you can replace the author's name and copyright with
|
||||
* whatever your want. When you redistribute this skeleton or
|
||||
* enhance it, please leave my name and copyright on it.
|
||||
*
|
||||
* Copyright (C) 1993-2014 Serge Vakulenko, <vak@cronyx.ru>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* and its documentation for any purpose and without fee is hereby
|
||||
* granted, provided that the above copyright notice appear in all
|
||||
* copies and that both that the copyright notice and this
|
||||
* permission notice and warranty disclaimer appear in supporting
|
||||
* documentation, and that the name of the author not be used in
|
||||
* advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* The author disclaim all warranties with regard to this
|
||||
* software, including all implied warranties of merchantability
|
||||
* and fitness. In no event shall the author be liable for any
|
||||
* special, indirect or consequential damages or any damages
|
||||
* whatsoever resulting from loss of use, data or profits, whether
|
||||
* in an action of contract, negligence or other tortious action,
|
||||
* arising out of or in connection with the use or performance of
|
||||
* this software.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
const char version[] = "1.0";
|
||||
const char copyright[] = "Copyright (C) 1993-2014 Serge Vakulenko";
|
||||
|
||||
char *progname; /* Name of the current program (argv[0]) */
|
||||
int verbose; /* Option -v */
|
||||
int trace; /* Option -t */
|
||||
int debug; /* Option -d */
|
||||
|
||||
void usage ()
|
||||
{
|
||||
fprintf (stderr, "Generic C skeleton, Version %s, %s\n", version, copyright);
|
||||
fprintf (stderr, "Usage:\n\t%s [-vtd] [-r count] file...\n", progname);
|
||||
fprintf (stderr, "Options:\n");
|
||||
fprintf (stderr, "\t-v\tverbose mode\n");
|
||||
fprintf (stderr, "\t-t\ttrace mode\n");
|
||||
fprintf (stderr, "\t-d\tdebug\n");
|
||||
fprintf (stderr, "\t-r #\trepeat count\n");
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
int count = 1; /* Option -r # */
|
||||
|
||||
progname = *argv;
|
||||
for (;;) {
|
||||
switch (getopt (argc, argv, "vtdr:")) {
|
||||
case EOF:
|
||||
break;
|
||||
case 'v':
|
||||
++verbose;
|
||||
continue;
|
||||
case 't':
|
||||
++trace;
|
||||
continue;
|
||||
case 'd':
|
||||
++debug;
|
||||
continue;
|
||||
case 'r':
|
||||
count = strtol (optarg, 0, 0);
|
||||
continue;
|
||||
default:
|
||||
usage ();
|
||||
}
|
||||
break;
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (argc < 1)
|
||||
usage ();
|
||||
|
||||
while (count-- > 0) {
|
||||
int i;
|
||||
|
||||
for (i=0; i<argc; ++i)
|
||||
printf ("%s ", argv[i]);
|
||||
printf ("\n");
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
void print(char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int d;
|
||||
char c, *s;
|
||||
|
||||
va_start(ap, fmt);
|
||||
while (*fmt) {
|
||||
switch (*fmt++) {
|
||||
case 's': /* string */
|
||||
s = va_arg(ap, char*);
|
||||
printf("string %s\n", s);
|
||||
break;
|
||||
case 'd': /* int */
|
||||
d = va_arg(ap, int);
|
||||
printf("int %d\n", d);
|
||||
break;
|
||||
case 'c': /* char */
|
||||
c = va_arg(ap, int);
|
||||
printf("char %c\n", c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
print("sdcsdc", "abracadabra", 12345, 'Z', "foo", 365, '%');
|
||||
return 0;
|
||||
}
|
||||
21
share/lccom/Makefile
Normal file
21
share/lccom/Makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
.SUFFIXES: .c .s .S .o
|
||||
|
||||
.c.o:
|
||||
lccom -target=mips-el $< > $*.s
|
||||
as -o $@ $*.s
|
||||
|
||||
.s.o:
|
||||
as -o $@ $<
|
||||
|
||||
.S.o:
|
||||
as -o $@ $<
|
||||
|
||||
all: hello
|
||||
|
||||
hello: hello.o sys.o
|
||||
ld -o hello -e main hello.o sys.o
|
||||
|
||||
clean:
|
||||
rm -f *.o *.s hello
|
||||
|
||||
6
share/lccom/hello.c
Normal file
6
share/lccom/hello.c
Normal file
@@ -0,0 +1,6 @@
|
||||
int main()
|
||||
{
|
||||
|
||||
write(1,"hello\n",6);
|
||||
exit(1);
|
||||
}
|
||||
100
share/lccom/sys.s
Normal file
100
share/lccom/sys.s
Normal file
@@ -0,0 +1,100 @@
|
||||
.text
|
||||
|
||||
#
|
||||
# int open( char* file, int flags, int mode )
|
||||
#
|
||||
open:
|
||||
|
||||
# errno handling code after syscall is not ideal,
|
||||
# but I don't think the assembler handles specifying
|
||||
# relocations for %hi and %lo yet, so the handling
|
||||
# shown in the retrobsd code is not really doable
|
||||
|
||||
syscall 5
|
||||
nop
|
||||
j serrn
|
||||
nop
|
||||
|
||||
jr $ra
|
||||
nop
|
||||
|
||||
#
|
||||
# int read( int fd, void* dest, int count)
|
||||
# returns: count of chars read or -1 if error (see errno)
|
||||
#
|
||||
read:
|
||||
|
||||
# errno handling code after syscall is not ideal,
|
||||
# but I don't think the assembler handles specifying
|
||||
# relocations for %hi and %lo yet, so the handling
|
||||
# shown in the retrobsd code is not really doable
|
||||
|
||||
syscall 3
|
||||
nop
|
||||
j serrn
|
||||
nop
|
||||
|
||||
jr $ra
|
||||
nop
|
||||
|
||||
|
||||
|
||||
#
|
||||
# int write( int fd, void* string, int count );
|
||||
# returns: count of chars written or -1 if error (see errno)
|
||||
#
|
||||
write:
|
||||
# errno handling code after syscall is not ideal,
|
||||
# but I don't think the assembler handles specifying
|
||||
# relocations for %hi and %lo yet, so the handling
|
||||
# shown in the retrobsd code is not really doable
|
||||
|
||||
syscall 4
|
||||
nop
|
||||
j serrn
|
||||
nop
|
||||
|
||||
jr $ra
|
||||
nop
|
||||
|
||||
#
|
||||
# int close( int fd );
|
||||
#
|
||||
close:
|
||||
# errno handling code after syscall is not ideal,
|
||||
# but I don't think the assembler handles specifying
|
||||
# relocations for %hi and %lo yet, so the handling
|
||||
# shown in the retrobsd code is not really doable
|
||||
|
||||
syscall 6
|
||||
nop
|
||||
j serrn
|
||||
nop
|
||||
|
||||
jr $ra
|
||||
nop
|
||||
|
||||
#
|
||||
# exit( int n );
|
||||
#
|
||||
exit:
|
||||
syscall 1
|
||||
nop
|
||||
|
||||
|
||||
serrn:
|
||||
la $t1, _errno
|
||||
sw $t0, 0($t1)
|
||||
jr $ra
|
||||
nop
|
||||
|
||||
.data
|
||||
_errno: .byte 0,0,0,0
|
||||
|
||||
.globl open
|
||||
.globl read
|
||||
.globl write
|
||||
.globl close
|
||||
.globl exit
|
||||
.globl _errno
|
||||
|
||||
3
share/man/.gitignore
vendored
3
share/man/.gitignore
vendored
@@ -1,3 +0,0 @@
|
||||
makewhatis.sed
|
||||
man.template
|
||||
whatis
|
||||
0
share/man/cat7/.gitignore
vendored
0
share/man/cat7/.gitignore
vendored
0
share/man/cat8/.gitignore
vendored
0
share/man/cat8/.gitignore
vendored
@@ -1,41 +1,27 @@
|
||||
CC = scc
|
||||
PROG = hello primelist primesum test1 test2 test3 gpio adc rain \
|
||||
webserver q8
|
||||
|
||||
all: $(PROG)
|
||||
.SUFFIXES: .c .s .o
|
||||
|
||||
hello: hello.c
|
||||
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) hello.c
|
||||
.c.o:
|
||||
smallc $<
|
||||
as -o $@ $*.s
|
||||
|
||||
primelist: primelist.c
|
||||
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) primelist.c
|
||||
.s.o:
|
||||
as -o $@ $<
|
||||
|
||||
primesum: primesum.c
|
||||
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) primesum.c
|
||||
all: primelist primesum test1 test2
|
||||
|
||||
webserver: webserver.c
|
||||
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) webserver.c -lwiznet
|
||||
primelist: primelist.o lib.o sys.o
|
||||
ld -o primelist -e _main primelist.o lib.o sys.o
|
||||
|
||||
gpio: gpio.c
|
||||
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) gpio.c
|
||||
primesum: primesum.o lib.o sys.o
|
||||
ld -o primesum -e _main primesum.o lib.o sys.o
|
||||
|
||||
adc: adc.c
|
||||
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) adc.c
|
||||
test1: test1.o lib.o sys.o
|
||||
ld -o $@ -e _main test1.o lib.o sys.o
|
||||
|
||||
rain: rain.c
|
||||
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) rain.c
|
||||
|
||||
q8: q8.c
|
||||
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) q8.c
|
||||
|
||||
test1: test1.c
|
||||
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) test1.c
|
||||
|
||||
test2: test2.c
|
||||
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) test2.c
|
||||
|
||||
test3: test3.c
|
||||
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) test3.c
|
||||
test2: test2.o lib.o sys.o
|
||||
ld -o $@ -e _main test2.o lib.o sys.o
|
||||
|
||||
clean:
|
||||
rm -f *.o $(PROG)
|
||||
rm *.o primelist primesum test1 test2 primelist.s primesum.s test1.s test2.s
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Example of reading ADC data.
|
||||
*/
|
||||
#include <fcntl.h>
|
||||
|
||||
char buf[100];
|
||||
|
||||
main()
|
||||
{
|
||||
int i, fd, value;
|
||||
|
||||
for (i=0; i<16; i++) {
|
||||
sprintf(buf, "/dev/adc%d", i);
|
||||
fd = open(buf, O_RDWR);
|
||||
if (fd < 0) {
|
||||
printf("Error: unable to open %s\n", buf);
|
||||
} else {
|
||||
if (read(fd, buf, 20) > 0) {
|
||||
value = strtol (buf, 0, 0);
|
||||
printf("adc%-2d = %d\n", i, value);
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Example of polling general purpose i/o pins.
|
||||
*/
|
||||
#include <fcntl.h>
|
||||
#include <sys/gpio.h>
|
||||
|
||||
main ()
|
||||
{
|
||||
int fd, pnum, value;
|
||||
|
||||
fd = open ("/dev/porta", O_RDWR);
|
||||
if (fd < 0) {
|
||||
perror ("/dev/porta");
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (pnum=0; pnum<7; pnum++) {
|
||||
value = ioctl (fd, GPIO_POLL | GPIO_PORT (pnum), 0);
|
||||
if (value < 0)
|
||||
perror ("GPIO_POLL");
|
||||
printf ("port%c = 0x%04x\n", pnum + 'A', value);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
main()
|
||||
{
|
||||
printf ("Hello, SmallC World!\n");
|
||||
}
|
||||
37
share/smallc/lib.c
Normal file
37
share/smallc/lib.c
Normal file
@@ -0,0 +1,37 @@
|
||||
w_s(s)
|
||||
char*s;
|
||||
{
|
||||
write( 1, s, strlen(s) );
|
||||
}
|
||||
|
||||
strlen(s)
|
||||
char*s;
|
||||
{
|
||||
char *e;
|
||||
e = s;
|
||||
while(*e != 0) ++e;
|
||||
return e-s;
|
||||
}
|
||||
|
||||
w_c(c)
|
||||
char c;
|
||||
{
|
||||
write( 1, &c, 1 );
|
||||
}
|
||||
|
||||
w_n(number, radix)
|
||||
int number, radix;
|
||||
{
|
||||
int i;
|
||||
char *drp;
|
||||
drp = "0123456789ABCDEF";
|
||||
|
||||
if (number < 0 & radix == 10)
|
||||
{
|
||||
w_c('-');
|
||||
number = -number;
|
||||
}
|
||||
if ((i = number / radix) != 0)
|
||||
w_n(i, radix);
|
||||
w_c(drp[number % radix]);
|
||||
}
|
||||
@@ -1,31 +1,24 @@
|
||||
/*
|
||||
* Print the list of prime numbers up to 100.
|
||||
*/
|
||||
main()
|
||||
{
|
||||
int n;
|
||||
|
||||
for (n=2; n<100; ++n) {
|
||||
if (isprime(n)) {
|
||||
printf("%d ", n);
|
||||
for(n=2;n<100;++n){
|
||||
if( isprime(n) ){
|
||||
w_n(n,10);
|
||||
w_c(' ');
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
w_c('\n');
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
isprime(n)
|
||||
int n;
|
||||
int n;
|
||||
{
|
||||
int j;
|
||||
|
||||
if (n == 2)
|
||||
return 1;
|
||||
|
||||
if (n % 2 == 0)
|
||||
return 0;
|
||||
|
||||
for (j=3; j*j<=n; j+=2)
|
||||
if (n % j == 0)
|
||||
return 0;
|
||||
if( n == 2 ) return 1;
|
||||
if( n % 2 == 0 ) return 0;
|
||||
for(j=3;j*j<=n;j+=2)
|
||||
if( n % j == 0 ) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1,32 +1,27 @@
|
||||
/*
|
||||
* Compute the sum of prime numbers up to 10000.
|
||||
*/
|
||||
main()
|
||||
{
|
||||
int sum, n;
|
||||
|
||||
int sum;
|
||||
int n;
|
||||
sum = 0;
|
||||
for (n=2; n<10000; ++n) {
|
||||
if (isprime(n)) {
|
||||
for(n=2;n<10000;++n){
|
||||
if( isprime(n) ){
|
||||
sum += n;
|
||||
}
|
||||
}
|
||||
printf("Sum of primes less than 10000: %d\n", sum);
|
||||
w_s("sum of primes less than 10000: ");
|
||||
w_n(sum,10);
|
||||
w_c('\n');
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
isprime(n)
|
||||
int n;
|
||||
int n;
|
||||
{
|
||||
int j;
|
||||
|
||||
if (n == 2)
|
||||
return 1;
|
||||
|
||||
if (n % 2 == 0)
|
||||
return 0;
|
||||
|
||||
for (j=3; j*j<=n; j+=2)
|
||||
if (n % j == 0)
|
||||
return 0;
|
||||
if( n == 2 ) return 1;
|
||||
if( n % 2 == 0 ) return 0;
|
||||
for(j=3;j*j<=n;j+=2)
|
||||
if( n % j == 0 ) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1,208 +0,0 @@
|
||||
/*
|
||||
* Eight Queens puzzle
|
||||
*
|
||||
* (C) 2010 by Mark Sproul
|
||||
* Open source as per standard Arduino code
|
||||
* Modified by Pito 12/2012 for SmallC
|
||||
*/
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
unsigned int gChessBoard[8];
|
||||
unsigned int gLoopCounter;
|
||||
int gValidCount;
|
||||
|
||||
CheckCurrentBoard()
|
||||
{
|
||||
int ii;
|
||||
int jj;
|
||||
int theRow;
|
||||
int theLongRow;
|
||||
int theLongColumns;
|
||||
int bitCount;
|
||||
|
||||
//* we know we have 1 in each row,
|
||||
//* Check for 1 in each column
|
||||
theRow = 0;
|
||||
for (ii=0; ii<8; ii++) {
|
||||
theRow |= gChessBoard[ii];
|
||||
}
|
||||
if (theRow != 0x0ff) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//* we have 1 in each column, now check the diagonals
|
||||
theLongColumns = 0;
|
||||
for (ii=0; ii<8; ii++) {
|
||||
theLongRow = gChessBoard[ii] & 0x0ff;
|
||||
theLongRow = theLongRow << ii;
|
||||
|
||||
theLongColumns |= theLongRow;
|
||||
}
|
||||
|
||||
//* now count the bits
|
||||
bitCount = 0;
|
||||
for (ii=0; ii<16; ii++) {
|
||||
if ((theLongColumns & 0x01) == 0x01) {
|
||||
bitCount++;
|
||||
}
|
||||
theLongColumns = theLongColumns >> 1;
|
||||
}
|
||||
|
||||
if (bitCount != 8) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//* we now have to check the other diagonal
|
||||
theLongColumns = 0;
|
||||
for (ii=0; ii<8; ii++) {
|
||||
theLongRow = gChessBoard[ii] & 0x0ff;
|
||||
theLongRow = theLongRow << 8;
|
||||
theLongRow = theLongRow >> ii;
|
||||
|
||||
theLongColumns |= theLongRow;
|
||||
}
|
||||
|
||||
//* now count the bits
|
||||
bitCount = 0;
|
||||
for (ii=0; ii<16; ii++) {
|
||||
if ((theLongColumns & 0x01) == 0x01) {
|
||||
bitCount++;
|
||||
}
|
||||
theLongColumns = theLongColumns >> 1;
|
||||
}
|
||||
|
||||
if (bitCount != 8) {
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
CheckForDone()
|
||||
{
|
||||
int ii;
|
||||
int weAreDone;
|
||||
int theRow;
|
||||
|
||||
weAreDone = FALSE;
|
||||
|
||||
//* we know we have 1 in each row,
|
||||
//* Check for 1 in each column
|
||||
theRow = 0;
|
||||
for (ii=0; ii<8; ii++) {
|
||||
theRow |= gChessBoard[ii];
|
||||
}
|
||||
|
||||
if (theRow == 0x01) {
|
||||
weAreDone = TRUE;
|
||||
}
|
||||
return weAreDone;
|
||||
}
|
||||
|
||||
RotateQueens()
|
||||
{
|
||||
int ii;
|
||||
int keepGoing;
|
||||
int theRow;
|
||||
|
||||
ii = 0;
|
||||
keepGoing = TRUE;
|
||||
while (keepGoing && (ii < 8)) {
|
||||
theRow = gChessBoard[ii] & 0x0ff;
|
||||
theRow = (theRow >> 1) & 0x0ff;
|
||||
if (theRow != 0) {
|
||||
gChessBoard[ii] = theRow;
|
||||
keepGoing = FALSE;
|
||||
} else {
|
||||
gChessBoard[ii] = 0x080;
|
||||
}
|
||||
ii++;
|
||||
}
|
||||
}
|
||||
|
||||
PrintChessBoard()
|
||||
{
|
||||
int ii;
|
||||
int jj;
|
||||
int theRow;
|
||||
char textString[32];
|
||||
|
||||
printf("\nLoop= %d\n", gLoopCounter);
|
||||
printf("Solution count= %d\n", gValidCount);
|
||||
|
||||
printf("+----------------+\n");
|
||||
for (ii=0; ii<8; ii++) {
|
||||
theRow = gChessBoard[ii];
|
||||
|
||||
printf("|");
|
||||
for (jj=0; jj<8; jj++) {
|
||||
if (theRow & 0x080) {
|
||||
printf("Q ");
|
||||
} else {
|
||||
printf(". ");
|
||||
}
|
||||
theRow = theRow << 1;
|
||||
}
|
||||
printf("|\n");
|
||||
}
|
||||
printf("+----------------+\n");
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
int ii;
|
||||
|
||||
printf("\nEight Queens brute force");
|
||||
printf("\n************************\n");
|
||||
//* put the 8 queens on the board, 1 in each row
|
||||
for (ii=0; ii<8; ii++) {
|
||||
gChessBoard[ii] = 0x080;
|
||||
}
|
||||
PrintChessBoard();
|
||||
|
||||
gLoopCounter = 0;
|
||||
gValidCount = 0;
|
||||
|
||||
|
||||
while (1) {
|
||||
gLoopCounter++;
|
||||
|
||||
if (CheckCurrentBoard()) {
|
||||
gValidCount++;
|
||||
PrintChessBoard();
|
||||
} else if ((gLoopCounter % 1000) == 0) {
|
||||
//PrintChessBoard();
|
||||
}
|
||||
|
||||
RotateQueens();
|
||||
if (CheckForDone()) {
|
||||
//int elapsedSeconds;
|
||||
//int elapsedMinutes;
|
||||
//int elapsedHours;
|
||||
|
||||
//elapsedSeconds = millis() / 1000;
|
||||
//elapsedMinutes = elapsedSeconds / 60;
|
||||
//elapsedHours = elapsedMinutes / 60;
|
||||
|
||||
printf("----------------------------------\n");
|
||||
printf("All done\n");
|
||||
|
||||
PrintChessBoard();
|
||||
printf("----------------------------------\n");
|
||||
|
||||
//Serial.print("total seconds=");
|
||||
//Serial.println(elapsedSeconds);
|
||||
|
||||
//Serial.print("hours=");
|
||||
//Serial.println(elapsedHours);
|
||||
|
||||
//Serial.print("minutes=");
|
||||
//Serial.println(elapsedMinutes % 60);
|
||||
|
||||
//Serial.print("seconds=");
|
||||
//Serial.println(elapsedSeconds % 60);
|
||||
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
/*
|
||||
* Example of using termcap library for SmallC.
|
||||
* 11/3/1980 EPS/CITHEP
|
||||
*
|
||||
* Copyright (c) 1980 Regents of the University of California.
|
||||
* All rights reserved. The Berkeley software License Agreement
|
||||
* specifies the terms and conditions for redistribution.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
|
||||
#define CO 80 /* number of columns */
|
||||
#define LI 24 /* number of lines */
|
||||
|
||||
#define CL "\33[H\33[J" /* clear the screen */
|
||||
#define CM "\33[%u;%uH" /* move the cursor to row, column */
|
||||
#define BC "\b" /* move cursor left */
|
||||
#define DN "\33[B" /* move cursor down */
|
||||
#define ND " " /* move cursor right */
|
||||
|
||||
int xpos[5], ypos[5];
|
||||
char outbuf[BUFSIZ];
|
||||
|
||||
moveto(col, row)
|
||||
int col, row;
|
||||
{
|
||||
printf(CM, row, col);
|
||||
}
|
||||
|
||||
onsig(n)
|
||||
int n;
|
||||
{
|
||||
moveto(0, LI - 1);
|
||||
fflush(stdout);
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
int x, y, j;
|
||||
|
||||
setbuf(stdout, outbuf);
|
||||
for (j = SIGHUP; j <= SIGTERM; j++)
|
||||
if (signal(j, SIG_IGN) != SIG_IGN)
|
||||
signal(j, onsig);
|
||||
|
||||
fputs(CL, stdout);
|
||||
fflush(stdout);
|
||||
for (j = 5; --j >= 0; ) {
|
||||
xpos[j] = 2 + rand() % (CO - 4);
|
||||
ypos[j] = 2 + rand() % (LI - 4);
|
||||
}
|
||||
for (j = 0; ; ) {
|
||||
x = 2 + rand() % (CO - 4);
|
||||
y = 2 + rand() % (LI - 4);
|
||||
moveto(x, y);
|
||||
putchar('.');
|
||||
moveto(xpos[j], ypos[j]);
|
||||
putchar('o');
|
||||
if (j == 0)
|
||||
j = 4;
|
||||
else
|
||||
--j;
|
||||
moveto(xpos[j], ypos[j]);
|
||||
putchar('O');
|
||||
if (j == 0)
|
||||
j = 4;
|
||||
else
|
||||
--j;
|
||||
moveto(xpos[j], ypos[j]-1);
|
||||
putchar('-');
|
||||
fputs(DN, stdout);
|
||||
fputs(BC, stdout);
|
||||
fputs(BC, stdout);
|
||||
fputs("|.|", stdout);
|
||||
fputs(DN, stdout);
|
||||
fputs(BC, stdout);
|
||||
fputs(BC, stdout);
|
||||
putchar('-');
|
||||
if (j == 0)
|
||||
j = 4;
|
||||
else
|
||||
--j;
|
||||
moveto(xpos[j], ypos[j]-2);
|
||||
putchar('-');
|
||||
fputs(DN, stdout);
|
||||
fputs(BC, stdout);
|
||||
fputs(BC, stdout);
|
||||
fputs("/ \\", stdout);
|
||||
moveto(xpos[j]-2, ypos[j]);
|
||||
fputs("| O |", stdout);
|
||||
moveto(xpos[j]-1, ypos[j]+1);
|
||||
fputs("\\ /", stdout);
|
||||
fputs(DN, stdout);
|
||||
fputs(BC, stdout);
|
||||
fputs(BC, stdout);
|
||||
putchar('-');
|
||||
if (j == 0)
|
||||
j = 4;
|
||||
else
|
||||
--j;
|
||||
moveto(xpos[j], ypos[j]-2);
|
||||
putchar(' ');
|
||||
fputs(DN, stdout);
|
||||
fputs(BC, stdout);
|
||||
fputs(BC, stdout);
|
||||
putchar(' ');
|
||||
fputs(ND, stdout);
|
||||
putchar(' ');
|
||||
moveto(xpos[j]-2, ypos[j]);
|
||||
putchar(' ');
|
||||
fputs(ND, stdout);
|
||||
putchar(' ');
|
||||
fputs(ND, stdout);
|
||||
putchar(' ');
|
||||
moveto(xpos[j]-1, ypos[j]+1);
|
||||
putchar(' ');
|
||||
fputs(ND, stdout);
|
||||
putchar(' ');
|
||||
fputs(DN, stdout);
|
||||
fputs(BC, stdout);
|
||||
fputs(BC, stdout);
|
||||
putchar(' ');
|
||||
xpos[j] = x;
|
||||
ypos[j] = y;
|
||||
fflush(stdout);
|
||||
usleep(100000);
|
||||
}
|
||||
}
|
||||
159
share/smallc/sys.s
Normal file
159
share/smallc/sys.s
Normal file
@@ -0,0 +1,159 @@
|
||||
.text
|
||||
|
||||
#
|
||||
# int open( char* file, int flags, int mode )
|
||||
#
|
||||
_open:
|
||||
lw $a0, 8($sp)
|
||||
lw $a1, 4($sp)
|
||||
lw $a2, 0($sp)
|
||||
|
||||
# errno handling code after syscall is not ideal,
|
||||
# but I don't think the assembler handles specifying
|
||||
# relocations for %hi and %lo yet, so the handling
|
||||
# shown in the retrobsd code is not really doable
|
||||
|
||||
syscall 5
|
||||
nop
|
||||
j serrn
|
||||
nop
|
||||
|
||||
jr $ra
|
||||
nop
|
||||
|
||||
#
|
||||
# int read( int fd, void* dest, int count)
|
||||
# returns: count of chars read or -1 if error (see errno)
|
||||
#
|
||||
_read:
|
||||
lw $a0, 8($sp)
|
||||
lw $a1, 4($sp)
|
||||
lw $a2, 0($sp)
|
||||
|
||||
# errno handling code after syscall is not ideal,
|
||||
# but I don't think the assembler handles specifying
|
||||
# relocations for %hi and %lo yet, so the handling
|
||||
# shown in the retrobsd code is not really doable
|
||||
|
||||
syscall 3
|
||||
nop
|
||||
j serrn
|
||||
nop
|
||||
|
||||
jr $ra
|
||||
nop
|
||||
|
||||
|
||||
|
||||
#
|
||||
# int write( int fd, void* string, int count );
|
||||
# returns: count of chars written or -1 if error (see errno)
|
||||
#
|
||||
_write:
|
||||
lw $a0, 8($sp)
|
||||
lw $a1, 4($sp)
|
||||
lw $a2, 0($sp)
|
||||
|
||||
# errno handling code after syscall is not ideal,
|
||||
# but I don't think the assembler handles specifying
|
||||
# relocations for %hi and %lo yet, so the handling
|
||||
# shown in the retrobsd code is not really doable
|
||||
|
||||
syscall 4
|
||||
nop
|
||||
j serrn
|
||||
nop
|
||||
|
||||
jr $ra
|
||||
nop
|
||||
|
||||
#
|
||||
# int close( int fd );
|
||||
#
|
||||
_close:
|
||||
lw $a0, 0($sp)
|
||||
|
||||
# errno handling code after syscall is not ideal,
|
||||
# but I don't think the assembler handles specifying
|
||||
# relocations for %hi and %lo yet, so the handling
|
||||
# shown in the retrobsd code is not really doable
|
||||
|
||||
syscall 6
|
||||
nop
|
||||
j serrn
|
||||
nop
|
||||
|
||||
jr $ra
|
||||
nop
|
||||
|
||||
#
|
||||
# exit( int n );
|
||||
#
|
||||
_exit:
|
||||
lw $a0, 0($sp)
|
||||
addiu $sp, $sp, -4
|
||||
syscall 1
|
||||
nop
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
serrn:
|
||||
la $t1, _errno
|
||||
sw $t0, 0($t1)
|
||||
jr $ra
|
||||
nop
|
||||
|
||||
#
|
||||
# $v0 = value to switch on
|
||||
# 0($sp) = pointer to list of value,ptr cases
|
||||
# ended where ptr=0, value is used as pointer to jump to in default case
|
||||
# looks like stack is popped as part of this
|
||||
# FIXME - The assembler/linker only stores the bottom 16 bits
|
||||
# of the labels in pair, so we construct the address by merging the 16 bits
|
||||
# in the cell with the upper 16 bits in the return address of the code that
|
||||
# called this. Is there a way to get the assembler linker to store the full
|
||||
# address? If so, that should be used instead.
|
||||
#
|
||||
Tcase:
|
||||
lw $t1, 0($sp) # t1=pointer to list of value/ptr pairs
|
||||
addiu $sp, $sp, 4 # pop stack that held pointer
|
||||
.Tcl:
|
||||
lw $t2, 0($t1) # get value from pair
|
||||
lw $t3, 4($t1) # get ptr from pair
|
||||
beq $t3, $zero, .Tcd
|
||||
nop
|
||||
|
||||
beq $t2, $v0, .Tcm
|
||||
nop
|
||||
|
||||
addiu $t1, $t1, 8 # t1 += size of pair
|
||||
j .Tcl
|
||||
nop
|
||||
|
||||
.Tcd:
|
||||
move $t3, $t2
|
||||
.Tcm:
|
||||
lui $t2, 0xffff
|
||||
and $t2, $t2, $ra
|
||||
or $t3, $t3, $t2
|
||||
jr $t3
|
||||
nop
|
||||
|
||||
Tcallstk:
|
||||
jr $t1
|
||||
nop
|
||||
|
||||
.data
|
||||
_errno: .byte 0,0,0,0
|
||||
|
||||
.globl _open
|
||||
.globl _read
|
||||
.globl _write
|
||||
.globl _close
|
||||
.globl _exit
|
||||
.globl _errno
|
||||
.globl Tcase
|
||||
.globl Tcallstk
|
||||
|
||||
@@ -1,219 +1,231 @@
|
||||
int ga[5];
|
||||
|
||||
main()
|
||||
{
|
||||
int a, b, c, d;
|
||||
int arr[5];
|
||||
int *pi;
|
||||
char arrc[5];
|
||||
char *pic;
|
||||
int s1, s2;
|
||||
int z;
|
||||
int t;
|
||||
int *pip;
|
||||
int *picp;
|
||||
int e1, e2;
|
||||
int a,b,c,d;
|
||||
int arr[5];
|
||||
int *pi;
|
||||
char arrc[5];
|
||||
char *pic;
|
||||
int s1,s2;
|
||||
int z;
|
||||
int t;
|
||||
int *pip;
|
||||
int *picp;
|
||||
int e1,e2;
|
||||
|
||||
ga[0] = 10;
|
||||
ga[1] = 20;
|
||||
ga[2] = 30;
|
||||
ga[3] = 40;
|
||||
ga[4] = 50;
|
||||
a = 21;
|
||||
b = 31;
|
||||
c = 71;
|
||||
d = 82;
|
||||
|
||||
arr[0] = 10;
|
||||
arr[1] = 20;
|
||||
arr[2] = 30;
|
||||
arr[3] = 40;
|
||||
arr[4] = 50;
|
||||
pi = &arr[0];
|
||||
|
||||
arrc[0] = 13;
|
||||
arrc[1] = 23;
|
||||
arrc[2] = 33;
|
||||
arrc[3] = 43;
|
||||
arrc[4] = 53;
|
||||
pic = &arrc[0];
|
||||
|
||||
w_s("21+31="); w_n(a+b,10); w_s(" (52)\n");
|
||||
w_s("21-31="); w_n(a-b,10); w_s(" (-10)\n");
|
||||
w_s("21&71="); w_n(a&c,10); w_s(" (5)\n");
|
||||
w_s("21|82="); w_n(a|d,10); w_s(" (87)\n");
|
||||
w_s("21^82="); w_n(a^d,10); w_s(" (71)\n");
|
||||
w_s("21*82="); w_n(a*d,10); w_s(" (1722)\n");
|
||||
w_s("82%21="); w_n(d%a,10); w_s(" (19)\n");
|
||||
w_s("82/21="); w_n(d/a,10); w_s(" (3)\n");
|
||||
w_s("*pi="); w_n(*pi,10); w_s(" (10)\n");
|
||||
w_s("*pi+1="); w_n(*pi+1,10); w_s(" (11)\n");
|
||||
w_s("*(pi+1)="); w_n(*(pi+1),10); w_s(" (20)\n");
|
||||
w_s("&arr[3]-&arr[0]="); w_n(&arr[3]-&arr[0],10); w_s(" (3)\n");
|
||||
|
||||
w_s("*pic="); w_n(*pic,10); w_s(" (13)\n");
|
||||
w_s("*pic+1="); w_n(*pic+1,10); w_s(" (14)\n");
|
||||
w_s("*(pic+1)="); w_n(*(pic+1),10); w_s(" (23)\n");
|
||||
w_s("&arrc[3]-&arrc[0]="); w_n(&arrc[3]-&arrc[0],10); w_s(" (3)\n");
|
||||
|
||||
s1 = 3;
|
||||
s2 = -200;
|
||||
w_s("82<<3="); w_n(d<<s1,10); w_s(" (656)\n");
|
||||
w_s("82>>3="); w_n(d>>s1,10); w_s(" (10)\n");
|
||||
w_s("-200>>3="); w_n(s2>>s1,10); w_s(" (-25)\n");
|
||||
w_s("-200<<3="); w_n(s2<<s1,10); w_s(" (-1600)\n");
|
||||
|
||||
w_s("-s1="); w_n(-s1,10); w_s(" (-3)\n");
|
||||
w_s("-s2="); w_n(-s2,10); w_s(" (200)\n");
|
||||
|
||||
w_s("~82="); w_n(~d,10); w_s(" (-83)\n");
|
||||
|
||||
z = 0;
|
||||
|
||||
w_s("!82="); w_n(!d,10); w_s(" (0)\n");
|
||||
w_s("!0="); w_n(!z,10); w_s(" (1)\n");
|
||||
|
||||
t = 0;
|
||||
if(t) printt(t,"failure\n"); else printt(t,"success\n");
|
||||
t = 1;
|
||||
if(t) printt(t,"success\n"); else printt(t,"failure\n");
|
||||
t = 8;
|
||||
if(t) printt(t,"success\n"); else printt(t,"failure\n");
|
||||
t = -2;
|
||||
if(t) printt(t,"success\n"); else printt(t,"failure\n");
|
||||
|
||||
w_s("0&&0="); w_n(z&&z,10); w_s(" (0)\n");
|
||||
w_s("0&&21="); w_n(z&&a,10); w_s(" (0)\n");
|
||||
w_s("3&&21="); w_n(s1&&a,10); w_s(" (1)\n");
|
||||
w_s("21&&3="); w_n(a&&s1,10); w_s(" (1)\n");
|
||||
|
||||
w_s("0||0="); w_n(z||z,10); w_s(" (0)\n");
|
||||
w_s("0||21="); w_n(z||a,10); w_s(" (1)\n");
|
||||
w_s("3||21="); w_n(s1||a,10); w_s(" (1)\n");
|
||||
w_s("21||3="); w_n(a||s1,10); w_s(" (1)\n");
|
||||
|
||||
pi = 4;
|
||||
w_s("pi++="); w_n(pi++,10); w_s(" (4)\n");
|
||||
w_s("pi="); w_n(pi,10); w_s(" (8)\n");
|
||||
w_s("++pi="); w_n(++pi,10); w_s(" (12)\n");
|
||||
w_s("pi--="); w_n(pi--,10); w_s(" (12)\n");
|
||||
w_s("pi="); w_n(pi,10); w_s(" (8)\n");
|
||||
w_s("--pi="); w_n(--pi,10); w_s(" (4)\n");
|
||||
|
||||
pic = 4;
|
||||
w_s("pic++="); w_n(pic++,10); w_s(" (4)\n");
|
||||
w_s("pic="); w_n(pic,10); w_s(" (5)\n");
|
||||
w_s("++pic="); w_n(++pic,10); w_s(" (6)\n");
|
||||
w_s("pic--="); w_n(pic--,10); w_s(" (6)\n");
|
||||
w_s("pic="); w_n(pic,10); w_s(" (5)\n");
|
||||
w_s("--pic="); w_n(--pic,10); w_s(" (4)\n");
|
||||
|
||||
t = 4;
|
||||
w_s("t++="); w_n(t++,10); w_s(" (4)\n");
|
||||
w_s("t="); w_n(t,10); w_s(" (5)\n");
|
||||
w_s("++t="); w_n(++t,10); w_s(" (6)\n");
|
||||
w_s("t--="); w_n(t--,10); w_s(" (6)\n");
|
||||
w_s("t="); w_n(t,10); w_s(" (5)\n");
|
||||
w_s("--t="); w_n(--t,10); w_s(" (4)\n");
|
||||
|
||||
a = 21;
|
||||
b = 31;
|
||||
c = 71;
|
||||
d = 82;
|
||||
t = 4;
|
||||
w_s("t==4="); w_n(t==4,10); w_s(" (1)\n");
|
||||
w_s("t==3="); w_n(t==3,10); w_s(" (0)\n");
|
||||
w_s("t==5="); w_n(t==5,10); w_s(" (0)\n");
|
||||
t = -4;
|
||||
w_s("t==-4="); w_n(t==-4,10); w_s(" (1)\n");
|
||||
w_s("t==-3="); w_n(t==-3,10); w_s(" (0)\n");
|
||||
w_s("t==-5="); w_n(t==-5,10); w_s(" (0)\n");
|
||||
w_s("t==4="); w_n(t==4,10); w_s(" (0)\n");
|
||||
w_s("t==3="); w_n(t==3,10); w_s(" (0)\n");
|
||||
w_s("t==5="); w_n(t==5,10); w_s(" (0)\n");
|
||||
|
||||
t = 4;
|
||||
w_s("t!=4="); w_n(t!=4,10); w_s(" (0)\n");
|
||||
w_s("t!=3="); w_n(t!=3,10); w_s(" (1)\n");
|
||||
w_s("t!=5="); w_n(t!=5,10); w_s(" (1)\n");
|
||||
t = -4;
|
||||
w_s("t!=-4="); w_n(t!=-4,10); w_s(" (0)\n");
|
||||
w_s("t!=-3="); w_n(t!=-3,10); w_s(" (1)\n");
|
||||
w_s("t!=-5="); w_n(t!=-5,10); w_s(" (1)\n");
|
||||
w_s("t!=4="); w_n(t!=4,10); w_s(" (1)\n");
|
||||
w_s("t!=3="); w_n(t!=3,10); w_s(" (1)\n");
|
||||
w_s("t!=5="); w_n(t!=5,10); w_s(" (1)\n");
|
||||
|
||||
arr[0] = 10;
|
||||
arr[1] = 20;
|
||||
arr[2] = 30;
|
||||
arr[3] = 40;
|
||||
arr[4] = 50;
|
||||
pi = &arr[0];
|
||||
t = 4;
|
||||
w_s("t<4="); w_n(t<4,10); w_s(" (0)\n");
|
||||
w_s("t<3="); w_n(t<3,10); w_s(" (0)\n");
|
||||
w_s("t<5="); w_n(t<5,10); w_s(" (1)\n");
|
||||
w_s("t<-1="); w_n(t<-1,10); w_s(" (0)\n");
|
||||
|
||||
arrc[0] = 13;
|
||||
arrc[1] = 23;
|
||||
arrc[2] = 33;
|
||||
arrc[3] = 43;
|
||||
arrc[4] = 53;
|
||||
pic = &arrc[0];
|
||||
w_s("t<=4="); w_n(t<=4,10); w_s(" (1)\n");
|
||||
w_s("t<=3="); w_n(t<=3,10); w_s(" (0)\n");
|
||||
w_s("t<=5="); w_n(t<=5,10); w_s(" (1)\n");
|
||||
w_s("t<=-1="); w_n(t<=-1,10); w_s(" (0)\n");
|
||||
|
||||
printf(" 21 + 31 = %d (52)\n", a + b);
|
||||
printf(" 21 - 31 = %d (-10)\n", a - b);
|
||||
printf(" 21 & 71 = %d (5)\n", a & c);
|
||||
printf(" 21 | 82 = %d (87)\n", a | d);
|
||||
printf(" 21 ^ 82 = %d (71)\n", a ^ d);
|
||||
printf(" 21 * 82 = %d (1722)\n", a * d);
|
||||
printf(" 82 % 21 = %d (19)\n", d % a);
|
||||
printf(" 82 / 21 = %d (3)\n", d / a);
|
||||
printf(" *pi = %d (10)\n", *pi);
|
||||
printf(" *pi + 1 = %d (11)\n", *pi + 1);
|
||||
printf(" *(pi + 1) = %d (20)\n", *(pi + 1));
|
||||
printf("&arr[3] - &arr[0] = %d (3)\n", &arr[3] - &arr[0]);
|
||||
printf(" arr[3]-arr[0] = %d (30)\n", arr[3] - arr[0]);
|
||||
printf(" arr[3]+arr[0] = %d (50)\n", arr[3] + arr[0]);
|
||||
printf(" &ga[3] - &ga[0] = %d (3)\n", &ga[3] - &ga[0]);
|
||||
printf(" ga[3]-ga[0] = %d (30)\n", ga[3] - ga[0]);
|
||||
printf(" ga[3]+ga[0] = %d (50)\n", ga[3] + ga[0]);
|
||||
printf("\n");
|
||||
t = 4;
|
||||
w_s("t>4="); w_n(t>4,10); w_s(" (0)\n");
|
||||
w_s("t>3="); w_n(t>3,10); w_s(" (1)\n");
|
||||
w_s("t>5="); w_n(t>5,10); w_s(" (0)\n");
|
||||
w_s("t>-1="); w_n(t>-1,10); w_s(" (1)\n");
|
||||
|
||||
printf(" *pic = %d (13)\n", *pic);
|
||||
printf(" *pic + 1 = %d (14)\n", *pic+1);
|
||||
printf(" *(pic + 1) = %d (23)\n", *(pic+1));
|
||||
printf("&arrc[3] - &arrc[0] = %d (3)\n", &arrc[3]-&arrc[0]);
|
||||
printf("\n");
|
||||
w_s("t>=4="); w_n(t>=4,10); w_s(" (1)\n");
|
||||
w_s("t>=3="); w_n(t>=3,10); w_s(" (1)\n");
|
||||
w_s("t>=5="); w_n(t>=5,10); w_s(" (0)\n");
|
||||
w_s("t>=-1="); w_n(t>=-1,10); w_s(" (1)\n");
|
||||
|
||||
|
||||
s1 = 3;
|
||||
s2 = -200;
|
||||
printf(" 82 << 3 = %d (656)\n", d << s1);
|
||||
printf(" 82 >> 3 = %d (10)\n", d >> s1);
|
||||
printf("-200 >> 3 = %d (-25)\n", s2 >> s1);
|
||||
printf("-200 << 3 = %d (-1600)\n", s2 << s1);
|
||||
printf("\n");
|
||||
pi = -100;
|
||||
w_s("pi<4="); w_n(pi<4,10); w_s(" (0)\n");
|
||||
w_s("pi<3="); w_n(pi<3,10); w_s(" (0)\n");
|
||||
w_s("pi<-100="); w_n(pi<-100,10); w_s(" (0)\n");
|
||||
w_s("pi<-1="); w_n(pi<-1,10); w_s(" (1)\n");
|
||||
|
||||
printf("-s1 = %d (-3)\n", -s1);
|
||||
printf("-s2 = %d (200)\n", -s2);
|
||||
printf("\n");
|
||||
w_s("pi<=4="); w_n(pi<=4,10); w_s(" (0)\n");
|
||||
w_s("pi<=3="); w_n(pi<=3,10); w_s(" (0)\n");
|
||||
w_s("pi<=-100="); w_n(pi<=-100,10); w_s(" (1)\n");
|
||||
w_s("pi<=-1="); w_n(pi<=-1,10); w_s(" (1)\n");
|
||||
|
||||
printf("~82 = %d (-83)\n", ~d);
|
||||
printf("\n");
|
||||
pi = -100;
|
||||
w_s("pi>4="); w_n(pi>4,10); w_s(" (1)\n");
|
||||
w_s("pi>3="); w_n(pi>3,10); w_s(" (1)\n");
|
||||
w_s("pi>-100="); w_n(pi>-100,10); w_s(" (0)\n");
|
||||
w_s("pi>-1="); w_n(pi>-1,10); w_s(" (0)\n");
|
||||
|
||||
z = 0;
|
||||
printf("!82 = %d (0)\n", !d);
|
||||
printf(" !0 = %d (1)\n", !z);
|
||||
printf("\n");
|
||||
w_s("pi>=4="); w_n(pi>=4,10); w_s(" (1)\n");
|
||||
w_s("pi>=3="); w_n(pi>=3,10); w_s(" (1)\n");
|
||||
w_s("pi>=-100="); w_n(pi>=-100,10); w_s(" (1)\n");
|
||||
w_s("pi>=-1="); w_n(pi>=-1,10); w_s(" (0)\n");
|
||||
|
||||
printf(" 0 && 0 = %d (0)\n", z && z);
|
||||
printf(" 0 && 21 = %d (0)\n", z && a);
|
||||
printf(" 3 && 21 = %d (1)\n", s1 && a);
|
||||
printf("21 && 3 = %d (1)\n", a && s1);
|
||||
printf("\n");
|
||||
w_s("switch test: ");
|
||||
switch(t)
|
||||
{
|
||||
case 3:
|
||||
w_s("failure");
|
||||
break;
|
||||
case 4:
|
||||
w_s("success");
|
||||
break;
|
||||
case 5:
|
||||
w_s("failure");
|
||||
break;
|
||||
}
|
||||
w_s("\n");
|
||||
|
||||
printf(" 0 || 0 = %d (0)\n", z || z);
|
||||
printf(" 0 || 21 = %d (1)\n", z || a);
|
||||
printf(" 3 || 21 = %d (1)\n", s1 || a);
|
||||
printf("21 || 3 = %d (1)\n", a || s1);
|
||||
printf("\n");
|
||||
|
||||
pi = 4;
|
||||
printf("pi++ = %d (4)\n", pi++);
|
||||
printf(" pi = %d (8)\n", pi);
|
||||
printf("++pi = %d (12)\n", ++pi);
|
||||
printf("pi-- = %d (12)\n", pi--);
|
||||
printf(" pi = %d (8)\n", pi);
|
||||
printf("--pi = %d (4)\n", --pi);
|
||||
printf("\n");
|
||||
|
||||
pic = 4;
|
||||
printf("pic++ = %d (4)\n", pic++);
|
||||
printf(" pic = %d (5)\n", pic);
|
||||
printf("++pic = %d (6)\n", ++pic);
|
||||
printf("pic-- = %d (6)\n", pic--);
|
||||
printf(" pic = %d (5)\n", pic);
|
||||
printf("--pic = %d (4)\n", --pic);
|
||||
printf("\n");
|
||||
|
||||
t = 4;
|
||||
printf("t++ = %d (4)\n", t++);
|
||||
printf(" t = %d (5)\n", t);
|
||||
printf("++t = %d (6)\n", ++t);
|
||||
printf("t-- = %d (6)\n", t--);
|
||||
printf(" t = %d (5)\n", t);
|
||||
printf("--t = %d (4)\n", --t);
|
||||
printf("\n");
|
||||
|
||||
t = 4;
|
||||
printf(" t==4 = %d (1)\n", t == 4);
|
||||
printf(" t==3 = %d (0)\n", t == 3);
|
||||
printf(" t==5 = %d (0)\n", t == 5);
|
||||
t = -4;
|
||||
printf("t==-4 = %d (1)\n", t == -4);
|
||||
printf("t==-3 = %d (0)\n", t == -3);
|
||||
printf("t==-5 = %d (0)\n", t == -5);
|
||||
printf(" t==4 = %d (0)\n", t == 4);
|
||||
printf(" t==3 = %d (0)\n", t == 3);
|
||||
printf(" t==5 = %d (0)\n", t == 5);
|
||||
printf("\n");
|
||||
|
||||
t = 4;
|
||||
printf(" t!=4 = %d (0)\n", t != 4);
|
||||
printf(" t!=3 = %d (1)\n", t != 3);
|
||||
printf(" t!=5 = %d (1)\n", t != 5);
|
||||
t = -4;
|
||||
printf("t!=-4 = %d (0)\n", t != -4);
|
||||
printf("t!=-3 = %d (1)\n", t != -3);
|
||||
printf("t!=-5 = %d (1)\n", t != -5);
|
||||
printf(" t!=4 = %d (1)\n", t != 4);
|
||||
printf(" t!=3 = %d (1)\n", t != 3);
|
||||
printf(" t!=5 = %d (1)\n", t != 5);
|
||||
printf("\n");
|
||||
|
||||
t = 4;
|
||||
printf(" t<4 = %d (0)\n", t < 4);
|
||||
printf(" t<3 = %d (0)\n", t < 3);
|
||||
printf(" t<5 = %d (1)\n", t < 5);
|
||||
printf("t<-1 = %d (0)\n", t < -1);
|
||||
printf("\n");
|
||||
|
||||
printf(" t<=4 = %d (1)\n", t <= 4);
|
||||
printf(" t<=3 = %d (0)\n", t <= 3);
|
||||
printf(" t<=5 = %d (1)\n", t <= 5);
|
||||
printf("t<=-1 = %d (0)\n", t <= -1);
|
||||
printf("\n");
|
||||
|
||||
t = 4;
|
||||
printf(" t>4 = %d (0)\n", t > 4);
|
||||
printf(" t>3 = %d (1)\n", t > 3);
|
||||
printf(" t>5 = %d (0)\n", t > 5);
|
||||
printf("t>-1 = %d (1)\n", t > -1);
|
||||
printf("\n");
|
||||
|
||||
printf(" t>=4 = %d (1)\n", t >= 4);
|
||||
printf(" t>=3 = %d (1)\n", t >= 3);
|
||||
printf(" t>=5 = %d (0)\n", t >= 5);
|
||||
printf("t>=-1 = %d (1)\n", t >= -1);
|
||||
printf("\n");
|
||||
|
||||
pi = -100;
|
||||
printf(" pi<4 = %d (0)\n", pi < 4);
|
||||
printf(" pi<3 = %d (0)\n", pi < 3);
|
||||
printf("pi<-100 = %d (0)\n", pi < -100);
|
||||
printf(" pi<-1 = %d (1)\n", pi < -1);
|
||||
printf("\n");
|
||||
|
||||
printf(" pi<=4 = %d (0)\n", pi <= 4);
|
||||
printf(" pi<=3 = %d (0)\n", pi <= 3);
|
||||
printf("pi<=-100 = %d (1)\n", pi <= -100);
|
||||
printf(" pi<=-1 = %d (1)\n", pi <= -1);
|
||||
printf("\n");
|
||||
|
||||
pi = -100;
|
||||
printf(" pi>4 = %d (1)\n", pi > 4);
|
||||
printf(" pi>3 = %d (1)\n", pi > 3);
|
||||
printf("pi>-100 = %d (0)\n", pi > -100);
|
||||
printf(" pi>-1 = %d (0)\n", pi > -1);
|
||||
printf("\n");
|
||||
|
||||
printf(" pi>=4 = %d (1)\n", pi >= 4);
|
||||
printf(" pi>=3 = %d (1)\n", pi >= 3);
|
||||
printf("pi>=-100 = %d (1)\n", pi >= -100);
|
||||
printf(" pi>=-1 = %d (0)\n", pi >= -1);
|
||||
printf("\n");
|
||||
|
||||
pi = &arr[0];
|
||||
pip = &arr[3];
|
||||
printf(" *pip - *pi: %d 30\n", *pip - *pi);
|
||||
printf(" pip - pi: %d 3\n", pip - pi);
|
||||
printf(" *pip: %d 40\n", *pip);
|
||||
printf(" *(pip - 3): %d 10\n", *(pip - 3));
|
||||
printf(" *&arr[3]: %d 40\n", *&arr[3]);
|
||||
printf("*(&arr[3] - 3): %d 10\n", *(&arr[3]-3));
|
||||
w_s("switch fallthrough test: ");
|
||||
switch(t)
|
||||
{
|
||||
case 3:
|
||||
w_s("failure");
|
||||
break;
|
||||
case 4:
|
||||
w_s("OKSOFAR: ");
|
||||
case 5:
|
||||
w_s("success if oksofar printed before this in caps");
|
||||
break;
|
||||
}
|
||||
w_s("\n");
|
||||
|
||||
pi = &arr[0];
|
||||
pip = &arr[3];
|
||||
w_s("*pip-*pi: "); w_n(*pip-*pi,10); w_s(" 30\n");
|
||||
w_s("pip-pi: "); w_n(pip-pi,10); w_s(" 3\n");
|
||||
w_s("*pip: "); w_n( *pip, 10 ); w_s(" 40\n");
|
||||
w_s("*(pip-3): "); w_n(*(pip-3),10); w_s(" 10\n");
|
||||
w_s("*&arr[3]: "); w_n( *&arr[3], 10 ); w_s(" 40\n");
|
||||
// The following causes an address error, so it has been removed
|
||||
// and needs to be fixed
|
||||
w_s("*(&arr[3]-3): "); w_n(0/**(&arr[3]-3)*/,10); w_s(" 10 broken - causes address error\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
printt (t, str)
|
||||
int t;
|
||||
char *str;
|
||||
printt(t,str)
|
||||
int t;
|
||||
char *str;
|
||||
{
|
||||
printf("bool test on value %d %s\n", t, str);
|
||||
w_s("bool t test on value ");
|
||||
w_n(t,10);
|
||||
w_s(" ");
|
||||
w_s(str);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
#include <fcntl.h>
|
||||
|
||||
#define O_RDONLY 0x0000 /* open for reading only */
|
||||
#define O_WRONLY 0x0001 /* open for writing only */
|
||||
#define O_RDWR 0x0002 /* open for reading and writing */
|
||||
#define O_ACCMODE 0x0003 /* mask for above modes */
|
||||
|
||||
#define O_NONBLOCK 0x0004 /* no delay */
|
||||
#define O_APPEND 0x0008 /* set append mode */
|
||||
#define O_SHLOCK 0x0010 /* open with shared file lock */
|
||||
#define O_EXLOCK 0x0020 /* open with exclusive file lock */
|
||||
#define O_ASYNC 0x0040 /* signal pgrp when data ready */
|
||||
#define O_FSYNC 0x0080 /* synchronous writes */
|
||||
#define O_CREAT 0x0200 /* create if nonexistant */
|
||||
#define O_TRUNC 0x0400 /* truncate to zero length */
|
||||
#define O_EXCL 0x0800 /* error if already exists */
|
||||
|
||||
int aaa;
|
||||
int bbb;
|
||||
@@ -11,117 +25,126 @@ extern errno;
|
||||
|
||||
main()
|
||||
{
|
||||
char b;
|
||||
int la;
|
||||
unsigned int u1, u2;
|
||||
int s1, s2;
|
||||
unsigned char uc1, uc2;
|
||||
char sc1, sc2;
|
||||
int fd;
|
||||
char buffer[6];
|
||||
int ibuffer[7];
|
||||
char b;
|
||||
int la;
|
||||
unsigned int u1, u2;
|
||||
int s1, s2;
|
||||
unsigned char uc1, uc2;
|
||||
char sc1, sc2;
|
||||
int fd;
|
||||
char buffer[6];
|
||||
int ibuffer[7];
|
||||
|
||||
w_s( "sizeof(uc1): "); w_n( sizeof(uc1), 10 ); w_s( " 1\n" );
|
||||
w_s( "sizeof(sc1): "); w_n( sizeof(sc1), 10 ); w_s( " 1\n" );
|
||||
w_s( "sizeof(u1): "); w_n( sizeof(u1), 10 ); w_s( " 4\n" );
|
||||
w_s( "sizeof(s1): "); w_n( sizeof(s1), 10 ); w_s( " 4\n" );
|
||||
w_s( "sizeof(aaa): "); w_n( sizeof(aaa), 10 ); w_s( " 4\n" );
|
||||
w_s( "sizeof(bbb): "); w_n( sizeof(bbb), 10 ); w_s( " 4\n" );
|
||||
w_s( "sizeof(gc): "); w_n( sizeof(gc), 10 ); w_s( " 1\n" );
|
||||
w_s( "sizeof(buffer): "); w_n( sizeof(buffer), 10 ); w_s( " 6\n" );
|
||||
w_s( "sizeof(ibuffer): "); w_n( sizeof(ibuffer), 10 ); w_s( " 28\n" );
|
||||
w_s( "sizeof(char): "); w_n( sizeof(char), 10 ); w_s( " 1\n" );
|
||||
w_s( "sizeof(int): "); w_n( sizeof(int), 10 ); w_s( " 4\n" );
|
||||
w_s( "sizeof(gbuffer): "); w_n( sizeof(gbuffer), 10 ); w_s( " 3\n" );
|
||||
w_s( "sizeof(gibuffer): "); w_n( sizeof(gibuffer), 10 ); w_s( " 16\n" );
|
||||
// sizeof(ibuffer[0]) is not supported, so the following can be used...
|
||||
w_s( "sizeof(ibuffer)/sizeof(int): "); w_n( sizeof(ibuffer)/sizeof(int), 10 ); w_s( " 7\n" );
|
||||
|
||||
printf(" sizeof(uc1): %d 1\n", sizeof(uc1));
|
||||
printf(" sizeof(sc1): %d 1\n", sizeof(sc1));
|
||||
printf(" sizeof(u1): %d 4\n", sizeof(u1));
|
||||
printf(" sizeof(s1): %d 4\n", sizeof(s1));
|
||||
printf(" sizeof(aaa): %d 4\n", sizeof(aaa));
|
||||
printf(" sizeof(bbb): %d 4\n", sizeof(bbb));
|
||||
printf(" sizeof(gc): %d 1\n", sizeof(gc));
|
||||
printf(" sizeof(buffer): %d 6\n", sizeof(buffer));
|
||||
printf(" sizeof(ibuffer): %d 28\n", sizeof(ibuffer));
|
||||
printf(" sizeof(char): %d 1\n", sizeof(char));
|
||||
printf(" sizeof(int): %d 4\n", sizeof(int));
|
||||
printf(" sizeof(gbuffer): %d 3\n", sizeof(gbuffer));
|
||||
printf(" sizeof(gibuffer): %d 16\n", sizeof(gibuffer));
|
||||
// sizeof(ibuffer[0]) is not supported, so the following can be used...
|
||||
printf("sizeof(ibuffer)/sizeof(int): %d 7\n", sizeof(ibuffer)/sizeof(int));
|
||||
aaa = 1;
|
||||
bbb = 2;
|
||||
la = 4;
|
||||
|
||||
aaa = 1;
|
||||
bbb = 2;
|
||||
la = 4;
|
||||
printf("%d 1\n", aaa);
|
||||
printf("%d 2\n", bbb);
|
||||
printf("%d 4\n", la);
|
||||
|
||||
w_n(aaa,10);
|
||||
w_s(" 1\n");
|
||||
w_n(bbb,10);
|
||||
w_s(" 2\n");
|
||||
w_n(la,10);
|
||||
w_s(" 4\n");
|
||||
|
||||
uc1 = 0x80;
|
||||
sc1 = 0x80;
|
||||
s1 = uc1;
|
||||
s2 = sc1;
|
||||
printf("unsigned char (0x80) -> int: %d 128\n", s1);
|
||||
printf(" signed char (0x80) -> int: %d -128\n", s2);
|
||||
uc1 = 0x80;
|
||||
sc1 = 0x80;
|
||||
s1 = uc1;
|
||||
s2 = sc1;
|
||||
w_s( "unsigned char (0x80) -> int: "); w_n( s1, 10 ); w_s( " 128\n" );
|
||||
w_s( "signed char (0x80) -> int: "); w_n( s2, 10 ); w_s( " -128\n" );
|
||||
|
||||
u1 = uc1;
|
||||
u2 = sc1;
|
||||
printf("unsigned char (0x80) -> unsigned: %d 128\n", u1);
|
||||
printf(" signed char (0x80) -> unsigned: %d -128\n", u2);
|
||||
u1 = uc1;
|
||||
u2 = sc1;
|
||||
w_s( "unsigned char (0x80) -> unsigned: "); w_n( u1, 10 ); w_s( " 128\n" );
|
||||
w_s( "signed char (0x80) -> unsigned: "); w_n( u2, 10 ); w_s( " -128\n" );
|
||||
|
||||
la = errno;
|
||||
printf("errno: %d 0\n", la);
|
||||
la = errno;
|
||||
w_s("errno: "); w_n(la,10); w_s( " 0\n");
|
||||
|
||||
write( 1, "abcd ", 5 );
|
||||
la = errno;
|
||||
w_s("errno after good write call: "); w_n(la,10); w_s( " 0\n");
|
||||
|
||||
write( 10, "abcde", 5 );
|
||||
la = errno;
|
||||
w_s("errno after bad write call: "); w_n(la,10); w_s( " 9\n");
|
||||
|
||||
write( 1, "abcd ", 5 );
|
||||
la = errno;
|
||||
w_s("good write after failed should not overwrite errno: "); w_n(la,10); w_s( " 9\n");
|
||||
|
||||
errno = 0;
|
||||
write( 1, "abcd ", 5 );
|
||||
la = errno;
|
||||
w_s("good write after errno set to zero: "); w_n(la,10); w_s( " 0\n");
|
||||
|
||||
la = write( 1, "abcd ", 5 );
|
||||
w_s( "write() return: " ); w_n(la,10); w_s( " 5\n" );
|
||||
|
||||
la = write( 10, "abcd ", 5 );
|
||||
w_s( "write(bad fd) return: " ); w_n(la,10); w_s( " -1\n" );
|
||||
|
||||
write(1, "abcd ", 5);
|
||||
la = errno;
|
||||
printf("errno after good write call: %d 0\n", la);
|
||||
fd = open( "/a.txt", O_WRONLY|O_CREAT, 0666 );
|
||||
if( fd != -1 )
|
||||
{
|
||||
w_s("open success\n");
|
||||
la = write( fd, "abcd\n", 5 );
|
||||
if( la == 5 ) w_s( "write success\n" ); else w_s( "write failed\n" );
|
||||
la = close( fd );
|
||||
if( la != -1 ) w_s( "close success\n" ); else w_s( "close failed\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
w_s("open failed\n");
|
||||
}
|
||||
|
||||
write(10, "abcde", 5);
|
||||
la = errno;
|
||||
printf("errno after bad write call: %d 9\n", la);
|
||||
|
||||
write(1, "abcd ", 5);
|
||||
la = errno;
|
||||
printf("good write after failed should not overwrite errno: %d 9\n", la);
|
||||
|
||||
errno = 0;
|
||||
write(1, "abcd ", 5);
|
||||
la = errno;
|
||||
printf("good write after errno set to zero: %d 0\n", la);
|
||||
|
||||
la = write(1, "abcd ", 5);
|
||||
printf("write() return: %d 5\n", la);
|
||||
|
||||
la = write(10, "abcd ", 5);
|
||||
printf("write(bad fd) return: %d -1\n", la);
|
||||
|
||||
fd = open("/a.txt", O_WRONLY | O_CREAT, 0666);
|
||||
if (fd != -1) {
|
||||
printf("open success\n");
|
||||
la = write(fd, "abcd\n", 5);
|
||||
if (la == 5) printf("write success\n"); else printf("write failed\n");
|
||||
la = close(fd);
|
||||
if (la != -1) printf("close success\n"); else printf("close failed\n");
|
||||
} else {
|
||||
printf("open failed\n");
|
||||
}
|
||||
|
||||
buffer[0] = 0;
|
||||
buffer[1] = 0;
|
||||
buffer[2] = 0;
|
||||
buffer[3] = 0;
|
||||
buffer[4] = 0;
|
||||
buffer[5] = 0;
|
||||
|
||||
fd = open("/a.txt", O_RDONLY, 0666);
|
||||
if (fd != -1) {
|
||||
printf("open success\n");
|
||||
la = read(fd, buffer, 5);
|
||||
printf(buffer);
|
||||
if (la == 5) printf("read success\n"); else printf("read failed\n");
|
||||
la = close(fd);
|
||||
if (la != -1) printf("close success\n"); else printf("close failed\n");
|
||||
} else {
|
||||
printf("open failed\n");
|
||||
}
|
||||
|
||||
if (buffer[0] != 'a') printf("data0 readback from file MISMATCH\n");
|
||||
if (buffer[1] != 'b') printf("data1 readback from file MISMATCH\n");
|
||||
if (buffer[2] != 'c') printf("data2 readback from file MISMATCH\n");
|
||||
if (buffer[3] != 'd') printf("data3 readback from file MISMATCH\n");
|
||||
if (buffer[4] != '\n') printf("data4 readback from file MISMATCH\n");
|
||||
|
||||
if (buffer[0] != 'a' || buffer[1] != 'b' || buffer[2] != 'c' ||
|
||||
buffer[3] != 'd' || buffer[4] != '\n') {
|
||||
printf("data readback from file MISMATCH\n");
|
||||
} else {
|
||||
printf("data readback from file OK\n");
|
||||
}
|
||||
buffer[0] = 0;
|
||||
buffer[1] = 0;
|
||||
buffer[2] = 0;
|
||||
buffer[3] = 0;
|
||||
buffer[4] = 0;
|
||||
buffer[5] = 0;
|
||||
|
||||
fd = open( "/a.txt", O_RDONLY, 0666 );
|
||||
if( fd != -1 )
|
||||
{
|
||||
w_s("open success\n");
|
||||
la = read( fd, buffer, 5 );
|
||||
w_s( buffer );
|
||||
if( la == 5 ) w_s( "read success\n" ); else w_s( "read failed\n" );
|
||||
la = close( fd );
|
||||
if( la != -1 ) w_s( "close success\n" ); else w_s( "close failed\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
w_s("open failed\n");
|
||||
}
|
||||
|
||||
if( buffer[0] != 'a') w_s("data0 readback from file MISMATCH\n");
|
||||
if( buffer[1] != 'b') w_s("data1 readback from file MISMATCH\n");
|
||||
if( buffer[2] != 'c') w_s("data2 readback from file MISMATCH\n");
|
||||
if( buffer[3] != 'd') w_s("data3 readback from file MISMATCH\n");
|
||||
if( buffer[4] != '\n') w_s("data4 readback from file MISMATCH\n");
|
||||
|
||||
if( buffer[0] != 'a' || buffer[1] != 'b' || buffer[2] != 'c' || buffer[3] != 'd' || buffer[4] != '\n') w_s("data readback from file MISMATCH\n");
|
||||
else w_s("data readback from file OK\n");
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
main()
|
||||
{
|
||||
int t;
|
||||
|
||||
t = 0;
|
||||
if (t) printt(t, "failure"); else printt(t, "success");
|
||||
t = 1;
|
||||
if (t) printt(t, "success"); else printt(t, "failure");
|
||||
t = 8;
|
||||
if (t) printt(t, "success"); else printt(t, "failure");
|
||||
t = -2;
|
||||
if (t) printt(t, "success"); else printt(t, "failure");
|
||||
printf("\n");
|
||||
|
||||
t = 4;
|
||||
printf("switch test: ");
|
||||
switch (t) {
|
||||
case 3:
|
||||
printf("failure");
|
||||
break;
|
||||
case 4:
|
||||
printf("success");
|
||||
break;
|
||||
case 5:
|
||||
printf("failure");
|
||||
break;
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
printf("switch fallthrough test: ");
|
||||
switch (t) {
|
||||
case 3:
|
||||
printf("failure");
|
||||
break;
|
||||
case 4:
|
||||
printf("OKSOFAR: ");
|
||||
case 5:
|
||||
printf("success if oksofar printed before this in caps");
|
||||
break;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
printt (t, str)
|
||||
int t;
|
||||
char *str;
|
||||
{
|
||||
printf("bool test on value %d %s\n", t, str);
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
/*
|
||||
* Web server, written in SmallC.
|
||||
*
|
||||
* A simple web server that shows the value of the analog input pins.
|
||||
* using an Arduino Wiznet Ethernet shield.
|
||||
*
|
||||
* 18 Dec 2009 created by David A. Mellis
|
||||
* 4 Sep 2010 modified by Tom Igoe
|
||||
* 16 Apr 2012 ported to RetroBSD by Serge Vakulenko
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/gpio.h>
|
||||
#include <wiznet.h>
|
||||
|
||||
int client [CLIENT_SIZE];
|
||||
|
||||
char buf [80];
|
||||
|
||||
main()
|
||||
{
|
||||
/* Initialize the Ethernet server library
|
||||
* with the IP address and port you want to use
|
||||
* (port 80 is default for HTTP). */
|
||||
ethernet_init ();
|
||||
server_init (80);
|
||||
|
||||
for (;;) {
|
||||
/* Listen for incoming clients. */
|
||||
if (server_available (client)) {
|
||||
process_request();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
process_request()
|
||||
{
|
||||
int current_line_is_blank;
|
||||
int c, fd, pnum, value;
|
||||
|
||||
/* An http request ends with a blank line. */
|
||||
current_line_is_blank = 1;
|
||||
|
||||
/* Parse the http request. */
|
||||
while (client_connected (client)) {
|
||||
if (client_available (client)) {
|
||||
c = client_getc (client);
|
||||
|
||||
/* If you've gotten to the end of the line (received
|
||||
* a newline character) and the line is blank, the http
|
||||
* request has ended, so you can send a reply. */
|
||||
if (c == '\n' && current_line_is_blank)
|
||||
break;
|
||||
|
||||
if (c == '\n') {
|
||||
/* You're starting a new line. */
|
||||
current_line_is_blank = 1;
|
||||
}
|
||||
else if (c != '\r') {
|
||||
/* You've gotten a character on the current line. */
|
||||
current_line_is_blank = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Send a standard http response header. */
|
||||
client_puts (client, "HTTP/1.1 200 OK\n");
|
||||
client_puts (client, "Content-Type: text/html\n\n");
|
||||
|
||||
/* Output the value of each digital pin. */
|
||||
fd = open ("/dev/porta", O_RDONLY);
|
||||
if (fd < 0) {
|
||||
client_puts (client, "Failed to open /dev/porta\n");
|
||||
} else {
|
||||
for (pnum = 0; pnum < 6; pnum++) {
|
||||
value = ioctl (fd, GPIO_POLL | GPIO_PORT (pnum), 0);
|
||||
sprintf (buf, "PORT%c = 0x%04x <br />\n", pnum+'A', value);
|
||||
client_puts (client, buf);
|
||||
}
|
||||
close (fd);
|
||||
}
|
||||
|
||||
/* Give the web browser time to receive the data. */
|
||||
usleep (1000);
|
||||
|
||||
/* Close the connection. */
|
||||
client_stop (client);
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
CC = cc
|
||||
PROG = hello primelist primesum test1 test2 test3 gpio adc rain \
|
||||
q8
|
||||
|
||||
all: $(PROG)
|
||||
|
||||
hello: hello.c
|
||||
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) hello.c
|
||||
|
||||
primelist: primelist.c
|
||||
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) primelist.c
|
||||
|
||||
primesum: primesum.c
|
||||
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) primesum.c
|
||||
|
||||
gpio: gpio.c
|
||||
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) gpio.c
|
||||
|
||||
adc: adc.c
|
||||
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) adc.c
|
||||
|
||||
rain: rain.c
|
||||
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) rain.c
|
||||
|
||||
q8: q8.c
|
||||
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) q8.c
|
||||
|
||||
test1: test1.c
|
||||
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) test1.c
|
||||
|
||||
test2: test2.c
|
||||
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) test2.c
|
||||
|
||||
test3: test3.c
|
||||
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) test3.c
|
||||
|
||||
clean:
|
||||
rm -f *.o $(PROG)
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Example of reading ADC data.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
char buf[100];
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int i, fd, value;
|
||||
|
||||
for (i=0; i<16; i++) {
|
||||
sprintf(buf, "/dev/adc%d", i);
|
||||
fd = open(buf, O_RDWR);
|
||||
if (fd < 0) {
|
||||
printf("Error: unable to open %s\n", buf);
|
||||
} else {
|
||||
if (read(fd, buf, 20) > 0) {
|
||||
value = strtol (buf, 0, 0);
|
||||
printf("adc%-2d = %d\n", i, value);
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Example of polling general purpose i/o pins.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/gpio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int fd, pnum, value;
|
||||
|
||||
fd = open ("/dev/porta", O_RDWR);
|
||||
if (fd < 0) {
|
||||
perror ("/dev/porta");
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (pnum=0; pnum<7; pnum++) {
|
||||
value = ioctl (fd, GPIO_POLL | GPIO_PORT (pnum), 0);
|
||||
if (value < 0)
|
||||
perror ("GPIO_POLL");
|
||||
printf ("port%c = 0x%04x\n", pnum + 'A', value);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("Hello, Smaller C World!\n");
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Print the list of prime numbers up to 100.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
int isprime(int);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int n;
|
||||
|
||||
for (n=2; n<100; ++n) {
|
||||
if (isprime(n)) {
|
||||
printf("%d ", n);
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
int isprime(int n)
|
||||
{
|
||||
int j;
|
||||
|
||||
if (n == 2)
|
||||
return 1;
|
||||
|
||||
if (n % 2 == 0)
|
||||
return 0;
|
||||
|
||||
for (j=3; j*j<=n; j+=2)
|
||||
if (n % j == 0)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Compute the sum of prime numbers up to 10000.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
int isprime(int);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int sum, n;
|
||||
|
||||
sum = 0;
|
||||
for (n=2; n<10000; ++n) {
|
||||
if (isprime(n)) {
|
||||
sum += n;
|
||||
}
|
||||
}
|
||||
printf("Sum of primes less than 10000: %d\n", sum);
|
||||
}
|
||||
|
||||
int isprime(int n)
|
||||
{
|
||||
int j;
|
||||
|
||||
if (n == 2)
|
||||
return 1;
|
||||
|
||||
if (n % 2 == 0)
|
||||
return 0;
|
||||
|
||||
for (j=3; j*j<=n; j+=2)
|
||||
if (n % j == 0)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
@@ -1,209 +0,0 @@
|
||||
/*
|
||||
* Eight Queens puzzle
|
||||
*
|
||||
* (C) 2010 by Mark Sproul
|
||||
* Open source as per standard Arduino code
|
||||
* Modified by Pito 12/2012 for SmallC and then by Alexey Frunze for Smaller C
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
unsigned int gChessBoard[8];
|
||||
unsigned int gLoopCounter;
|
||||
int gValidCount;
|
||||
|
||||
int CheckCurrentBoard(void)
|
||||
{
|
||||
int ii;
|
||||
int jj;
|
||||
int theRow;
|
||||
int theLongRow;
|
||||
int theLongColumns;
|
||||
int bitCount;
|
||||
|
||||
//* we know we have 1 in each row,
|
||||
//* Check for 1 in each column
|
||||
theRow = 0;
|
||||
for (ii=0; ii<8; ii++) {
|
||||
theRow |= gChessBoard[ii];
|
||||
}
|
||||
if (theRow != 0x0ff) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//* we have 1 in each column, now check the diagonals
|
||||
theLongColumns = 0;
|
||||
for (ii=0; ii<8; ii++) {
|
||||
theLongRow = gChessBoard[ii] & 0x0ff;
|
||||
theLongRow = theLongRow << ii;
|
||||
|
||||
theLongColumns |= theLongRow;
|
||||
}
|
||||
|
||||
//* now count the bits
|
||||
bitCount = 0;
|
||||
for (ii=0; ii<16; ii++) {
|
||||
if ((theLongColumns & 0x01) == 0x01) {
|
||||
bitCount++;
|
||||
}
|
||||
theLongColumns = theLongColumns >> 1;
|
||||
}
|
||||
|
||||
if (bitCount != 8) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//* we now have to check the other diagonal
|
||||
theLongColumns = 0;
|
||||
for (ii=0; ii<8; ii++) {
|
||||
theLongRow = gChessBoard[ii] & 0x0ff;
|
||||
theLongRow = theLongRow << 8;
|
||||
theLongRow = theLongRow >> ii;
|
||||
|
||||
theLongColumns |= theLongRow;
|
||||
}
|
||||
|
||||
//* now count the bits
|
||||
bitCount = 0;
|
||||
for (ii=0; ii<16; ii++) {
|
||||
if ((theLongColumns & 0x01) == 0x01) {
|
||||
bitCount++;
|
||||
}
|
||||
theLongColumns = theLongColumns >> 1;
|
||||
}
|
||||
|
||||
if (bitCount != 8) {
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int CheckForDone(void)
|
||||
{
|
||||
int ii;
|
||||
int weAreDone;
|
||||
int theRow;
|
||||
|
||||
weAreDone = FALSE;
|
||||
|
||||
//* we know we have 1 in each row,
|
||||
//* Check for 1 in each column
|
||||
theRow = 0;
|
||||
for (ii=0; ii<8; ii++) {
|
||||
theRow |= gChessBoard[ii];
|
||||
}
|
||||
|
||||
if (theRow == 0x01) {
|
||||
weAreDone = TRUE;
|
||||
}
|
||||
return weAreDone;
|
||||
}
|
||||
|
||||
void RotateQueens(void)
|
||||
{
|
||||
int ii;
|
||||
int keepGoing;
|
||||
int theRow;
|
||||
|
||||
ii = 0;
|
||||
keepGoing = TRUE;
|
||||
while (keepGoing && (ii < 8)) {
|
||||
theRow = gChessBoard[ii] & 0x0ff;
|
||||
theRow = (theRow >> 1) & 0x0ff;
|
||||
if (theRow != 0) {
|
||||
gChessBoard[ii] = theRow;
|
||||
keepGoing = FALSE;
|
||||
} else {
|
||||
gChessBoard[ii] = 0x080;
|
||||
}
|
||||
ii++;
|
||||
}
|
||||
}
|
||||
|
||||
void PrintChessBoard(void)
|
||||
{
|
||||
int ii;
|
||||
int jj;
|
||||
int theRow;
|
||||
char textString[32];
|
||||
|
||||
printf("\nLoop= %d\n", gLoopCounter);
|
||||
printf("Solution count= %d\n", gValidCount);
|
||||
|
||||
printf("+----------------+\n");
|
||||
for (ii=0; ii<8; ii++) {
|
||||
theRow = gChessBoard[ii];
|
||||
|
||||
printf("|");
|
||||
for (jj=0; jj<8; jj++) {
|
||||
if (theRow & 0x080) {
|
||||
printf("Q ");
|
||||
} else {
|
||||
printf(". ");
|
||||
}
|
||||
theRow = theRow << 1;
|
||||
}
|
||||
printf("|\n");
|
||||
}
|
||||
printf("+----------------+\n");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int ii;
|
||||
|
||||
printf("\nEight Queens brute force");
|
||||
printf("\n************************\n");
|
||||
//* put the 8 queens on the board, 1 in each row
|
||||
for (ii=0; ii<8; ii++) {
|
||||
gChessBoard[ii] = 0x080;
|
||||
}
|
||||
PrintChessBoard();
|
||||
|
||||
gLoopCounter = 0;
|
||||
gValidCount = 0;
|
||||
|
||||
|
||||
while (1) {
|
||||
gLoopCounter++;
|
||||
|
||||
if (CheckCurrentBoard()) {
|
||||
gValidCount++;
|
||||
PrintChessBoard();
|
||||
} else if ((gLoopCounter % 1000) == 0) {
|
||||
//PrintChessBoard();
|
||||
}
|
||||
|
||||
RotateQueens();
|
||||
if (CheckForDone()) {
|
||||
//int elapsedSeconds;
|
||||
//int elapsedMinutes;
|
||||
//int elapsedHours;
|
||||
|
||||
//elapsedSeconds = millis() / 1000;
|
||||
//elapsedMinutes = elapsedSeconds / 60;
|
||||
//elapsedHours = elapsedMinutes / 60;
|
||||
|
||||
printf("----------------------------------\n");
|
||||
printf("All done\n");
|
||||
|
||||
PrintChessBoard();
|
||||
printf("----------------------------------\n");
|
||||
|
||||
//Serial.print("total seconds=");
|
||||
//Serial.println(elapsedSeconds);
|
||||
|
||||
//Serial.print("hours=");
|
||||
//Serial.println(elapsedHours);
|
||||
|
||||
//Serial.print("minutes=");
|
||||
//Serial.println(elapsedMinutes % 60);
|
||||
|
||||
//Serial.print("seconds=");
|
||||
//Serial.println(elapsedSeconds % 60);
|
||||
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
/*
|
||||
* Example of using termcap library for SmallC.
|
||||
* 11/3/1980 EPS/CITHEP
|
||||
*
|
||||
* Copyright (c) 1980 Regents of the University of California.
|
||||
* All rights reserved. The Berkeley software License Agreement
|
||||
* specifies the terms and conditions for redistribution.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define CO 80 /* number of columns */
|
||||
#define LI 24 /* number of lines */
|
||||
|
||||
#define CL "\33[H\33[J" /* clear the screen */
|
||||
#define CM "\33[%u;%uH" /* move the cursor to row, column */
|
||||
#define BC "\b" /* move cursor left */
|
||||
#define DN "\33[B" /* move cursor down */
|
||||
#define ND " " /* move cursor right */
|
||||
|
||||
int xpos[5], ypos[5];
|
||||
char outbuf[BUFSIZ];
|
||||
|
||||
void moveto(int col, int row)
|
||||
{
|
||||
printf(CM, row, col);
|
||||
}
|
||||
|
||||
void onsig(int n)
|
||||
{
|
||||
moveto(0, LI - 1);
|
||||
fflush(stdout);
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int x, y, j;
|
||||
|
||||
setbuf(stdout, outbuf);
|
||||
for (j = SIGHUP; j <= SIGTERM; j++)
|
||||
if (signal(j, SIG_IGN) != SIG_IGN)
|
||||
signal(j, onsig);
|
||||
|
||||
fputs(CL, stdout);
|
||||
fflush(stdout);
|
||||
for (j = 5; --j >= 0; ) {
|
||||
xpos[j] = 2 + rand() % (CO - 4);
|
||||
ypos[j] = 2 + rand() % (LI - 4);
|
||||
}
|
||||
for (j = 0; ; ) {
|
||||
x = 2 + rand() % (CO - 4);
|
||||
y = 2 + rand() % (LI - 4);
|
||||
moveto(x, y);
|
||||
putchar('.');
|
||||
moveto(xpos[j], ypos[j]);
|
||||
putchar('o');
|
||||
if (j == 0)
|
||||
j = 4;
|
||||
else
|
||||
--j;
|
||||
moveto(xpos[j], ypos[j]);
|
||||
putchar('O');
|
||||
if (j == 0)
|
||||
j = 4;
|
||||
else
|
||||
--j;
|
||||
moveto(xpos[j], ypos[j]-1);
|
||||
putchar('-');
|
||||
fputs(DN, stdout);
|
||||
fputs(BC, stdout);
|
||||
fputs(BC, stdout);
|
||||
fputs("|.|", stdout);
|
||||
fputs(DN, stdout);
|
||||
fputs(BC, stdout);
|
||||
fputs(BC, stdout);
|
||||
putchar('-');
|
||||
if (j == 0)
|
||||
j = 4;
|
||||
else
|
||||
--j;
|
||||
moveto(xpos[j], ypos[j]-2);
|
||||
putchar('-');
|
||||
fputs(DN, stdout);
|
||||
fputs(BC, stdout);
|
||||
fputs(BC, stdout);
|
||||
fputs("/ \\", stdout);
|
||||
moveto(xpos[j]-2, ypos[j]);
|
||||
fputs("| O |", stdout);
|
||||
moveto(xpos[j]-1, ypos[j]+1);
|
||||
fputs("\\ /", stdout);
|
||||
fputs(DN, stdout);
|
||||
fputs(BC, stdout);
|
||||
fputs(BC, stdout);
|
||||
putchar('-');
|
||||
if (j == 0)
|
||||
j = 4;
|
||||
else
|
||||
--j;
|
||||
moveto(xpos[j], ypos[j]-2);
|
||||
putchar(' ');
|
||||
fputs(DN, stdout);
|
||||
fputs(BC, stdout);
|
||||
fputs(BC, stdout);
|
||||
putchar(' ');
|
||||
fputs(ND, stdout);
|
||||
putchar(' ');
|
||||
moveto(xpos[j]-2, ypos[j]);
|
||||
putchar(' ');
|
||||
fputs(ND, stdout);
|
||||
putchar(' ');
|
||||
fputs(ND, stdout);
|
||||
putchar(' ');
|
||||
moveto(xpos[j]-1, ypos[j]+1);
|
||||
putchar(' ');
|
||||
fputs(ND, stdout);
|
||||
putchar(' ');
|
||||
fputs(DN, stdout);
|
||||
fputs(BC, stdout);
|
||||
fputs(BC, stdout);
|
||||
putchar(' ');
|
||||
xpos[j] = x;
|
||||
ypos[j] = y;
|
||||
fflush(stdout);
|
||||
usleep(100000);
|
||||
}
|
||||
}
|
||||
@@ -1,214 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int ga[5];
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int a, b, c, d;
|
||||
int arr[5];
|
||||
int *pi;
|
||||
char arrc[5];
|
||||
char *pic;
|
||||
int s1, s2;
|
||||
int z;
|
||||
int t;
|
||||
int *pip;
|
||||
int *picp;
|
||||
int e1, e2;
|
||||
|
||||
ga[0] = 10;
|
||||
ga[1] = 20;
|
||||
ga[2] = 30;
|
||||
ga[3] = 40;
|
||||
ga[4] = 50;
|
||||
|
||||
a = 21;
|
||||
b = 31;
|
||||
c = 71;
|
||||
d = 82;
|
||||
|
||||
arr[0] = 10;
|
||||
arr[1] = 20;
|
||||
arr[2] = 30;
|
||||
arr[3] = 40;
|
||||
arr[4] = 50;
|
||||
pi = &arr[0];
|
||||
|
||||
arrc[0] = 13;
|
||||
arrc[1] = 23;
|
||||
arrc[2] = 33;
|
||||
arrc[3] = 43;
|
||||
arrc[4] = 53;
|
||||
pic = &arrc[0];
|
||||
|
||||
printf(" 21 + 31 = %d (52)\n", a + b);
|
||||
printf(" 21 - 31 = %d (-10)\n", a - b);
|
||||
printf(" 21 & 71 = %d (5)\n", a & c);
|
||||
printf(" 21 | 82 = %d (87)\n", a | d);
|
||||
printf(" 21 ^ 82 = %d (71)\n", a ^ d);
|
||||
printf(" 21 * 82 = %d (1722)\n", a * d);
|
||||
printf(" 82 %% 21 = %d (19)\n", d % a);
|
||||
printf(" 82 / 21 = %d (3)\n", d / a);
|
||||
printf(" *pi = %d (10)\n", *pi);
|
||||
printf(" *pi + 1 = %d (11)\n", *pi + 1);
|
||||
printf(" *(pi + 1) = %d (20)\n", *(pi + 1));
|
||||
printf("&arr[3] - &arr[0] = %d (3)\n", &arr[3] - &arr[0]);
|
||||
printf(" arr[3]-arr[0] = %d (30)\n", arr[3] - arr[0]);
|
||||
printf(" arr[3]+arr[0] = %d (50)\n", arr[3] + arr[0]);
|
||||
printf(" &ga[3] - &ga[0] = %d (3)\n", &ga[3] - &ga[0]);
|
||||
printf(" ga[3]-ga[0] = %d (30)\n", ga[3] - ga[0]);
|
||||
printf(" ga[3]+ga[0] = %d (50)\n", ga[3] + ga[0]);
|
||||
printf("\n");
|
||||
|
||||
printf(" *pic = %d (13)\n", *pic);
|
||||
printf(" *pic + 1 = %d (14)\n", *pic+1);
|
||||
printf(" *(pic + 1) = %d (23)\n", *(pic+1));
|
||||
printf("&arrc[3] - &arrc[0] = %d (3)\n", &arrc[3]-&arrc[0]);
|
||||
printf("\n");
|
||||
|
||||
s1 = 3;
|
||||
s2 = -200;
|
||||
printf(" 82 << 3 = %d (656)\n", d << s1);
|
||||
printf(" 82 >> 3 = %d (10)\n", d >> s1);
|
||||
printf("-200 >> 3 = %d (-25)\n", s2 >> s1);
|
||||
printf("-200 << 3 = %d (-1600)\n", s2 << s1);
|
||||
printf("\n");
|
||||
|
||||
printf("-s1 = %d (-3)\n", -s1);
|
||||
printf("-s2 = %d (200)\n", -s2);
|
||||
printf("\n");
|
||||
|
||||
printf("~82 = %d (-83)\n", ~d);
|
||||
printf("\n");
|
||||
|
||||
z = 0;
|
||||
printf("!82 = %d (0)\n", !d);
|
||||
printf(" !0 = %d (1)\n", !z);
|
||||
printf("\n");
|
||||
|
||||
printf(" 0 && 0 = %d (0)\n", z && z);
|
||||
printf(" 0 && 21 = %d (0)\n", z && a);
|
||||
printf(" 3 && 21 = %d (1)\n", s1 && a);
|
||||
printf("21 && 3 = %d (1)\n", a && s1);
|
||||
printf("\n");
|
||||
|
||||
printf(" 0 || 0 = %d (0)\n", z || z);
|
||||
printf(" 0 || 21 = %d (1)\n", z || a);
|
||||
printf(" 3 || 21 = %d (1)\n", s1 || a);
|
||||
printf("21 || 3 = %d (1)\n", a || s1);
|
||||
printf("\n");
|
||||
|
||||
pi = 4;
|
||||
printf("pi++ = %d (4)\n", pi++);
|
||||
printf(" pi = %d (8)\n", pi);
|
||||
printf("++pi = %d (12)\n", ++pi);
|
||||
printf("pi-- = %d (12)\n", pi--);
|
||||
printf(" pi = %d (8)\n", pi);
|
||||
printf("--pi = %d (4)\n", --pi);
|
||||
printf("\n");
|
||||
|
||||
pic = 4;
|
||||
printf("pic++ = %d (4)\n", pic++);
|
||||
printf(" pic = %d (5)\n", pic);
|
||||
printf("++pic = %d (6)\n", ++pic);
|
||||
printf("pic-- = %d (6)\n", pic--);
|
||||
printf(" pic = %d (5)\n", pic);
|
||||
printf("--pic = %d (4)\n", --pic);
|
||||
printf("\n");
|
||||
|
||||
t = 4;
|
||||
printf("t++ = %d (4)\n", t++);
|
||||
printf(" t = %d (5)\n", t);
|
||||
printf("++t = %d (6)\n", ++t);
|
||||
printf("t-- = %d (6)\n", t--);
|
||||
printf(" t = %d (5)\n", t);
|
||||
printf("--t = %d (4)\n", --t);
|
||||
printf("\n");
|
||||
|
||||
t = 4;
|
||||
printf(" t==4 = %d (1)\n", t == 4);
|
||||
printf(" t==3 = %d (0)\n", t == 3);
|
||||
printf(" t==5 = %d (0)\n", t == 5);
|
||||
t = -4;
|
||||
printf("t==-4 = %d (1)\n", t == -4);
|
||||
printf("t==-3 = %d (0)\n", t == -3);
|
||||
printf("t==-5 = %d (0)\n", t == -5);
|
||||
printf(" t==4 = %d (0)\n", t == 4);
|
||||
printf(" t==3 = %d (0)\n", t == 3);
|
||||
printf(" t==5 = %d (0)\n", t == 5);
|
||||
printf("\n");
|
||||
|
||||
t = 4;
|
||||
printf(" t!=4 = %d (0)\n", t != 4);
|
||||
printf(" t!=3 = %d (1)\n", t != 3);
|
||||
printf(" t!=5 = %d (1)\n", t != 5);
|
||||
t = -4;
|
||||
printf("t!=-4 = %d (0)\n", t != -4);
|
||||
printf("t!=-3 = %d (1)\n", t != -3);
|
||||
printf("t!=-5 = %d (1)\n", t != -5);
|
||||
printf(" t!=4 = %d (1)\n", t != 4);
|
||||
printf(" t!=3 = %d (1)\n", t != 3);
|
||||
printf(" t!=5 = %d (1)\n", t != 5);
|
||||
printf("\n");
|
||||
|
||||
t = 4;
|
||||
printf(" t<4 = %d (0)\n", t < 4);
|
||||
printf(" t<3 = %d (0)\n", t < 3);
|
||||
printf(" t<5 = %d (1)\n", t < 5);
|
||||
printf("t<-1 = %d (0)\n", t < -1);
|
||||
printf("\n");
|
||||
|
||||
printf(" t<=4 = %d (1)\n", t <= 4);
|
||||
printf(" t<=3 = %d (0)\n", t <= 3);
|
||||
printf(" t<=5 = %d (1)\n", t <= 5);
|
||||
printf("t<=-1 = %d (0)\n", t <= -1);
|
||||
printf("\n");
|
||||
|
||||
t = 4;
|
||||
printf(" t>4 = %d (0)\n", t > 4);
|
||||
printf(" t>3 = %d (1)\n", t > 3);
|
||||
printf(" t>5 = %d (0)\n", t > 5);
|
||||
printf("t>-1 = %d (1)\n", t > -1);
|
||||
printf("\n");
|
||||
|
||||
printf(" t>=4 = %d (1)\n", t >= 4);
|
||||
printf(" t>=3 = %d (1)\n", t >= 3);
|
||||
printf(" t>=5 = %d (0)\n", t >= 5);
|
||||
printf("t>=-1 = %d (1)\n", t >= -1);
|
||||
printf("\n");
|
||||
|
||||
pi = -100;
|
||||
printf(" pi<4 = %d (0)\n", pi < (int*)4);
|
||||
printf(" pi<3 = %d (0)\n", pi < (int*)3);
|
||||
printf("pi<-100 = %d (0)\n", pi < (int*)-100);
|
||||
printf(" pi<-1 = %d (1)\n", pi < (int*)-1);
|
||||
printf("\n");
|
||||
|
||||
printf(" pi<=4 = %d (0)\n", pi <= (int*)4);
|
||||
printf(" pi<=3 = %d (0)\n", pi <= (int*)3);
|
||||
printf("pi<=-100 = %d (1)\n", pi <= (int*)-100);
|
||||
printf(" pi<=-1 = %d (1)\n", pi <= (int*)-1);
|
||||
printf("\n");
|
||||
|
||||
pi = -100;
|
||||
printf(" pi>4 = %d (1)\n", pi > (int*)4);
|
||||
printf(" pi>3 = %d (1)\n", pi > (int*)3);
|
||||
printf("pi>-100 = %d (0)\n", pi > (int*)-100);
|
||||
printf(" pi>-1 = %d (0)\n", pi > (int*)-1);
|
||||
printf("\n");
|
||||
|
||||
printf(" pi>=4 = %d (1)\n", pi >= (int*)4);
|
||||
printf(" pi>=3 = %d (1)\n", pi >= (int*)3);
|
||||
printf("pi>=-100 = %d (1)\n", pi >= (int*)-100);
|
||||
printf(" pi>=-1 = %d (0)\n", pi >= (int*)-1);
|
||||
printf("\n");
|
||||
|
||||
pi = &arr[0];
|
||||
pip = &arr[3];
|
||||
printf(" *pip - *pi: %d (30)\n", *pip - *pi);
|
||||
printf(" pip - pi: %d (3)\n", pip - pi);
|
||||
printf(" *pip: %d (40)\n", *pip);
|
||||
printf(" *(pip - 3): %d (10)\n", *(pip - 3));
|
||||
printf(" *&arr[3]: %d (40)\n", *&arr[3]);
|
||||
printf("*(&arr[3] - 3): %d (10)\n", *(&arr[3]-3));
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int aaa;
|
||||
int bbb;
|
||||
int ccc;
|
||||
char gc;
|
||||
char gbuffer[3];
|
||||
int gibuffer[4];
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char b;
|
||||
int la;
|
||||
unsigned int u1, u2;
|
||||
int s1, s2;
|
||||
unsigned char uc1, uc2;
|
||||
char sc1, sc2;
|
||||
int fd;
|
||||
char buffer[6];
|
||||
int ibuffer[7];
|
||||
|
||||
printf(" sizeof(uc1): %d 1\n", sizeof(uc1));
|
||||
printf(" sizeof(sc1): %d 1\n", sizeof(sc1));
|
||||
printf(" sizeof(u1): %d 4\n", sizeof(u1));
|
||||
printf(" sizeof(s1): %d 4\n", sizeof(s1));
|
||||
printf(" sizeof(aaa): %d 4\n", sizeof(aaa));
|
||||
printf(" sizeof(bbb): %d 4\n", sizeof(bbb));
|
||||
printf(" sizeof(gc): %d 1\n", sizeof(gc));
|
||||
printf(" sizeof(buffer): %d 6\n", sizeof(buffer));
|
||||
printf(" sizeof(ibuffer): %d 28\n", sizeof(ibuffer));
|
||||
printf(" sizeof(char): %d 1\n", sizeof(char));
|
||||
printf(" sizeof(int): %d 4\n", sizeof(int));
|
||||
printf(" sizeof(gbuffer): %d 3\n", sizeof(gbuffer));
|
||||
printf(" sizeof(gibuffer): %d 16\n", sizeof(gibuffer));
|
||||
// sizeof(ibuffer[0]) is not supported, so the following can be used...
|
||||
printf("sizeof(ibuffer)/sizeof(int): %d 7\n", sizeof(ibuffer)/sizeof(int));
|
||||
|
||||
aaa = 1;
|
||||
bbb = 2;
|
||||
la = 4;
|
||||
printf("%d 1\n", aaa);
|
||||
printf("%d 2\n", bbb);
|
||||
printf("%d 4\n", la);
|
||||
|
||||
uc1 = 0x80;
|
||||
sc1 = 0x80;
|
||||
s1 = uc1;
|
||||
s2 = sc1;
|
||||
printf("unsigned char (0x80) -> int: %d 128\n", s1);
|
||||
printf(" signed char (0x80) -> int: %d -128\n", s2);
|
||||
|
||||
u1 = uc1;
|
||||
u2 = sc1;
|
||||
printf("unsigned char (0x80) -> unsigned: %d 128\n", u1);
|
||||
printf(" signed char (0x80) -> unsigned: %d -128\n", u2);
|
||||
|
||||
la = errno;
|
||||
printf("errno: %d 0\n", la);
|
||||
|
||||
write(1, "abcd ", 5);
|
||||
la = errno;
|
||||
printf("errno after good write call: %d 0\n", la);
|
||||
|
||||
write(10, "abcde", 5);
|
||||
la = errno;
|
||||
printf("errno after bad write call: %d 9\n", la);
|
||||
|
||||
write(1, "abcd ", 5);
|
||||
la = errno;
|
||||
printf("good write after failed should not overwrite errno: %d 9\n", la);
|
||||
|
||||
errno = 0;
|
||||
write(1, "abcd ", 5);
|
||||
la = errno;
|
||||
printf("good write after errno set to zero: %d 0\n", la);
|
||||
|
||||
la = write(1, "abcd ", 5);
|
||||
printf("write() return: %d 5\n", la);
|
||||
|
||||
la = write(10, "abcd ", 5);
|
||||
printf("write(bad fd) return: %d -1\n", la);
|
||||
|
||||
fd = open("/a.txt", O_WRONLY | O_CREAT, 0666);
|
||||
if (fd != -1) {
|
||||
printf("open success\n");
|
||||
la = write(fd, "abcd\n", 5);
|
||||
if (la == 5) printf("write success\n"); else printf("write failed\n");
|
||||
la = close(fd);
|
||||
if (la != -1) printf("close success\n"); else printf("close failed\n");
|
||||
} else {
|
||||
printf("open failed\n");
|
||||
}
|
||||
|
||||
buffer[0] = 0;
|
||||
buffer[1] = 0;
|
||||
buffer[2] = 0;
|
||||
buffer[3] = 0;
|
||||
buffer[4] = 0;
|
||||
buffer[5] = 0;
|
||||
|
||||
fd = open("/a.txt", O_RDONLY, 0666);
|
||||
if (fd != -1) {
|
||||
printf("open success\n");
|
||||
la = read(fd, buffer, 5);
|
||||
printf(buffer);
|
||||
if (la == 5) printf("read success\n"); else printf("read failed\n");
|
||||
la = close(fd);
|
||||
if (la != -1) printf("close success\n"); else printf("close failed\n");
|
||||
} else {
|
||||
printf("open failed\n");
|
||||
}
|
||||
|
||||
if (buffer[0] != 'a') printf("data0 readback from file MISMATCH\n");
|
||||
if (buffer[1] != 'b') printf("data1 readback from file MISMATCH\n");
|
||||
if (buffer[2] != 'c') printf("data2 readback from file MISMATCH\n");
|
||||
if (buffer[3] != 'd') printf("data3 readback from file MISMATCH\n");
|
||||
if (buffer[4] != '\n') printf("data4 readback from file MISMATCH\n");
|
||||
|
||||
if (buffer[0] != 'a' || buffer[1] != 'b' || buffer[2] != 'c' ||
|
||||
buffer[3] != 'd' || buffer[4] != '\n') {
|
||||
printf("data readback from file MISMATCH\n");
|
||||
} else {
|
||||
printf("data readback from file OK\n");
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void printt(int t, char* str);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int t;
|
||||
|
||||
t = 0;
|
||||
if (t) printt(t, "failure"); else printt(t, "success");
|
||||
t = 1;
|
||||
if (t) printt(t, "success"); else printt(t, "failure");
|
||||
t = 8;
|
||||
if (t) printt(t, "success"); else printt(t, "failure");
|
||||
t = -2;
|
||||
if (t) printt(t, "success"); else printt(t, "failure");
|
||||
printf("\n");
|
||||
|
||||
t = 4;
|
||||
printf("switch test: ");
|
||||
switch (t) {
|
||||
case 3:
|
||||
printf("failure");
|
||||
break;
|
||||
case 4:
|
||||
printf("success");
|
||||
break;
|
||||
case 5:
|
||||
printf("failure");
|
||||
break;
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
printf("switch fallthrough test: ");
|
||||
switch (t) {
|
||||
case 3:
|
||||
printf("failure");
|
||||
break;
|
||||
case 4:
|
||||
printf("OKSOFAR: ");
|
||||
case 5:
|
||||
printf("success if oksofar printed before this in caps");
|
||||
break;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void printt(int t, char* str)
|
||||
{
|
||||
printf("bool test on value %d %s\n", t, str);
|
||||
}
|
||||
@@ -9,7 +9,7 @@ include $(TOPSRC)/target.mk
|
||||
# Programs that live in subdirectories, and have makefiles of their own.
|
||||
#
|
||||
SUBDIR = startup-$(MACHINE) libc libm libutil libtermlib libcurses \
|
||||
libvmf libwiznet share cmd games man
|
||||
libvmf libwiznet share cmd games
|
||||
|
||||
all: $(SUBDIR)
|
||||
|
||||
@@ -21,7 +21,7 @@ FRC:
|
||||
install: elf32-mips.ld
|
||||
-for i in $(SUBDIR); do \
|
||||
$(MAKE) -C $$i DESTDIR=$(DESTDIR) all install; done
|
||||
# cp -p elf32-mips.ld $(DESTDIR)/lib/elf32-mips.ld
|
||||
cp -p elf32-mips.ld $(DESTDIR)/lib/elf32-mips.ld
|
||||
|
||||
clean:
|
||||
rm -f a.out core *.s *.o *.a *~
|
||||
|
||||
72
src/cmd/.gitignore
vendored
72
src/cmd/.gitignore
vendored
@@ -1,72 +0,0 @@
|
||||
basename
|
||||
bc
|
||||
cal
|
||||
cat
|
||||
cb
|
||||
chgrp
|
||||
chmod
|
||||
cmp
|
||||
col
|
||||
comm
|
||||
cp
|
||||
dd
|
||||
df
|
||||
diskspeed
|
||||
du
|
||||
echo
|
||||
ed
|
||||
egrep
|
||||
expr
|
||||
expr.c
|
||||
false
|
||||
fgrep
|
||||
file
|
||||
grep
|
||||
head
|
||||
hostid
|
||||
iostat
|
||||
join
|
||||
kill
|
||||
last
|
||||
ln
|
||||
mail
|
||||
mesg
|
||||
mkdir
|
||||
mv
|
||||
nice
|
||||
nohup
|
||||
od
|
||||
pagesize
|
||||
pr
|
||||
printenv
|
||||
ps
|
||||
pwd
|
||||
rev
|
||||
rm
|
||||
rmail
|
||||
rmdir
|
||||
size
|
||||
sleep
|
||||
sort
|
||||
split
|
||||
strip
|
||||
su
|
||||
sum
|
||||
sync
|
||||
tail
|
||||
tar
|
||||
tee
|
||||
time
|
||||
touch
|
||||
tr
|
||||
true
|
||||
tsort
|
||||
tty
|
||||
uniq
|
||||
vmstat
|
||||
w
|
||||
wall
|
||||
wc
|
||||
whereis
|
||||
who
|
||||
write
|
||||
@@ -10,14 +10,13 @@ CFLAGS += -Werror
|
||||
|
||||
# Programs that live in subdirectories, and have makefiles of their own.
|
||||
# /bin
|
||||
SUBDIR = adb adc-demo aout ar as awk basic cc chflags chpass \
|
||||
cpp dc diff emg env fdisk find forth fstat glcdtest \
|
||||
hostname id la lcc lcpp ld ls login make man med \
|
||||
more nm passwd picoc portio printf pwm \
|
||||
rdprof ranlib re renice retroforth scm setty sl \
|
||||
sed sh smallc smlrc stty sysctl test uname wiznet xargs \
|
||||
zmodem gtest msec unixbench cron compress date2 tip \
|
||||
talloc devupdate uucp smux
|
||||
SUBDIR = adb adc-demo ar as awk basic cc chflags chpass \
|
||||
cpp dc diff env find forth fstat glcdtest hostname \
|
||||
id la lcc lcpp ld ls login make man med \
|
||||
more nm passwd portio printf pwm \
|
||||
ranlib re renice retroforth scm setty sl \
|
||||
sed sh smallc stty sysctl test uname wiznet xargs \
|
||||
zmodem gtest cron uflash_r picoc-1 lccom-1
|
||||
|
||||
# /sbin
|
||||
SUBDIR += chown chroot disktool fsck getty init \
|
||||
@@ -33,11 +32,11 @@ SCRIPT = false nohup true #lorder mkdep
|
||||
# C programs that live in the current directory and do not need
|
||||
# explicit make lines.
|
||||
#
|
||||
STD = basename cal cat cb chgrp chmod cmp col comm cp dd \
|
||||
diskspeed du echo ed fgrep file grep head hostid join \
|
||||
kill last ln mesg mkdir mv nice od pagesize pr printenv \
|
||||
pwd rev rm rmail rmdir size sleep sort split sum sync \
|
||||
tail tar tee time touch tr tsort tty uniq w wc whereis who
|
||||
STD = basename cal cat cb chgrp chmod cmp col comm cp date dd du \
|
||||
echo ed fgrep file grep head hostid join kill last ln \
|
||||
mesg mkdir mv nice od pagesize pr printenv pwd rev rm rmail rmdir \
|
||||
size sleep sort split sum sync tail tar tee time touch tr \
|
||||
tsort tty uniq w wc whereis who uflash
|
||||
|
||||
# C programs that live in the current directory and need explicit make lines.
|
||||
#
|
||||
|
||||
1
src/cmd/adb/.gitignore
vendored
1
src/cmd/adb/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
adb
|
||||
@@ -1,7 +1,6 @@
|
||||
TOPSRC = $(shell cd ../../..; pwd)
|
||||
include $(TOPSRC)/target.mk
|
||||
#include $(TOPSRC)/cross.mk
|
||||
#CFLAGS = -DCROSS -I$(TOPSRC)/include -I/usr/include -D__mips__ -ggdb3
|
||||
|
||||
OBJS = message.o access.o command.o expr.o findfn.o format.o input.o \
|
||||
main.o opset.o output.o pcs.o print.o \
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
* File handling and access routines
|
||||
*/
|
||||
#include "defs.h"
|
||||
#include <fcntl.h>
|
||||
|
||||
static int
|
||||
within(adr, lbd, ubd)
|
||||
@@ -60,7 +59,7 @@ acces(mode, adr, space, value)
|
||||
long adr;
|
||||
{
|
||||
int w, w1, pmode, rd, file;
|
||||
BKPTR bkptr;
|
||||
BKPTR bkptr, scanbkpt();
|
||||
|
||||
if (space == NSP)
|
||||
return 0;
|
||||
@@ -90,7 +89,7 @@ acces(mode, adr, space, value)
|
||||
return w;
|
||||
}
|
||||
w = 0;
|
||||
if (mode==WT && wtflag==O_RDONLY) {
|
||||
if (mode==WT && wtflag==0) {
|
||||
error("not in write mode");
|
||||
}
|
||||
if (! chkmap(&adr, space))
|
||||
|
||||
@@ -190,8 +190,7 @@ trypr:
|
||||
regptr = getreg(savc);
|
||||
if (regptr != NOREG) {
|
||||
uframe[regptr] = shorten(dot);
|
||||
ptrace(PT_WRITE_U, pid, (char*) (KERNEL_DATA_END - USIZE) +
|
||||
((char*)&uframe[regptr] - (char*)&corhdr),
|
||||
ptrace(PT_WRITE_U, pid, &uframe[regptr] - (int)&corhdr,
|
||||
uframe[regptr]);
|
||||
} else if ((modifier = varchk(savc)) != -1) {
|
||||
var[modifier] = dot;
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
TOPSRC = $(shell cd ../../../..; pwd)
|
||||
include $(TOPSRC)/cross.mk
|
||||
|
||||
vpath %.c ..
|
||||
|
||||
# Build a list of the host include directories.
|
||||
CPP = $(shell gcc -print-prog-name=cc1)
|
||||
HOSTINC = $(addprefix -I,$(shell echo | $(CPP) -v 2>&1 | grep '^ /.*include'))
|
||||
HOSTINC += -I/usr/include/i386-linux-gnu
|
||||
|
||||
CFLAGS = -m32 -g -DCROSS -nostdinc -I. $(HOSTINC) -I.. -D__mips__
|
||||
CFLAGS += -Wall -Werror -DNUM_SYMS_CACHE=50 -fno-builtin
|
||||
LDFLAGS += -m32 -g
|
||||
|
||||
OBJS = message.o access.o command.o expr.o findfn.o format.o input.o \
|
||||
main.o opset.o output.o pcs.o print.o \
|
||||
runpcs.o setup.o sym.o
|
||||
HEADERS = a.out.h nlist.h time.h signal.h stdlib.h \
|
||||
sys/exec.h sys/types.h sys/param.h sys/user.h \
|
||||
sys/time.h sys/dir.h sys/resource.h sys/select.h \
|
||||
sys/signal.h sys/wait.h \
|
||||
machine/io.h machine/machparam.h
|
||||
|
||||
all: $(HEADERS) adb
|
||||
|
||||
adb: $(OBJS)
|
||||
$(CC) $(LDFLAGS) $(OBJS) -o $@
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o adb *.h */*.h gccdump.s
|
||||
|
||||
$(HEADERS):
|
||||
ln -s -f ../../../../include/a.out.h .
|
||||
ln -s -f ../../../../include/nlist.h .
|
||||
ln -s -f ../../../../include/time.h .
|
||||
ln -s -f ../../../../include/stdlib.h .
|
||||
ln -s -f sys/signal.h .
|
||||
ln -s -f ../../../../../include/sys/exec.h sys/
|
||||
ln -s -f ../../../../../include/sys/param.h sys/
|
||||
ln -s -f ../../../../../include/sys/user.h sys/
|
||||
ln -s -f ../../../../../include/sys/types.h sys/
|
||||
ln -s -f ../../../../../include/sys/time.h sys/
|
||||
ln -s -f ../../../../../include/sys/dir.h sys/
|
||||
ln -s -f ../../../../../include/sys/resource.h sys/
|
||||
ln -s -f ../../../../../include/sys/select.h sys/
|
||||
ln -s -f ../../../../../include/sys/wait.h sys/
|
||||
ln -s -f ../../../../../include/sys/signal.h sys/
|
||||
ln -s -f ../../../../../include/machine/io.h machine/
|
||||
ln -s -f ../../../../../include/machine/machparam.h machine/
|
||||
|
||||
test:
|
||||
echo '$$q' | ./adb fsck fsck.core
|
||||
@printf '\n----------------------------\n'
|
||||
echo '$$m' | ./adb fsck fsck.core
|
||||
@printf '\n----------------------------\n'
|
||||
@@ -8,22 +8,16 @@
|
||||
* This has changed over time - see a.out.h, sys/exec.h and nlist.h
|
||||
* for the current a.out definition and format.
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/user.h>
|
||||
#include <machine/io.h>
|
||||
#include <sgtty.h>
|
||||
#include <setjmp.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <a.out.h>
|
||||
#include <sys/ptrace.h>
|
||||
#ifdef CROSS
|
||||
# include <termios.h>
|
||||
# define sgttyb termios
|
||||
#else
|
||||
# include <sgtty.h>
|
||||
#endif
|
||||
|
||||
#define MAXSYMLEN 32
|
||||
#define MAXCOM 64
|
||||
@@ -55,6 +49,7 @@ typedef struct map MAP;
|
||||
typedef MAP *MAPPTR;
|
||||
typedef struct bkpt BKPT;
|
||||
typedef BKPT *BKPTR;
|
||||
typedef struct user U;
|
||||
|
||||
/* file address maps */
|
||||
struct map {
|
||||
@@ -134,9 +129,7 @@ typedef struct reglist REGLIST;
|
||||
#define MAXPOS 80
|
||||
#define MAXLIN 128
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE (-1)
|
||||
#endif
|
||||
#define TRUE (-1)
|
||||
#define FALSE 0
|
||||
#define LOBYTE 0377
|
||||
#define HIBYTE 0177400
|
||||
@@ -150,7 +143,7 @@ typedef struct reglist REGLIST;
|
||||
|
||||
/* long to ints and back (puns) */
|
||||
#define leng(a) ((long)((unsigned)(a)))
|
||||
#define shorten(a) ((long)a)
|
||||
#define shorten(a) ((int)a)
|
||||
|
||||
struct sgttyb adbtty, usrtty;
|
||||
jmp_buf erradb;
|
||||
|
||||
@@ -1,961 +0,0 @@
|
||||
.sp 100
|
||||
.nr PS 9
|
||||
.nr VS 11
|
||||
. \" START OF Figures
|
||||
.de P1
|
||||
.nf
|
||||
.in +.5i
|
||||
.ta .5i 1i 1.5i 2i 2.5i 3i 3.5i 4i 4.5i 5i
|
||||
.sp
|
||||
.ps 9
|
||||
.vs 11p
|
||||
..
|
||||
.de P2
|
||||
.sp
|
||||
.fi
|
||||
.ps \\n(PS
|
||||
.vs \\n(VS
|
||||
.in -.5i
|
||||
..
|
||||
.SH
|
||||
Figure 1: C program with pointer bug
|
||||
.LP
|
||||
.P1
|
||||
struct buf {
|
||||
int fildes;
|
||||
int nleft;
|
||||
char *nextp;
|
||||
char buff[512];
|
||||
}bb;
|
||||
struct buf *obuf;
|
||||
|
||||
char *charp "this is a sentence.";
|
||||
|
||||
main(argc,argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
char cc;
|
||||
|
||||
if(argc < 2) {
|
||||
printf("Input file missing\\n");
|
||||
exit(8);
|
||||
}
|
||||
|
||||
if((fcreat(argv[1],obuf)) < 0){
|
||||
printf("%s : not found\\n", argv[1]);
|
||||
exit(8);
|
||||
}
|
||||
charp = \'T\';
|
||||
printf("debug 1 %s\\n",charp);
|
||||
while(cc= *charp++)
|
||||
putc(cc,obuf);
|
||||
fflush(obuf);
|
||||
}
|
||||
.P2
|
||||
.sp 100
|
||||
.SH
|
||||
Figure 2: ADB output for C program of Figure 1
|
||||
.LP
|
||||
.P1
|
||||
.ft B
|
||||
adb a.out core
|
||||
$c
|
||||
.ft R
|
||||
~main(02,0177762)
|
||||
.ft B
|
||||
$C
|
||||
.ft R
|
||||
~main(02,0177762)
|
||||
argc: 02
|
||||
argv: 0177762
|
||||
cc: 02124
|
||||
.ft B
|
||||
$r
|
||||
.ft R
|
||||
ps 0170010
|
||||
pc 0204 ~main+0152
|
||||
sp 0177740
|
||||
r5 0177752
|
||||
r4 01
|
||||
r3 0
|
||||
r2 0
|
||||
r1 0
|
||||
r0 0124
|
||||
~main+0152: mov _obuf,(sp)
|
||||
.ft B
|
||||
$e
|
||||
.ft R
|
||||
savr5: 0
|
||||
_obuf: 0
|
||||
_charp: 0124
|
||||
_errno: 0
|
||||
_fout: 0
|
||||
.ft B
|
||||
$m
|
||||
.ft R
|
||||
text map \`ex1\'
|
||||
b1 = 0 e1 = 02360 f1 = 020
|
||||
b2 = 0 e2 = 02360 f2 = 020
|
||||
data map \`core1\'
|
||||
b1 = 0 e1 = 03500 f1 = 02000
|
||||
b2 = 0175400 e2 = 0200000 f2 = 05500
|
||||
.ft B
|
||||
*charp/s
|
||||
.ft R
|
||||
0124: TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTLx Nh@x&_
|
||||
~
|
||||
.ft B
|
||||
charp/s
|
||||
.ft R
|
||||
_charp: T
|
||||
|
||||
_charp+02: this is a sentence.
|
||||
|
||||
_charp+026: Input file missing
|
||||
.ft B
|
||||
main.argc/d
|
||||
.ft R
|
||||
0177756: 2
|
||||
.ft B
|
||||
*main.argv/3o
|
||||
.ft R
|
||||
0177762: 0177770 0177776 0177777
|
||||
.ft B
|
||||
0177770/s
|
||||
.ft R
|
||||
0177770: a.out
|
||||
.ft B
|
||||
*main.argv/3o
|
||||
.ft R
|
||||
0177762: 0177770 0177776 0177777
|
||||
.ft B
|
||||
*"/s
|
||||
.ft R
|
||||
0177770: a.out
|
||||
.ft B
|
||||
.=o
|
||||
.ft R
|
||||
0177770
|
||||
.ft B
|
||||
.\(mi10/d
|
||||
.ft R
|
||||
0177756: 2
|
||||
.ft B
|
||||
$q
|
||||
.P2
|
||||
.sp 100
|
||||
.SH
|
||||
Figure 3: Multiple function C program for stack trace illustration
|
||||
.LP
|
||||
.P1
|
||||
int fcnt,gcnt,hcnt;
|
||||
h(x,y)
|
||||
{
|
||||
int hi; register int hr;
|
||||
hi = x+1;
|
||||
hr = x\(miy+1;
|
||||
hcnt++ ;
|
||||
hj:
|
||||
f(hr,hi);
|
||||
}
|
||||
|
||||
g(p,q)
|
||||
{
|
||||
int gi; register int gr;
|
||||
gi = q\(mip;
|
||||
gr = q\(mip+1;
|
||||
gcnt++ ;
|
||||
gj:
|
||||
h(gr,gi);
|
||||
}
|
||||
|
||||
f(a,b)
|
||||
{
|
||||
int fi; register int fr;
|
||||
fi = a+2*b;
|
||||
fr = a+b;
|
||||
fcnt++ ;
|
||||
fj:
|
||||
g(fr,fi);
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
f(1,1);
|
||||
}
|
||||
.P2
|
||||
.sp 100
|
||||
.SH
|
||||
Figure 4: ADB output for C program of Figure 3
|
||||
.LP
|
||||
.P1
|
||||
.ft B
|
||||
adb
|
||||
$c
|
||||
.ft R
|
||||
~h(04452,04451)
|
||||
~g(04453,011124)
|
||||
~f(02,04451)
|
||||
~h(04450,04447)
|
||||
~g(04451,011120)
|
||||
~f(02,04447)
|
||||
~h(04446,04445)
|
||||
~g(04447,011114)
|
||||
~f(02,04445)
|
||||
~h(04444,04443)
|
||||
.ft B
|
||||
HIT DEL KEY
|
||||
.ft R
|
||||
adb
|
||||
.ft B
|
||||
,5$C
|
||||
.ft R
|
||||
~h(04452,04451)
|
||||
x: 04452
|
||||
y: 04451
|
||||
hi: ?
|
||||
~g(04453,011124)
|
||||
p: 04453
|
||||
q: 011124
|
||||
gi: 04451
|
||||
gr: ?
|
||||
~f(02,04451)
|
||||
a: 02
|
||||
b: 04451
|
||||
fi: 011124
|
||||
fr: 04453
|
||||
~h(04450,04447)
|
||||
x: 04450
|
||||
y: 04447
|
||||
hi: 04451
|
||||
hr: 02
|
||||
~g(04451,011120)
|
||||
p: 04451
|
||||
q: 011120
|
||||
gi: 04447
|
||||
gr: 04450
|
||||
.ft B
|
||||
fcnt/d
|
||||
.ft R
|
||||
_fcnt: 1173
|
||||
.ft B
|
||||
gcnt/d
|
||||
.ft R
|
||||
_gcnt: 1173
|
||||
.ft B
|
||||
hcnt/d
|
||||
.ft R
|
||||
_hcnt: 1172
|
||||
.ft B
|
||||
h.x/d
|
||||
.ft R
|
||||
022004: 2346
|
||||
.ft B
|
||||
$q
|
||||
.P2
|
||||
.sp 100
|
||||
.SH
|
||||
Figure 5: C program to decode tabs
|
||||
.LP
|
||||
.P1
|
||||
#define MAXLINE 80
|
||||
#define YES 1
|
||||
#define NO 0
|
||||
#define TABSP 8
|
||||
.sp .5
|
||||
char input[] "data";
|
||||
char ibuf[518];
|
||||
int tabs[MAXLINE];
|
||||
.sp .5
|
||||
main()
|
||||
{
|
||||
int col, *ptab;
|
||||
char c;
|
||||
.sp .5
|
||||
ptab = tabs;
|
||||
settab(ptab); /*Set initial tab stops */
|
||||
col = 1;
|
||||
if(fopen(input,ibuf) < 0) {
|
||||
printf("%s : not found\\n",input);
|
||||
exit(8);
|
||||
}
|
||||
while((c = getc(ibuf)) != \(mi1) {
|
||||
switch(c) {
|
||||
case \(fm\\t\(fm: /* TAB */
|
||||
while(tabpos(col) != YES) {
|
||||
putchar(\(fm \(fm); /* put BLANK */
|
||||
col++ ;
|
||||
}
|
||||
break;
|
||||
case \(fm\\n\(fm: /*NEWLINE */
|
||||
putchar(\(fm\\n\(fm);
|
||||
col = 1;
|
||||
break;
|
||||
default:
|
||||
putchar(c);
|
||||
col++ ;
|
||||
}
|
||||
}
|
||||
}
|
||||
.sp .5
|
||||
/* Tabpos return YES if col is a tab stop */
|
||||
tabpos(col)
|
||||
int col;
|
||||
{
|
||||
if(col > MAXLINE)
|
||||
return(YES);
|
||||
else
|
||||
return(tabs[col]);
|
||||
}
|
||||
.sp .5
|
||||
/* Settab - Set initial tab stops */
|
||||
settab(tabp)
|
||||
int *tabp;
|
||||
{
|
||||
int i;
|
||||
.sp .5
|
||||
for(i = 0; i<= MAXLINE; i++)
|
||||
(i%TABSP) ? (tabs[i] = NO) : (tabs[i] = YES);
|
||||
}
|
||||
.P2
|
||||
.sp 100
|
||||
.SH
|
||||
Figure 6a: ADB output for C program of Figure 5
|
||||
.LP
|
||||
.P1
|
||||
.ft B
|
||||
adb a.out \(mi
|
||||
settab+4:b
|
||||
fopen+4:b
|
||||
getc+4:b
|
||||
tabpos+4:b
|
||||
$b
|
||||
.ft R
|
||||
breakpoints
|
||||
count bkpt command
|
||||
1 ~tabpos+04
|
||||
1 _getc+04
|
||||
1 _fopen+04
|
||||
1 ~settab+04
|
||||
.ft B
|
||||
settab,5?ia
|
||||
.ft R
|
||||
~settab: jsr r5,csv
|
||||
~settab+04: tst \(mi(sp)
|
||||
~settab+06: clr 0177770(r5)
|
||||
~settab+012: cmp $0120,0177770(r5)
|
||||
~settab+020: blt ~settab+076
|
||||
~settab+022:
|
||||
.ft B
|
||||
settab,5?i
|
||||
.ft R
|
||||
~settab: jsr r5,csv
|
||||
tst \(mi(sp)
|
||||
clr 0177770(r5)
|
||||
cmp $0120,0177770(r5)
|
||||
blt ~settab+076
|
||||
.ft B
|
||||
:r
|
||||
.ft R
|
||||
a.out: running
|
||||
breakpoint ~settab+04: tst \(mi(sp)
|
||||
.ft B
|
||||
settab+4:d
|
||||
:c
|
||||
.ft R
|
||||
a.out: running
|
||||
breakpoint _fopen+04: mov 04(r5),nulstr+012
|
||||
.ft B
|
||||
$C
|
||||
.ft R
|
||||
_fopen(02302,02472)
|
||||
~main(01,0177770)
|
||||
col: 01
|
||||
c: 0
|
||||
ptab: 03500
|
||||
.ft B
|
||||
tabs,3/8o
|
||||
.ft R
|
||||
03500: 01 0 0 0 0 0 0 0
|
||||
01 0 0 0 0 0 0 0
|
||||
01 0 0 0 0 0 0 0
|
||||
.P2
|
||||
.sp 100
|
||||
.SH
|
||||
Figure 6b: ADB output for C program of Figure 5
|
||||
.LP
|
||||
.P1
|
||||
.ft B
|
||||
:c
|
||||
.ft R
|
||||
a.out: running
|
||||
breakpoint _getc+04: mov 04(r5),r1
|
||||
.ft B
|
||||
ibuf+6/20c
|
||||
.ft R
|
||||
__cleanu+0202: This is a test of
|
||||
.ft B
|
||||
:c
|
||||
.ft R
|
||||
a.out: running
|
||||
breakpoint ~tabpos+04: cmp $0120,04(r5)
|
||||
.ft B
|
||||
tabpos+4:d
|
||||
settab+4:b settab,5?ia
|
||||
settab+4:b settab,5?ia; 0
|
||||
getc+4,3:b main.c?C; 0
|
||||
settab+4:b settab,5?ia; ptab/o; 0
|
||||
$b
|
||||
.ft R
|
||||
breakpoints
|
||||
count bkpt command
|
||||
1 ~tabpos+04
|
||||
3 _getc+04 main.c?C;0
|
||||
1 _fopen+04
|
||||
1 ~settab+04 settab,5?ia;ptab?o;0
|
||||
~settab: jsr r5,csv
|
||||
~settab+04: bpt
|
||||
~settab+06: clr 0177770(r5)
|
||||
~settab+012: cmp $0120,0177770(r5)
|
||||
~settab+020: blt ~settab+076
|
||||
~settab+022:
|
||||
0177766: 0177770
|
||||
0177744: @\`
|
||||
T0177744: T
|
||||
h0177744: h
|
||||
i0177744: i
|
||||
s0177744: s
|
||||
.P2
|
||||
.sp 100
|
||||
.SH
|
||||
Figure 7: ADB output for C program with breakpoints
|
||||
.LP
|
||||
.in +.5i
|
||||
.nf
|
||||
.ps 8
|
||||
.vs 9
|
||||
.ft B
|
||||
adb ex3 \(mi
|
||||
h+4:b hcnt/d; h.hi/; h.hr/
|
||||
g+4:b gcnt/d; g.gi/; g.gr/
|
||||
f+4:b fcnt/d; f.fi/; f.fr/
|
||||
:r
|
||||
.ft R
|
||||
ex3: running
|
||||
_fcnt: 0
|
||||
0177732: 214
|
||||
symbol not found
|
||||
.ft B
|
||||
f+4:b fcnt/d; f.a/; f.b/; f.fi/
|
||||
g+4:b gcnt/d; g.p/; g.q/; g.gi/
|
||||
h+4:b hcnt/d; h.x/; h.y/; h.hi/
|
||||
:c
|
||||
.ft R
|
||||
ex3: running
|
||||
_fcnt: 0
|
||||
0177746: 1
|
||||
0177750: 1
|
||||
0177732: 214
|
||||
_gcnt: 0
|
||||
0177726: 2
|
||||
0177730: 3
|
||||
0177712: 214
|
||||
_hcnt: 0
|
||||
0177706: 2
|
||||
0177710: 1
|
||||
0177672: 214
|
||||
_fcnt: 1
|
||||
0177666: 2
|
||||
0177670: 3
|
||||
0177652: 214
|
||||
_gcnt: 1
|
||||
0177646: 5
|
||||
0177650: 8
|
||||
0177632: 214
|
||||
.ft B
|
||||
HIT DEL
|
||||
f+4:b fcnt/d; f.a/"a = "d; f.b/"b = "d; f.fi/"fi = "d
|
||||
g+4:b gcnt/d; g.p/"p = "d; g.q/"q = "d; g.gi/"gi = "d
|
||||
h+4:b hcnt/d; h.x/"x = "d; h.y/"h = "d; h.hi/"hi = "d
|
||||
:r
|
||||
.ft R
|
||||
ex3: running
|
||||
_fcnt: 0
|
||||
0177746: a = 1
|
||||
0177750: b = 1
|
||||
0177732: fi = 214
|
||||
_gcnt: 0
|
||||
0177726: p = 2
|
||||
0177730: q = 3
|
||||
0177712: gi = 214
|
||||
_hcnt: 0
|
||||
0177706: x = 2
|
||||
0177710: y = 1
|
||||
0177672: hi = 214
|
||||
_fcnt: 1
|
||||
0177666: a = 2
|
||||
0177670: b = 3
|
||||
0177652: fi = 214
|
||||
.ft B
|
||||
HIT DEL
|
||||
$q
|
||||
.in -.5i
|
||||
.sp 100
|
||||
.SH
|
||||
Figure 8: ADB address maps
|
||||
.LP
|
||||
.de l1
|
||||
.tc
|
||||
.ta 1.20i +1.6i +2.5i
|
||||
..
|
||||
.de l3
|
||||
.tc
|
||||
.ta 1.6i +2.80i +.2i +1.55i
|
||||
..
|
||||
.de l2
|
||||
.tc
|
||||
.ti 1.0i
|
||||
.ta +0.5i +3.0i +1.75i
|
||||
.tc _
|
||||
..
|
||||
.de l5
|
||||
.tc
|
||||
.ti 1.0i
|
||||
.ta +0.75i +3.0i +1.5i
|
||||
.tc _
|
||||
..
|
||||
.de l6
|
||||
.tc
|
||||
.ti 1.0i
|
||||
.ta +.8i +2.85i +0.4i +1.1i
|
||||
..
|
||||
.de l8
|
||||
.tc
|
||||
.ti 1.0i
|
||||
.ta +0.5i +3.0i +1.75i
|
||||
.tc _
|
||||
..
|
||||
.de la
|
||||
.tc
|
||||
.ta 1.20i +1.25i +1.7i
|
||||
..
|
||||
.de lc
|
||||
.tc
|
||||
.ti 1.0i
|
||||
.ta +.85i +1.6i +.35i +1.1i
|
||||
..
|
||||
.de lb
|
||||
.tc
|
||||
.ti 1.0i
|
||||
.ta +0.75i +1.75i +1.5i
|
||||
.tc _
|
||||
..
|
||||
.ul
|
||||
407 files
|
||||
.sp
|
||||
.l1
|
||||
a.out hdr text+data
|
||||
.l2
|
||||
| | |
|
||||
.l3
|
||||
0 D
|
||||
.sp
|
||||
.l1
|
||||
core hdr text+data stack
|
||||
.l5
|
||||
| | ......| |
|
||||
.l6
|
||||
0 D S E
|
||||
.sp 2
|
||||
.ul
|
||||
410 files (shared text)
|
||||
.sp
|
||||
.l1
|
||||
a.out hdr text data
|
||||
.l2
|
||||
| | | |
|
||||
.l3
|
||||
0 T B D
|
||||
.sp
|
||||
.la
|
||||
core hdr data stack
|
||||
.lb
|
||||
| | ......| |
|
||||
.lc
|
||||
B D S E
|
||||
.sp 2
|
||||
.ul
|
||||
411 files (separated I and D space)
|
||||
.sp
|
||||
.l1
|
||||
a.out hdr text data
|
||||
.l2
|
||||
| | | |
|
||||
.l3
|
||||
0 T 0 D
|
||||
.sp
|
||||
.la
|
||||
core hdr data stack
|
||||
.lb
|
||||
| | ......| |
|
||||
.lc
|
||||
0 D S E
|
||||
.sp 2
|
||||
The following
|
||||
.ul
|
||||
adb
|
||||
variables are set.
|
||||
.nf
|
||||
.ta .75i 1.5i 3.5i 4.5i 5.5i
|
||||
.sp
|
||||
407 410 411
|
||||
.sp
|
||||
b base of data 0 B 0
|
||||
d length of data D D\(miB D
|
||||
s length of stack S S S
|
||||
t length of text 0 T T
|
||||
.sp 100
|
||||
.SH
|
||||
Figure 9: ADB output for maps
|
||||
.LP
|
||||
.nf
|
||||
.in +.5i
|
||||
.ft B
|
||||
adb map407 core407
|
||||
$m
|
||||
.ft R
|
||||
text map \`map407\'
|
||||
b1 = 0 e1 = 0256 f1 = 020
|
||||
b2 = 0 e2 = 0256 f2 = 020
|
||||
data map \`core407\'
|
||||
b1 = 0 e1 = 0300 f1 = 02000
|
||||
b2 = 0175400 e2 = 0200000 f2 = 02300
|
||||
.ft B
|
||||
$v
|
||||
.ft R
|
||||
variables
|
||||
d = 0300
|
||||
m = 0407
|
||||
s = 02400
|
||||
.ft B
|
||||
$q
|
||||
.sp 2
|
||||
adb map410 core410
|
||||
$m
|
||||
.ft R
|
||||
text map \`map410\'
|
||||
b1 = 0 e1 = 0200 f1 = 020
|
||||
b2 = 020000 e2 = 020116 f2 = 0220
|
||||
data map \`core410\'
|
||||
b1 = 020000 e1 = 020200 f1 = 02000
|
||||
b2 = 0175400 e2 = 0200000 f2 = 02200
|
||||
.ft B
|
||||
$v
|
||||
.ft R
|
||||
variables
|
||||
b = 020000
|
||||
d = 0200
|
||||
m = 0410
|
||||
s = 02400
|
||||
t = 0200
|
||||
.ft B
|
||||
$q
|
||||
.sp 2
|
||||
adb map411 core411
|
||||
$m
|
||||
.ft R
|
||||
text map \`map411\'
|
||||
b1 = 0 e1 = 0200 f1 = 020
|
||||
b2 = 0 e2 = 0116 f2 = 0220
|
||||
data map \`core411\'
|
||||
b1 = 0 e1 = 0200 f1 = 02000
|
||||
b2 = 0175400 e2 = 0200000 f2 = 02200
|
||||
.ft B
|
||||
$v
|
||||
.ft R
|
||||
variables
|
||||
d = 0200
|
||||
m = 0411
|
||||
s = 02400
|
||||
t = 0200
|
||||
.ft B
|
||||
$q
|
||||
.in -.5i
|
||||
.sp 100
|
||||
.SH
|
||||
Figure 10: Simple C program for illustrating formatting and patching
|
||||
.LP
|
||||
.P1
|
||||
char str1[] "This is a character string";
|
||||
int one 1;
|
||||
int number 456;
|
||||
long lnum 1234;
|
||||
float fpt 1.25;
|
||||
char str2[] "This is the second character string";
|
||||
main()
|
||||
{
|
||||
one = 2;
|
||||
}
|
||||
.P2
|
||||
.sp 100
|
||||
.SH
|
||||
Figure 11: ADB output illustrating fancy formats
|
||||
.LP
|
||||
.nf
|
||||
.ps 9
|
||||
.vs 11p
|
||||
.ft B
|
||||
adb map410 core410
|
||||
<b,\(mi1/8ona
|
||||
.ft R
|
||||
020000: 0 064124 071551 064440 020163 020141 064143 071141
|
||||
.sp .5
|
||||
_str1+016: 061541 062564 020162 072163 064562 063556 0 02
|
||||
.sp .5
|
||||
_number:
|
||||
_number: 0710 0 02322 040240 0 064124 071551 064440
|
||||
.sp .5
|
||||
_str2+06: 020163 064164 020145 062563 067543 062156 061440 060550
|
||||
.sp .5
|
||||
_str2+026: 060562 072143 071145 071440 071164 067151 0147 0
|
||||
.sp .5
|
||||
savr5+02: 0 0 0 0 0 0 0 0
|
||||
.sp .5
|
||||
.ft B
|
||||
<b,20/4o4^8Cn
|
||||
.ft R
|
||||
020000: 0 064124 071551 064440 @\`@\`This i
|
||||
020163 020141 064143 071141 s a char
|
||||
061541 062564 020162 072163 acter st
|
||||
064562 063556 0 02 ring@\`@\`@b@\`
|
||||
.sp .5
|
||||
_number: 0710 0 02322 040240 H@a@\`@\`R@d @@
|
||||
0 064124 071551 064440 @\`@\`This i
|
||||
020163 064164 020145 062563 s the se
|
||||
067543 062156 061440 060550 cond cha
|
||||
060562 072143 071145 071440 racter s
|
||||
071164 067151 0147 0 tring@\`@\`@\`
|
||||
0 0 0 0 @\`@\`@\`@\`@\`@\`@\`@\`
|
||||
0 0 0 0 @\`@\`@\`@\`@\`@\`@\`@\`
|
||||
data address not found
|
||||
.ft B
|
||||
<b,20/4o4^8t8cna
|
||||
.ft R
|
||||
020000: 0 064124 071551 064440 This i
|
||||
_str1+06: 020163 020141 064143 071141 s a char
|
||||
_str1+016: 061541 062564 020162 072163 acter st
|
||||
_str1+026: 064562 063556 0 02 ring
|
||||
_number:
|
||||
_number: 0710 0 02322 040240 HR
|
||||
_fpt+02: 0 064124 071551 064440 This i
|
||||
_str2+06: 020163 064164 020145 062563 s the se
|
||||
_str2+016: 067543 062156 061440 060550 cond cha
|
||||
_str2+026: 060562 072143 071145 071440 racter s
|
||||
_str2+036: 071164 067151 0147 0 tring
|
||||
savr5+02: 0 0 0 0
|
||||
savr5+012: 0 0 0 0
|
||||
data address not found
|
||||
.ft B
|
||||
<b,10/2b8t^2cn
|
||||
.ft R
|
||||
020000: 0 0
|
||||
.sp .5
|
||||
_str1: 0124 0150 Th
|
||||
0151 0163 is
|
||||
040 0151 i
|
||||
0163 040 s
|
||||
0141 040 a
|
||||
0143 0150 ch
|
||||
0141 0162 ar
|
||||
0141 0143 ac
|
||||
0164 0145 te
|
||||
.ft B
|
||||
$Q
|
||||
.sp 100
|
||||
.SH
|
||||
Figure 12: Directory and inode dumps
|
||||
.LP
|
||||
.nf
|
||||
.ft B
|
||||
adb dir \(mi
|
||||
=nt"Inode"t"Name"
|
||||
0,\(mi1?ut14cn
|
||||
.ft R
|
||||
|
||||
Inode Name
|
||||
0: 652 .
|
||||
82 ..
|
||||
5971 cap.c
|
||||
5323 cap
|
||||
0 pp
|
||||
.sp 4
|
||||
.ft B
|
||||
adb /dev/src \(mi
|
||||
.ft B
|
||||
02000>b
|
||||
?m<b
|
||||
.ft R
|
||||
new map \`/dev/src\'
|
||||
b1 = 02000 e1 = 0100000000 f1 = 0
|
||||
b2 = 0 e2 = 0 f2 = 0
|
||||
.ft B
|
||||
$v
|
||||
.ft R
|
||||
variables
|
||||
b = 02000
|
||||
.ft B
|
||||
<b,\(mi1?"flags"8ton"links,uid,gid"8t3bn"size"8tbrdn"addr"8t8un"times"8t2Y2na
|
||||
.ft R
|
||||
02000: flags 073145
|
||||
links,uid,gid 0163 0164 0141
|
||||
size 0162 10356
|
||||
addr 28770 8236 25956 27766 25455 8236 25956 25206
|
||||
times 1976 Feb 5 08:34:56 1975 Dec 28 10:55:15
|
||||
|
||||
02040: flags 024555
|
||||
links,uid,gid 012 0163 0164
|
||||
size 0162 25461
|
||||
addr 8308 30050 8294 25130 15216 26890 29806 10784
|
||||
times 1976 Aug 17 12:16:51 1976 Aug 17 12:16:51
|
||||
|
||||
02100: flags 05173
|
||||
links,uid,gid 011 0162 0145
|
||||
size 0147 29545
|
||||
addr 25972 8306 28265 8308 25642 15216 2314 25970
|
||||
times 1977 Apr 2 08:58:01 1977 Feb 5 10:21:44
|
||||
.\"
|
||||
.\" Start of Summary
|
||||
.sp 100
|
||||
.TL
|
||||
ADB Summary
|
||||
.LP
|
||||
.LP
|
||||
.if t .2C
|
||||
.nr VS 9
|
||||
.nr VS 11
|
||||
.SH
|
||||
Command Summary
|
||||
.LP
|
||||
.ta .7i
|
||||
a) formatted printing
|
||||
.sp .5
|
||||
.IP "\fB? \fIformat\fR" .7i
|
||||
print from \fIa.out\fR file according to \fIformat\fR
|
||||
.IP "\fB/ \fIformat\fR" .7i
|
||||
print from \fIcore\fR file according to \fIformat\fR
|
||||
.IP "\fB= \fIformat\fR" .7i
|
||||
print the value of \fIdot\fR
|
||||
.sp .5
|
||||
.IP "\fB?w\fR expr" .7i
|
||||
write expression into \fIa.out\fR file
|
||||
.IP "\fB/w\fR expr" .7i
|
||||
write expression into \fIcore\fR file
|
||||
.sp .5
|
||||
.IP "\fB?l\fR expr" .7i
|
||||
locate expression in \fIa.out\fR file
|
||||
.LP
|
||||
.ta .7i
|
||||
b) breakpoint and program control
|
||||
.LP
|
||||
.ta .7i
|
||||
.nf
|
||||
.ta .7i
|
||||
\fB:b\fR set breakpoint at \fIdot\fR
|
||||
\fB:c\fR continue running program
|
||||
\fB:d\fR delete breakpoint
|
||||
\fB:k\fR kill the program being debugged
|
||||
\fB:r\fR run \fIa.out\fR file under ADB control
|
||||
\fB:s\fR single step
|
||||
.LP
|
||||
.ta .7i
|
||||
c) miscellaneous printing
|
||||
.LP
|
||||
.ta .7i
|
||||
.nf
|
||||
\fB$b\fR print current breakpoints
|
||||
\fB$c\fR C stack trace
|
||||
\fB$e\fR external variables
|
||||
\fB$f\fR floating registers
|
||||
\fB$m\fR print ADB segment maps
|
||||
\fB$q\fR exit from ADB
|
||||
\fB$r\fR general registers
|
||||
\fB$s\fR set offset for symbol match
|
||||
\fB$v\fR print ADB variables
|
||||
\fB$w\fR set output line width
|
||||
.LP
|
||||
.ta .7i
|
||||
d) calling the shell
|
||||
.LP
|
||||
.ta .7i
|
||||
.nf
|
||||
\fB!\fR call \fIshell\fP to read rest of line
|
||||
.LP
|
||||
.ta .7i
|
||||
e) assignment to variables
|
||||
.LP
|
||||
.ta .7i
|
||||
.nf
|
||||
\fB>\fIname\fR assign dot to variable or register \fIname\fR
|
||||
.sp 100
|
||||
.SH
|
||||
Format Summary
|
||||
.LP
|
||||
.ta .7i
|
||||
.nf
|
||||
\fBa \fRthe value of dot
|
||||
\fBb \fRone byte in octal
|
||||
\fBc \fRone byte as a character
|
||||
\fBd \fRone word in decimal
|
||||
\fBf \fRtwo words in floating point
|
||||
\fBi \fRPDP 11 instruction
|
||||
\fBo \fRone word in octal
|
||||
\fBn \fRprint a newline
|
||||
\fBr \fRprint a blank space
|
||||
\fBs \fRa null terminated character string
|
||||
\fIn\fBt \fRmove to next \fIn\fR space tab
|
||||
\fBu \fRone word as unsigned integer
|
||||
\fBx \fRhexadecimal
|
||||
\fBY \fRdate
|
||||
\fB^ \fRbackup dot
|
||||
\fB"..."\fR print string
|
||||
.LP
|
||||
.ta .7i
|
||||
.SH
|
||||
Expression Summary
|
||||
.LP
|
||||
.ta .7i
|
||||
a) expression components
|
||||
.LP
|
||||
.ta .1.1i
|
||||
.nf
|
||||
\fBdecimal integer \fRe.g. 256
|
||||
\fBoctal integer \fRe.g. 0277
|
||||
\fBhexadecimal \fRe.g. #ff
|
||||
\fBsymbols \fRe.g. flag _main main.argc
|
||||
\fBvariables \fRe.g. <b
|
||||
\fBregisters \fRe.g. <pc <r0
|
||||
\fB(expression) \fRexpression grouping
|
||||
.LP
|
||||
.ta .7i
|
||||
b) dyadic operators
|
||||
.LP
|
||||
.ta .7i
|
||||
.nf
|
||||
\fB+\fP add
|
||||
\fB\(mi\fP subtract
|
||||
\fB*\fP multiply
|
||||
\fB%\fP integer division
|
||||
\fB&\fP bitwise and
|
||||
\fB|\fP bitwise or
|
||||
\fB#\fP round up to the next multiple
|
||||
.LP
|
||||
.ta .7i
|
||||
c) monadic operators
|
||||
.LP
|
||||
.ta .7i
|
||||
.nf
|
||||
\v'.25m'\s+2\fB~\fP\s0\v'-.25m' not
|
||||
\fB*\fR contents of location
|
||||
\fB\(mi\fR integer negate
|
||||
.fi
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user