1
0

Grunddaten

This commit is contained in:
Anna Christina Naß 2018-06-01 10:49:06 +02:00
parent 7034fec407
commit a5987b00cb
76 changed files with 20446 additions and 2 deletions

View File

@ -1,4 +1,5 @@
# minibtx-acn
Ein Klon des miniBtx-Codes aus dem bildschirmtrix-Paket von Philipp Fabian Benedikt Maier
https://github.com/cccbdexter/bildschirmtrix
Ein Klon des miniBtx-Codes aus dem bildschirmtrix-Paket von Philipp Fabian Benedikt Maier
Quelle: https://github.com/cccbdexter/bildschirmtrix

Binary file not shown.

After

Width:  |  Height:  |  Size: 669 KiB

BIN
doc/board_wirewrap_top.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 KiB

BIN
doc/connectors.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
doc/first_tests.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 KiB

BIN
doc/fusemap.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 KiB

BIN
doc/miniBTX.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

12820
doc/miniBTX.sch Normal file

File diff suppressed because it is too large Load Diff

BIN
doc/miniBTX_module.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 KiB

BIN
doc/prototype_setup.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 730 KiB

55
doc/readme Normal file
View File

@ -0,0 +1,55 @@
miniBTX
=======
==Abstract==
MiniBTX is an intelligent adapter that adapts the dbt03 interface to a normal V.24 serial interface. It is useful if you whish to connect a BTX (Videotex) terminal to your PC to use it with the pcPAD software.
==Control signals==
The device emulates a real dbt03 modem. If the device is hooked to another device via RS232 you will want to know if a terminal is connected and if the (fake) dialin process is done. When the START line turns to high the miniBTX adaptor sends a 0x01 by itsself. When the dialin is complete and the terminal is ready for data the miniBTX adaptor sends a 0x00. For the use in embedded devices TTL signals somethimes are a better way to indicate the state miniBTX serves sough signals too, see section "Control lines".
==Control lines==
There are 4 control lines. /Reset, /Inhibit /Terminate and Ready. Reset is directly connected to the START signal pin of the terminal (see dbt03.h for detailed description of dbt03 signals). START is mentiond here because you cen use it in an embedded device for activating power or something.
Inhibt and /Ready are also for use in embedded devices when the miniBTX circuit is integrated in another device. /Ready and /Inhibit are low active. /Ready goes to low level when a (faked) dialin process is finished. /Inhibit can be used to lock the receiving part of the miniBTX circuit. If you do not want to receive anything from the terminal just pull /Inhibt low.
The /Terminate signal can be used to cause a termination of the connection between the miniBTX circuit and the BTX-Terminal. To be sure that the termination signal is proper detected you must send at least one character (e.g. 0x00 or something). Effectively it drives the sending I/O line to the terminal to a constant high level. The BTX-Terminal interprets that as a termination of the connection and switches of the circuit immediately (If that fails the user should press the termination button on the terminal to terminate manualy) and the next connection cycle can begin.
Note: It is very important that the START line from the terminal is connected with the Reset input of the controller. The Firmware expects that a hardware reset is caused after every connection cycle! Keep that in mind when you layout your embedded circuit!
==Power supply==
The circuit needs 5V DC-Powersupply.
==How the dbt03 works==
The dbt03 is a very easy and straight forward implementation of e modem. You just have to pull an I/O pin to high level and 3 seconds later, the modem starts to dial. While the modem is dialing in you get the dialtones handed through to the TX I/O pin. While all this happens the neutral status of the I/O line is high. When the dialin process is finished the TX I/O line goes to low level (This is the new neutral status) and we are ready to transmit serial data. That is all.
==What is the problem?==
There are two problems to solve when you connect a BTX-Terminal to PC. The first thing is that the Terminals have thier own special way to set up a connection and the sacond thing is that you have an asymetric baudrate (V.23). The adapter solves this problem by acting like a real dbt03 on the one side and like a normal V.24 interface on the other side. To do this an ATmega8 is used.
==Duplex==
The original dbt03 was designed to operate in full duplex. miniBTX up to now leaks full duplex support. That is really a problem because if the terminal starts a transmission while you transmit data to the terminal the data will be garbeled. To make this missfeature less painful you can use the /inhibit signal line to lock up the receiver.
==Talking CEPT?==
The adapter has nothing to do with the CEPT-Protocol. Al it does is handing the data through. The included PC-Software illustrates how to talk to a BTX-Terminal. It implements a testpage that can be transmitted again an again by pressing the terminator (#) key. All transmission events are logged on the screen. But please be careful with the software, it is only a quick and dirty reference implementation, you should rewrite it to get a serious implementation.
Getting information about the CEPT-Protocol is a bit problematic, but not impossible if you know the magic words. You will find lots of useful information at http://www.etsi.org
The document numbers are:
T/TE 06-01 / T/CD 06-01 = ETS 300 072
T/TE 06-01 = ETS 300 073
T/TE 06-03 = ETS 300 074
T/TE 06-04 / T/CD 06-04 = ETS 300 075
T/TE 06-05 / T/CD 06-05 = ETS 300 076
Note: The article "INTERPRETATION OF THE INTERFACE SIGNALS BY THE D-BT03", published in the Hackerbibel by the CCC is not really recomandable. Especially the explaination of the dbt03 signals seems to be wrong. However you can get the article at: http://www.trust-us.ch/habi1/156_dbt03.html
08072015 Philipp Fabian Benedikt Maier

91
doc/readme.avrisp Normal file
View File

@ -0,0 +1,91 @@
==Abstract==
This file contains some hints that might be useful to solve some beginners
programming problems.
==Changing the programmer==
The progject makes use of the avrdude programmer tool which supports several
types of programmers. I prefer the avrispMKII and the stk200 Parallport
programmer. Anyway, you can change the makefile to use your favourite programmer
Find the section that is labeled with:
"Programming Options (avrdude)"
Set the variable AVRDUDE_PROGRAMMER to the programmer type you use. To find
out which programmer types are supported type
avrdude -c x
to get a list of the supported programmers. Then pick out your programmer and
configure it in the makefile. Here are two examples:
AVRDUDE_PROGRAMMER = stk200 #Parallelport
AVRDUDE_PROGRAMMER = avrispv2 #USB
Then find and set the AVRDUDE_PORT variable acording your needs:
AVRDUDE_PORT = /dev/parport0 #Parallelport
AVRDUDE_PORT = usb #USB
Now you should be ready to program the AVR device directly via the makefile.
==Set programming speed==
When using an AVRispMKII the following hints might be useful:
When you use your AVR isp you might want to change the programming speed
acording your needs. A slow clocked device needs a slow programming speed
a fast clocked device cen be programmed at a higher speed. To change
the programming speed do the following:
* Enter the terminal mode:
avrdude -p m16 -c avrispmkII -P usb -t
Note: change the -p option to the device you are using. In this
example a mega 16 is used. The terminal mode can only be
entered when an AVR device is connected correctly.
* Set the sck clock devider by typing:
sck 1 for a fast programming speed (e.g. Avr with 16 Mhz)
sck 10 for a slow programming speed
sck 100 for a very slow programming speed
Note: You might think that the programmer works without a VCC supply. (Because
it gets its power from the USB port) But this is not correct. You need
to contact the VCC pin in your layout. Otherwise the programmer will
refuse to work.
==Pinout of the ISP Header==
The most of my projects are using a customized ISP-Pinheader. It has only one
row of pins instead of two. That makes it much easier to layout. Here is the
pinout:
+---------------------+
| o o o o o o |
| 1 2 3 4 5 6 |
+---------------------+
1 = VCC
2 = SCK
3 = RESET
4 = MOSI
5 = MISO
6 = GND
20112009 Philipp Fabian Benedikt Maier

BIN
doc/software-screenshot.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

BIN
doc/testpage_on_BtxTV.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

28
firmware/.dep/ctrl.o.d Normal file
View File

@ -0,0 +1,28 @@
ctrl.o: ctrl.c /usr/lib/avr/include/avr/io.h \
/usr/lib/avr/include/avr/sfr_defs.h /usr/lib/avr/include/inttypes.h \
/usr/lib/gcc/avr/4.8.2/include/stdint.h /usr/lib/avr/include/stdint.h \
/usr/lib/avr/include/avr/iom8.h /usr/lib/avr/include/avr/portpins.h \
/usr/lib/avr/include/avr/common.h /usr/lib/avr/include/avr/version.h \
/usr/lib/avr/include/avr/fuse.h /usr/lib/avr/include/avr/lock.h
/usr/lib/avr/include/avr/io.h:
/usr/lib/avr/include/avr/sfr_defs.h:
/usr/lib/avr/include/inttypes.h:
/usr/lib/gcc/avr/4.8.2/include/stdint.h:
/usr/lib/avr/include/stdint.h:
/usr/lib/avr/include/avr/iom8.h:
/usr/lib/avr/include/avr/portpins.h:
/usr/lib/avr/include/avr/common.h:
/usr/lib/avr/include/avr/version.h:
/usr/lib/avr/include/avr/fuse.h:
/usr/lib/avr/include/avr/lock.h:

45
firmware/.dep/dbt03.o.d Normal file
View File

@ -0,0 +1,45 @@
dbt03.o: dbt03.c /usr/lib/avr/include/avr/io.h \
/usr/lib/avr/include/avr/sfr_defs.h /usr/lib/avr/include/inttypes.h \
/usr/lib/gcc/avr/4.8.2/include/stdint.h /usr/lib/avr/include/stdint.h \
/usr/lib/avr/include/avr/iom8.h /usr/lib/avr/include/avr/portpins.h \
/usr/lib/avr/include/avr/common.h /usr/lib/avr/include/avr/version.h \
/usr/lib/avr/include/avr/fuse.h /usr/lib/avr/include/avr/lock.h \
/usr/lib/gcc/avr/4.8.2/include/stdbool.h \
/usr/lib/avr/include/avr/interrupt.h /usr/lib/avr/include/util/parity.h \
dbt03.h uart.h delay.h ctrl.h
/usr/lib/avr/include/avr/io.h:
/usr/lib/avr/include/avr/sfr_defs.h:
/usr/lib/avr/include/inttypes.h:
/usr/lib/gcc/avr/4.8.2/include/stdint.h:
/usr/lib/avr/include/stdint.h:
/usr/lib/avr/include/avr/iom8.h:
/usr/lib/avr/include/avr/portpins.h:
/usr/lib/avr/include/avr/common.h:
/usr/lib/avr/include/avr/version.h:
/usr/lib/avr/include/avr/fuse.h:
/usr/lib/avr/include/avr/lock.h:
/usr/lib/gcc/avr/4.8.2/include/stdbool.h:
/usr/lib/avr/include/avr/interrupt.h:
/usr/lib/avr/include/util/parity.h:
dbt03.h:
uart.h:
delay.h:
ctrl.h:

40
firmware/.dep/delay.o.d Normal file
View File

@ -0,0 +1,40 @@
delay.o: delay.c /usr/lib/avr/include/util/delay.h \
/usr/lib/avr/include/inttypes.h /usr/lib/gcc/avr/4.8.2/include/stdint.h \
/usr/lib/avr/include/stdint.h /usr/lib/avr/include/util/delay_basic.h \
/usr/lib/avr/include/math.h /usr/lib/avr/include/avr/interrupt.h \
/usr/lib/avr/include/avr/io.h /usr/lib/avr/include/avr/sfr_defs.h \
/usr/lib/avr/include/avr/iom8.h /usr/lib/avr/include/avr/portpins.h \
/usr/lib/avr/include/avr/common.h /usr/lib/avr/include/avr/version.h \
/usr/lib/avr/include/avr/fuse.h /usr/lib/avr/include/avr/lock.h delay.h
/usr/lib/avr/include/util/delay.h:
/usr/lib/avr/include/inttypes.h:
/usr/lib/gcc/avr/4.8.2/include/stdint.h:
/usr/lib/avr/include/stdint.h:
/usr/lib/avr/include/util/delay_basic.h:
/usr/lib/avr/include/math.h:
/usr/lib/avr/include/avr/interrupt.h:
/usr/lib/avr/include/avr/io.h:
/usr/lib/avr/include/avr/sfr_defs.h:
/usr/lib/avr/include/avr/iom8.h:
/usr/lib/avr/include/avr/portpins.h:
/usr/lib/avr/include/avr/common.h:
/usr/lib/avr/include/avr/version.h:
/usr/lib/avr/include/avr/fuse.h:
/usr/lib/avr/include/avr/lock.h:
delay.h:

50
firmware/.dep/main.o.d Normal file
View File

@ -0,0 +1,50 @@
main.o: main.c /usr/lib/avr/include/avr/io.h \
/usr/lib/avr/include/avr/sfr_defs.h /usr/lib/avr/include/inttypes.h \
/usr/lib/gcc/avr/4.8.2/include/stdint.h /usr/lib/avr/include/stdint.h \
/usr/lib/avr/include/avr/iom8.h /usr/lib/avr/include/avr/portpins.h \
/usr/lib/avr/include/avr/common.h /usr/lib/avr/include/avr/version.h \
/usr/lib/avr/include/avr/fuse.h /usr/lib/avr/include/avr/lock.h \
/usr/lib/avr/include/stdio.h /usr/lib/gcc/avr/4.8.2/include/stdarg.h \
/usr/lib/gcc/avr/4.8.2/include/stddef.h \
/usr/lib/avr/include/avr/pgmspace.h /usr/lib/avr/include/avr/interrupt.h \
uart.h dbt03.h ctrl.h delay.h
/usr/lib/avr/include/avr/io.h:
/usr/lib/avr/include/avr/sfr_defs.h:
/usr/lib/avr/include/inttypes.h:
/usr/lib/gcc/avr/4.8.2/include/stdint.h:
/usr/lib/avr/include/stdint.h:
/usr/lib/avr/include/avr/iom8.h:
/usr/lib/avr/include/avr/portpins.h:
/usr/lib/avr/include/avr/common.h:
/usr/lib/avr/include/avr/version.h:
/usr/lib/avr/include/avr/fuse.h:
/usr/lib/avr/include/avr/lock.h:
/usr/lib/avr/include/stdio.h:
/usr/lib/gcc/avr/4.8.2/include/stdarg.h:
/usr/lib/gcc/avr/4.8.2/include/stddef.h:
/usr/lib/avr/include/avr/pgmspace.h:
/usr/lib/avr/include/avr/interrupt.h:
uart.h:
dbt03.h:
ctrl.h:
delay.h:

45
firmware/.dep/uart.o.d Normal file
View File

@ -0,0 +1,45 @@
uart.o: uart.c /usr/lib/avr/include/avr/io.h \
/usr/lib/avr/include/avr/sfr_defs.h /usr/lib/avr/include/inttypes.h \
/usr/lib/gcc/avr/4.8.2/include/stdint.h /usr/lib/avr/include/stdint.h \
/usr/lib/avr/include/avr/iom8.h /usr/lib/avr/include/avr/portpins.h \
/usr/lib/avr/include/avr/common.h /usr/lib/avr/include/avr/version.h \
/usr/lib/avr/include/avr/fuse.h /usr/lib/avr/include/avr/lock.h \
/usr/lib/avr/include/avr/interrupt.h \
/usr/lib/gcc/avr/4.8.2/include/stdbool.h \
/usr/lib/avr/include/util/delay.h \
/usr/lib/avr/include/util/delay_basic.h /usr/lib/avr/include/math.h \
uart.h
/usr/lib/avr/include/avr/io.h:
/usr/lib/avr/include/avr/sfr_defs.h:
/usr/lib/avr/include/inttypes.h:
/usr/lib/gcc/avr/4.8.2/include/stdint.h:
/usr/lib/avr/include/stdint.h:
/usr/lib/avr/include/avr/iom8.h:
/usr/lib/avr/include/avr/portpins.h:
/usr/lib/avr/include/avr/common.h:
/usr/lib/avr/include/avr/version.h:
/usr/lib/avr/include/avr/fuse.h:
/usr/lib/avr/include/avr/lock.h:
/usr/lib/avr/include/avr/interrupt.h:
/usr/lib/gcc/avr/4.8.2/include/stdbool.h:
/usr/lib/avr/include/util/delay.h:
/usr/lib/avr/include/util/delay_basic.h:
/usr/lib/avr/include/math.h:
uart.h:

512
firmware/Makefile Normal file
View File

@ -0,0 +1,512 @@
# Hey Emacs, this is a -*- makefile -*-
#----------------------------------------------------------------------------
# WinAVR Makefile Template written by Eric B. Weddington, J<>rg Wunsch, et al.
#
# Released to the Public Domain
#
# Additional material for this makefile was written by:
# Peter Fleury
# Tim Henigan
# Colin O'Flynn
# Reiner Patommel
# Markus Pfaff
# Sander Pool
# Frederik Rouleau
#
#----------------------------------------------------------------------------
# On command line:
#
# make all = Make software.
#
# make clean = Clean out built project files.
#
# make coff = Convert ELF to AVR COFF.
#
# make extcoff = Convert ELF to AVR Extended COFF.
#
# make program = Download the hex file to the device, using avrdude.
# Please customize the avrdude settings below first!
#
# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
#
# make filename.i = Create a preprocessed source file for use in submitting
# bug reports to the GCC project.
#
# To rebuild project do "make clean" then "make all".
#----------------------------------------------------------------------------
# MCU name
MCU = atmega8
# Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the
# processor frequency. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
F_CPU = 16000000
# Output format. (can be srec, ihex, binary)
FORMAT = binary
# Target file name (without extension).
TARGET = main
# List C source files here. (C dependencies are automatically generated.)
SRC = $(TARGET).c uart.c delay.c dbt03.c ctrl.c
# List Assembler source files here.
# Make them always end in a capital .S. Files ending in a lowercase .s
# will not be considered source files but generated files (assembler
# output from the compiler), and will be deleted upon "make clean"!
# Even though the DOS/Win* filesystem matches both .s and .S the same,
# it will preserve the spelling of the filenames, and gcc itself does
# care about how the name is spelled on its command-line.
ASRC =
# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT =s
# Debugging format.
# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
# AVR Studio 4.10 requires dwarf-2.
# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
#DEBUG = dwarf-2
# List any extra directories to look for include files here.
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
EXTRAINCDIRS =
# Compiler flag to set the C Standard level.
# c89 = "ANSI" C
# gnu89 = c89 plus GCC extensions
# c99 = ISO C99 standard (not yet fully implemented)
# gnu99 = c99 plus GCC extensions
CSTANDARD = -std=gnu99
# Place -D or -U options here
CDEFS = -DF_CPU=$(F_CPU)UL
# Place -I options here
CINCS =
#---------------- Compiler Options ----------------
# -g*: generate debugging information
# -O*: optimization level
# -f...: tuning, see GCC manual and avr-libc documentation
# -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
#CFLAGS = -g$(DEBUG)
CFLAGS += $(CDEFS) $(CINCS)
CFLAGS += -O$(OPT)
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
CFLAGS += -Wall -Wstrict-prototypes
CFLAGS += -Wa,-adhlns=$(<:.c=.lst)
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
CFLAGS += $(CSTANDARD)
#---------------- Assembler Options ----------------
# -Wa,...: tell GCC to pass this to the assembler.
# -ahlms: create listing
# -gstabs: have the assembler create line number information; note that
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
#---------------- Library Options ----------------
# Minimalistic printf version
PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
# Floating point printf version (requires MATH_LIB = -lm below)
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
# Minimalistic scanf version
SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
MATH_LIB = -lm
#---------------- External Memory Options ----------------
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
# used for variables (.data/.bss) and heap (malloc()).
#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
# only used for heap (malloc()).
#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff
EXTMEMOPTS =
#---------------- Linker Options ----------------
# -Wl,...: tell GCC to pass this to linker.
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
#---------------- Programming Options (avrdude) ----------------
# Programming hardware: alf avr910 avrisp bascom bsd
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
#
# Type: avrdude -c ?
# to get a full listing.
#
#AVRDUDE_PROGRAMMER = stk200 #Parallelport
AVRDUDE_PROGRAMMER = avrispv2 #USB
# com1 = serial port. Use lpt1 to connect to parallel port.
#AVRDUDE_PORT = /dev/parport0 # programmer connected to serial device
AVRDUDE_PORT = usb
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
# Uncomment the following if you want avrdude's erase cycle counter.
# Note that this counter needs to be initialized first using -Yn,
# see avrdude manual.
#AVRDUDE_ERASE_COUNTER = -y
# Uncomment the following if you do /not/ wish a verification to be
# performed after programming the device.
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
#---------------- Debugging Options ----------------
# For simulavr only - target MCU frequency.
DEBUG_MFREQ = $(F_CPU)
# Set the DEBUG_UI to either gdb or insight.
# DEBUG_UI = gdb
DEBUG_UI = insight
# Set the debugging back-end to either avarice, simulavr.
DEBUG_BACKEND = avarice
#DEBUG_BACKEND = simulavr
# GDB Init Filename.
GDBINIT_FILE = __avr_gdbinit
# When using avarice settings for the JTAG
JTAG_DEV = /dev/com1
# Debugging port used to communicate between GDB / avarice / simulavr.
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
#============================================================================
# Define programs and commands.
SHELL = sh
CC = avr-gcc
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
SIZE = avr-size
NM = avr-nm
AVRDUDE = avrdude
REMOVE = rm -f
COPY = cp
WINSHELL = cmd
# Define Messages
# English
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
MSG_FLASH = Creating load file for Flash:
MSG_EEPROM = Creating load file for EEPROM:
MSG_EXTENDED_LISTING = Creating Extended Listing:
MSG_SYMBOL_TABLE = Creating Symbol Table:
MSG_LINKING = Linking:
MSG_COMPILING = Compiling:
MSG_ASSEMBLING = Assembling:
MSG_CLEANING = Cleaning project:
# Define all object files.
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)
# Define all listing files.
LST = $(SRC:.c=.lst) $(ASRC:.S=.lst)
# Compiler flags to generate dependency files.
GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d
# Combine all necessary flags and optional flags.
# Add target processor to flags.
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
# Default target.
all: begin gccversion sizebefore build sizeafter end
build: elf hex eep lss sym
elf: $(TARGET).elf
hex: $(TARGET).hex
eep: $(TARGET).eep
lss: $(TARGET).lss
sym: $(TARGET).sym
# Eye candy.
# AVR Studio 3.x does not check make's exit code but relies on
# the following magic strings to be generated by the compile job.
begin:
@echo
@echo $(MSG_BEGIN)
end:
@echo $(MSG_END)
@echo
# Display size of file.
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
ELFSIZE = $(SIZE) -A $(TARGET).elf
AVRMEM = avr-mem.sh $(TARGET).elf $(MCU)
sizebefore:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
$(AVRMEM) 2>/dev/null; echo; fi
sizeafter:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
$(AVRMEM) 2>/dev/null; echo; fi
# Display compiler version information.
gccversion :
@$(CC) --version
# Program the device.
program: $(TARGET).hex $(TARGET).eep
sudo $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
fuse:
$(AVRDUDE) $(AVRDUDE_FLAGS) -q -U lfuse:w:0x20:m -U hfuse:w:0xd9:m
# Generate avr-gdb config/init file which does the following:
# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@echo end >> $(GDBINIT_FILE)
@echo file $(TARGET).elf >> $(GDBINIT_FILE)
@echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
ifeq ($(DEBUG_BACKEND),simulavr)
@echo load >> $(GDBINIT_FILE)
endif
@echo break main >> $(GDBINIT_FILE)
debug: gdb-config $(TARGET).elf
ifeq ($(DEBUG_BACKEND), avarice)
@echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
@$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
$(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
@$(WINSHELL) /c pause
else
@$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
$(DEBUG_MFREQ) --port $(DEBUG_PORT)
endif
@$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
COFFCONVERT=$(OBJCOPY) --debugging \
--change-section-address .data-0x800000 \
--change-section-address .bss-0x800000 \
--change-section-address .noinit-0x800000 \
--change-section-address .eeprom-0x810000
coff: $(TARGET).elf
@echo
@echo $(MSG_COFF) $(TARGET).cof
$(COFFCONVERT) -O coff-avr $< $(TARGET).cof
extcoff: $(TARGET).elf
@echo
@echo $(MSG_EXTENDED_COFF) $(TARGET).cof
$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
# Create final output files (.hex, .eep) from ELF output file.
%.hex: %.elf
@echo
@echo $(MSG_FLASH) $@
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
%.eep: %.elf
@echo
@echo $(MSG_EEPROM) $@
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@
# Create extended listing file from ELF output file.
%.lss: %.elf
@echo
@echo $(MSG_EXTENDED_LISTING) $@
$(OBJDUMP) -h -S $< > $@
# Create a symbol table from ELF output file.
%.sym: %.elf
@echo
@echo $(MSG_SYMBOL_TABLE) $@
$(NM) -n $< > $@
# Link: create ELF output file from object files.
.SECONDARY : $(TARGET).elf
.PRECIOUS : $(OBJ)
%.elf: $(OBJ)
@echo
@echo $(MSG_LINKING) $@
$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
# Compile: create object files from C source files.
%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
$(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create assembler files from C source files.
%.s : %.c
$(CC) -S $(ALL_CFLAGS) $< -o $@
# Assemble: create object files from assembler source files.
%.o : %.S
@echo
@echo $(MSG_ASSEMBLING) $<
$(CC) -c $(ALL_ASFLAGS) $< -o $@
# Create preprocessed source for use in sending a bug report.
%.i : %.c
$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
clean: begin clean_list end
clean_list :
@echo
@echo $(MSG_CLEANING)
$(REMOVE) $(TARGET).hex
$(REMOVE) $(TARGET).eep
$(REMOVE) $(TARGET).cof
$(REMOVE) $(TARGET).elf
$(REMOVE) $(TARGET).map
$(REMOVE) $(TARGET).sym
$(REMOVE) $(TARGET).lss
$(REMOVE) $(OBJ)
$(REMOVE) $(LST)
$(REMOVE) $(SRC:.c=.s)
$(REMOVE) $(SRC:.c=.d)
$(REMOVE) .dep/*
# Include the dependency files.
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
# Listing of phony targets.
.PHONY : all begin finish end sizebefore sizeafter gccversion \
build elf hex eep lss sym coff extcoff \
clean clean_list program debug gdb-config

61
firmware/ctrl.c Normal file
View File

@ -0,0 +1,61 @@
/*
####################################################################################
# #
# Bildschirmtricks Firmware V1.0.0 #
# Control-line-Handler #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#include <avr/io.h> /* Include I/O definitions */
#include <stdint.h> /* Include Integer types */
/* #################################################################################### */
/* #################################################################################### */
/* Initalize Control lines */
void systemCtrlInit(void)
{
PORTB |= (1 << PB1); /* Set PB1 to high level */
DDRB |= (1 << DDB1); /* Set PB1 as output */
PORTB |= (1 << PB2); /* Enable PB2 (inhibit) pullup resistor */
PORTD |= (1 << PD4); /* Enable PD4 (terminate) pullup resistor */
return;
}
/* Toggle ready signal (ready => low) */
void systemCtrlReady(void)
{
PORTB &= ~(1 << PB1); /* Set PB1 to low level */
}
/* Check if inhibit signal is present (Low=Inhibit=0 , High=Normal=1) */
uint8_t systemCtrlCheckInhibit(void)
{
return ((PINB >> PB2) & 1);
}
/* Check if terminate signal is present (Low=Terminate=0 , High=Normal=1 */
uint8_t systemCtrlCheckTerminate(void)
{
return ((PIND >> PD4) & 1);
}
/* #################################################################################### */

38
firmware/ctrl.h Normal file
View File

@ -0,0 +1,38 @@
/*
####################################################################################
# #
# Bildschirmtricks Firmware V1.0.0 #
# Control-line-Handler #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#ifndef CTRL_H
#define CTRL_H
void systemCtrlInit(void); /* Initalize Control lines */
void systemCtrlReady(void); /* Toggle ready signal (ready => low) */
uint8_t systemCtrlCheckInhibit(void); /* Check if inhibit signal is present (Low=Inhibit=0 , High=Normal=1) */
uint8_t systemCtrlCheckTerminate(void); /* Check if terminate signal is present (Low=Terminate=0 , High=Normal=1 */
#endif /*CTRL_H*/
/* #################################################################################### */

61
firmware/ctrl.lst Normal file
View File

@ -0,0 +1,61 @@
1 .file "ctrl.c"
2 __SP_H__ = 0x3e
3 __SP_L__ = 0x3d
4 __SREG__ = 0x3f
5 __tmp_reg__ = 0
6 __zero_reg__ = 1
7 .text
8 .global systemCtrlInit
10 systemCtrlInit:
11 /* prologue: function */
12 /* frame size = 0 */
13 /* stack size = 0 */
14 .L__stack_usage = 0
15 0000 C19A sbi 0x18,1
16 0002 B99A sbi 0x17,1
17 0004 C29A sbi 0x18,2
18 0006 949A sbi 0x12,4
19 0008 0895 ret
21 .global systemCtrlReady
23 systemCtrlReady:
24 /* prologue: function */
25 /* frame size = 0 */
26 /* stack size = 0 */
27 .L__stack_usage = 0
28 000a C198 cbi 0x18,1
29 000c 0895 ret
31 .global systemCtrlCheckInhibit
33 systemCtrlCheckInhibit:
34 /* prologue: function */
35 /* frame size = 0 */
36 /* stack size = 0 */
37 .L__stack_usage = 0
38 000e 86B3 in r24,0x16
39 0010 82FB bst r24,2
40 0012 8827 clr r24
41 0014 80F9 bld r24,0
42 0016 0895 ret
44 .global systemCtrlCheckTerminate
46 systemCtrlCheckTerminate:
47 /* prologue: function */
48 /* frame size = 0 */
49 /* stack size = 0 */
50 .L__stack_usage = 0
51 0018 80B3 in r24,0x10
52 001a 8295 swap r24
53 001c 8170 andi r24,1
54 001e 0895 ret
56 .ident "GCC: (GNU) 4.8.2"
DEFINED SYMBOLS
*ABS*:0000000000000000 ctrl.c
/tmp/ccdBCC9Q.s:2 *ABS*:000000000000003e __SP_H__
/tmp/ccdBCC9Q.s:3 *ABS*:000000000000003d __SP_L__
/tmp/ccdBCC9Q.s:4 *ABS*:000000000000003f __SREG__
/tmp/ccdBCC9Q.s:5 *ABS*:0000000000000000 __tmp_reg__
/tmp/ccdBCC9Q.s:6 *ABS*:0000000000000001 __zero_reg__
/tmp/ccdBCC9Q.s:10 .text:0000000000000000 systemCtrlInit
/tmp/ccdBCC9Q.s:23 .text:000000000000000a systemCtrlReady
/tmp/ccdBCC9Q.s:33 .text:000000000000000e systemCtrlCheckInhibit
/tmp/ccdBCC9Q.s:46 .text:0000000000000018 systemCtrlCheckTerminate
NO UNDEFINED SYMBOLS

197
firmware/dbt03.c Normal file
View File

@ -0,0 +1,197 @@
/*
####################################################################################
# #
# Bildschirmtricks Firmware V2.0.0 #
# dbt03 emulator layer #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#include <avr/io.h> /* Include I/O definitions */
#include <stdbool.h> /* Include Boolean types */
#include <avr/interrupt.h> /* Include Interrupt control */
#include <util/parity.h> /* Include parity calculation functions */
#include "dbt03.h" /* Include own header file */
#include "uart.h" /* Include serial port control */
#include "delay.h" /* Include Delay control mechanisms */
#include "ctrl.h" /* Include control line handler */
/* #################################################################################### */
/* #################################################################################### */
/* Internal subroutine: Toggle display I/O pin */
static void dbt03IoCtrl(const uint8_t status)
{
if(status == 1)
PORTB |= (1 << PB0);
else
PORTB &= ~(1 << PB0);
return;
}
/* Internal subroutine: Perform 425Hz tone (as a TTL signal) */
static void dbt03Dialtone(const uint16_t cycles)
{
uint16_t i;
for(i=0; i<cycles; i++)
{
dbt03IoCtrl(0);
systemDelay100us(10);
dbt03IoCtrl(1);
systemDelay100us(10);
}
}
/* Internal subroutine: Perform 1300Hz tone (as a TTL signal) */
static void dbt03Carriertone(const uint16_t cycles)
{
uint16_t i;
for(i=0; i<cycles; i++)
{
dbt03IoCtrl(0);
systemDelay10us(38);
dbt03IoCtrl(1);
systemDelay10us(38);
}
}
/* Initalize dbt03 emulation layer */
void systemDbt03Init(void)
{
dbt03IoCtrl(1); /* Set initial state of serial output line */
DDRB |= (1 << DDB0); /* Set PB0 as output */
PORTD &= ~(1 << PD2); /* Disable pullup resistor on PB2 */
GIMSK |= (1<<INT0); /* Configure interrupt driven receiver */
MCUCR |= (1<<ISC01);
sei();
return;
}
/* Send character to the BTX-Terminal */
void systemDbt03Transmit(uint8_t character)
{
uint8_t i;
cli();
dbt03IoCtrl(1); /* Perform start bit */
systemDelay10us(DBT03_TX_BAUDRATE);
for(i=0; i<=7; i++) /* Transmit data bits */
{
dbt03IoCtrl((~character >> i) & 1);
systemDelay10us(DBT03_TX_BAUDRATE);
}
dbt03IoCtrl(0);
systemDelay10us(DBT03_TX_BAUDRATE);
sei();
return;
}
/* Receive a character from the BTX-Terminal */
uint8_t systemDbt03Receive(void)
{
uint8_t i;
uint8_t result = 0;
if(systemCtrlCheckInhibit() == 0)
{
cli();
while(((PIND >> PD2) & 1) == 1); /* Wait for incoming start bit */
systemDelay100us(DBT03_RX_BAUDRATE);
for(i=0; i<=7; i++) /* Read data bits */
{
systemDelay100us(DBT03_RX_BAUDRATE / 2);
result |= (((PIND >> PD2) & 1) << i);
systemDelay100us(DBT03_RX_BAUDRATE / 2);
}
sei();
}
return result;
}
/* Tell the BTX-Terminal that connection went ok */
void systemDbt03ConnectionOk(void)
{
systemDelay100ms(DBT03_HOOK_OFF_DELAY); /* Modem startup time (about 3s) */
dbt03Dialtone(DBT03_DAILTONE_CYCLES); /* Perform dialtone */
systemDelay100ms(DBT03_DIALIN_DELAY); /* Delay dialintime (Terminal beleves now that the modem dials) */
dbt03Dialtone(DBT03_RINGTONE_CYCLES); /* Perform ringtone */
systemDelay100ms(DBT03_POST_RINGTONE_DELAY); /* Delay aftr ringtone */
dbt03Carriertone(DBT03_CARRIERTONE_CYCLES); /* Perform carrier tone */
dbt03IoCtrl(0); /* Pull I/O line to low level */
systemDelay100ms(DBT03_POST_DIALIN_DELAY); /* Delay time after dailin */
return;
}
/* Tell the BTX-Terminal that the connection has terminated */
void systemDbt03ConnectionTerminate(void)
{
dbt03IoCtrl(1); /* Pull I/O line to high level */
while(1); /* Halt in endless loop (Terminal will cause reset of power off, so do not worry about deadlock) */
return;
}
/* Receive a character from the BTX-Terminal via interrupt and pass it through the UART */
SIGNAL(INT0_vect)
{
uint8_t i;
uint8_t result = 0;
if(systemCtrlCheckInhibit() == 1)
{
systemDelay100us(DBT03_RX_BAUDRATE/2); /* let start bit pass by and check whether it is a real start bit */
if(((PIND >> PD2) & 1) != 0)
return;
systemDelay100us(DBT03_RX_BAUDRATE / 2);
for(i=0; i<=7; i++) /* Read data bits */
{
systemDelay100us(DBT03_RX_BAUDRATE / 2);
result |= (((PIND >> PD2) & 1) << i);
systemDelay100us(DBT03_RX_BAUDRATE / 2);
}
systemDelay100us(DBT03_RX_BAUDRATE/2); /* let start bit pass by */
systemUartTransmit(result);
}
}
/* #################################################################################### */

127
firmware/dbt03.h Normal file
View File

@ -0,0 +1,127 @@
/*
####################################################################################
# #
# Bildschirmtricks Firmware V2.0.0 #
# dbt03 emulator layer #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#ifndef DBT03_H
#define DBT03_H
/*
==OVERVIEW==
Note: Every BTX Terminal was connected to a propritary modem that that could only dial the number
of the BTX-Mainframe (PAD). The microcontroller in the modem also conained a secret that was
necessary to associate with the BTX-Mainfraime. The Modem were sealed and opening was a
punishable offence.
2 7=START (Power modem up and initaiate connection)
o 5=ED (Data receive and status report, 1200 baud, 8n1)
4 o o 5 6=SD (Data send port, 75 baud)
1 o o 3 2=E (GND)
6 o o 7
^
View at the
terminal/modem
side
The DBT03 was a V.23 modem from the BUNDESPOST (a telecommunications service in germany, now history)
to dial into the BTX (=BILDSCHIRMTEXT) system. This modem was switched on by pulling the the START
line to high. Then the modem dials automaticly and does the BTX negotiation. Then the modem reports
the connection status in a very easy way: It just takes the dialtones and hands them through as normal
TTL signals.
________________________________________________________________________________________
START ___|
___ Start bits ____
| Stop bit ___ |
V | V
_______________ ______________ ______ _ _ _ _ _ _ V _
ED ___| |||||||| ||||||| ||||||_____| |_| |_| |_| |_|.|____ And so on....
<---------------><-----><------------><-----><----><----><----><---Serial data at 1200 Baud-->
T1 T2 T3 T4 T5 T6 T7
(dialtone) (dialing) (ring)
T1: Time between modem activision and hook-off, typicaly 3s.
Configurable with DBT03_HOOK_OFF_DELAY macro.
T2: Dialtone appeareance time, a dialtone cycle is about 2,35ms long.
Number of cyceles is configurable with DBT03_DAILTONE_CYCLES
T3: Dialin delay time, time that goes by whil a real modem dials the BTX-PAD number (019 or 01910)
Typicaly it takes 4 seconds to dial that number. The dialin delay time is configurable
with DBT03_DIALIN_DELAY
T4: Ringtone appearance time, nealy the same as T2 but in this case this tone stands for
a successful dial process and tells the BTX-Terminal that the pone of the BTX-PAD is ringing.
In this emulation we assume that the BTX-PAD is fast and hooks off with the first ringtone.
The ringtone-appeareance-time is configurable with DBT03_RINGTONE_CYCLES
T5: Post ringtone delay, time between the dialtone and the carrier signal. This time can be configured
with DBT03_POST_RINGTONE_DELAY
T6: Carrier tone appereance time: The original DBT-03 modem needed about 1,6 - 1,7 ms time to detect the
carrier signal. As long as the carrier signal is not recognized the modem passes the signal through.
That is why the carrier signal is also a part of this simulation.
T7: To finish the dialin procedure the modem pulls the ED line to low level and waits some time.
This time is configurable with DBT03_POST_DIALIN_DELAY
Note: The configured values are based on some old documentation i found on the net as well as on
experiments with various types of terminals. if this does not work on your setup or if you
unhappy with the long dialin procedure you can try to tune the timing.
==CONFIGURATION== */
/* Timing configuration for serial data transmission */
#define DBT03_TX_BAUDRATE 82 /* (x10us) Should be 1200 baud/833,333us bit legth */
#define DBT03_RX_BAUDRATE 133 /* (x100us) Should be 75 baud/13,333ms bit legth */
/* Timing configuration for dialin simulation */
#define DBT03_HOOK_OFF_DELAY 30 /* (x100ms) Hook off delay time, typical 3,0s */
#define DBT03_DAILTONE_CYCLES 800 /* (x2,35ms) Dialtone appearance time */
#define DBT03_DIALIN_DELAY 40 /* (x100ms) Dailin delay time, maximum 4,3s */
#define DBT03_RINGTONE_CYCLES 200 /* (x2,35ms) Ringtone appearance time */
#define DBT03_POST_RINGTONE_DELAY 5 /* (x100ms) Time between ringtone and carrier tone */
#define DBT03_CARRIERTONE_CYCLES 2080 /* (x760us) Carrier tone appereance time */
#define DBT03_POST_DIALIN_DELAY 5 /* (x100ms) Time between successful dialin notification and transmission start */
/* ==Function set==
This proviedes a set of basic functions that emulate the typical dbt03 signals */
void systemDbt03Init(void); /* Initalize dbt03 emulation layer */
void systemDbt03Transmit(uint8_t character); /* Send character to the BTX-Terminal */
uint8_t systemDbt03Receive(void); /* Receive a character from the BTX-Terminal */
void systemDbt03ConnectionOk(void); /* Tell the BTX-Terminal that connection went ok */
void systemDbt03ConnectionTerminate(void); /* Tell the BTX-Terminal that the connection has terminated */
#endif /*DBT03_H*/
/* #################################################################################### */

355
firmware/dbt03.lst Normal file
View File

@ -0,0 +1,355 @@
1 .file "dbt03.c"
2 __SP_H__ = 0x3e
3 __SP_L__ = 0x3d
4 __SREG__ = 0x3f
5 __tmp_reg__ = 0
6 __zero_reg__ = 1
7 .text
9 dbt03IoCtrl.part.0:
10 /* prologue: function */
11 /* frame size = 0 */
12 /* stack size = 0 */
13 .L__stack_usage = 0
14 0000 C09A sbi 0x18,0
15 0002 0895 ret
18 dbt03Dialtone:
19 0004 0F93 push r16
20 0006 1F93 push r17
21 0008 CF93 push r28
22 000a DF93 push r29
23 /* prologue: function */
24 /* frame size = 0 */
25 /* stack size = 4 */
26 .L__stack_usage = 4
27 000c 8C01 movw r16,r24
28 000e C0E0 ldi r28,0
29 0010 D0E0 ldi r29,0
30 .L3:
31 0012 C017 cp r28,r16
32 0014 D107 cpc r29,r17
33 0016 01F0 breq .L6
34 0018 C098 cbi 0x18,0
35 001a 8AE0 ldi r24,lo8(10)
36 001c 00D0 rcall systemDelay100us
37 001e 00D0 rcall dbt03IoCtrl.part.0
38 0020 8AE0 ldi r24,lo8(10)
39 0022 00D0 rcall systemDelay100us
40 0024 2196 adiw r28,1
41 0026 00C0 rjmp .L3
42 .L6:
43 /* epilogue start */
44 0028 DF91 pop r29
45 002a CF91 pop r28
46 002c 1F91 pop r17
47 002e 0F91 pop r16
48 0030 0895 ret
50 .global systemDbt03Init
52 systemDbt03Init:
53 /* prologue: function */
54 /* frame size = 0 */
55 /* stack size = 0 */
56 .L__stack_usage = 0
57 0032 00D0 rcall dbt03IoCtrl.part.0
58 0034 B89A sbi 0x17,0
59 0036 9298 cbi 0x12,2
60 0038 8BB7 in r24,0x3b
61 003a 8064 ori r24,lo8(64)
62 003c 8BBF out 0x3b,r24
63 003e 85B7 in r24,0x35
64 0040 8260 ori r24,lo8(2)
65 0042 85BF out 0x35,r24
66 /* #APP */
67 ; 90 "dbt03.c" 1
68 0044 7894 sei
69 ; 0 "" 2
70 /* #NOAPP */
71 0046 0895 ret
73 .global systemDbt03Transmit
75 systemDbt03Transmit:
76 0048 0F93 push r16
77 004a 1F93 push r17
78 004c CF93 push r28
79 004e DF93 push r29
80 /* prologue: function */
81 /* frame size = 0 */
82 /* stack size = 4 */
83 .L__stack_usage = 4
84 0050 082F mov r16,r24
85 /* #APP */
86 ; 100 "dbt03.c" 1
87 0052 F894 cli
88 ; 0 "" 2
89 /* #NOAPP */
90 0054 00D0 rcall dbt03IoCtrl.part.0
91 0056 82E5 ldi r24,lo8(82)
92 0058 00D0 rcall systemDelay10us
93 005a C0E0 ldi r28,0
94 005c D0E0 ldi r29,0
95 005e 10E0 ldi r17,0
96 0060 0095 com r16
97 0062 1095 com r17
98 .L12:
99 0064 C801 movw r24,r16
100 0066 0C2E mov r0,r28
101 0068 00C0 rjmp 2f
102 1:
103 006a 9595 asr r25
104 006c 8795 ror r24
105 2:
106 006e 0A94 dec r0
107 0070 02F4 brpl 1b
108 0072 80FF sbrs r24,0
109 0074 00C0 rjmp .L9
110 0076 00D0 rcall dbt03IoCtrl.part.0
111 0078 00C0 rjmp .L10
112 .L9:
113 007a C098 cbi 0x18,0
114 .L10:
115 007c 82E5 ldi r24,lo8(82)
116 007e 00D0 rcall systemDelay10us
117 0080 2196 adiw r28,1
118 0082 C830 cpi r28,8
119 0084 D105 cpc r29,__zero_reg__
120 0086 01F4 brne .L12
121 0088 C098 cbi 0x18,0
122 008a 82E5 ldi r24,lo8(82)
123 008c 00D0 rcall systemDelay10us
124 /* #APP */
125 ; 114 "dbt03.c" 1
126 008e 7894 sei
127 ; 0 "" 2
128 /* epilogue start */
129 /* #NOAPP */
130 0090 DF91 pop r29
131 0092 CF91 pop r28
132 0094 1F91 pop r17
133 0096 0F91 pop r16
134 0098 0895 ret
136 .global systemDbt03Receive
138 systemDbt03Receive:
139 009a FF92 push r15
140 009c 0F93 push r16
141 009e 1F93 push r17
142 00a0 CF93 push r28
143 00a2 DF93 push r29
144 /* prologue: function */
145 /* frame size = 0 */
146 /* stack size = 5 */
147 .L__stack_usage = 5
148 00a4 00D0 rcall systemCtrlCheckInhibit
149 00a6 8111 cpse r24,__zero_reg__
150 00a8 00C0 rjmp .L19
151 /* #APP */
152 ; 127 "dbt03.c" 1
153 00aa F894 cli
154 ; 0 "" 2
155 /* #NOAPP */
156 .L16:
157 00ac 8299 sbic 0x10,2
158 00ae 00C0 rjmp .L16
159 00b0 85E8 ldi r24,lo8(-123)
160 00b2 00D0 rcall systemDelay100us
161 00b4 00E0 ldi r16,0
162 00b6 10E0 ldi r17,0
163 00b8 F12C mov r15,__zero_reg__
164 .L18:
165 00ba 82E4 ldi r24,lo8(66)
166 00bc 00D0 rcall systemDelay100us
167 00be 80B3 in r24,0x10
168 00c0 82FB bst r24,2
169 00c2 8827 clr r24
170 00c4 80F9 bld r24,0
171 00c6 C82F mov r28,r24
172 00c8 002E mov r0,r16
173 00ca 00C0 rjmp 2f
174 1:
175 00cc CC0F lsl r28
176 2:
177 00ce 0A94 dec r0
178 00d0 02F4 brpl 1b
179 00d2 FC2A or r15,r28
180 00d4 82E4 ldi r24,lo8(66)
181 00d6 00D0 rcall systemDelay100us
182 00d8 0F5F subi r16,-1
183 00da 1F4F sbci r17,-1
184 00dc 0830 cpi r16,8
185 00de 1105 cpc r17,__zero_reg__
186 00e0 01F4 brne .L18
187 /* #APP */
188 ; 141 "dbt03.c" 1
189 00e2 7894 sei
190 ; 0 "" 2
191 /* #NOAPP */
192 00e4 00C0 rjmp .L14
193 .L19:
194 00e6 F12C mov r15,__zero_reg__
195 .L14:
196 00e8 8F2D mov r24,r15
197 /* epilogue start */
198 00ea DF91 pop r29
199 00ec CF91 pop r28
200 00ee 1F91 pop r17
201 00f0 0F91 pop r16
202 00f2 FF90 pop r15
203 00f4 0895 ret
205 .global systemDbt03ConnectionOk
207 systemDbt03ConnectionOk:
208 00f6 CF93 push r28
209 00f8 DF93 push r29
210 /* prologue: function */
211 /* frame size = 0 */
212 /* stack size = 2 */
213 .L__stack_usage = 2
214 00fa 8EE1 ldi r24,lo8(30)
215 00fc 00D0 rcall systemDelay100ms
216 00fe 80E2 ldi r24,lo8(32)
217 0100 93E0 ldi r25,lo8(3)
218 0102 00D0 rcall dbt03Dialtone
219 0104 88E2 ldi r24,lo8(40)
220 0106 00D0 rcall systemDelay100ms
221 0108 88EC ldi r24,lo8(-56)
222 010a 90E0 ldi r25,0
223 010c 00D0 rcall dbt03Dialtone
224 010e 85E0 ldi r24,lo8(5)
225 0110 00D0 rcall systemDelay100ms
226 0112 C0E2 ldi r28,lo8(32)
227 0114 D8E0 ldi r29,lo8(8)
228 .L22:
229 0116 C098 cbi 0x18,0
230 0118 86E2 ldi r24,lo8(38)
231 011a 00D0 rcall systemDelay10us
232 011c 00D0 rcall dbt03IoCtrl.part.0
233 011e 86E2 ldi r24,lo8(38)
234 0120 00D0 rcall systemDelay10us
235 0122 2197 sbiw r28,1
236 0124 2097 sbiw r28,0
237 0126 01F4 brne .L22
238 0128 C098 cbi 0x18,0
239 012a 85E0 ldi r24,lo8(5)
240 /* epilogue start */
241 012c DF91 pop r29
242 012e CF91 pop r28
243 0130 00C0 rjmp systemDelay100ms
245 .global systemDbt03ConnectionTerminate
247 systemDbt03ConnectionTerminate:
248 /* prologue: function */
249 /* frame size = 0 */
250 /* stack size = 0 */
251 .L__stack_usage = 0
252 0132 00D0 rcall dbt03IoCtrl.part.0
253 .L24:
254 0134 00C0 rjmp .L24
256 .global __vector_1
258 __vector_1:
259 0136 1F92 push r1
260 0138 0F92 push r0
261 013a 0FB6 in r0,__SREG__
262 013c 0F92 push r0
263 013e 1124 clr __zero_reg__
264 0140 FF92 push r15
265 0142 0F93 push r16
266 0144 1F93 push r17
267 0146 2F93 push r18
268 0148 3F93 push r19
269 014a 4F93 push r20
270 014c 5F93 push r21
271 014e 6F93 push r22
272 0150 7F93 push r23
273 0152 8F93 push r24
274 0154 9F93 push r25
275 0156 AF93 push r26
276 0158 BF93 push r27
277 015a CF93 push r28
278 015c DF93 push r29
279 015e EF93 push r30
280 0160 FF93 push r31
281 /* prologue: Signal */
282 /* frame size = 0 */
283 /* stack size = 20 */
284 .L__stack_usage = 20
285 0162 00D0 rcall systemCtrlCheckInhibit
286 0164 8130 cpi r24,lo8(1)
287 0166 01F4 brne .L25
288 0168 82E4 ldi r24,lo8(66)
289 016a 00D0 rcall systemDelay100us
290 016c 8299 sbic 0x10,2
291 016e 00C0 rjmp .L25
292 0170 82E4 ldi r24,lo8(66)
293 0172 00D0 rcall systemDelay100us
294 0174 00E0 ldi r16,0
295 0176 10E0 ldi r17,0
296 0178 F12C mov r15,__zero_reg__
297 .L30:
298 017a 82E4 ldi r24,lo8(66)
299 017c 00D0 rcall systemDelay100us
300 017e 80B3 in r24,0x10
301 0180 82FB bst r24,2
302 0182 8827 clr r24
303 0184 80F9 bld r24,0
304 0186 C82F mov r28,r24
305 0188 002E mov r0,r16
306 018a 00C0 rjmp 2f
307 1:
308 018c CC0F lsl r28
309 2:
310 018e 0A94 dec r0
311 0190 02F4 brpl 1b
312 0192 FC2A or r15,r28
313 0194 82E4 ldi r24,lo8(66)
314 0196 00D0 rcall systemDelay100us
315 0198 0F5F subi r16,-1
316 019a 1F4F sbci r17,-1
317 019c 0830 cpi r16,8
318 019e 1105 cpc r17,__zero_reg__
319 01a0 01F4 brne .L30
320 01a2 82E4 ldi r24,lo8(66)
321 01a4 00D0 rcall systemDelay100us
322 01a6 8F2D mov r24,r15
323 01a8 00D0 rcall systemUartTransmit
324 .L25:
325 /* epilogue start */
326 01aa FF91 pop r31
327 01ac EF91 pop r30
328 01ae DF91 pop r29
329 01b0 CF91 pop r28
330 01b2 BF91 pop r27
331 01b4 AF91 pop r26
332 01b6 9F91 pop r25
333 01b8 8F91 pop r24
334 01ba 7F91 pop r23
335 01bc 6F91 pop r22
336 01be 5F91 pop r21
337 01c0 4F91 pop r20
338 01c2 3F91 pop r19
339 01c4 2F91 pop r18
340 01c6 1F91 pop r17
341 01c8 0F91 pop r16
342 01ca FF90 pop r15
343 01cc 0F90 pop r0
344 01ce 0FBE out __SREG__,r0
345 01d0 0F90 pop r0
346 01d2 1F90 pop r1
347 01d4 1895 reti
349 .ident "GCC: (GNU) 4.8.2"
DEFINED SYMBOLS
*ABS*:0000000000000000 dbt03.c
/tmp/ccDZmxBL.s:2 *ABS*:000000000000003e __SP_H__
/tmp/ccDZmxBL.s:3 *ABS*:000000000000003d __SP_L__
/tmp/ccDZmxBL.s:4 *ABS*:000000000000003f __SREG__
/tmp/ccDZmxBL.s:5 *ABS*:0000000000000000 __tmp_reg__
/tmp/ccDZmxBL.s:6 *ABS*:0000000000000001 __zero_reg__
/tmp/ccDZmxBL.s:9 .text:0000000000000000 dbt03IoCtrl.part.0
/tmp/ccDZmxBL.s:18 .text:0000000000000004 dbt03Dialtone
/tmp/ccDZmxBL.s:52 .text:0000000000000032 systemDbt03Init
/tmp/ccDZmxBL.s:75 .text:0000000000000048 systemDbt03Transmit
/tmp/ccDZmxBL.s:138 .text:000000000000009a systemDbt03Receive
/tmp/ccDZmxBL.s:207 .text:00000000000000f6 systemDbt03ConnectionOk
/tmp/ccDZmxBL.s:247 .text:0000000000000132 systemDbt03ConnectionTerminate
/tmp/ccDZmxBL.s:258 .text:0000000000000136 __vector_1
UNDEFINED SYMBOLS
systemDelay100us
systemDelay10us
systemCtrlCheckInhibit
systemDelay100ms
systemUartTransmit

109
firmware/delay.c Normal file
View File

@ -0,0 +1,109 @@
/*
####################################################################################
# #
# Bildschirmtricks Firmware V1.0.0 #
# Delay-Routines #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#include <util/delay.h> /* Include delay functions */
#include <avr/interrupt.h> /* Include Interrupt control */
#include "delay.h" /* Include own header file */
/* #################################################################################### */
/* ## DELAY CONTROL ################################################################### */
void systemDelay1s(uint8_t value)
{
while(value--)
systemDelay10ms(100);
return;
}
void systemDelay10ms(uint8_t value)
{
while(value--)
_delay_ms(10);
return;
}
void systemDelay100ms(uint8_t value)
{
while(value--)
systemDelay10ms(10);
return;
}
void systemDelay1ms(uint8_t value)
{
while(value--)
_delay_ms(1);
return;
}
void systemDelay10us(uint8_t value)
{
while(value--)
_delay_us(10);
return;
}
void systemDelay100us(uint8_t value)
{
while(value--)
systemDelay10us(10);
return;
}
void systemDelay1us(uint8_t value)
{
while(value--)
_delay_us(1);
return;
}
void systemDelay05us(uint8_t value)
{
while(value--)
_delay_us(0.5);
return;
}
void systemDelay01us(uint8_t value)
{
while(value--)
_delay_us(0.1);
return;
}
void systemDelay16(uint16_t value)
{
_delay_loop_2(value);
return;
}
void systemDelay8(uint8_t value)
{
_delay_loop_1(value);
return;
}
/* #################################################################################### */

43
firmware/delay.h Normal file
View File

@ -0,0 +1,43 @@
/*
####################################################################################
# #
# Bildschirmtricks Firmware V1.0.0 #
# Delay-Routines #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#ifndef DELAY_H
#define DELAY_H
void systemDelay1s(uint8_t value);
void systemDelay10ms(uint8_t value);
void systemDelay100ms(uint8_t value);
void systemDelay1ms(uint8_t value);
void systemDelay10us(uint8_t value);
void systemDelay100us(uint8_t value);
void systemDelay1us(uint8_t value);
void systemDelay05us(uint8_t value);
void systemDelay01us(uint8_t value);
void systemDelay16(uint16_t value);
void systemDelay8(uint8_t value);
#endif /*DELAY_H*/
/* #################################################################################### */

220
firmware/delay.lst Normal file
View File

@ -0,0 +1,220 @@
1 .file "delay.c"
2 __SP_H__ = 0x3e
3 __SP_L__ = 0x3d
4 __SREG__ = 0x3f
5 __tmp_reg__ = 0
6 __zero_reg__ = 1
7 .text
8 .global systemDelay10ms
10 systemDelay10ms:
11 /* prologue: function */
12 /* frame size = 0 */
13 /* stack size = 0 */
14 .L__stack_usage = 0
15 .L2:
16 0000 8823 tst r24
17 0002 01F0 breq .L5
18 0004 EFE3 ldi r30,lo8(-25537)
19 0006 FCE9 ldi r31,hi8(-25537)
20 0008 3197 1: sbiw r30,1
21 000a 01F4 brne 1b
22 000c 00C0 rjmp .
23 000e 0000 nop
24 0010 8150 subi r24,lo8(-(-1))
25 0012 00C0 rjmp .L2
26 .L5:
27 /* epilogue start */
28 0014 0895 ret
30 .global systemDelay1s
32 systemDelay1s:
33 0016 CF93 push r28
34 /* prologue: function */
35 /* frame size = 0 */
36 /* stack size = 1 */
37 .L__stack_usage = 1
38 0018 C82F mov r28,r24
39 .L7:
40 001a CC23 tst r28
41 001c 01F0 breq .L9
42 001e 84E6 ldi r24,lo8(100)
43 0020 00D0 rcall systemDelay10ms
44 0022 C150 subi r28,lo8(-(-1))
45 0024 00C0 rjmp .L7
46 .L9:
47 /* epilogue start */
48 0026 CF91 pop r28
49 0028 0895 ret
51 .global systemDelay100ms
53 systemDelay100ms:
54 002a CF93 push r28
55 /* prologue: function */
56 /* frame size = 0 */
57 /* stack size = 1 */
58 .L__stack_usage = 1
59 002c C82F mov r28,r24
60 .L11:
61 002e CC23 tst r28
62 0030 01F0 breq .L13
63 0032 8AE0 ldi r24,lo8(10)
64 0034 00D0 rcall systemDelay10ms
65 0036 C150 subi r28,lo8(-(-1))
66 0038 00C0 rjmp .L11
67 .L13:
68 /* epilogue start */
69 003a CF91 pop r28
70 003c 0895 ret
72 .global systemDelay1ms
74 systemDelay1ms:
75 /* prologue: function */
76 /* frame size = 0 */
77 /* stack size = 0 */
78 .L__stack_usage = 0
79 .L15:
80 003e 8823 tst r24
81 0040 01F0 breq .L17
82 0042 EFE9 ldi r30,lo8(3999)
83 0044 FFE0 ldi r31,hi8(3999)
84 0046 3197 1: sbiw r30,1
85 0048 01F4 brne 1b
86 004a 00C0 rjmp .
87 004c 0000 nop
88 004e 8150 subi r24,lo8(-(-1))
89 0050 00C0 rjmp .L15
90 .L17:
91 /* epilogue start */
92 0052 0895 ret
94 .global systemDelay10us
96 systemDelay10us:
97 /* prologue: function */
98 /* frame size = 0 */
99 /* stack size = 0 */
100 .L__stack_usage = 0
101 .L19:
102 0054 8823 tst r24
103 0056 01F0 breq .L21
104 0058 95E3 ldi r25,lo8(53)
105 005a 9A95 1: dec r25
106 005c 01F4 brne 1b
107 005e 0000 nop
108 0060 8150 subi r24,lo8(-(-1))
109 0062 00C0 rjmp .L19
110 .L21:
111 /* epilogue start */
112 0064 0895 ret
114 .global systemDelay100us
116 systemDelay100us:
117 0066 CF93 push r28
118 /* prologue: function */
119 /* frame size = 0 */
120 /* stack size = 1 */
121 .L__stack_usage = 1
122 0068 C82F mov r28,r24
123 .L23:
124 006a CC23 tst r28
125 006c 01F0 breq .L25
126 006e 8AE0 ldi r24,lo8(10)
127 0070 00D0 rcall systemDelay10us
128 0072 C150 subi r28,lo8(-(-1))
129 0074 00C0 rjmp .L23
130 .L25:
131 /* epilogue start */
132 0076 CF91 pop r28
133 0078 0895 ret
135 .global systemDelay1us
137 systemDelay1us:
138 /* prologue: function */
139 /* frame size = 0 */
140 /* stack size = 0 */
141 .L__stack_usage = 0
142 .L27:
143 007a 8823 tst r24
144 007c 01F0 breq .L29
145 007e 95E0 ldi r25,lo8(5)
146 0080 9A95 1: dec r25
147 0082 01F4 brne 1b
148 0084 0000 nop
149 0086 8150 subi r24,lo8(-(-1))
150 0088 00C0 rjmp .L27
151 .L29:
152 /* epilogue start */
153 008a 0895 ret
155 .global systemDelay05us
157 systemDelay05us:
158 /* prologue: function */
159 /* frame size = 0 */
160 /* stack size = 0 */
161 .L__stack_usage = 0
162 .L31:
163 008c 8823 tst r24
164 008e 01F0 breq .L33
165 0090 92E0 ldi r25,lo8(2)
166 0092 9A95 1: dec r25
167 0094 01F4 brne 1b
168 0096 00C0 rjmp .
169 0098 8150 subi r24,lo8(-(-1))
170 009a 00C0 rjmp .L31
171 .L33:
172 /* epilogue start */
173 009c 0895 ret
175 .global systemDelay01us
177 systemDelay01us:
178 /* prologue: function */
179 /* frame size = 0 */
180 /* stack size = 0 */
181 .L__stack_usage = 0
182 .L35:
183 009e 8823 tst r24
184 00a0 01F0 breq .L37
185 00a2 00C0 rjmp .
186 00a4 8150 subi r24,lo8(-(-1))
187 00a6 00C0 rjmp .L35
188 .L37:
189 /* epilogue start */
190 00a8 0895 ret
192 .global systemDelay16
194 systemDelay16:
195 /* prologue: function */
196 /* frame size = 0 */
197 /* stack size = 0 */
198 .L__stack_usage = 0
199 /* #APP */
200 ; 105 "/usr/lib/avr/include/util/delay_basic.h" 1
201 00aa 0197 1: sbiw r24,1
202 00ac 01F4 brne 1b
203 ; 0 "" 2
204 /* #NOAPP */
205 00ae 0895 ret
207 .global systemDelay8
209 systemDelay8:
210 /* prologue: function */
211 /* frame size = 0 */
212 /* stack size = 0 */
213 .L__stack_usage = 0
214 /* #APP */
215 ; 83 "/usr/lib/avr/include/util/delay_basic.h" 1
216 00b0 8A95 1: dec r24
217 00b2 01F4 brne 1b
218 ; 0 "" 2
219 /* #NOAPP */
220 00b4 0895 ret
222 .ident "GCC: (GNU) 4.8.2"
DEFINED SYMBOLS
*ABS*:0000000000000000 delay.c
/tmp/cchzLu0J.s:2 *ABS*:000000000000003e __SP_H__
/tmp/cchzLu0J.s:3 *ABS*:000000000000003d __SP_L__
/tmp/cchzLu0J.s:4 *ABS*:000000000000003f __SREG__
/tmp/cchzLu0J.s:5 *ABS*:0000000000000000 __tmp_reg__
/tmp/cchzLu0J.s:6 *ABS*:0000000000000001 __zero_reg__
/tmp/cchzLu0J.s:10 .text:0000000000000000 systemDelay10ms
/tmp/cchzLu0J.s:32 .text:0000000000000016 systemDelay1s
/tmp/cchzLu0J.s:53 .text:000000000000002a systemDelay100ms
/tmp/cchzLu0J.s:74 .text:000000000000003e systemDelay1ms
/tmp/cchzLu0J.s:96 .text:0000000000000054 systemDelay10us
/tmp/cchzLu0J.s:116 .text:0000000000000066 systemDelay100us
/tmp/cchzLu0J.s:137 .text:000000000000007a systemDelay1us
/tmp/cchzLu0J.s:157 .text:000000000000008c systemDelay05us
/tmp/cchzLu0J.s:177 .text:000000000000009e systemDelay01us
/tmp/cchzLu0J.s:194 .text:00000000000000aa systemDelay16
/tmp/cchzLu0J.s:209 .text:00000000000000b0 systemDelay8
NO UNDEFINED SYMBOLS

67
firmware/main.c Normal file
View File

@ -0,0 +1,67 @@
/*
####################################################################################
# #
# Bildschirmtricks Firmware V1.0.0 #
# Main-Program #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#include <avr/io.h> /* Include I/O definitions */
#include <stdint.h> /* Include Integer types */
#include <stdio.h> /* Include standard I/O */
#include <avr/pgmspace.h> /* Include pgmspace definition */
#include <avr/interrupt.h> /* Include Interrupt control */
#include "uart.h" /* Include serial port control */
#include "dbt03.h" /* Include dbt03 emulator layer */
#include "ctrl.h" /* Include control line handler */
#include "delay.h" /* Include delay function set */
#define MINIBTX_HOOKOFF 0x01
#define MINIBTX_CONNECT 0x00
/* #################################################################################### */
/* ## MAIN ############################################################################ */
int main(void)
{
systemUartInit(832); /* Initalize UART with 1200 Baud */
systemCtrlInit(); /* Initalize control line handler (inhibit, ready) */
systemDbt03Init(); /* Initalize dbt03 emulation (communication line to the terminal */
systemUartTransmit(MINIBTX_HOOKOFF); /* Tell the V24 side that terminal hooked off the line */
systemDbt03ConnectionOk(); /* Make the terminal think that the connection is sucessfully set up */
systemUartTransmit(MINIBTX_CONNECT); /* Tell the V24 side that connection to terminal is made */
systemCtrlReady(); /* Tell the V24 side that connection to terminal is made (the low level method) */
while(1) /* Enter main-loop (Pass all data from uart to dbt03) */
{
systemDbt03Transmit(systemUartRecive());
if(systemCtrlCheckTerminate() == 0) /* Terminate connection if terminate control line is pulled low */
systemDbt03ConnectionTerminate();
}
return 0;
}
/* #################################################################################### */

0
firmware/main.eep Normal file
View File

511
firmware/main.lss Normal file
View File

@ -0,0 +1,511 @@
main.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00000358 00000000 00000000 00000074 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00000000 00800060 00000358 000003cc 2**0
CONTENTS, ALLOC, LOAD, DATA
2 .stab 000006cc 00000000 00000000 000003cc 2**2
CONTENTS, READONLY, DEBUGGING
3 .stabstr 00000054 00000000 00000000 00000a98 2**0
CONTENTS, READONLY, DEBUGGING
4 .comment 00000011 00000000 00000000 00000aec 2**0
CONTENTS, READONLY
Disassembly of section .text:
00000000 <__vectors>:
0: 12 c0 rjmp .+36 ; 0x26 <__ctors_end>
2: 36 c1 rjmp .+620 ; 0x270 <__vector_1>
4: 18 c0 rjmp .+48 ; 0x36 <__bad_interrupt>
6: 17 c0 rjmp .+46 ; 0x36 <__bad_interrupt>
8: 16 c0 rjmp .+44 ; 0x36 <__bad_interrupt>
a: 15 c0 rjmp .+42 ; 0x36 <__bad_interrupt>
c: 14 c0 rjmp .+40 ; 0x36 <__bad_interrupt>
e: 13 c0 rjmp .+38 ; 0x36 <__bad_interrupt>
10: 12 c0 rjmp .+36 ; 0x36 <__bad_interrupt>
12: 11 c0 rjmp .+34 ; 0x36 <__bad_interrupt>
14: 10 c0 rjmp .+32 ; 0x36 <__bad_interrupt>
16: 0f c0 rjmp .+30 ; 0x36 <__bad_interrupt>
18: 0e c0 rjmp .+28 ; 0x36 <__bad_interrupt>
1a: 0d c0 rjmp .+26 ; 0x36 <__bad_interrupt>
1c: 0c c0 rjmp .+24 ; 0x36 <__bad_interrupt>
1e: 0b c0 rjmp .+22 ; 0x36 <__bad_interrupt>
20: 0a c0 rjmp .+20 ; 0x36 <__bad_interrupt>
22: 09 c0 rjmp .+18 ; 0x36 <__bad_interrupt>
24: 08 c0 rjmp .+16 ; 0x36 <__bad_interrupt>
00000026 <__ctors_end>:
26: 11 24 eor r1, r1
28: 1f be out 0x3f, r1 ; 63
2a: cf e5 ldi r28, 0x5F ; 95
2c: d4 e0 ldi r29, 0x04 ; 4
2e: de bf out 0x3e, r29 ; 62
30: cd bf out 0x3d, r28 ; 61
32: 7e d1 rcall .+764 ; 0x330 <main>
34: 8f c1 rjmp .+798 ; 0x354 <_exit>
00000036 <__bad_interrupt>:
36: e4 cf rjmp .-56 ; 0x0 <__vectors>
00000038 <systemUartInit>:
38: 20 b5 in r18, 0x20 ; 32
3a: 28 60 ori r18, 0x08 ; 8
3c: 20 bd out 0x20, r18 ; 32
3e: 20 b5 in r18, 0x20 ; 32
40: 20 bd out 0x20, r18 ; 32
42: 20 b5 in r18, 0x20 ; 32
44: 24 60 ori r18, 0x04 ; 4
46: 20 bd out 0x20, r18 ; 32
48: 20 b5 in r18, 0x20 ; 32
4a: 22 60 ori r18, 0x02 ; 2
4c: 20 bd out 0x20, r18 ; 32
4e: 20 b5 in r18, 0x20 ; 32
50: 20 bd out 0x20, r18 ; 32
52: 20 b5 in r18, 0x20 ; 32
54: 20 bd out 0x20, r18 ; 32
56: 90 bd out 0x20, r25 ; 32
58: 89 b9 out 0x09, r24 ; 9
5a: 53 9a sbi 0x0a, 3 ; 10
5c: 54 9a sbi 0x0a, 4 ; 10
5e: 08 95 ret
00000060 <systemUartTransmit>:
60: 5d 9b sbis 0x0b, 5 ; 11
62: fe cf rjmp .-4 ; 0x60 <systemUartTransmit>
64: 8c b9 out 0x0c, r24 ; 12
66: 08 95 ret
00000068 <systemUartRecive>:
68: 5f 9b sbis 0x0b, 7 ; 11
6a: fe cf rjmp .-4 ; 0x68 <systemUartRecive>
6c: 8c b1 in r24, 0x0c ; 12
6e: 08 95 ret
00000070 <USART0_RX_vect>:
70: 1f 92 push r1
72: 0f 92 push r0
74: 0f b6 in r0, 0x3f ; 63
76: 0f 92 push r0
78: 11 24 eor r1, r1
7a: 0f 90 pop r0
7c: 0f be out 0x3f, r0 ; 63
7e: 0f 90 pop r0
80: 1f 90 pop r1
82: 18 95 reti
00000084 <systemDelay10ms>:
84: 88 23 and r24, r24
86: 41 f0 breq .+16 ; 0x98 <systemDelay10ms+0x14>
88: ef e3 ldi r30, 0x3F ; 63
8a: fc e9 ldi r31, 0x9C ; 156
8c: 31 97 sbiw r30, 0x01 ; 1
8e: f1 f7 brne .-4 ; 0x8c <systemDelay10ms+0x8>
90: 00 c0 rjmp .+0 ; 0x92 <systemDelay10ms+0xe>
92: 00 00 nop
94: 81 50 subi r24, 0x01 ; 1
96: f6 cf rjmp .-20 ; 0x84 <systemDelay10ms>
98: 08 95 ret
0000009a <systemDelay1s>:
9a: cf 93 push r28
9c: c8 2f mov r28, r24
9e: cc 23 and r28, r28
a0: 21 f0 breq .+8 ; 0xaa <systemDelay1s+0x10>
a2: 84 e6 ldi r24, 0x64 ; 100
a4: ef df rcall .-34 ; 0x84 <systemDelay10ms>
a6: c1 50 subi r28, 0x01 ; 1
a8: fa cf rjmp .-12 ; 0x9e <systemDelay1s+0x4>
aa: cf 91 pop r28
ac: 08 95 ret
000000ae <systemDelay100ms>:
ae: cf 93 push r28
b0: c8 2f mov r28, r24
b2: cc 23 and r28, r28
b4: 21 f0 breq .+8 ; 0xbe <systemDelay100ms+0x10>
b6: 8a e0 ldi r24, 0x0A ; 10
b8: e5 df rcall .-54 ; 0x84 <systemDelay10ms>
ba: c1 50 subi r28, 0x01 ; 1
bc: fa cf rjmp .-12 ; 0xb2 <systemDelay100ms+0x4>
be: cf 91 pop r28
c0: 08 95 ret
000000c2 <systemDelay1ms>:
c2: 88 23 and r24, r24
c4: 41 f0 breq .+16 ; 0xd6 <systemDelay1ms+0x14>
c6: ef e9 ldi r30, 0x9F ; 159
c8: ff e0 ldi r31, 0x0F ; 15
ca: 31 97 sbiw r30, 0x01 ; 1
cc: f1 f7 brne .-4 ; 0xca <systemDelay1ms+0x8>
ce: 00 c0 rjmp .+0 ; 0xd0 <systemDelay1ms+0xe>
d0: 00 00 nop
d2: 81 50 subi r24, 0x01 ; 1
d4: f6 cf rjmp .-20 ; 0xc2 <systemDelay1ms>
d6: 08 95 ret
000000d8 <systemDelay10us>:
d8: 88 23 and r24, r24
da: 31 f0 breq .+12 ; 0xe8 <systemDelay10us+0x10>
dc: 95 e3 ldi r25, 0x35 ; 53
de: 9a 95 dec r25
e0: f1 f7 brne .-4 ; 0xde <systemDelay10us+0x6>
e2: 00 00 nop
e4: 81 50 subi r24, 0x01 ; 1
e6: f8 cf rjmp .-16 ; 0xd8 <systemDelay10us>
e8: 08 95 ret
000000ea <systemDelay100us>:
ea: cf 93 push r28
ec: c8 2f mov r28, r24
ee: cc 23 and r28, r28
f0: 21 f0 breq .+8 ; 0xfa <systemDelay100us+0x10>
f2: 8a e0 ldi r24, 0x0A ; 10
f4: f1 df rcall .-30 ; 0xd8 <systemDelay10us>
f6: c1 50 subi r28, 0x01 ; 1
f8: fa cf rjmp .-12 ; 0xee <systemDelay100us+0x4>
fa: cf 91 pop r28
fc: 08 95 ret
000000fe <systemDelay1us>:
fe: 88 23 and r24, r24
100: 31 f0 breq .+12 ; 0x10e <systemDelay1us+0x10>
102: 95 e0 ldi r25, 0x05 ; 5
104: 9a 95 dec r25
106: f1 f7 brne .-4 ; 0x104 <systemDelay1us+0x6>
108: 00 00 nop
10a: 81 50 subi r24, 0x01 ; 1
10c: f8 cf rjmp .-16 ; 0xfe <systemDelay1us>
10e: 08 95 ret
00000110 <systemDelay05us>:
110: 88 23 and r24, r24
112: 31 f0 breq .+12 ; 0x120 <systemDelay05us+0x10>
114: 92 e0 ldi r25, 0x02 ; 2
116: 9a 95 dec r25
118: f1 f7 brne .-4 ; 0x116 <systemDelay05us+0x6>
11a: 00 c0 rjmp .+0 ; 0x11c <systemDelay05us+0xc>
11c: 81 50 subi r24, 0x01 ; 1
11e: f8 cf rjmp .-16 ; 0x110 <systemDelay05us>
120: 08 95 ret
00000122 <systemDelay01us>:
122: 88 23 and r24, r24
124: 19 f0 breq .+6 ; 0x12c <systemDelay01us+0xa>
126: 00 c0 rjmp .+0 ; 0x128 <systemDelay01us+0x6>
128: 81 50 subi r24, 0x01 ; 1
12a: fb cf rjmp .-10 ; 0x122 <systemDelay01us>
12c: 08 95 ret
0000012e <systemDelay16>:
12e: 01 97 sbiw r24, 0x01 ; 1
130: f1 f7 brne .-4 ; 0x12e <systemDelay16>
132: 08 95 ret
00000134 <systemDelay8>:
134: 8a 95 dec r24
136: f1 f7 brne .-4 ; 0x134 <systemDelay8>
138: 08 95 ret
0000013a <dbt03IoCtrl.part.0>:
13a: c0 9a sbi 0x18, 0 ; 24
13c: 08 95 ret
0000013e <dbt03Dialtone>:
13e: 0f 93 push r16
140: 1f 93 push r17
142: cf 93 push r28
144: df 93 push r29
146: 8c 01 movw r16, r24
148: c0 e0 ldi r28, 0x00 ; 0
14a: d0 e0 ldi r29, 0x00 ; 0
14c: c0 17 cp r28, r16
14e: d1 07 cpc r29, r17
150: 41 f0 breq .+16 ; 0x162 <dbt03Dialtone+0x24>
152: c0 98 cbi 0x18, 0 ; 24
154: 8a e0 ldi r24, 0x0A ; 10
156: c9 df rcall .-110 ; 0xea <systemDelay100us>
158: f0 df rcall .-32 ; 0x13a <dbt03IoCtrl.part.0>
15a: 8a e0 ldi r24, 0x0A ; 10
15c: c6 df rcall .-116 ; 0xea <systemDelay100us>
15e: 21 96 adiw r28, 0x01 ; 1
160: f5 cf rjmp .-22 ; 0x14c <dbt03Dialtone+0xe>
162: df 91 pop r29
164: cf 91 pop r28
166: 1f 91 pop r17
168: 0f 91 pop r16
16a: 08 95 ret
0000016c <systemDbt03Init>:
16c: e6 df rcall .-52 ; 0x13a <dbt03IoCtrl.part.0>
16e: b8 9a sbi 0x17, 0 ; 23
170: 92 98 cbi 0x12, 2 ; 18
172: 8b b7 in r24, 0x3b ; 59
174: 80 64 ori r24, 0x40 ; 64
176: 8b bf out 0x3b, r24 ; 59
178: 85 b7 in r24, 0x35 ; 53
17a: 82 60 ori r24, 0x02 ; 2
17c: 85 bf out 0x35, r24 ; 53
17e: 78 94 sei
180: 08 95 ret
00000182 <systemDbt03Transmit>:
182: 0f 93 push r16
184: 1f 93 push r17
186: cf 93 push r28
188: df 93 push r29
18a: 08 2f mov r16, r24
18c: f8 94 cli
18e: d5 df rcall .-86 ; 0x13a <dbt03IoCtrl.part.0>
190: 82 e5 ldi r24, 0x52 ; 82
192: a2 df rcall .-188 ; 0xd8 <systemDelay10us>
194: c0 e0 ldi r28, 0x00 ; 0
196: d0 e0 ldi r29, 0x00 ; 0
198: 10 e0 ldi r17, 0x00 ; 0
19a: 00 95 com r16
19c: 10 95 com r17
19e: c8 01 movw r24, r16
1a0: 0c 2e mov r0, r28
1a2: 02 c0 rjmp .+4 ; 0x1a8 <systemDbt03Transmit+0x26>
1a4: 95 95 asr r25
1a6: 87 95 ror r24
1a8: 0a 94 dec r0
1aa: e2 f7 brpl .-8 ; 0x1a4 <systemDbt03Transmit+0x22>
1ac: 80 ff sbrs r24, 0
1ae: 02 c0 rjmp .+4 ; 0x1b4 <systemDbt03Transmit+0x32>
1b0: c4 df rcall .-120 ; 0x13a <dbt03IoCtrl.part.0>
1b2: 01 c0 rjmp .+2 ; 0x1b6 <systemDbt03Transmit+0x34>
1b4: c0 98 cbi 0x18, 0 ; 24
1b6: 82 e5 ldi r24, 0x52 ; 82
1b8: 8f df rcall .-226 ; 0xd8 <systemDelay10us>
1ba: 21 96 adiw r28, 0x01 ; 1
1bc: c8 30 cpi r28, 0x08 ; 8
1be: d1 05 cpc r29, r1
1c0: 71 f7 brne .-36 ; 0x19e <systemDbt03Transmit+0x1c>
1c2: c0 98 cbi 0x18, 0 ; 24
1c4: 82 e5 ldi r24, 0x52 ; 82
1c6: 88 df rcall .-240 ; 0xd8 <systemDelay10us>
1c8: 78 94 sei
1ca: df 91 pop r29
1cc: cf 91 pop r28
1ce: 1f 91 pop r17
1d0: 0f 91 pop r16
1d2: 08 95 ret
000001d4 <systemDbt03Receive>:
1d4: ff 92 push r15
1d6: 0f 93 push r16
1d8: 1f 93 push r17
1da: cf 93 push r28
1dc: df 93 push r29
1de: 9f d0 rcall .+318 ; 0x31e <systemCtrlCheckInhibit>
1e0: 81 11 cpse r24, r1
1e2: 1e c0 rjmp .+60 ; 0x220 <systemDbt03Receive+0x4c>
1e4: f8 94 cli
1e6: 82 99 sbic 0x10, 2 ; 16
1e8: fe cf rjmp .-4 ; 0x1e6 <systemDbt03Receive+0x12>
1ea: 85 e8 ldi r24, 0x85 ; 133
1ec: 7e df rcall .-260 ; 0xea <systemDelay100us>
1ee: 00 e0 ldi r16, 0x00 ; 0
1f0: 10 e0 ldi r17, 0x00 ; 0
1f2: f1 2c mov r15, r1
1f4: 82 e4 ldi r24, 0x42 ; 66
1f6: 79 df rcall .-270 ; 0xea <systemDelay100us>
1f8: 80 b3 in r24, 0x10 ; 16
1fa: 82 fb bst r24, 2
1fc: 88 27 eor r24, r24
1fe: 80 f9 bld r24, 0
200: c8 2f mov r28, r24
202: 00 2e mov r0, r16
204: 01 c0 rjmp .+2 ; 0x208 <systemDbt03Receive+0x34>
206: cc 0f add r28, r28
208: 0a 94 dec r0
20a: ea f7 brpl .-6 ; 0x206 <systemDbt03Receive+0x32>
20c: fc 2a or r15, r28
20e: 82 e4 ldi r24, 0x42 ; 66
210: 6c df rcall .-296 ; 0xea <systemDelay100us>
212: 0f 5f subi r16, 0xFF ; 255
214: 1f 4f sbci r17, 0xFF ; 255
216: 08 30 cpi r16, 0x08 ; 8
218: 11 05 cpc r17, r1
21a: 61 f7 brne .-40 ; 0x1f4 <systemDbt03Receive+0x20>
21c: 78 94 sei
21e: 01 c0 rjmp .+2 ; 0x222 <systemDbt03Receive+0x4e>
220: f1 2c mov r15, r1
222: 8f 2d mov r24, r15
224: df 91 pop r29
226: cf 91 pop r28
228: 1f 91 pop r17
22a: 0f 91 pop r16
22c: ff 90 pop r15
22e: 08 95 ret
00000230 <systemDbt03ConnectionOk>:
230: cf 93 push r28
232: df 93 push r29
234: 8e e1 ldi r24, 0x1E ; 30
236: 3b df rcall .-394 ; 0xae <systemDelay100ms>
238: 80 e2 ldi r24, 0x20 ; 32
23a: 93 e0 ldi r25, 0x03 ; 3
23c: 80 df rcall .-256 ; 0x13e <dbt03Dialtone>
23e: 88 e2 ldi r24, 0x28 ; 40
240: 36 df rcall .-404 ; 0xae <systemDelay100ms>
242: 88 ec ldi r24, 0xC8 ; 200
244: 90 e0 ldi r25, 0x00 ; 0
246: 7b df rcall .-266 ; 0x13e <dbt03Dialtone>
248: 85 e0 ldi r24, 0x05 ; 5
24a: 31 df rcall .-414 ; 0xae <systemDelay100ms>
24c: c0 e2 ldi r28, 0x20 ; 32
24e: d8 e0 ldi r29, 0x08 ; 8
250: c0 98 cbi 0x18, 0 ; 24
252: 86 e2 ldi r24, 0x26 ; 38
254: 41 df rcall .-382 ; 0xd8 <systemDelay10us>
256: 71 df rcall .-286 ; 0x13a <dbt03IoCtrl.part.0>
258: 86 e2 ldi r24, 0x26 ; 38
25a: 3e df rcall .-388 ; 0xd8 <systemDelay10us>
25c: 21 97 sbiw r28, 0x01 ; 1
25e: 20 97 sbiw r28, 0x00 ; 0
260: b9 f7 brne .-18 ; 0x250 <systemDbt03ConnectionOk+0x20>
262: c0 98 cbi 0x18, 0 ; 24
264: 85 e0 ldi r24, 0x05 ; 5
266: df 91 pop r29
268: cf 91 pop r28
26a: 21 cf rjmp .-446 ; 0xae <systemDelay100ms>
0000026c <systemDbt03ConnectionTerminate>:
26c: 66 df rcall .-308 ; 0x13a <dbt03IoCtrl.part.0>
26e: ff cf rjmp .-2 ; 0x26e <systemDbt03ConnectionTerminate+0x2>
00000270 <__vector_1>:
270: 1f 92 push r1
272: 0f 92 push r0
274: 0f b6 in r0, 0x3f ; 63
276: 0f 92 push r0
278: 11 24 eor r1, r1
27a: ff 92 push r15
27c: 0f 93 push r16
27e: 1f 93 push r17
280: 2f 93 push r18
282: 3f 93 push r19
284: 4f 93 push r20
286: 5f 93 push r21
288: 6f 93 push r22
28a: 7f 93 push r23
28c: 8f 93 push r24
28e: 9f 93 push r25
290: af 93 push r26
292: bf 93 push r27
294: cf 93 push r28
296: df 93 push r29
298: ef 93 push r30
29a: ff 93 push r31
29c: 40 d0 rcall .+128 ; 0x31e <systemCtrlCheckInhibit>
29e: 81 30 cpi r24, 0x01 ; 1
2a0: 09 f5 brne .+66 ; 0x2e4 <__vector_1+0x74>
2a2: 82 e4 ldi r24, 0x42 ; 66
2a4: 22 df rcall .-444 ; 0xea <systemDelay100us>
2a6: 82 99 sbic 0x10, 2 ; 16
2a8: 1d c0 rjmp .+58 ; 0x2e4 <__vector_1+0x74>
2aa: 82 e4 ldi r24, 0x42 ; 66
2ac: 1e df rcall .-452 ; 0xea <systemDelay100us>
2ae: 00 e0 ldi r16, 0x00 ; 0
2b0: 10 e0 ldi r17, 0x00 ; 0
2b2: f1 2c mov r15, r1
2b4: 82 e4 ldi r24, 0x42 ; 66
2b6: 19 df rcall .-462 ; 0xea <systemDelay100us>
2b8: 80 b3 in r24, 0x10 ; 16
2ba: 82 fb bst r24, 2
2bc: 88 27 eor r24, r24
2be: 80 f9 bld r24, 0
2c0: c8 2f mov r28, r24
2c2: 00 2e mov r0, r16
2c4: 01 c0 rjmp .+2 ; 0x2c8 <__vector_1+0x58>
2c6: cc 0f add r28, r28
2c8: 0a 94 dec r0
2ca: ea f7 brpl .-6 ; 0x2c6 <__vector_1+0x56>
2cc: fc 2a or r15, r28
2ce: 82 e4 ldi r24, 0x42 ; 66
2d0: 0c df rcall .-488 ; 0xea <systemDelay100us>
2d2: 0f 5f subi r16, 0xFF ; 255
2d4: 1f 4f sbci r17, 0xFF ; 255
2d6: 08 30 cpi r16, 0x08 ; 8
2d8: 11 05 cpc r17, r1
2da: 61 f7 brne .-40 ; 0x2b4 <__vector_1+0x44>
2dc: 82 e4 ldi r24, 0x42 ; 66
2de: 05 df rcall .-502 ; 0xea <systemDelay100us>
2e0: 8f 2d mov r24, r15
2e2: be de rcall .-644 ; 0x60 <systemUartTransmit>
2e4: ff 91 pop r31
2e6: ef 91 pop r30
2e8: df 91 pop r29
2ea: cf 91 pop r28
2ec: bf 91 pop r27
2ee: af 91 pop r26
2f0: 9f 91 pop r25
2f2: 8f 91 pop r24
2f4: 7f 91 pop r23
2f6: 6f 91 pop r22
2f8: 5f 91 pop r21
2fa: 4f 91 pop r20
2fc: 3f 91 pop r19
2fe: 2f 91 pop r18
300: 1f 91 pop r17
302: 0f 91 pop r16
304: ff 90 pop r15
306: 0f 90 pop r0
308: 0f be out 0x3f, r0 ; 63
30a: 0f 90 pop r0
30c: 1f 90 pop r1
30e: 18 95 reti
00000310 <systemCtrlInit>:
310: c1 9a sbi 0x18, 1 ; 24
312: b9 9a sbi 0x17, 1 ; 23
314: c2 9a sbi 0x18, 2 ; 24
316: 94 9a sbi 0x12, 4 ; 18
318: 08 95 ret
0000031a <systemCtrlReady>:
31a: c1 98 cbi 0x18, 1 ; 24
31c: 08 95 ret
0000031e <systemCtrlCheckInhibit>:
31e: 86 b3 in r24, 0x16 ; 22
320: 82 fb bst r24, 2
322: 88 27 eor r24, r24
324: 80 f9 bld r24, 0
326: 08 95 ret
00000328 <systemCtrlCheckTerminate>:
328: 80 b3 in r24, 0x10 ; 16
32a: 82 95 swap r24
32c: 81 70 andi r24, 0x01 ; 1
32e: 08 95 ret
00000330 <main>:
330: 80 e4 ldi r24, 0x40 ; 64
332: 93 e0 ldi r25, 0x03 ; 3
334: 81 de rcall .-766 ; 0x38 <systemUartInit>
336: ec df rcall .-40 ; 0x310 <systemCtrlInit>
338: 19 df rcall .-462 ; 0x16c <systemDbt03Init>
33a: 81 e0 ldi r24, 0x01 ; 1
33c: 91 de rcall .-734 ; 0x60 <systemUartTransmit>
33e: 78 df rcall .-272 ; 0x230 <systemDbt03ConnectionOk>
340: 80 e0 ldi r24, 0x00 ; 0
342: 8e de rcall .-740 ; 0x60 <systemUartTransmit>
344: ea df rcall .-44 ; 0x31a <systemCtrlReady>
346: 90 de rcall .-736 ; 0x68 <systemUartRecive>
348: 1c df rcall .-456 ; 0x182 <systemDbt03Transmit>
34a: ee df rcall .-36 ; 0x328 <systemCtrlCheckTerminate>
34c: 81 11 cpse r24, r1
34e: fb cf rjmp .-10 ; 0x346 <main+0x16>
350: 8d df rcall .-230 ; 0x26c <systemDbt03ConnectionTerminate>
352: f9 cf rjmp .-14 ; 0x346 <main+0x16>
00000354 <_exit>:
354: f8 94 cli
00000356 <__stop_program>:
356: ff cf rjmp .-2 ; 0x356 <__stop_program>

53
firmware/main.lst Normal file
View File

@ -0,0 +1,53 @@
1 .file "main.c"
2 __SP_H__ = 0x3e
3 __SP_L__ = 0x3d
4 __SREG__ = 0x3f
5 __tmp_reg__ = 0
6 __zero_reg__ = 1
7 .section .text.startup,"ax",@progbits
8 .global main
10 main:
11 /* prologue: function */
12 /* frame size = 0 */
13 /* stack size = 0 */
14 .L__stack_usage = 0
15 0000 80E4 ldi r24,lo8(64)
16 0002 93E0 ldi r25,lo8(3)
17 0004 00D0 rcall systemUartInit
18 0006 00D0 rcall systemCtrlInit
19 0008 00D0 rcall systemDbt03Init
20 000a 81E0 ldi r24,lo8(1)
21 000c 00D0 rcall systemUartTransmit
22 000e 00D0 rcall systemDbt03ConnectionOk
23 0010 80E0 ldi r24,0
24 0012 00D0 rcall systemUartTransmit
25 0014 00D0 rcall systemCtrlReady
26 .L3:
27 0016 00D0 rcall systemUartRecive
28 0018 00D0 rcall systemDbt03Transmit
29 001a 00D0 rcall systemCtrlCheckTerminate
30 001c 8111 cpse r24,__zero_reg__
31 001e 00C0 rjmp .L3
32 0020 00D0 rcall systemDbt03ConnectionTerminate
33 0022 00C0 rjmp .L3
35 .ident "GCC: (GNU) 4.8.2"
DEFINED SYMBOLS
*ABS*:0000000000000000 main.c
/tmp/ccA9iM3F.s:2 *ABS*:000000000000003e __SP_H__
/tmp/ccA9iM3F.s:3 *ABS*:000000000000003d __SP_L__
/tmp/ccA9iM3F.s:4 *ABS*:000000000000003f __SREG__
/tmp/ccA9iM3F.s:5 *ABS*:0000000000000000 __tmp_reg__
/tmp/ccA9iM3F.s:6 *ABS*:0000000000000001 __zero_reg__
/tmp/ccA9iM3F.s:10 .text.startup:0000000000000000 main
UNDEFINED SYMBOLS
systemUartInit
systemCtrlInit
systemDbt03Init
systemUartTransmit
systemDbt03ConnectionOk
systemCtrlReady
systemUartRecive
systemDbt03Transmit
systemCtrlCheckTerminate
systemDbt03ConnectionTerminate

479
firmware/main.map Normal file
View File

@ -0,0 +1,479 @@
Archive member included because of file (symbol)
/usr/lib/gcc/avr/4.8.2/avr4/libgcc.a(_exit.o)
/usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o (exit)
Memory Configuration
Name Origin Length Attributes
text 0x0000000000000000 0x0000000000002000 xr
data 0x0000000000800060 0x000000000000ffa0 rw !x
eeprom 0x0000000000810000 0x0000000000010000 rw !x
fuse 0x0000000000820000 0x0000000000000400 rw !x
lock 0x0000000000830000 0x0000000000000400 rw !x
signature 0x0000000000840000 0x0000000000000400 rw !x
user_signatures 0x0000000000850000 0x0000000000000400 rw !x
*default* 0x0000000000000000 0xffffffffffffffff
Linker script and memory map
LOAD /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
LOAD main.o
LOAD uart.o
LOAD delay.o
LOAD dbt03.o
LOAD ctrl.o
LOAD /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/libm.a
START GROUP
LOAD /usr/lib/gcc/avr/4.8.2/avr4/libgcc.a
LOAD /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/libm.a
LOAD /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/libc.a
END GROUP
.hash
*(.hash)
.dynsym
*(.dynsym)
.dynstr
*(.dynstr)
.gnu.version
*(.gnu.version)
.gnu.version_d
*(.gnu.version_d)
.gnu.version_r
*(.gnu.version_r)
.rel.init
*(.rel.init)
.rela.init
*(.rela.init)
.rel.text
*(.rel.text)
*(.rel.text.*)
*(.rel.gnu.linkonce.t*)
.rela.text
*(.rela.text)
*(.rela.text.*)
*(.rela.gnu.linkonce.t*)
.rel.fini
*(.rel.fini)
.rela.fini
*(.rela.fini)
.rel.rodata
*(.rel.rodata)
*(.rel.rodata.*)
*(.rel.gnu.linkonce.r*)
.rela.rodata
*(.rela.rodata)
*(.rela.rodata.*)
*(.rela.gnu.linkonce.r*)
.rel.data
*(.rel.data)
*(.rel.data.*)
*(.rel.gnu.linkonce.d*)
.rela.data
*(.rela.data)
*(.rela.data.*)
*(.rela.gnu.linkonce.d*)
.rel.ctors
*(.rel.ctors)
.rela.ctors
*(.rela.ctors)
.rel.dtors
*(.rel.dtors)
.rela.dtors
*(.rela.dtors)
.rel.got
*(.rel.got)
.rela.got
*(.rela.got)
.rel.bss
*(.rel.bss)
.rela.bss
*(.rela.bss)
.rel.plt
*(.rel.plt)
.rela.plt
*(.rela.plt)
.text 0x0000000000000000 0x358
*(.vectors)
.vectors 0x0000000000000000 0x26 /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
0x0000000000000000 __vectors
0x0000000000000000 __vector_default
*(.vectors)
*(.progmem.gcc*)
*(.progmem*)
0x0000000000000026 . = ALIGN (0x2)
0x0000000000000026 __trampolines_start = .
*(.trampolines)
.trampolines 0x0000000000000026 0x0 linker stubs
*(.trampolines*)
0x0000000000000026 __trampolines_end = .
*(.jumptables)
*(.jumptables*)
*(.lowtext)
*(.lowtext*)
0x0000000000000026 __ctors_start = .
*(.ctors)
0x0000000000000026 __ctors_end = .
0x0000000000000026 __dtors_start = .
*(.dtors)
0x0000000000000026 __dtors_end = .
SORT(*)(.ctors)
SORT(*)(.dtors)
*(.init0)
.init0 0x0000000000000026 0x0 /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
0x0000000000000026 __init
*(.init0)
*(.init1)
*(.init1)
*(.init2)
.init2 0x0000000000000026 0xc /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
*(.init2)
*(.init3)
*(.init3)
*(.init4)
*(.init4)
*(.init5)
*(.init5)
*(.init6)
*(.init6)
*(.init7)
*(.init7)
*(.init8)
*(.init8)
*(.init9)
.init9 0x0000000000000032 0x4 /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
*(.init9)
*(.text)
.text 0x0000000000000036 0x2 /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
0x0000000000000036 __vector_12
0x0000000000000036 __bad_interrupt
0x0000000000000036 __vector_6
0x0000000000000036 __vector_3
0x0000000000000036 __vector_11
0x0000000000000036 __vector_13
0x0000000000000036 __vector_17
0x0000000000000036 __vector_7
0x0000000000000036 __vector_5
0x0000000000000036 __vector_4
0x0000000000000036 __vector_9
0x0000000000000036 __vector_2
0x0000000000000036 __vector_15
0x0000000000000036 __vector_8
0x0000000000000036 __vector_14
0x0000000000000036 __vector_10
0x0000000000000036 __vector_16
0x0000000000000036 __vector_18
.text 0x0000000000000038 0x0 main.o
.text 0x0000000000000038 0x4c uart.o
0x0000000000000038 systemUartInit
0x0000000000000060 systemUartTransmit
0x0000000000000068 systemUartRecive
0x0000000000000070 USART0_RX_vect
.text 0x0000000000000084 0xb6 delay.o
0x0000000000000084 systemDelay10ms
0x000000000000009a systemDelay1s
0x00000000000000ae systemDelay100ms
0x00000000000000c2 systemDelay1ms
0x00000000000000d8 systemDelay10us
0x00000000000000ea systemDelay100us
0x00000000000000fe systemDelay1us
0x0000000000000110 systemDelay05us
0x0000000000000122 systemDelay01us
0x000000000000012e systemDelay16
0x0000000000000134 systemDelay8
.text 0x000000000000013a 0x1d6 dbt03.o
0x000000000000016c systemDbt03Init
0x0000000000000182 systemDbt03Transmit
0x00000000000001d4 systemDbt03Receive
0x0000000000000230 systemDbt03ConnectionOk
0x000000000000026c systemDbt03ConnectionTerminate
0x0000000000000270 __vector_1
.text 0x0000000000000310 0x20 ctrl.o
0x0000000000000310 systemCtrlInit
0x000000000000031a systemCtrlReady
0x000000000000031e systemCtrlCheckInhibit
0x0000000000000328 systemCtrlCheckTerminate
.text 0x0000000000000330 0x0 /usr/lib/gcc/avr/4.8.2/avr4/libgcc.a(_exit.o)
0x0000000000000330 . = ALIGN (0x2)
*(.text.*)
.text.startup 0x0000000000000330 0x24 main.o
0x0000000000000330 main
.text.libgcc.mul
0x0000000000000354 0x0 /usr/lib/gcc/avr/4.8.2/avr4/libgcc.a(_exit.o)
.text.libgcc.div
0x0000000000000354 0x0 /usr/lib/gcc/avr/4.8.2/avr4/libgcc.a(_exit.o)
.text.libgcc 0x0000000000000354 0x0 /usr/lib/gcc/avr/4.8.2/avr4/libgcc.a(_exit.o)
.text.libgcc.prologue
0x0000000000000354 0x0 /usr/lib/gcc/avr/4.8.2/avr4/libgcc.a(_exit.o)
.text.libgcc.builtins
0x0000000000000354 0x0 /usr/lib/gcc/avr/4.8.2/avr4/libgcc.a(_exit.o)
.text.libgcc.fmul
0x0000000000000354 0x0 /usr/lib/gcc/avr/4.8.2/avr4/libgcc.a(_exit.o)
.text.libgcc.fixed
0x0000000000000354 0x0 /usr/lib/gcc/avr/4.8.2/avr4/libgcc.a(_exit.o)
0x0000000000000354 . = ALIGN (0x2)
*(.fini9)
.fini9 0x0000000000000354 0x0 /usr/lib/gcc/avr/4.8.2/avr4/libgcc.a(_exit.o)
0x0000000000000354 exit
0x0000000000000354 _exit
*(.fini9)
*(.fini8)
*(.fini8)
*(.fini7)
*(.fini7)
*(.fini6)
*(.fini6)
*(.fini5)
*(.fini5)
*(.fini4)
*(.fini4)
*(.fini3)
*(.fini3)
*(.fini2)
*(.fini2)
*(.fini1)
*(.fini1)
*(.fini0)
.fini0 0x0000000000000354 0x4 /usr/lib/gcc/avr/4.8.2/avr4/libgcc.a(_exit.o)
*(.fini0)
0x0000000000000358 _etext = .
.data 0x0000000000800060 0x0 load address 0x0000000000000358
0x0000000000800060 PROVIDE (__data_start, .)
*(.data)
.data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
.data 0x0000000000800060 0x0 main.o
.data 0x0000000000800060 0x0 uart.o
.data 0x0000000000800060 0x0 delay.o
.data 0x0000000000800060 0x0 dbt03.o
.data 0x0000000000800060 0x0 ctrl.o
.data 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.8.2/avr4/libgcc.a(_exit.o)
*(.data*)
*(.rodata)
*(.rodata*)
*(.gnu.linkonce.d*)
0x0000000000800060 . = ALIGN (0x2)
0x0000000000800060 _edata = .
0x0000000000800060 PROVIDE (__data_end, .)
.bss 0x0000000000800060 0x0
0x0000000000800060 PROVIDE (__bss_start, .)
*(.bss)
.bss 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
.bss 0x0000000000800060 0x0 main.o
.bss 0x0000000000800060 0x0 uart.o
.bss 0x0000000000800060 0x0 delay.o
.bss 0x0000000000800060 0x0 dbt03.o
.bss 0x0000000000800060 0x0 ctrl.o
.bss 0x0000000000800060 0x0 /usr/lib/gcc/avr/4.8.2/avr4/libgcc.a(_exit.o)
*(.bss*)
*(COMMON)
0x0000000000800060 PROVIDE (__bss_end, .)
0x0000000000000358 __data_load_start = LOADADDR (.data)
0x0000000000000358 __data_load_end = (__data_load_start + SIZEOF (.data))
.noinit 0x0000000000800060 0x0
0x0000000000800060 PROVIDE (__noinit_start, .)
*(.noinit*)
0x0000000000800060 PROVIDE (__noinit_end, .)
0x0000000000800060 _end = .
0x0000000000800060 PROVIDE (__heap_start, .)
.eeprom 0x0000000000810000 0x0
*(.eeprom*)
0x0000000000810000 __eeprom_end = .
.fuse
*(.fuse)
*(.lfuse)
*(.hfuse)
*(.efuse)
.lock
*(.lock*)
.signature
*(.signature*)
.user_signatures
*(.user_signatures*)
.stab 0x0000000000000000 0x6cc
*(.stab)
.stab 0x0000000000000000 0x6cc /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
.stabstr 0x0000000000000000 0x54
*(.stabstr)
.stabstr 0x0000000000000000 0x54 /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
.stab.excl
*(.stab.excl)
.stab.exclstr
*(.stab.exclstr)
.stab.index
*(.stab.index)
.stab.indexstr
*(.stab.indexstr)
.comment 0x0000000000000000 0x11
*(.comment)
.comment 0x0000000000000000 0x11 main.o
0x12 (size before relaxing)
.comment 0x0000000000000000 0x12 uart.o
.comment 0x0000000000000000 0x12 delay.o
.comment 0x0000000000000000 0x12 dbt03.o
.comment 0x0000000000000000 0x12 ctrl.o
.debug
*(.debug)
.line
*(.line)
.debug_srcinfo
*(.debug_srcinfo)
.debug_sfnames
*(.debug_sfnames)
.debug_aranges
*(.debug_aranges)
.debug_pubnames
*(.debug_pubnames)
.debug_info
*(.debug_info)
*(.gnu.linkonce.wi.*)
.debug_abbrev
*(.debug_abbrev)
.debug_line
*(.debug_line)
.debug_frame
*(.debug_frame)
.debug_str
*(.debug_str)
.debug_loc
*(.debug_loc)
.debug_macinfo
*(.debug_macinfo)
.debug_pubtypes
*(.debug_pubtypes)
.debug_ranges
*(.debug_ranges)
.debug_macro
*(.debug_macro)
OUTPUT(main.elf elf32-avr)
LOAD linker stubs
Cross Reference Table
Symbol File
USART0_RX_vect uart.o
__bad_interrupt /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
__heap_end /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
__init /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
__stack /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
__vector_1 dbt03.o
/usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
__vector_10 /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
__vector_11 /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
__vector_12 /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
__vector_13 /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
__vector_14 /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
__vector_15 /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
__vector_16 /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
__vector_17 /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
__vector_18 /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
__vector_2 /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
__vector_3 /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
__vector_4 /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
__vector_5 /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
__vector_6 /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
__vector_7 /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
__vector_8 /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
__vector_9 /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
__vector_default /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
__vectors /usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
_exit /usr/lib/gcc/avr/4.8.2/avr4/libgcc.a(_exit.o)
exit /usr/lib/gcc/avr/4.8.2/avr4/libgcc.a(_exit.o)
/usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
main main.o
/usr/lib/gcc/avr/4.8.2/../../../avr/lib/avr4/crtm8.o
systemCtrlCheckInhibit ctrl.o
dbt03.o
systemCtrlCheckTerminate ctrl.o
main.o
systemCtrlInit ctrl.o
main.o
systemCtrlReady ctrl.o
main.o
systemDbt03ConnectionOk dbt03.o
main.o
systemDbt03ConnectionTerminate dbt03.o
main.o
systemDbt03Init dbt03.o
main.o
systemDbt03Receive dbt03.o
systemDbt03Transmit dbt03.o
main.o
systemDelay01us delay.o
systemDelay05us delay.o
systemDelay100ms delay.o
dbt03.o
systemDelay100us delay.o
dbt03.o
systemDelay10ms delay.o
systemDelay10us delay.o
dbt03.o
systemDelay16 delay.o
systemDelay1ms delay.o
systemDelay1s delay.o
systemDelay1us delay.o
systemDelay8 delay.o
systemUartInit uart.o
main.o
systemUartRecive uart.o
main.o
systemUartTransmit uart.o
dbt03.o
main.o

91
firmware/main.sym Normal file
View File

@ -0,0 +1,91 @@
00000000 W __heap_end
00000000 a __tmp_reg__
00000000 a __tmp_reg__
00000000 a __tmp_reg__
00000000 a __tmp_reg__
00000000 a __tmp_reg__
00000000 W __vector_default
00000000 T __vectors
00000001 a __zero_reg__
00000001 a __zero_reg__
00000001 a __zero_reg__
00000001 a __zero_reg__
00000001 a __zero_reg__
00000026 T __ctors_end
00000026 T __ctors_start
00000026 T __dtors_end
00000026 T __dtors_start
00000026 W __init
00000026 T __trampolines_end
00000026 T __trampolines_start
00000036 T __bad_interrupt
00000036 W __vector_10
00000036 W __vector_11
00000036 W __vector_12
00000036 W __vector_13
00000036 W __vector_14
00000036 W __vector_15
00000036 W __vector_16
00000036 W __vector_17
00000036 W __vector_18
00000036 W __vector_2
00000036 W __vector_3
00000036 W __vector_4
00000036 W __vector_5
00000036 W __vector_6
00000036 W __vector_7
00000036 W __vector_8
00000036 W __vector_9
00000038 T systemUartInit
0000003d a __SP_L__
0000003d a __SP_L__
0000003d a __SP_L__
0000003d a __SP_L__
0000003d a __SP_L__
0000003e a __SP_H__
0000003e a __SP_H__
0000003e a __SP_H__
0000003e a __SP_H__
0000003e a __SP_H__
0000003f a __SREG__
0000003f a __SREG__
0000003f a __SREG__
0000003f a __SREG__
0000003f a __SREG__
00000060 T systemUartTransmit
00000068 T systemUartRecive
00000070 T USART0_RX_vect
00000084 T systemDelay10ms
0000009a T systemDelay1s
000000ae T systemDelay100ms
000000c2 T systemDelay1ms
000000d8 T systemDelay10us
000000ea T systemDelay100us
000000fe T systemDelay1us
00000110 T systemDelay05us
00000122 T systemDelay01us
0000012e T systemDelay16
00000134 T systemDelay8
0000013a t dbt03IoCtrl.part.0
0000013e t dbt03Dialtone
0000016c T systemDbt03Init
00000182 T systemDbt03Transmit
000001d4 T systemDbt03Receive
00000230 T systemDbt03ConnectionOk
0000026c T systemDbt03ConnectionTerminate
00000270 T __vector_1
00000310 T systemCtrlInit
0000031a T systemCtrlReady
0000031e T systemCtrlCheckInhibit
00000328 T systemCtrlCheckTerminate
00000330 T main
00000354 W exit
00000354 T _exit
00000356 t __stop_program
00000358 A __data_load_end
00000358 A __data_load_start
00000358 T _etext
0000045f W __stack
00800060 D _edata
00800060 D _end
00810000 D __eeprom_end

88
firmware/uart.c Normal file
View File

@ -0,0 +1,88 @@
/*
####################################################################################
# #
# Bildschirmtricks Firmware V1.0.0 #
# Uart-Handler #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#include <avr/io.h> /* Include I/O definitions */
#include <avr/interrupt.h> /* Include Interrupt control */
#include <stdint.h> /* Include Integer types */
#include <stdbool.h> /* Include Boolean types */
#include <util/delay.h> /* Include delay functions */
#include "uart.h" /* Include own header file */
/* #################################################################################### */
/* ## INITALIZE UART INTERFACE ######################################################## */
/* Initalize UART */
void systemUartInit(uint16_t UartBaudrate)
{
UCSRC |= (1<<USBS); /* Configure UART to operate in asynchronous mode */
UCSRC &= ~(0<<UCSZ2); /* Configure UART ... */
UCSRC |= (1<<UCSZ1); /* ...to operate */
UCSRC |= (1<<UCSZ0); /* ...with 8 data bits */
UCSRC &= ~(0<<UPM1); /* don't know what... */
UCSRC &= ~(0<<UPM0); /* ...this funny bits do */
UBRRH = (uint8_t)(UartBaudrate >> 8); /* Configure UART0... */
UBRRL = (uint8_t)(UartBaudrate & 0x00FF); /* ... to selected baudrate */
UCSRB |= (1<<TXEN); /* Enable transmitter of UART */
UCSRB |= (1<<RXEN); /* Enable reviver of UART */
/* DISABLED: UCSRB |= (1<<RXCIE); */ /* Enable reciver interrupt */
/* DISABLED: UCSRA |= (1<<U2X); */ /* Enable doubble speed */
}
/* #################################################################################### */
/* ## TRANSMIT TROUGH UART INTERFACES ################################################# */
void systemUartTransmit(uint8_t byte2transmit)
{
while ( !( UCSRA & (1<<UDRE)) ) /* Wait till the interface becomes ready */
{
}
UDR = byte2transmit; /* Transmit byte */
}
/* #################################################################################### */
/* ## RECIVE TROUGH UART INTERFACES ################################################### */
uint8_t systemUartRecive(void)
{
while (!(UCSRA & (1<<RXC))); /* Wait until a byte is recived, always true on ISR call */
return UDR; /* Return the recived byte */
}
/* #################################################################################### */
/* ## RECIVER INTERRUPT SERVICE ROUTINES ############################################## */
/* ISR for UART0 */
ISR(USART0_RX_vect)
{
/* This interrupt service routine is not used, so it is left empty */
}
/* #################################################################################### */

36
firmware/uart.h Normal file
View File

@ -0,0 +1,36 @@
/*
####################################################################################
# #
# Bildschirmtricks Firmware V1.0.0 #
# Uart-Handler #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#ifndef UART_H
#define UART_H
void systemUartInit(uint16_t UartBaudrate); /* Initalize UART */
void systemUartTransmit(uint8_t byte2transmit); /* Transmit a byte */
uint8_t systemUartRecive(void); /* Receive a byte */
#endif /*UART_H*/
/* #################################################################################### */

86
firmware/uart.lst Normal file
View File

@ -0,0 +1,86 @@
1 .file "uart.c"
2 __SP_H__ = 0x3e
3 __SP_L__ = 0x3d
4 __SREG__ = 0x3f
5 __tmp_reg__ = 0
6 __zero_reg__ = 1
7 .text
8 .global systemUartInit
10 systemUartInit:
11 /* prologue: function */
12 /* frame size = 0 */
13 /* stack size = 0 */
14 .L__stack_usage = 0
15 0000 20B5 in r18,0x20
16 0002 2860 ori r18,lo8(8)
17 0004 20BD out 0x20,r18
18 0006 20B5 in r18,0x20
19 0008 20BD out 0x20,r18
20 000a 20B5 in r18,0x20
21 000c 2460 ori r18,lo8(4)
22 000e 20BD out 0x20,r18
23 0010 20B5 in r18,0x20
24 0012 2260 ori r18,lo8(2)
25 0014 20BD out 0x20,r18
26 0016 20B5 in r18,0x20
27 0018 20BD out 0x20,r18
28 001a 20B5 in r18,0x20
29 001c 20BD out 0x20,r18
30 001e 90BD out 0x20,r25
31 0020 89B9 out 0x9,r24
32 0022 539A sbi 0xa,3
33 0024 549A sbi 0xa,4
34 0026 0895 ret
36 .global systemUartTransmit
38 systemUartTransmit:
39 /* prologue: function */
40 /* frame size = 0 */
41 /* stack size = 0 */
42 .L__stack_usage = 0
43 .L4:
44 0028 5D9B sbis 0xb,5
45 002a 00C0 rjmp .L4
46 002c 8CB9 out 0xc,r24
47 002e 0895 ret
49 .global systemUartRecive
51 systemUartRecive:
52 /* prologue: function */
53 /* frame size = 0 */
54 /* stack size = 0 */
55 .L__stack_usage = 0
56 .L8:
57 0030 5F9B sbis 0xb,7
58 0032 00C0 rjmp .L8
59 0034 8CB1 in r24,0xc
60 0036 0895 ret
62 .global USART0_RX_vect
64 USART0_RX_vect:
65 0038 1F92 push r1
66 003a 0F92 push r0
67 003c 0FB6 in r0,__SREG__
68 003e 0F92 push r0
69 0040 1124 clr __zero_reg__
70 /* prologue: Signal */
71 /* frame size = 0 */
72 /* stack size = 3 */
73 .L__stack_usage = 3
74 /* epilogue start */
75 0042 0F90 pop r0
76 0044 0FBE out __SREG__,r0
77 0046 0F90 pop r0
78 0048 1F90 pop r1
79 004a 1895 reti
81 .ident "GCC: (GNU) 4.8.2"
DEFINED SYMBOLS
*ABS*:0000000000000000 uart.c
/tmp/ccg2IVBH.s:2 *ABS*:000000000000003e __SP_H__
/tmp/ccg2IVBH.s:3 *ABS*:000000000000003d __SP_L__
/tmp/ccg2IVBH.s:4 *ABS*:000000000000003f __SREG__
/tmp/ccg2IVBH.s:5 *ABS*:0000000000000000 __tmp_reg__
/tmp/ccg2IVBH.s:6 *ABS*:0000000000000001 __zero_reg__
/tmp/ccg2IVBH.s:10 .text:0000000000000000 systemUartInit
/tmp/ccg2IVBH.s:38 .text:0000000000000028 systemUartTransmit
/tmp/ccg2IVBH.s:51 .text:0000000000000030 systemUartRecive
/tmp/ccg2IVBH.s:64 .text:0000000000000038 USART0_RX_vect
NO UNDEFINED SYMBOLS

62
pc-software/btxasm/88.btx Normal file
View File

@ -0,0 +1,62 @@
<!-- This is a system page of the fictional online service 'Bildschirmtrix' -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="next_page" content="*welcome#"> <!-- Define the page that is loaded when '#' is pressed -->
<meta name="hyperlinks" content="10*fernbl#">
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<aph> <!-- Set cursor to home position -->
Bildschirmtrix<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table (to get a real white) -->
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<apd>
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<trb><blf> <!-- Select Transparent background with blue foreground -->
<csi><0x31><0x40> <!-- Invoke 2nd color table -->
<dbs><apr>Neue<sp>Mitteilungen<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<nsz> <!-- Select normal size font -->
<apd><apr>
10<sp><sp>Chaos<sp>Team<sp>Hamburg<apd><apr>
<sp><sp><sp><sp>23.05.84<sp>23:23:23<sp>012345678901-0001<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
Zum<sp><ss2>HOffnen<sp>der<sp>Mitteilung<sp>nebenstehende<apd><apr>
zweistellige<sp>Zahl<sp>eingeben.
<apd><apr>
<apd><apr>
Zur<ss2>Huck<sp>mit<sp>#<apd><apr>
Eingabe<sp>==><sp>
</body>
</cept>

View File

@ -0,0 +1,16 @@
all: main.o cept.o
gcc -Wall ./*.o -o btxasm -lcodebananas
main.o: main.c
gcc -Wall -c main.c
cept.o: cept.c
gcc -Wall -c cept.c
clean:
rm ./*.o
rm ./btxasm
install:
cp ./btxasm /usr/local/bin

View File

@ -0,0 +1,9 @@
0@# S(@ž€(c `ppppppp0 z_?////o?///_///_} _7 "o4 _% "_4 _ "ot _uppp{uppppp p0t j_ k|ps{____ssss{?mv_;}jt j_ bsssss{________~__{u_x _ `~?'sssssssssssss___}___t _0 `~' ~'###s3######+___o___u0 _5 h_! _ _% (__/g_w_! k_tpppp_qppp_pppz_ ||~?c_' "////////////////! !l~oi} z_4k}ppp0 x?k5"_+//! h_!j5 _ j5 ~5j7 ppp_x/ ##k? j_ "ot # (@ Chaos Computer Club
#=ZurHuck zum
HauptmenHu
Kabelsalat ist gesund.
Eingabe==>

View File

@ -0,0 +1,67 @@
<!-- This ia an example page that illustrate how a CEPT TCD 6-1
looks when it is formatted in the btxml hypertext language
Propose: How to use the different character sets -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="next_page" content="*0#"> <!-- Define the page that is loaded when '#' is pressed -->
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a Brown/Yellow ambient -->
<cs> <!-- Clear screen -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<esc><0x23><0x20><fylb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<trb><bkf> <!-- Select Transparent background with white foreground -->
<esc><0x28><0x63> <!-- Invoke G1 set -->
<sp><sp><sp><sp><sp><sp>`ppppppp0<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>
<sp>z_?////o?///_///_}<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>
<sp>_7<sp><sp><sp><sp><sp>"o4<sp><sp>_%<sp><sp>"_4<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>
<sp>_<sp><sp><sp><sp><sp><sp><sp>"ot<sp>_uppp{uppppp<sp><sp>p0t<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>
j_<sp><sp><sp><sp><sp><sp><sp><sp><sp>k|ps{____ssss{?mv_;}jt<sp><sp><sp><sp><sp><sp><sp>
j_<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>bsssss{________~__{u_x<sp><sp><sp><sp><sp><sp>
<sp>_<sp><sp><sp><sp><sp><sp><sp><sp>`~?'sssssssssssss___}___t<sp><sp><sp><sp><sp>
<sp>_0<sp><sp><sp><sp><sp><sp>`~'<sp>~'###s3######+___o___u0<sp><sp><sp><sp>
<sp>_5<sp><sp><sp><sp><sp>h_!<sp><sp>_<sp><sp><sp><sp>_%<sp><sp><sp><sp><sp><sp><sp>(__/g_w_!<sp><sp><sp><sp>
<sp>k_tpppp_qppp_pppz_<sp><sp><sp><sp><sp><sp><sp><sp><sp>||~?c_'<sp><sp><sp><sp><sp>
<sp>"////////////////!<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>!l~oi}<sp><sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>z_4k}ppp0
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>x?k5"_+//!
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>h_!j5<sp>_<sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>j5<sp>~5j7<sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>ppp_x/<sp><sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>##k?<sp><sp><sp><sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>j_<sp><sp><sp><sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>"ot<sp><sp><sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>#<sp><sp><sp><sp><sp><sp>
<!-- Text and input prompt -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<apu>
<apu>
<apu>
<apu>
<apu>
<apu>
Chaos<sp>Computer<sp>Club<apd><apr>
<apd><apr>
<apd><apr>
#=Zur<ss2>Huck<sp>zum<apd><apr>
Hauptmen<ss2>Hu<apd><apr>
<apd><apr>
<apd><apr>
Kabelsalat<sp>ist<sp>gesund.<apd><apr>
Eingabe==><sp>
</body> <!-- Close page body segment -->
</cept> <!-- Close CEPT page -->

635
pc-software/btxasm/cept.c Normal file
View File

@ -0,0 +1,635 @@
/*
####################################################################################
# #
# Bildschirmtricks MikroPAD V2.0.0 #
# http client layer #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "config.h" /* Include btx configuration */
#include "cept.h" /* include own header file */
#define HEAD_PARSER_MODE 1 /* Parser control constants */
#define HYPERTEXT_PARSER_MODE 2
/* #################################################################################### */
/* ## CEPT PARSER ##################################################################### */
/* Trigger on a specified tag (Note: tag should be null terminated e.g. "<body>\0" ) */
static int applicationBtxCeptTriggerTag(char *data, char *tag)
{
char *dataPointer = data;
char *tagPointer = tag;
while(*tagPointer != '\0')
{
if((*tagPointer != *dataPointer)||(*dataPointer == '\0'))
return -1; /* Not that tag what we are looking for */
dataPointer++;
tagPointer++;
}
return 0; /* All chars match, this is the tag what we ar looking for */
}
/* Translate a cept tag to its binary pendant */
static int applicationBtxCeptTranslateTag(char *data, char *code, int *size)
{
*size = 1;
int sizecount = 0;
char *dataPointer = data;
char *tagPointer = data;
char hexCode = 0;
if(*dataPointer == '<')
{
dataPointer++;
/* Calculate tag size */
while(*dataPointer != '>')
{
if((sizecount >= BTX_CEPT_TAG_MAXSIZE)||(*dataPointer == '\0'))
{
*code = *data;
*size = 1;
return -1; /* Invalid tag */
}
dataPointer++;
sizecount++;
}
*size = sizecount + 2; /* Tag + 2 chars for <> */
/* Examine tag */
if(applicationBtxCeptTriggerTag(tagPointer,"<0x\0") == 0)
{
tagPointer++;
tagPointer++;
tagPointer++;
/* Note: I know this is not very witty but i was tired to code a
more sophisticated piece of code... */
if(*tagPointer == '0')
hexCode = 0;
else if(*tagPointer == '1')
hexCode = 16;
else if(*tagPointer == '2')
hexCode = 32;
else if(*tagPointer == '3')
hexCode = 48;
else if(*tagPointer == '4')
hexCode = 64;
else if(*tagPointer == '5')
hexCode = 80;
else if(*tagPointer == '6')
hexCode = 96;
else if(*tagPointer == '7')
hexCode = 112;
else if(*tagPointer == '8')
hexCode = 128;
else if(*tagPointer == '9')
hexCode = 144;
else if(*tagPointer == 'a')
hexCode = 160;
else if(*tagPointer == 'b')
hexCode = 176;
else if(*tagPointer == 'c')
hexCode = 192;
else if(*tagPointer == 'd')
hexCode = 208;
else if(*tagPointer == 'e')
hexCode = 224;
else if(*tagPointer == 'f')
hexCode = 240;
tagPointer++;
if(*tagPointer == '1')
hexCode += 1;
else if(*tagPointer == '2')
hexCode += 2;
else if(*tagPointer == '3')
hexCode += 3;
else if(*tagPointer == '4')
hexCode += 4;
else if(*tagPointer == '5')
hexCode += 5;
else if(*tagPointer == '6')
hexCode += 6;
else if(*tagPointer == '7')
hexCode += 7;
else if(*tagPointer == '8')
hexCode += 8;
else if(*tagPointer == '9')
hexCode += 9;
else if(*tagPointer == 'a')
hexCode += 10;
else if(*tagPointer == 'b')
hexCode += 11;
else if(*tagPointer == 'c')
hexCode += 12;
else if(*tagPointer == 'd')
hexCode += 13;
else if(*tagPointer == 'e')
hexCode += 14;
else if(*tagPointer == 'f')
hexCode += 15;
*code = hexCode;
}
else if(applicationBtxCeptTriggerTag(tagPointer,"<sp>\0") == 0)
*code = ' ';
else if(applicationBtxCeptTriggerTag(tagPointer,"<apb>\0") == 0)
*code = CEPT_APB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<apf>\0") == 0)
*code = CEPT_APF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<apd>\0") == 0)
*code = CEPT_APD;
else if(applicationBtxCeptTriggerTag(tagPointer,"<apu>\0") == 0)
*code = CEPT_APU;
else if(applicationBtxCeptTriggerTag(tagPointer,"<cs>\0") == 0)
*code = CEPT_CS;
else if(applicationBtxCeptTriggerTag(tagPointer,"<apr>\0") == 0)
*code = CEPT_APR;
else if(applicationBtxCeptTriggerTag(tagPointer,"<si>\0") == 0)
*code = CEPT_SI;
else if(applicationBtxCeptTriggerTag(tagPointer,"<so>\0") == 0)
*code = CEPT_SO;
else if(applicationBtxCeptTriggerTag(tagPointer,"<con>\0") == 0)
*code = CEPT_CON;
else if(applicationBtxCeptTriggerTag(tagPointer,"<rpt>\0") == 0)
*code = CEPT_RPT;
else if(applicationBtxCeptTriggerTag(tagPointer,"<cof>\0") == 0)
*code = CEPT_COF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<can>\0") == 0)
*code = CEPT_CAN;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ss2>\0") == 0)
*code = CEPT_SS2;
else if(applicationBtxCeptTriggerTag(tagPointer,"<esc>\0") == 0)
*code = CEPT_ESC;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ss3>\0") == 0)
*code = CEPT_SS3;
else if(applicationBtxCeptTriggerTag(tagPointer,"<aph>\0") == 0)
*code = CEPT_APH;
else if(applicationBtxCeptTriggerTag(tagPointer,"<us>\0") == 0)
*code = CEPT_US;
else if(applicationBtxCeptTriggerTag(tagPointer,"<nul>\0") == 0)
*code = CEPT_NUL;
else if(applicationBtxCeptTriggerTag(tagPointer,"<soh>\0") == 0)
*code = CEPT_SOH;
else if(applicationBtxCeptTriggerTag(tagPointer,"<stx>\0") == 0)
*code = CEPT_STX;
else if(applicationBtxCeptTriggerTag(tagPointer,"<etx>\0") == 0)
*code = CEPT_ETX;
else if(applicationBtxCeptTriggerTag(tagPointer,"<eot>\0") == 0)
*code = CEPT_EOT;
else if(applicationBtxCeptTriggerTag(tagPointer,"<enq>\0") == 0)
*code = CEPT_ENQ;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ack>\0") == 0)
*code = CEPT_ACK;
else if(applicationBtxCeptTriggerTag(tagPointer,"<itb>\0") == 0)
*code = CEPT_ITB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<dle>\0") == 0)
*code = CEPT_DLE;
else if(applicationBtxCeptTriggerTag(tagPointer,"<nak>\0") == 0)
*code = CEPT_NAK;
else if(applicationBtxCeptTriggerTag(tagPointer,"<syn>\0") == 0)
*code = CEPT_SYN;
else if(applicationBtxCeptTriggerTag(tagPointer,"<etb>\0") == 0)
*code = CEPT_ETB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ini>\0") == 0)
*code = CEPT_INI;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ter>\0") == 0)
*code = CEPT_TER;
else if(applicationBtxCeptTriggerTag(tagPointer,"<dct>\0") == 0)
*code = CEPT_DCT;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fsh>\0") == 0)
*code = CEPT_FSH;
else if(applicationBtxCeptTriggerTag(tagPointer,"<std>\0") == 0)
*code = CEPT_STD;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ebx>\0") == 0)
*code = CEPT_EBX;
else if(applicationBtxCeptTriggerTag(tagPointer,"<sbx>\0") == 0)
*code = CEPT_SBX;
else if(applicationBtxCeptTriggerTag(tagPointer,"<nsz>\0") == 0)
*code = CEPT_NSZ;
else if(applicationBtxCeptTriggerTag(tagPointer,"<dbh>\0") == 0)
*code = CEPT_DBH;
else if(applicationBtxCeptTriggerTag(tagPointer,"<dbw>\0") == 0)
*code = CEPT_DBW;
else if(applicationBtxCeptTriggerTag(tagPointer,"<dbs>\0") == 0)
*code = CEPT_DBS;
else if(applicationBtxCeptTriggerTag(tagPointer,"<cdy>\0") == 0)
*code = CEPT_CDY;
else if(applicationBtxCeptTriggerTag(tagPointer,"<spl>\0") == 0)
*code = CEPT_SPL;
else if(applicationBtxCeptTriggerTag(tagPointer,"<stl>\0") == 0)
*code = CEPT_STL;
else if(applicationBtxCeptTriggerTag(tagPointer,"<csi>\0") == 0)
*code = CEPT_CSI;
else if(applicationBtxCeptTriggerTag(tagPointer,"<abk>\0") == 0)
*code = CEPT_ABK;
else if(applicationBtxCeptTriggerTag(tagPointer,"<anr>\0") == 0)
*code = CEPT_ANR;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ang>\0") == 0)
*code = CEPT_ANG;
else if(applicationBtxCeptTriggerTag(tagPointer,"<any>\0") == 0)
*code = CEPT_ANY;
else if(applicationBtxCeptTriggerTag(tagPointer,"<anb>\0") == 0)
*code = CEPT_ANB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<anm>\0") == 0)
*code = CEPT_ANM;
else if(applicationBtxCeptTriggerTag(tagPointer,"<anc>\0") == 0)
*code = CEPT_ANC;
else if(applicationBtxCeptTriggerTag(tagPointer,"<anw>\0") == 0)
*code = CEPT_ANW;
else if(applicationBtxCeptTriggerTag(tagPointer,"<mbk>\0") == 0)
*code = CEPT_MBK;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msr>\0") == 0)
*code = CEPT_MSR;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msg>\0") == 0)
*code = CEPT_MSG;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msy>\0") == 0)
*code = CEPT_MSY;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msb>\0") == 0)
*code = CEPT_MSB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msm>\0") == 0)
*code = CEPT_MSM;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msc>\0") == 0)
*code = CEPT_MSC;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msw>\0") == 0)
*code = CEPT_MSW;
else if(applicationBtxCeptTriggerTag(tagPointer,"<bbd>\0") == 0)
*code = CEPT_BBD;
else if(applicationBtxCeptTriggerTag(tagPointer,"<nbd>\0") == 0)
*code = CEPT_NBD;
else if(applicationBtxCeptTriggerTag(tagPointer,"<hms>\0") == 0)
*code = CEPT_HMS;
else if(applicationBtxCeptTriggerTag(tagPointer,"<rms>\0") == 0)
*code = CEPT_RMS;
else if(applicationBtxCeptTriggerTag(tagPointer,"<bkf>\0") == 0)
*code = CEPT_BKF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<rdf>\0") == 0)
*code = CEPT_RDF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<grf>\0") == 0)
*code = CEPT_GRF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ylf>\0") == 0)
*code = CEPT_YLF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<blf>\0") == 0)
*code = CEPT_BLF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<mgf>\0") == 0)
*code = CEPT_MGF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<cnf>\0") == 0)
*code = CEPT_CNF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<whf>\0") == 0)
*code = CEPT_WHF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<bkb>\0") == 0)
*code = CEPT_BKB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<rdb>\0") == 0)
*code = CEPT_RDB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<grb>\0") == 0)
*code = CEPT_GRB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ylb>\0") == 0)
*code = CEPT_YLB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<blb>\0") == 0)
*code = CEPT_BLB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<mgb>\0") == 0)
*code = CEPT_MGB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<cnb>\0") == 0)
*code = CEPT_CNB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<whb>\0") == 0)
*code = CEPT_WHB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<npo>\0") == 0)
*code = CEPT_NPO;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ipo>\0") == 0)
*code = CEPT_IPO;
else if(applicationBtxCeptTriggerTag(tagPointer,"<trb>\0") == 0)
*code = CEPT_TRB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<stc>\0") == 0)
*code = CEPT_STC;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fbkb>\0") == 0)
*code = CEPT_FBKB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<frdb>\0") == 0)
*code = CEPT_FRDB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fgrb>\0") == 0)
*code = CEPT_FGRB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fylb>\0") == 0)
*code = CEPT_FYLB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fblb>\0") == 0)
*code = CEPT_FBLB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fmgb>\0") == 0)
*code = CEPT_FMGB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fcnb>\0") == 0)
*code = CEPT_FCNB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fwhb>\0") == 0)
*code = CEPT_FWHB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ftrb>\0") == 0)
*code = CEPT_FTRB;
else
{
*size = 1;
*code = *data;
return -1; /* Invalid tag! */
}
return 0;
}
else
{
*size = 1;
*code = *data;
return -1; /* Invalid tag! */
}
}
/* Strip everthing that is encapsulated by <!-- --> */
static int applicationBtxCeptStripComments(char *data)
{
int ignoreData = 0;
char *dataPointer = data;
char *dataAheadPointer = data;
while(*dataAheadPointer != '\0')
{
if(applicationBtxCeptTriggerTag(dataAheadPointer, "<!--\0") == 0)
ignoreData = 1;
if(applicationBtxCeptTriggerTag(dataAheadPointer, "-->\0") == 0)
{
ignoreData = 0;
dataAheadPointer += 3;
}
*dataPointer = *dataAheadPointer;
if(ignoreData == 0)
dataPointer++;
dataAheadPointer++;
}
*dataPointer = '\0';
return 0;
}
/* Chech if the character is non pintable. Return 0 when printable and -1 when non printable */
static int applicationBtxCeptCheckPrintable(char *data)
{
if(*data == ' ') /* In our case a space is a non printable char (We have <sp> for that) */
return -1;
else if ((*data >= 0x20)&&(*data <= 0x7E)) /* Printable char */
return 0;
else if(*data == '\0') /* Do not destroy \0 terminator */
return 0;
else /* All other chars are threated as non printable */
return -1;
}
/* Strip non printable characters */
static int applicationBtxCeptStripNonPrintable(char *data)
{
char *dataPointer = data;
char *dataAheadPointer = data;
while(*dataAheadPointer != '\0')
{
if(applicationBtxCeptCheckPrintable(dataAheadPointer) == -1)
dataAheadPointer++;
else
{
*dataPointer = *dataAheadPointer;
dataPointer++;
dataAheadPointer++;
}
}
*dataPointer = '\0';
return 0;
}
/* Extract content and name from a meta tag string */
static int applicationBtxParseMetaTag(char *data, char *name, char *content)
{
char *dataPointer = data;
char *namePointer = name;
char *contentPointer = content;
int copyControl = 0;
int nameSizeCount = 0; /* Size counter to prevent buffer overflow */
int contentSizeCount = 0;
while(*dataPointer != '>')
{
if(*dataPointer == '\0')
return -1; /* Something has gone completely wrong */
if(*dataPointer == '\"') /* Switch off copy control when delimeter character passes by */
copyControl = 0;
if(copyControl == 1)
{
if(nameSizeCount < (BTX_CEPT_META_TAG_NAME_BUFFERSIZE -1))
{
*namePointer = *dataPointer;
namePointer++;
nameSizeCount++;
}
else
return -1;
}
else if(copyControl == 2)
{
if(contentSizeCount < (BTX_CEPT_META_TAG_CONTENT_BUFFERSIZE -1))
{
*contentPointer = *dataPointer;
contentPointer++;
contentSizeCount++;
}
else
return -1;
}
else
{
if((applicationBtxCeptTriggerTag(dataPointer,"name=\"\0") == 0))
{
dataPointer += 5;
copyControl = 1;
}
else if((applicationBtxCeptTriggerTag(dataPointer,"content=\"\0") == 0))
{
dataPointer += 8;
copyControl = 2;
}
}
dataPointer++;
}
*namePointer = '\0';
*contentPointer = '\0';
if(copyControl != 0) /* If copy control flag is not zero something gone wrong ! */
return -1;
else
return 0;
}
/* Parse the raw data that was received via http to a btx-cept-page */
int applicationBtxCeptParse(char *dataIn, btxCeptPageData *page)
{
char *dataInPointer = dataIn;
char *dataOutPointer = page->ceptPage;
int tagSize;
char binaryCode;
int parserMode = 0; /* Parser control flags */
int parserActive = 0;
int tagHistory = 0;
page->ceptPageLength = 0; /* Initalize data in the page structure */
page->metaTagCount = 0;
applicationBtxCeptStripComments(dataInPointer); /* strip comments */
applicationBtxCeptStripNonPrintable(dataInPointer); /* strip non printable chars (and whitespaces) */
while(*dataInPointer != '\0')
{
/* Handle parser control */
if((applicationBtxCeptTriggerTag(dataInPointer,"<cept>\0") == 0))
{
if(tagHistory == 0)
{
tagHistory = 1;
parserActive = 1;
}
else
return -1;
}
if((applicationBtxCeptTriggerTag(dataInPointer,"<head>\0") == 0))
{
if(tagHistory == 1)
{
tagHistory = 2;
parserMode = HEAD_PARSER_MODE;
}
else
return -1;
}
if((applicationBtxCeptTriggerTag(dataInPointer,"</head>\0") == 0))
{
if(tagHistory == 2)
{
tagHistory = 3;
parserMode = 0;
}
else
return -1;
}
if((applicationBtxCeptTriggerTag(dataInPointer,"<body>\0") == 0))
{
if(tagHistory == 3)
{
tagHistory = 4;
parserMode = HYPERTEXT_PARSER_MODE;
dataInPointer += 6; /* Override the body tag */
}
else
return -1;
}
if((applicationBtxCeptTriggerTag(dataInPointer,"</body>\0") == 0))
{
if(tagHistory == 4)
{
tagHistory = 5;
parserMode = 0;
}
else
return -1;
}
if((applicationBtxCeptTriggerTag(dataInPointer,"</cept>\0") == 0))
{
if(tagHistory == 5)
{
tagHistory = 6;
parserActive = 0;
}
else
return -1;
}
/* Head parser mode */
if((parserMode == HEAD_PARSER_MODE)&&(parserActive == 1))
{
if((applicationBtxCeptTriggerTag(dataInPointer,"<meta\0") == 0))
{
if(page->metaTagCount<BTX_CEPT_META_TAG_MAXCOUNT)
{
if(applicationBtxParseMetaTag(dataInPointer,page->metaName[page->metaTagCount],page->metaContent[page->metaTagCount]) == -1)
return -1;
page->metaTagCount++;
}
else
return -1;
}
dataInPointer++;
}
/* Hypertect parser mode */
else if((parserMode == HYPERTEXT_PARSER_MODE)&&(parserActive == 1))
{
if(page->ceptPageLength < BTX_CEPT_BINARY_BUFFERSIZE)
{
applicationBtxCeptTranslateTag(dataInPointer,&binaryCode,&tagSize); /* Translate hypertext to binary */
dataInPointer += tagSize;
*dataOutPointer = binaryCode;
dataOutPointer++;
page->ceptPageLength++;
}
else
return 0;
}
/* Parser off */
else
dataInPointer++;
}
*dataOutPointer = '\0';
/* Do final check, every flack must be set! */
if((tagHistory == 6)&&(parserActive == 0)&&(parserMode == 0))
return 0;
else
return -1;
}
/* #################################################################################### */

283
pc-software/btxasm/cept.h Normal file
View File

@ -0,0 +1,283 @@
/*
####################################################################################
# #
# Bildschirmtricks MikroPAD V2.0.0 #
# cept parser layer #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#ifndef CEPT_H
#define CEPT_H
/* ==Control codes==
The the CEPT protocol includes a wide range of special control codes, here is a
hopefully complete list of all available control codes. A detailed explaination
of nearly all control codes can be found in ETS_300_072 (downloadable from etsi.org) */
/* C0 Control characters (printf-friendly) */
#define F_CEPT_APB "\x08" /* Active Position Back */
#define F_CEPT_APF "\x09" /* Active Position Forward */
#define F_CEPT_APD "\x0A" /* Active Position Down */
#define F_CEPT_APU "\x0B" /* Active Position Up */
#define F_CEPT_CS "\x0C" /* Clear Screen */
#define F_CEPT_APR "\x0D" /* Active Position Return */
#define F_CEPT_SI "\x0E" /* Shift In */
#define F_CEPT_SO "\x0F" /* Shift Out */
#define F_CEPT_CON "\x11" /* Cursor ON */
#define F_CEPT_RPT "\x12" /* Repeat Character */
#define F_CEPT_COF "\x14" /* Cursor OFf */
#define F_CEPT_CAN "\x18" /* CANcel (fills the rest off the line with spaces) */
#define F_CEPT_SS2 "\x19" /* Single Shift 2 (G2 set, Some legents say that this is the magic "YES" character) */
#define F_CEPT_ESC "\x1B" /* ESCape */
#define F_CEPT_SS3 "\x1D" /* Single Shift 3 (G3 set) */
#define F_CEPT_APH "\x1E" /* Active Position Home */
#define F_CEPT_US "\x1F" /* Unit Seperator (also known as APA) */
/* C0 Control characters (single byte constants) */
#define CEPT_APB 0x08 /* Active Position Back */
#define CEPT_APF 0x09 /* Active Position Forward */
#define CEPT_APD 0x0A /* Active Position Down */
#define CEPT_APU 0x0B /* Active Position Up */
#define CEPT_CS 0x0C /* Clear Screen */
#define CEPT_APR 0x0D /* Active Position Return */
#define CEPT_SI 0x0E /* Shift In */
#define CEPT_SO 0x0F /* Shift Out */
#define CEPT_CON 0x11 /* Cursor ON */
#define CEPT_RPT 0x12 /* Repeat Last Character */
#define CEPT_COF 0x14 /* Cursor OFf */
#define CEPT_CAN 0x18 /* CANcel (fills the rest off the line with spaces) */
#define CEPT_SS2 0x19 /* Single Shift 2 (G2 set, Some legents say that this is the magic "YES" character) */
#define CEPT_ESC 0x1B /* ESCape */
#define CEPT_SS3 0x1D /* Single Shift 3 (G3 set) */
#define CEPT_APH 0x1E /* Active Position Home */
#define CEPT_US 0x1F /* Unit Seperator (also known as APA) */
/* C0 Data link control tokens (printf-friendly) */
#define F_CEPT_NUL "\x00" /* NULl */
#define F_CEPT_SOH "\x01" /* Start Of Heading */
#define F_CEPT_STX "\x02" /* Start TeXt */
#define F_CEPT_ETX "\x03" /* End TeXt */
#define F_CEPT_EOT "\x04" /* End Of Transmission */
#define F_CEPT_ENQ "\x05" /* ENQuiry */
#define F_CEPT_ACK "\x06" /* ACKnowledge */
#define F_CEPT_ITB "\x07" /* end InTermediate Block */
#define F_CEPT_DLE "\x10" /* Data Link Escape */
#define F_CEPT_NAK "\x15" /* Negative AcKnowledge */
#define F_CEPT_SYN "\x16" /* SYNcronize */
#define F_CEPT_ETB "\x17" /* End TeXtblock */
/* C0 Data link control tokens (single byte constants) */
#define CEPT_NUL 0x00 /* NULl */
#define CEPT_SOH 0x01 /* Start Of Heading */
#define CEPT_STX 0x02 /* Start TeXt */
#define CEPT_ETX 0x03 /* End TeXt */
#define CEPT_EOT 0x04 /* End Of Transmission */
#define CEPT_ENQ 0x05 /* ENQuiry */
#define CEPT_ACK 0x06 /* ACKnowledge */
#define CEPT_ITB 0x07 /* end InTermediate Block */
#define CEPT_DLE 0x10 /* Data Link Escape */
#define CEPT_NAK 0x15 /* Negative AcKnowledge */
#define CEPT_SYN 0x16 /* SYNcronize */
#define CEPT_ETB 0x17 /* End TeXtblock */
/* NOTE: The Data link control tokens are not mentiond in ETS_300_072 */
/* C0 Propritay-BTX tokens (printf-friendly) */
#define F_CEPT_INI "\x13" /* Initiator (*) */
#define F_CEPT_TER "\x1C" /* Terminator (#) */
#define F_CEPT_DCT "\x1A" /* propritary btx (makes the terminal talking) */
/* C0 Propritay-BTX tokens (single byte constants) */
#define CEPT_INI 0x13 /* Initiator (*) */
#define CEPT_TER 0x1C /* Terminator (#) */
#define CEPT_DCT 0x1A /* propritary btx (makes the terminal talking) */
/* C1S/C1P control functions set (printf-friendly) */
#define F_CEPT_FSH "\x88" /* FlaSH */
#define F_CEPT_STD "\x89" /* STeaDy */
#define F_CEPT_EBX "\x8A" /* End BoX */
#define F_CEPT_SBX "\x8B" /* Start BoX */
#define F_CEPT_NSZ "\x8C" /* Normal-SiZe */
#define F_CEPT_DBH "\x8D" /* DouBle-Height */
#define F_CEPT_DBW "\x8E" /* DouBle-Width */
#define F_CEPT_DBS "\x8F" /* DouBle-Size */
#define F_CEPT_CDY "\x98" /* Conceal DisplaY */
#define F_CEPT_SPL "\x99" /* StoP Lining */
#define F_CEPT_STL "\x9A" /* StarT Lining */
#define F_CEPT_CSI "\x9B" /* Control Sequence Introducer */
/* C1S/C1P control functions set (single byte constants) */
#define CEPT_FSH 0x88 /* FlaSH */
#define CEPT_STD 0x89 /* STeaDy */
#define CEPT_EBX 0x8A /* End BoX */
#define CEPT_SBX 0x8B /* Start BoX */
#define CEPT_NSZ 0x8C /* Normal-SiZe */
#define CEPT_DBH 0x8D /* DouBle-Height */
#define CEPT_DBW 0x8E /* DouBle-Width */
#define CEPT_DBS 0x8F /* DouBle-Size */
#define CEPT_CDY 0x98 /* Conceal DisplaY */
#define CEPT_SPL 0x99 /* StoP Lining */
#define CEPT_STL 0x9A /* StarT Lining */
#define CEPT_CSI 0x9B /* Control Sequence Introducer */
/* C1S control functions set (printf-friendly) */
#define F_CEPT_ABK "\x80" /* Alpha BlacK */
#define F_CEPT_ANR "\x81" /* Alpha Red */
#define F_CEPT_ANG "\x82" /* Alpha Green */
#define F_CEPT_ANY "\x83" /* Alpha Yellow */
#define F_CEPT_ANB "\x84" /* Alpha Blue */
#define F_CEPT_ANM "\x85" /* Alpha Mageta */
#define F_CEPT_ANC "\x86" /* Alpha Cyan */
#define F_CEPT_ANW "\x87" /* Alpha White */
#define F_CEPT_MBK "\x90" /* Mosaic BlacK */
#define F_CEPT_MSR "\x91" /* MoSaic Red */
#define F_CEPT_MSG "\x92" /* MoSaic Green */
#define F_CEPT_MSY "\x93" /* MoSaic Yellow */
#define F_CEPT_MSB "\x94" /* MoSaic Blue */
#define F_CEPT_MSM "\x95" /* MoSaic Magenta */
#define F_CEPT_MSC "\x96" /* MoSaic Cyan */
#define F_CEPT_MSW "\x97" /* MoSaic White */
#define F_CEPT_BBD "\x9c" /* Black BackgrounD */
#define F_CEPT_NBD "\x9d" /* New BackgrounD */
#define F_CEPT_HMS "\x9e" /* Hold MoSaic */
#define F_CEPT_RMS "\x9f" /* Release MoSaic */
/* C1S control functions set (single byte constants) */
#define CEPT_ABK 0x80 /* Alpha BlacK */
#define CEPT_ANR 0x81 /* Alpha Red */
#define CEPT_ANG 0x82 /* Alpha Green */
#define CEPT_ANY 0x83 /* Alpha Yellow */
#define CEPT_ANB 0x84 /* Alpha Blue */
#define CEPT_ANM 0x85 /* Alpha Mageta */
#define CEPT_ANC 0x86 /* Alpha Cyan */
#define CEPT_ANW 0x87 /* Alpha White */
#define CEPT_MBK 0x90 /* Mosaic BlacK */
#define CEPT_MSR 0x91 /* MoSaic Red */
#define CEPT_MSG 0x92 /* MoSaic Green */
#define CEPT_MSY 0x93 /* MoSaic Yellow */
#define CEPT_MSB 0x94 /* MoSaic Blue */
#define CEPT_MSM 0x95 /* MoSaic Magenta */
#define CEPT_MSC 0x96 /* MoSaic Cyan */
#define CEPT_MSW 0x97 /* MoSaic White */
#define CEPT_BBD 0x9c /* Black BackgrounD */
#define CEPT_NBD 0x9d /* New BackgrounD */
#define CEPT_HMS 0x9e /* Hold MoSaic */
#define CEPT_RMS 0x9f /* Release MoSaic */
/* C1P control functions set (printf-friendly) */
#define F_CEPT_BKF "\x80" /* BlacK Foreground */
#define F_CEPT_RDF "\x81" /* ReD Foreground */
#define F_CEPT_GRF "\x82" /* GReen Foreground */
#define F_CEPT_YLF "\x83" /* YeLlow Foreground */
#define F_CEPT_BLF "\x84" /* BLue Foreground */
#define F_CEPT_MGF "\x85" /* MaGenta Foreground */
#define F_CEPT_CNF "\x86" /* CyaN Foreground */
#define F_CEPT_WHF "\x87" /* WHite Foreground */
#define F_CEPT_BKB "\x90" /* BlacK Background */
#define F_CEPT_RDB "\x91" /* ReD Background */
#define F_CEPT_GRB "\x92" /* GReen Background */
#define F_CEPT_YLB "\x93" /* YeLlow Background */
#define F_CEPT_BLB "\x94" /* BLue Background */
#define F_CEPT_MGB "\x95" /* MaGenta Background */
#define F_CEPT_CNB "\x96" /* CyaN Background */
#define F_CEPT_WHB "\x97" /* WHite Background */
#define F_CEPT_NPO "\x9c" /* Normal POlarity */
#define F_CEPT_IPO "\x9d" /* Inverted POlarity */
#define F_CEPT_TRB "\x9e" /* TranspaRent Background */
#define F_CEPT_STC "\x9f" /* STop Conceal */
/* C1P control functions set (single byte constants) */
#define CEPT_BKF 0x80 /* BlacK Foreground */
#define CEPT_RDF 0x81 /* ReD Foreground */
#define CEPT_GRF 0x82 /* GReen Foreground */
#define CEPT_YLF 0x83 /* YeLlow Foreground */
#define CEPT_BLF 0x84 /* BLue Foreground */
#define CEPT_MGF 0x85 /* MaGenta Foreground */
#define CEPT_CNF 0x86 /* CyaN Foreground */
#define CEPT_WHF 0x87 /* WHite Foreground */
#define CEPT_BKB 0x90 /* BlacK Background */
#define CEPT_RDB 0x91 /* ReD Background */
#define CEPT_GRB 0x92 /* GReen Background */
#define CEPT_YLB 0x93 /* YeLlow Background */
#define CEPT_BLB 0x94 /* BLue Background */
#define CEPT_MGB 0x95 /* MaGenta Background */
#define CEPT_CNB 0x96 /* CyaN Background */
#define CEPT_WHB 0x97 /* WHite Background */
#define CEPT_NPO 0x9c /* Normal POlarity */
#define CEPT_IPO 0x9d /* Inverted POlarity */
#define CEPT_TRB 0x9e /* TranspaRent Background */
#define CEPT_STC 0x9f /* STop Conceal */
/* FE Full Screen atributes (single byte constants) */
#define CEPT_FBKB 0x50 /* BlacK Background */
#define CEPT_FRDB 0x51 /* ReD Background */
#define CEPT_FGRB 0x52 /* GReen Background */
#define CEPT_FYLB 0x53 /* YeLlow Background */
#define CEPT_FBLB 0x54 /* BLue Background */
#define CEPT_FMGB 0x55 /* MaGenta Background */
#define CEPT_FCNB 0x56 /* CyaN Background */
#define CEPT_FWHB 0x57 /* WHite Background */
#define CEPT_FTRB 0x5E /* TRansparent Background */
/* FE Full Screen atributes (printf-friendly) */
#define F_CEPT_FBKB "\x50" /* BlacK Background */
#define F_CEPT_FRDB "\x51" /* ReD Background */
#define F_CEPT_FGRB "\x52" /* GReen Background */
#define F_CEPT_FYLB "\x53" /* YeLlow Background */
#define F_CEPT_FBLB "\x54" /* BLue Background */
#define F_CEPT_FMGB "\x55" /* MaGenta Background */
#define F_CEPT_FCNB "\x56" /* CyaN Background */
#define F_CEPT_FWHB "\x57" /* WHite Background */
#define F_CEPT_FTRB "\x5E" /* TRansparent Background */
#define CEPT_ECHOPLEX_GUARDTIME 200 /* Echoplex guardtime, time between receiving and echoing */
/* Data structure of a btx-cept-page */
typedef struct
{
/* Contains the cept page in its binary form */
char ceptPage[BTX_CEPT_BINARY_BUFFERSIZE];
/* Contains the length of the cept page */
int ceptPageLength;
/* Contains the meta tag name */
char metaName[BTX_CEPT_META_TAG_MAXCOUNT][BTX_CEPT_META_TAG_NAME_BUFFERSIZE];
/* Contains the corospondenting meta content */
char metaContent[BTX_CEPT_META_TAG_MAXCOUNT][BTX_CEPT_META_TAG_CONTENT_BUFFERSIZE];
/* Contains the number of meta tags that are issued to the page */
int metaTagCount;
}btxCeptPageData;
/* Parse the raw data that was received via http to a btx-cept-page */
int applicationBtxCeptParse(char *dataIn, btxCeptPageData *page);
#endif /*CEPT_H*/
/* #################################################################################### */

View File

@ -0,0 +1,65 @@
/*
####################################################################################
# #
# Bildschirmtricks MikroPAD V2.0.0 #
# mikroPAD configuration #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#ifndef CONFIG_H
#define CONFIG_H
/* ATTENTION! You must do a "make clean" and then "make" to make the changes take effect! */
/* General configuration */
#define DEBUGPORT 0 /* Debug port configuration (0=Disabled, 1=Enabled) */
#define VERSIONSTRING "V 0.0.1" /* Version string */
#define DISPLAYPAGE_RETRYS 3 /* Configures how often the system retrys to display a page */
#define PAGE_HISTORY_SIZE 23 /* Configures how many entered pageIds the integrated history can store */
/* Ulm configuration */
#define BTX_ULM_INITIAL_PAGE "*index#" /* Set the initial page (Wellcomescreen) */
#define BTX_ULM_HOST "btx.runningserver.com" /* Configure where Ulm is */
#define BTX_ULM_PORT 80 /* Configure on which port of Ulm the http-server is running */
#define BTX_ULM_STYLE 1 /* Configure ulm style: 1=Static, 2=Dynamic (see readme file) */
#define BTX_ULM_PAGE_FILE_SUFFIX "btx" /* File type prefix that will be used for http access */
#define BTX_ULM_PAGE_ID_MAXLENGTH 32 /* The length of the page id (see readme file) */
#define BTX_ULM_HYPERLINK_ID_MAXLENGTH 2 /* The lenght of an hyperlink id (recomanded value is 2) */
#define BTX_ULM_PAGE_BASENAME "page" /* When style 2 is selected, this is the name of the page that generates the contnet */
#define BTX_ULM_PAGE_REQUESTVAR "id" /* When style 2 is selected, this is the name of the variable that contains the request */
#define BTX_ULM_IP_RESOLVE_RETRYS 3 /* Configures how often the system retrys to resolve the ulm ip */
/* Internal messages */
#define BTX_MESSAGE_HTTPERROR "SEITE NICHT VERFUEGBAR" /* Message that is displayed if an http-error anounces */
#define BTX_MESSAGE_CONNECTIONERROR "ZENTRALE NICHT ERREICHBAR" /* Message that is displayed when there is a problem with the ulm connection */
#define BTX_MESSAGE_PARSEERROR "SEITE BESCHAEDIGT" /* Message that is displayed when parse errors anounces */
/* Cept parser configuration: */
#define BTX_CEPT_HYPERTEXT_BUFFERSIZE 10000 /* Maximal size of a hypertext cept-page the PAD can process */
#define BTX_CEPT_BINARY_BUFFERSIZE 10000 /* Maximal size of a binary cept-page the PAD can process */
#define BTX_CEPT_TAG_MAXSIZE 32 /* Maximal size of a single tag */
#define BTX_CEPT_META_TAG_MAXCOUNT 8 /* Maximal number of meta tags that can be stored in one page structure */
#define BTX_CEPT_META_TAG_NAME_BUFFERSIZE 32+1 /* Maximal size of a meta tag name (+1 for \0) */
#define BTX_CEPT_META_TAG_CONTENT_BUFFERSIZE 128+1 /* Maximal size of a meta tag content (+1 for \0) */
#define BTX_CEPT_META_TAG_HYPERLINKLIST_BUFFER 256 /* Hyperlinklist buffer size */
#endif /*CONFIG_H*/
/* #################################################################################### */

View File

@ -0,0 +1,63 @@
<!-- This is a system page of the fictional online service 'Bildschirmtrix' -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="load_page" content="*fernbl2#">
<meta name="load_timeout" content="5">
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<aph> <!-- Set cursor to home position -->
Bildschirmtrix<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table (to get a real white) -->
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<apd>
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<trb><blf> <!-- Select Transparent background with blue foreground -->
<csi><0x31><0x40> <!-- Invoke 2nd color table -->
<dbs><apr>Neue<sp>Mitteilungen<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<nsz> <!-- Select normal size font -->
<apd><apr>
Von<sp><sp>Chaos<sp>Team<sp>Hamburg<apd><apr>
An<sp>die<sp>Bundesdatenschutzbeauftragten<apd><apr>
<apd><apr>
<apd><apr>
Liebe<sp>Datensch<ss2>Hutzer,<apd><apr>
wir<sp>werden<sp>Sie<sp>mit<sp>diesem<sp>Schreiben<apd><apr>
fernbeleidigen<sp>Wir<sp>bitten<sp>Sie<sp>uns<apd><apr>
1<sp>St<ss2>Huck<sp>ihres<sp>letzten<sp>T<ss2>Hatigkeitsberichts<!-- apd apr -->
zuzusenden<sp>
<apd><apr>
<apd><apr>
Mit<sp>freundlichen<sp>Gr<ss2>Hussen<apd><apr>
Chaos<sp>Team<sp>Hamburg<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
Zur<ss2>Huck<sp>mit<sp>#<apd><apr>
Eingabe<sp>==><sp>
</body>
</cept>

View File

@ -0,0 +1,62 @@
<!-- This is a system page of the fictional online service 'Bildschirmtrix' -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="next_page" content="*welcome#"> <!-- Define the page that is loaded when '#' is pressed -->
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<aph> <!-- Set cursor to home position -->
Bildschirmtrix<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table (to get a real white) -->
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<apd>
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<trb><blf> <!-- Select Transparent background with blue foreground -->
<csi><0x31><0x40> <!-- Invoke 2nd color table -->
<dbs><apr>Neue<sp>Mitteilungen<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<nsz> <!-- Select normal size font -->
<apd><apr>
Von<sp><sp>Chaos<sp>Team<sp>Hamburg<apd><apr>
An<sp>die<sp>Bundesdatenschutzbeauftragten<apd><apr>
<apd><apr>
<apd><apr>
Liebe<sp>Dateischeisser,<apd><apr>
wir<sp>werden<sp>Sie<sp>mit<sp>diesem<sp>Schreiben<apd><apr>
fernbeleidigen<sp>Wir<sp>bitten<sp>Sie<sp>uns<apd><apr>
1000<sp>St<ss2>Huck<sp>ihres<sp>letzten<apd><apr>
T<ss2>Hatigkeitsberichts<sp>zuzusenden<sp>
<apd><apr>
<apd><apr>
Mit<sp>freundlichen<sp>Gr<ss2>Hussen<apd><apr>
Chaos<sp>Team<sp>Hamburg<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
Zur<ss2>Huck<sp>mit<sp>#<apd><apr>
Eingabe<sp>==><sp>
</body>
</cept>

View File

@ -0,0 +1,68 @@
<!-- This ia an example page that illustrate how a CEPT TCD 6-1
looks when it is formatted in the btxml hypertext language
Propose: How to use the different character sets -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="next_page" content="*0#"> <!-- Define the page that is loaded when '#' is pressed -->
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<aph> <!-- Set cursor to home position -->
Bildschirmtrix<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table (to get a real white) -->
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<apd>
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<trb><blf> <!-- Select Transparent background with blue foreground -->
<csi><0x31><0x40> <!-- Invoke 2nd color table -->
<dbs><apr>Hilfe<sp><sp><sp><sp><sp><sp><sp><sp>*hilfe#<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<nsz> <!-- Select normal size font -->
<!-- Text -->
<apd><apr>
<dbh>Die<sp>wichtigsten<sp>codes:<nsz><apd><apr>
<sp>#<sp><sp><sp><sp>=<sp>Weiter<sp><sp><sp><sp>*0#<sp><sp>=<sp><ss2>HUbersichtsseite<!-- apd apr -->
<sp>*#<sp><sp><sp>=<sp>Zur<ss2>Huck<sp><sp><sp><sp>*00#<sp>=<sp>Neu<sp>laden<apd><apr>
<apd><apr>
<dbh>Direktaufruf<sp>von<sp>Seiten:<nsz><apd><apr>
<sp>*seitenname#<sp>oder<sp>*seitennummer#<apd><apr>
<sp>z.B.:<sp>*wtf#<apd><apr>
<apd><apr>
<dbh>Aufruf<sp>von<sp>Verkn<ss2>Hupfungen:<nsz><apd><apr>
<sp>Einfach<sp>die<sp>entsprechende<sp>zweistellige<apd><apr>
<sp>Zahl<sp>eingeben<sp>(<ss2>HAhnlich<sp>Videotext)<apd><apr>
<apd><apr>
<dbh>Eingabe:<nsz><apd><apr>
<sp>Taste<sp><ss3>\<sp>korrigiert<sp>Eingabe<apd><apr>
<sp>Nicht<sp>zu<sp>schnell<sp>tippen!<apd><apr>
<sp>Ung<ss2>Hultige<sp>Eingaben<sp>werden<sp>ignoriert.<apd><apr>
<apd><apr>
<!-- Input prompt -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
#<sp>um<sp>naechste<sp>Testseite<sp>abzurufen<apd><apr>
Eingabe<sp>==><sp>
</body> <!-- Close page body segment -->
</cept> <!-- Close CEPT page -->

View File

@ -0,0 +1,51 @@
<!-- This is a system page of the fictional online service 'Bildschirmtrix' -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="load_page" content="*welcome#">
<meta name="load_timeout" content="2">
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<apd>
<apd><apr>
<!-- Logo -->
<esc><0x28><0x63> <!-- Invoke G1 set -->
<sp><sp><sp><sp><sp><sp><sp><sp>8######################)0<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp><sp>`x|__________}|p<sp><sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp>h____w######c____}<sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp>*___/'`~___t"/o__?<sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp><sp>"cx~_j_____j_|r#<sp><sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp><sp><sp>____j_____j___5<sp><sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp><sp><sp>____};///y____5<sp><sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp><sp><sp>______________5<sp><sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp>p000<sp>0`<sp><sp>0<sp>0<sp><sp><sp><sp>`<sp><sp>`<sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp>=14575mh$7547jkkj!7h"6<sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>"d#!!!#!#"!!!!!""""!!"""`&<apd><apr>
<sp><sp><sp><sp><sp><sp><sp><sp><sp>######################!<apd><apr>
<esc><0x28><0x40> <!-- Invoke G0 set -->
<apd>
________________________________________<apd><apr>
<sp><sp><sp>BTX-Nummer<sp><sp><sp><sp>:<sp><sp>23422342235<sp><sp>-<sp><sp>1<apd><apr>
<sp><sp><sp>pers.<sp>Kennwort:<sp><sp>usd7000011<apd><apr>
________________________________________<apd><apr>
<apd>
Bitte<sp>warten...
</body>
</cept>

176
pc-software/btxasm/main.c Normal file
View File

@ -0,0 +1,176 @@
/*
####################################################################################
# #
# BTXASM V1.0.0 #
# Main-Program #
# #
# Copyright (C) 2010 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
/* Header */
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <libcodebananas/toolbanana.h>
#include <string.h>
#include <getopt.h>
#include <ctype.h>
#include <unistd.h>
#include <libgen.h>
#include "config.h"
#include "cept.h"
char programName[255];
/* Transmission parameters */
#define MINIBTX_HOOKOFF 0x01 /* Hookoff-token (Do not change) */
#define MINIBTX_CONNECT 0x00 /* Connect-token (Do not change) */
#define MINIBTX_BAUDRATE 1200 /* Baudrate, can not be changed */
/* #################################################################################### */
/* #################################################################################### */
void showUsage(void)
{
printf(" * Usage:\r\n");
printf(" %s -p [PORT] -i [BTXML-INPUT] -o [BINARY-OUTPUT]-f\r\n",programName);
printf("\r\n");
}
/* Main program: Perform some testpages */
int main(int argc, char *argv[])
{
int getoptOption;
char *getoptBtxPage = 0;
char *getoptBtxPageBinary = 0;
int getoptVerboseMode = 0;
char ceptHypertextBuffer[BTX_CEPT_HYPERTEXT_BUFFERSIZE];
int i;
btxCeptPageData btxCeptPage; /* Contains the page information of the last displayed page */
strcpy(programName,basename(argv[0]));
printf("_______________________________________________________________________________\n\r");
printf("Bildschirmtrix BTX Assembler V.1.0\n\r");
printf("Copyright(c) 2014 Philipp Fabian Benedikt Maier\n\r");
printf("\n\r");
/* Parse Options */
while ((getoptOption = getopt (argc, argv, ":h?i:o:v")) != -1)
switch (getoptOption)
{
case 'h':
showUsage();
return 0;
case '?':
showUsage();
return 0;
case 'v':
getoptVerboseMode = 1;
break;
case 'i':
getoptBtxPage = optarg;
case 'o':
getoptBtxPageBinary = optarg;
break;
}
/* Check input file */
if(getoptBtxPage)
{
printf(" * Path to BTXML BTX-Page is: %s\r\n", getoptBtxPage);
/* Check whether the file is readable */
if(testFile(getoptBtxPage) != 0)
{
printf(" * Error: Can not read BTX-Page from file system - aborting!\r\n");
printf("\r\n");
exit(1);
}
}
else
{
printf(" * Error: You must specify a BTX-Page!\r\n");
printf("\r\n");
exit(1);
}
printf(" * Path to BINARY BTX-Page is: %s\r\n", getoptBtxPageBinary);
/* Load Hypertext file into buffer */
if(loadFile(ceptHypertextBuffer, sizeof(ceptHypertextBuffer), getoptBtxPage) != -1)
printf(" * Info: BTX-Hypertext loaded successfully...\r\n");
else
{
printf(" * Error: Could not load BTX-Hypertext page - aborting!\r\n");
printf("\r\n");
exit(1);
}
/* In verbose mode display hypertext page on the screen.. */
if(getoptVerboseMode)
{
printf(" * Info: The following BTX-Hypertext has been loaded:\r\n");
printf("%s\r\n",ceptHypertextBuffer);
}
/* Parse hypertext page */
if(applicationBtxCeptParse(ceptHypertextBuffer, &btxCeptPage) != 1)
printf(" * Info: BTX-Hypertext parsed successfully...\r\n");
else
{
printf(" * Error: Could not parse BTX-Hypertext page - aborting!\r\n");
printf("\r\n");
exit(1);
}
/* In verbose mode display additional information: hexdump, metatags ect.. */
if(getoptVerboseMode)
{
printf(" * Info: The page contains the following meta information (has no effect here)\r\n");
for(i=0; i<btxCeptPage.metaTagCount; i++)
printf(" %s = %s\r\n", btxCeptPage.metaName[i], btxCeptPage.metaContent[i]);
printf(" * Info: The following binary data (%i bytes) will be transmitted to therminal:\r\n", btxCeptPage.ceptPageLength);
hexBinAsciiDump(btxCeptPage.ceptPage, btxCeptPage.ceptPageLength);
}
printf(" * Writing output file...\n");
if(storeFile(btxCeptPage.ceptPage, btxCeptPage.ceptPageLength, getoptBtxPageBinary) != -1)
printf(" * Info: Outputfile stored successfully!\r\n");
else
{
printf(" * Error: Writing output file failed!\r\n");
exit(1);
}
printf(" * Done!\n\r");
printf("\n\r");
return 0;
}
/* #################################################################################### */

View File

@ -0,0 +1,2 @@
This is a program to assemble the textual btxml representation into a binary stream.

View File

@ -0,0 +1,75 @@
<!-- This ia an example page that illustrate how a CEPT TCD 6-1
looks when it is formatted in the btxml hypertext language
Propose: How to use the different character sets -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="next_page" content="*test2#"> <!-- Define the page that is loaded when '#' is pressed -->
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<aph> <!-- Set cursor to home position -->
Bildschirmtrix<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table (to get a real white) -->
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<apd>
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<trb><blf> <!-- Select Transparent background with blue foreground -->
<csi><0x31><0x40> <!-- Invoke 2nd color table -->
<dbs><apr>Testbild<sp><sp><sp><sp><sp><sp>*test#<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<nsz> <!-- Select normal size font -->
<!-- Test-Text -->
BTX<sp>Testbild<sp>nach<sp>CEPT<sp>T/CD<sp>6-1<apd><apd><apr>
<esc><0x28><0x40> <!-- Invoke G0 set (just activate, only for a better understanding) -->
<grb><bkf>G0-SET:<whf><trb> <!-- Green foreground with black background and back -->
<sp>!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~<apd><apr>
<apd><apr>
<esc><0x28><0x40> <!-- Invoke G0 set -->
<grb><bkf>G1-SET:<whf><trb> <!-- Green foreground with black background and back -->
<esc><0x28><0x63> <!-- Invoke G1 set -->
<sp>!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~<apd><apr>
<apd><apr>
<esc><0x28><0x40> <!-- Invoke G0 set -->
<grb><bkf>G2-SET:<whf><trb> <!-- Green foreground with black background and back -->
<esc><0x28><0x62> <!-- Invoke G2 set -->
<sp>!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~<apd><apr>
<apd><apr>
<esc><0x28><0x40> <!-- Invoke G0 set -->
<grb><bkf>G3-SET:<whf><trb> <!-- Green foreground with black background and back -->
<esc><0x28><0x64> <!-- Invoke G3 set -->
<sp>!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~<apd><apr>
<apd><apr>
<!-- Input prompt -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
#<sp>um<sp>naechste<sp>Testseite<sp>abzurufen<apd><apr>
Eingabe<sp>==><sp>
</body> <!-- Close page body segment -->
</cept> <!-- Close CEPT page -->

View File

@ -0,0 +1,61 @@
<!-- This is a system page of the fictional online service 'Bildschirmtrix' -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="next_page" content="*0#"> <!-- Define the page that is loaded when '#' is pressed -->
<meta name="hyperlinks" content="06*88#">
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<aph> <!-- Set cursor to home position -->
Bildschirmtrix<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table (to get a real white) -->
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<apd>
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<trb><blf> <!-- Select Transparent background with blue foreground -->
<csi><0x31><0x40> <!-- Invoke 2nd color table -->
<dbs><apr>Deutsche<sp>Chaospost<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<nsz> <!-- Select normal size font -->
<apd><apr>
<nsz>02.09.1983<sp><sp>23:23<apd><apr>
<apd><apr>
Guten<sp>Tag<apd><apr>
Frau<apd><apr>
Eris<apd><apr>
Discordia<apd><apr>
<apd><apr>
Mitteilungsempfang<sp><ss2>Hoffnen<sp>mit<sp>06<apd><apr>
<apd>
<apd>
<apd>
<apd>
<apd>
<apd><apr>
Sie<sp>benutzten<sp>Bildschirmtext<sp>zuletzt<apd><apr>
am<sp>31.12.2001<sp>bis<sp>23:59<apd><apr>
<apd><apr>
<apd><apr>
Weiter<sp>mit<sp>#<sp>oder<sp><sp><sp>*Seitennummer#<apd><apr>
Eingabe<sp>==><sp>
</body>
</cept>

View File

@ -0,0 +1,62 @@
<!-- This is a system page of the fictional online service 'Bildschirmtrix' -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="next_page" content="*welcome#"> <!-- Define the page that is loaded when '#' is pressed -->
<meta name="hyperlinks" content="10*fernbl#">
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<aph> <!-- Set cursor to home position -->
Bildschirmtrix<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table (to get a real white) -->
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<apd>
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<trb><blf> <!-- Select Transparent background with blue foreground -->
<csi><0x31><0x40> <!-- Invoke 2nd color table -->
<dbs><apr>Neue<sp>Mitteilungen<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<nsz> <!-- Select normal size font -->
<apd><apr>
10<sp><sp>Chaos<sp>Team<sp>Hamburg<apd><apr>
<sp><sp><sp><sp>23.05.84<sp>23:23:23<sp>012345678901-0001<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
Zum<sp><ss2>HOffnen<sp>der<sp>Mitteilung<sp>nebenstehende<apd><apr>
zweistellige<sp>Zahl<sp>eingeben.
<apd><apr>
<apd><apr>
Zur<ss2>Huck<sp>mit<sp>#<apd><apr>
Eingabe<sp>==><sp>
</body>
</cept>

View File

@ -0,0 +1,16 @@
all: main.o cept.o
gcc -Wall ./*.o -o pageload -lcodebananas
main.o: main.c
gcc -Wall -c main.c
cept.o: cept.c
gcc -Wall -c cept.c
clean:
rm ./*.o
rm ./pageload
install:
cp ./pageload /usr/local/bin

View File

@ -0,0 +1,67 @@
<!-- This ia an example page that illustrate how a CEPT TCD 6-1
looks when it is formatted in the btxml hypertext language
Propose: How to use the different character sets -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="next_page" content="*0#"> <!-- Define the page that is loaded when '#' is pressed -->
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a Brown/Yellow ambient -->
<cs> <!-- Clear screen -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<esc><0x23><0x20><fylb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<trb><bkf> <!-- Select Transparent background with white foreground -->
<esc><0x28><0x63> <!-- Invoke G1 set -->
<sp><sp><sp><sp><sp><sp>`ppppppp0<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>
<sp>z_?////o?///_///_}<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>
<sp>_7<sp><sp><sp><sp><sp>"o4<sp><sp>_%<sp><sp>"_4<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>
<sp>_<sp><sp><sp><sp><sp><sp><sp>"ot<sp>_uppp{uppppp<sp><sp>p0t<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>
j_<sp><sp><sp><sp><sp><sp><sp><sp><sp>k|ps{____ssss{?mv_;}jt<sp><sp><sp><sp><sp><sp><sp>
j_<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>bsssss{________~__{u_x<sp><sp><sp><sp><sp><sp>
<sp>_<sp><sp><sp><sp><sp><sp><sp><sp>`~?'sssssssssssss___}___t<sp><sp><sp><sp><sp>
<sp>_0<sp><sp><sp><sp><sp><sp>`~'<sp>~'###s3######+___o___u0<sp><sp><sp><sp>
<sp>_5<sp><sp><sp><sp><sp>h_!<sp><sp>_<sp><sp><sp><sp>_%<sp><sp><sp><sp><sp><sp><sp>(__/g_w_!<sp><sp><sp><sp>
<sp>k_tpppp_qppp_pppz_<sp><sp><sp><sp><sp><sp><sp><sp><sp>||~?c_'<sp><sp><sp><sp><sp>
<sp>"////////////////!<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>!l~oi}<sp><sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>z_4k}ppp0
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>x?k5"_+//!
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>h_!j5<sp>_<sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>j5<sp>~5j7<sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>ppp_x/<sp><sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>##k?<sp><sp><sp><sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>j_<sp><sp><sp><sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>"ot<sp><sp><sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>#<sp><sp><sp><sp><sp><sp>
<!-- Text and input prompt -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<apu>
<apu>
<apu>
<apu>
<apu>
<apu>
Chaos<sp>Computer<sp>Club<apd><apr>
<apd><apr>
<apd><apr>
#=Zur<ss2>Huck<sp>zum<apd><apr>
Hauptmen<ss2>Hu<apd><apr>
<apd><apr>
<apd><apr>
Kabelsalat<sp>ist<sp>gesund.<apd><apr>
Eingabe==><sp>
</body> <!-- Close page body segment -->
</cept> <!-- Close CEPT page -->

635
pc-software/pageload/cept.c Normal file
View File

@ -0,0 +1,635 @@
/*
####################################################################################
# #
# Bildschirmtricks MikroPAD V2.0.0 #
# http client layer #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "config.h" /* Include btx configuration */
#include "cept.h" /* include own header file */
#define HEAD_PARSER_MODE 1 /* Parser control constants */
#define HYPERTEXT_PARSER_MODE 2
/* #################################################################################### */
/* ## CEPT PARSER ##################################################################### */
/* Trigger on a specified tag (Note: tag should be null terminated e.g. "<body>\0" ) */
static int applicationBtxCeptTriggerTag(char *data, char *tag)
{
char *dataPointer = data;
char *tagPointer = tag;
while(*tagPointer != '\0')
{
if((*tagPointer != *dataPointer)||(*dataPointer == '\0'))
return -1; /* Not that tag what we are looking for */
dataPointer++;
tagPointer++;
}
return 0; /* All chars match, this is the tag what we ar looking for */
}
/* Translate a cept tag to its binary pendant */
static int applicationBtxCeptTranslateTag(char *data, char *code, int *size)
{
*size = 1;
int sizecount = 0;
char *dataPointer = data;
char *tagPointer = data;
char hexCode = 0;
if(*dataPointer == '<')
{
dataPointer++;
/* Calculate tag size */
while(*dataPointer != '>')
{
if((sizecount >= BTX_CEPT_TAG_MAXSIZE)||(*dataPointer == '\0'))
{
*code = *data;
*size = 1;
return -1; /* Invalid tag */
}
dataPointer++;
sizecount++;
}
*size = sizecount + 2; /* Tag + 2 chars for <> */
/* Examine tag */
if(applicationBtxCeptTriggerTag(tagPointer,"<0x\0") == 0)
{
tagPointer++;
tagPointer++;
tagPointer++;
/* Note: I know this is not very witty but i was tired to code a
more sophisticated piece of code... */
if(*tagPointer == '0')
hexCode = 0;
else if(*tagPointer == '1')
hexCode = 16;
else if(*tagPointer == '2')
hexCode = 32;
else if(*tagPointer == '3')
hexCode = 48;
else if(*tagPointer == '4')
hexCode = 64;
else if(*tagPointer == '5')
hexCode = 80;
else if(*tagPointer == '6')
hexCode = 96;
else if(*tagPointer == '7')
hexCode = 112;
else if(*tagPointer == '8')
hexCode = 128;
else if(*tagPointer == '9')
hexCode = 144;
else if(*tagPointer == 'a')
hexCode = 160;
else if(*tagPointer == 'b')
hexCode = 176;
else if(*tagPointer == 'c')
hexCode = 192;
else if(*tagPointer == 'd')
hexCode = 208;
else if(*tagPointer == 'e')
hexCode = 224;
else if(*tagPointer == 'f')
hexCode = 240;
tagPointer++;
if(*tagPointer == '1')
hexCode += 1;
else if(*tagPointer == '2')
hexCode += 2;
else if(*tagPointer == '3')
hexCode += 3;
else if(*tagPointer == '4')
hexCode += 4;
else if(*tagPointer == '5')
hexCode += 5;
else if(*tagPointer == '6')
hexCode += 6;
else if(*tagPointer == '7')
hexCode += 7;
else if(*tagPointer == '8')
hexCode += 8;
else if(*tagPointer == '9')
hexCode += 9;
else if(*tagPointer == 'a')
hexCode += 10;
else if(*tagPointer == 'b')
hexCode += 11;
else if(*tagPointer == 'c')
hexCode += 12;
else if(*tagPointer == 'd')
hexCode += 13;
else if(*tagPointer == 'e')
hexCode += 14;
else if(*tagPointer == 'f')
hexCode += 15;
*code = hexCode;
}
else if(applicationBtxCeptTriggerTag(tagPointer,"<sp>\0") == 0)
*code = ' ';
else if(applicationBtxCeptTriggerTag(tagPointer,"<apb>\0") == 0)
*code = CEPT_APB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<apf>\0") == 0)
*code = CEPT_APF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<apd>\0") == 0)
*code = CEPT_APD;
else if(applicationBtxCeptTriggerTag(tagPointer,"<apu>\0") == 0)
*code = CEPT_APU;
else if(applicationBtxCeptTriggerTag(tagPointer,"<cs>\0") == 0)
*code = CEPT_CS;
else if(applicationBtxCeptTriggerTag(tagPointer,"<apr>\0") == 0)
*code = CEPT_APR;
else if(applicationBtxCeptTriggerTag(tagPointer,"<si>\0") == 0)
*code = CEPT_SI;
else if(applicationBtxCeptTriggerTag(tagPointer,"<so>\0") == 0)
*code = CEPT_SO;
else if(applicationBtxCeptTriggerTag(tagPointer,"<con>\0") == 0)
*code = CEPT_CON;
else if(applicationBtxCeptTriggerTag(tagPointer,"<rpt>\0") == 0)
*code = CEPT_RPT;
else if(applicationBtxCeptTriggerTag(tagPointer,"<cof>\0") == 0)
*code = CEPT_COF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<can>\0") == 0)
*code = CEPT_CAN;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ss2>\0") == 0)
*code = CEPT_SS2;
else if(applicationBtxCeptTriggerTag(tagPointer,"<esc>\0") == 0)
*code = CEPT_ESC;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ss3>\0") == 0)
*code = CEPT_SS3;
else if(applicationBtxCeptTriggerTag(tagPointer,"<aph>\0") == 0)
*code = CEPT_APH;
else if(applicationBtxCeptTriggerTag(tagPointer,"<us>\0") == 0)
*code = CEPT_US;
else if(applicationBtxCeptTriggerTag(tagPointer,"<nul>\0") == 0)
*code = CEPT_NUL;
else if(applicationBtxCeptTriggerTag(tagPointer,"<soh>\0") == 0)
*code = CEPT_SOH;
else if(applicationBtxCeptTriggerTag(tagPointer,"<stx>\0") == 0)
*code = CEPT_STX;
else if(applicationBtxCeptTriggerTag(tagPointer,"<etx>\0") == 0)
*code = CEPT_ETX;
else if(applicationBtxCeptTriggerTag(tagPointer,"<eot>\0") == 0)
*code = CEPT_EOT;
else if(applicationBtxCeptTriggerTag(tagPointer,"<enq>\0") == 0)
*code = CEPT_ENQ;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ack>\0") == 0)
*code = CEPT_ACK;
else if(applicationBtxCeptTriggerTag(tagPointer,"<itb>\0") == 0)
*code = CEPT_ITB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<dle>\0") == 0)
*code = CEPT_DLE;
else if(applicationBtxCeptTriggerTag(tagPointer,"<nak>\0") == 0)
*code = CEPT_NAK;
else if(applicationBtxCeptTriggerTag(tagPointer,"<syn>\0") == 0)
*code = CEPT_SYN;
else if(applicationBtxCeptTriggerTag(tagPointer,"<etb>\0") == 0)
*code = CEPT_ETB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ini>\0") == 0)
*code = CEPT_INI;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ter>\0") == 0)
*code = CEPT_TER;
else if(applicationBtxCeptTriggerTag(tagPointer,"<dct>\0") == 0)
*code = CEPT_DCT;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fsh>\0") == 0)
*code = CEPT_FSH;
else if(applicationBtxCeptTriggerTag(tagPointer,"<std>\0") == 0)
*code = CEPT_STD;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ebx>\0") == 0)
*code = CEPT_EBX;
else if(applicationBtxCeptTriggerTag(tagPointer,"<sbx>\0") == 0)
*code = CEPT_SBX;
else if(applicationBtxCeptTriggerTag(tagPointer,"<nsz>\0") == 0)
*code = CEPT_NSZ;
else if(applicationBtxCeptTriggerTag(tagPointer,"<dbh>\0") == 0)
*code = CEPT_DBH;
else if(applicationBtxCeptTriggerTag(tagPointer,"<dbw>\0") == 0)
*code = CEPT_DBW;
else if(applicationBtxCeptTriggerTag(tagPointer,"<dbs>\0") == 0)
*code = CEPT_DBS;
else if(applicationBtxCeptTriggerTag(tagPointer,"<cdy>\0") == 0)
*code = CEPT_CDY;
else if(applicationBtxCeptTriggerTag(tagPointer,"<spl>\0") == 0)
*code = CEPT_SPL;
else if(applicationBtxCeptTriggerTag(tagPointer,"<stl>\0") == 0)
*code = CEPT_STL;
else if(applicationBtxCeptTriggerTag(tagPointer,"<csi>\0") == 0)
*code = CEPT_CSI;
else if(applicationBtxCeptTriggerTag(tagPointer,"<abk>\0") == 0)
*code = CEPT_ABK;
else if(applicationBtxCeptTriggerTag(tagPointer,"<anr>\0") == 0)
*code = CEPT_ANR;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ang>\0") == 0)
*code = CEPT_ANG;
else if(applicationBtxCeptTriggerTag(tagPointer,"<any>\0") == 0)
*code = CEPT_ANY;
else if(applicationBtxCeptTriggerTag(tagPointer,"<anb>\0") == 0)
*code = CEPT_ANB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<anm>\0") == 0)
*code = CEPT_ANM;
else if(applicationBtxCeptTriggerTag(tagPointer,"<anc>\0") == 0)
*code = CEPT_ANC;
else if(applicationBtxCeptTriggerTag(tagPointer,"<anw>\0") == 0)
*code = CEPT_ANW;
else if(applicationBtxCeptTriggerTag(tagPointer,"<mbk>\0") == 0)
*code = CEPT_MBK;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msr>\0") == 0)
*code = CEPT_MSR;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msg>\0") == 0)
*code = CEPT_MSG;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msy>\0") == 0)
*code = CEPT_MSY;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msb>\0") == 0)
*code = CEPT_MSB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msm>\0") == 0)
*code = CEPT_MSM;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msc>\0") == 0)
*code = CEPT_MSC;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msw>\0") == 0)
*code = CEPT_MSW;
else if(applicationBtxCeptTriggerTag(tagPointer,"<bbd>\0") == 0)
*code = CEPT_BBD;
else if(applicationBtxCeptTriggerTag(tagPointer,"<nbd>\0") == 0)
*code = CEPT_NBD;
else if(applicationBtxCeptTriggerTag(tagPointer,"<hms>\0") == 0)
*code = CEPT_HMS;
else if(applicationBtxCeptTriggerTag(tagPointer,"<rms>\0") == 0)
*code = CEPT_RMS;
else if(applicationBtxCeptTriggerTag(tagPointer,"<bkf>\0") == 0)
*code = CEPT_BKF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<rdf>\0") == 0)
*code = CEPT_RDF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<grf>\0") == 0)
*code = CEPT_GRF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ylf>\0") == 0)
*code = CEPT_YLF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<blf>\0") == 0)
*code = CEPT_BLF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<mgf>\0") == 0)
*code = CEPT_MGF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<cnf>\0") == 0)
*code = CEPT_CNF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<whf>\0") == 0)
*code = CEPT_WHF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<bkb>\0") == 0)
*code = CEPT_BKB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<rdb>\0") == 0)
*code = CEPT_RDB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<grb>\0") == 0)
*code = CEPT_GRB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ylb>\0") == 0)
*code = CEPT_YLB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<blb>\0") == 0)
*code = CEPT_BLB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<mgb>\0") == 0)
*code = CEPT_MGB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<cnb>\0") == 0)
*code = CEPT_CNB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<whb>\0") == 0)
*code = CEPT_WHB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<npo>\0") == 0)
*code = CEPT_NPO;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ipo>\0") == 0)
*code = CEPT_IPO;
else if(applicationBtxCeptTriggerTag(tagPointer,"<trb>\0") == 0)
*code = CEPT_TRB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<stc>\0") == 0)
*code = CEPT_STC;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fbkb>\0") == 0)
*code = CEPT_FBKB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<frdb>\0") == 0)
*code = CEPT_FRDB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fgrb>\0") == 0)
*code = CEPT_FGRB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fylb>\0") == 0)
*code = CEPT_FYLB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fblb>\0") == 0)
*code = CEPT_FBLB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fmgb>\0") == 0)
*code = CEPT_FMGB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fcnb>\0") == 0)
*code = CEPT_FCNB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fwhb>\0") == 0)
*code = CEPT_FWHB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ftrb>\0") == 0)
*code = CEPT_FTRB;
else
{
*size = 1;
*code = *data;
return -1; /* Invalid tag! */
}
return 0;
}
else
{
*size = 1;
*code = *data;
return -1; /* Invalid tag! */
}
}
/* Strip everthing that is encapsulated by <!-- --> */
static int applicationBtxCeptStripComments(char *data)
{
int ignoreData = 0;
char *dataPointer = data;
char *dataAheadPointer = data;
while(*dataAheadPointer != '\0')
{
if(applicationBtxCeptTriggerTag(dataAheadPointer, "<!--\0") == 0)
ignoreData = 1;
if(applicationBtxCeptTriggerTag(dataAheadPointer, "-->\0") == 0)
{
ignoreData = 0;
dataAheadPointer += 3;
}
*dataPointer = *dataAheadPointer;
if(ignoreData == 0)
dataPointer++;
dataAheadPointer++;
}
*dataPointer = '\0';
return 0;
}
/* Chech if the character is non pintable. Return 0 when printable and -1 when non printable */
static int applicationBtxCeptCheckPrintable(char *data)
{
if(*data == ' ') /* In our case a space is a non printable char (We have <sp> for that) */
return -1;
else if ((*data >= 0x20)&&(*data <= 0x7E)) /* Printable char */
return 0;
else if(*data == '\0') /* Do not destroy \0 terminator */
return 0;
else /* All other chars are threated as non printable */
return -1;
}
/* Strip non printable characters */
static int applicationBtxCeptStripNonPrintable(char *data)
{
char *dataPointer = data;
char *dataAheadPointer = data;
while(*dataAheadPointer != '\0')
{
if(applicationBtxCeptCheckPrintable(dataAheadPointer) == -1)
dataAheadPointer++;
else
{
*dataPointer = *dataAheadPointer;
dataPointer++;
dataAheadPointer++;
}
}
*dataPointer = '\0';
return 0;
}
/* Extract content and name from a meta tag string */
static int applicationBtxParseMetaTag(char *data, char *name, char *content)
{
char *dataPointer = data;
char *namePointer = name;
char *contentPointer = content;
int copyControl = 0;
int nameSizeCount = 0; /* Size counter to prevent buffer overflow */
int contentSizeCount = 0;
while(*dataPointer != '>')
{
if(*dataPointer == '\0')
return -1; /* Something has gone completely wrong */
if(*dataPointer == '\"') /* Switch off copy control when delimeter character passes by */
copyControl = 0;
if(copyControl == 1)
{
if(nameSizeCount < (BTX_CEPT_META_TAG_NAME_BUFFERSIZE -1))
{
*namePointer = *dataPointer;
namePointer++;
nameSizeCount++;
}
else
return -1;
}
else if(copyControl == 2)
{
if(contentSizeCount < (BTX_CEPT_META_TAG_CONTENT_BUFFERSIZE -1))
{
*contentPointer = *dataPointer;
contentPointer++;
contentSizeCount++;
}
else
return -1;
}
else
{
if((applicationBtxCeptTriggerTag(dataPointer,"name=\"\0") == 0))
{
dataPointer += 5;
copyControl = 1;
}
else if((applicationBtxCeptTriggerTag(dataPointer,"content=\"\0") == 0))
{
dataPointer += 8;
copyControl = 2;
}
}
dataPointer++;
}
*namePointer = '\0';
*contentPointer = '\0';
if(copyControl != 0) /* If copy control flag is not zero something gone wrong ! */
return -1;
else
return 0;
}
/* Parse the raw data that was received via http to a btx-cept-page */
int applicationBtxCeptParse(char *dataIn, btxCeptPageData *page)
{
char *dataInPointer = dataIn;
char *dataOutPointer = page->ceptPage;
int tagSize;
char binaryCode;
int parserMode = 0; /* Parser control flags */
int parserActive = 0;
int tagHistory = 0;
page->ceptPageLength = 0; /* Initalize data in the page structure */
page->metaTagCount = 0;
applicationBtxCeptStripComments(dataInPointer); /* strip comments */
applicationBtxCeptStripNonPrintable(dataInPointer); /* strip non printable chars (and whitespaces) */
while(*dataInPointer != '\0')
{
/* Handle parser control */
if((applicationBtxCeptTriggerTag(dataInPointer,"<cept>\0") == 0))
{
if(tagHistory == 0)
{
tagHistory = 1;
parserActive = 1;
}
else
return -1;
}
if((applicationBtxCeptTriggerTag(dataInPointer,"<head>\0") == 0))
{
if(tagHistory == 1)
{
tagHistory = 2;
parserMode = HEAD_PARSER_MODE;
}
else
return -1;
}
if((applicationBtxCeptTriggerTag(dataInPointer,"</head>\0") == 0))
{
if(tagHistory == 2)
{
tagHistory = 3;
parserMode = 0;
}
else
return -1;
}
if((applicationBtxCeptTriggerTag(dataInPointer,"<body>\0") == 0))
{
if(tagHistory == 3)
{
tagHistory = 4;
parserMode = HYPERTEXT_PARSER_MODE;
dataInPointer += 6; /* Override the body tag */
}
else
return -1;
}
if((applicationBtxCeptTriggerTag(dataInPointer,"</body>\0") == 0))
{
if(tagHistory == 4)
{
tagHistory = 5;
parserMode = 0;
}
else
return -1;
}
if((applicationBtxCeptTriggerTag(dataInPointer,"</cept>\0") == 0))
{
if(tagHistory == 5)
{
tagHistory = 6;
parserActive = 0;
}
else
return -1;
}
/* Head parser mode */
if((parserMode == HEAD_PARSER_MODE)&&(parserActive == 1))
{
if((applicationBtxCeptTriggerTag(dataInPointer,"<meta\0") == 0))
{
if(page->metaTagCount<BTX_CEPT_META_TAG_MAXCOUNT)
{
if(applicationBtxParseMetaTag(dataInPointer,page->metaName[page->metaTagCount],page->metaContent[page->metaTagCount]) == -1)
return -1;
page->metaTagCount++;
}
else
return -1;
}
dataInPointer++;
}
/* Hypertect parser mode */
else if((parserMode == HYPERTEXT_PARSER_MODE)&&(parserActive == 1))
{
if(page->ceptPageLength < BTX_CEPT_BINARY_BUFFERSIZE)
{
applicationBtxCeptTranslateTag(dataInPointer,&binaryCode,&tagSize); /* Translate hypertext to binary */
dataInPointer += tagSize;
*dataOutPointer = binaryCode;
dataOutPointer++;
page->ceptPageLength++;
}
else
return 0;
}
/* Parser off */
else
dataInPointer++;
}
*dataOutPointer = '\0';
/* Do final check, every flack must be set! */
if((tagHistory == 6)&&(parserActive == 0)&&(parserMode == 0))
return 0;
else
return -1;
}
/* #################################################################################### */

283
pc-software/pageload/cept.h Normal file
View File

@ -0,0 +1,283 @@
/*
####################################################################################
# #
# Bildschirmtricks MikroPAD V2.0.0 #
# cept parser layer #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#ifndef CEPT_H
#define CEPT_H
/* ==Control codes==
The the CEPT protocol includes a wide range of special control codes, here is a
hopefully complete list of all available control codes. A detailed explaination
of nearly all control codes can be found in ETS_300_072 (downloadable from etsi.org) */
/* C0 Control characters (printf-friendly) */
#define F_CEPT_APB "\x08" /* Active Position Back */
#define F_CEPT_APF "\x09" /* Active Position Forward */
#define F_CEPT_APD "\x0A" /* Active Position Down */
#define F_CEPT_APU "\x0B" /* Active Position Up */
#define F_CEPT_CS "\x0C" /* Clear Screen */
#define F_CEPT_APR "\x0D" /* Active Position Return */
#define F_CEPT_SI "\x0E" /* Shift In */
#define F_CEPT_SO "\x0F" /* Shift Out */
#define F_CEPT_CON "\x11" /* Cursor ON */
#define F_CEPT_RPT "\x12" /* Repeat Character */
#define F_CEPT_COF "\x14" /* Cursor OFf */
#define F_CEPT_CAN "\x18" /* CANcel (fills the rest off the line with spaces) */
#define F_CEPT_SS2 "\x19" /* Single Shift 2 (G2 set, Some legents say that this is the magic "YES" character) */
#define F_CEPT_ESC "\x1B" /* ESCape */
#define F_CEPT_SS3 "\x1D" /* Single Shift 3 (G3 set) */
#define F_CEPT_APH "\x1E" /* Active Position Home */
#define F_CEPT_US "\x1F" /* Unit Seperator (also known as APA) */
/* C0 Control characters (single byte constants) */
#define CEPT_APB 0x08 /* Active Position Back */
#define CEPT_APF 0x09 /* Active Position Forward */
#define CEPT_APD 0x0A /* Active Position Down */
#define CEPT_APU 0x0B /* Active Position Up */
#define CEPT_CS 0x0C /* Clear Screen */
#define CEPT_APR 0x0D /* Active Position Return */
#define CEPT_SI 0x0E /* Shift In */
#define CEPT_SO 0x0F /* Shift Out */
#define CEPT_CON 0x11 /* Cursor ON */
#define CEPT_RPT 0x12 /* Repeat Last Character */
#define CEPT_COF 0x14 /* Cursor OFf */
#define CEPT_CAN 0x18 /* CANcel (fills the rest off the line with spaces) */
#define CEPT_SS2 0x19 /* Single Shift 2 (G2 set, Some legents say that this is the magic "YES" character) */
#define CEPT_ESC 0x1B /* ESCape */
#define CEPT_SS3 0x1D /* Single Shift 3 (G3 set) */
#define CEPT_APH 0x1E /* Active Position Home */
#define CEPT_US 0x1F /* Unit Seperator (also known as APA) */
/* C0 Data link control tokens (printf-friendly) */
#define F_CEPT_NUL "\x00" /* NULl */
#define F_CEPT_SOH "\x01" /* Start Of Heading */
#define F_CEPT_STX "\x02" /* Start TeXt */
#define F_CEPT_ETX "\x03" /* End TeXt */
#define F_CEPT_EOT "\x04" /* End Of Transmission */
#define F_CEPT_ENQ "\x05" /* ENQuiry */
#define F_CEPT_ACK "\x06" /* ACKnowledge */
#define F_CEPT_ITB "\x07" /* end InTermediate Block */
#define F_CEPT_DLE "\x10" /* Data Link Escape */
#define F_CEPT_NAK "\x15" /* Negative AcKnowledge */
#define F_CEPT_SYN "\x16" /* SYNcronize */
#define F_CEPT_ETB "\x17" /* End TeXtblock */
/* C0 Data link control tokens (single byte constants) */
#define CEPT_NUL 0x00 /* NULl */
#define CEPT_SOH 0x01 /* Start Of Heading */
#define CEPT_STX 0x02 /* Start TeXt */
#define CEPT_ETX 0x03 /* End TeXt */
#define CEPT_EOT 0x04 /* End Of Transmission */
#define CEPT_ENQ 0x05 /* ENQuiry */
#define CEPT_ACK 0x06 /* ACKnowledge */
#define CEPT_ITB 0x07 /* end InTermediate Block */
#define CEPT_DLE 0x10 /* Data Link Escape */
#define CEPT_NAK 0x15 /* Negative AcKnowledge */
#define CEPT_SYN 0x16 /* SYNcronize */
#define CEPT_ETB 0x17 /* End TeXtblock */
/* NOTE: The Data link control tokens are not mentiond in ETS_300_072 */
/* C0 Propritay-BTX tokens (printf-friendly) */
#define F_CEPT_INI "\x13" /* Initiator (*) */
#define F_CEPT_TER "\x1C" /* Terminator (#) */
#define F_CEPT_DCT "\x1A" /* propritary btx (makes the terminal talking) */
/* C0 Propritay-BTX tokens (single byte constants) */
#define CEPT_INI 0x13 /* Initiator (*) */
#define CEPT_TER 0x1C /* Terminator (#) */
#define CEPT_DCT 0x1A /* propritary btx (makes the terminal talking) */
/* C1S/C1P control functions set (printf-friendly) */
#define F_CEPT_FSH "\x88" /* FlaSH */
#define F_CEPT_STD "\x89" /* STeaDy */
#define F_CEPT_EBX "\x8A" /* End BoX */
#define F_CEPT_SBX "\x8B" /* Start BoX */
#define F_CEPT_NSZ "\x8C" /* Normal-SiZe */
#define F_CEPT_DBH "\x8D" /* DouBle-Height */
#define F_CEPT_DBW "\x8E" /* DouBle-Width */
#define F_CEPT_DBS "\x8F" /* DouBle-Size */
#define F_CEPT_CDY "\x98" /* Conceal DisplaY */
#define F_CEPT_SPL "\x99" /* StoP Lining */
#define F_CEPT_STL "\x9A" /* StarT Lining */
#define F_CEPT_CSI "\x9B" /* Control Sequence Introducer */
/* C1S/C1P control functions set (single byte constants) */
#define CEPT_FSH 0x88 /* FlaSH */
#define CEPT_STD 0x89 /* STeaDy */
#define CEPT_EBX 0x8A /* End BoX */
#define CEPT_SBX 0x8B /* Start BoX */
#define CEPT_NSZ 0x8C /* Normal-SiZe */
#define CEPT_DBH 0x8D /* DouBle-Height */
#define CEPT_DBW 0x8E /* DouBle-Width */
#define CEPT_DBS 0x8F /* DouBle-Size */
#define CEPT_CDY 0x98 /* Conceal DisplaY */
#define CEPT_SPL 0x99 /* StoP Lining */
#define CEPT_STL 0x9A /* StarT Lining */
#define CEPT_CSI 0x9B /* Control Sequence Introducer */
/* C1S control functions set (printf-friendly) */
#define F_CEPT_ABK "\x80" /* Alpha BlacK */
#define F_CEPT_ANR "\x81" /* Alpha Red */
#define F_CEPT_ANG "\x82" /* Alpha Green */
#define F_CEPT_ANY "\x83" /* Alpha Yellow */
#define F_CEPT_ANB "\x84" /* Alpha Blue */
#define F_CEPT_ANM "\x85" /* Alpha Mageta */
#define F_CEPT_ANC "\x86" /* Alpha Cyan */
#define F_CEPT_ANW "\x87" /* Alpha White */
#define F_CEPT_MBK "\x90" /* Mosaic BlacK */
#define F_CEPT_MSR "\x91" /* MoSaic Red */
#define F_CEPT_MSG "\x92" /* MoSaic Green */
#define F_CEPT_MSY "\x93" /* MoSaic Yellow */
#define F_CEPT_MSB "\x94" /* MoSaic Blue */
#define F_CEPT_MSM "\x95" /* MoSaic Magenta */
#define F_CEPT_MSC "\x96" /* MoSaic Cyan */
#define F_CEPT_MSW "\x97" /* MoSaic White */
#define F_CEPT_BBD "\x9c" /* Black BackgrounD */
#define F_CEPT_NBD "\x9d" /* New BackgrounD */
#define F_CEPT_HMS "\x9e" /* Hold MoSaic */
#define F_CEPT_RMS "\x9f" /* Release MoSaic */
/* C1S control functions set (single byte constants) */
#define CEPT_ABK 0x80 /* Alpha BlacK */
#define CEPT_ANR 0x81 /* Alpha Red */
#define CEPT_ANG 0x82 /* Alpha Green */
#define CEPT_ANY 0x83 /* Alpha Yellow */
#define CEPT_ANB 0x84 /* Alpha Blue */
#define CEPT_ANM 0x85 /* Alpha Mageta */
#define CEPT_ANC 0x86 /* Alpha Cyan */
#define CEPT_ANW 0x87 /* Alpha White */
#define CEPT_MBK 0x90 /* Mosaic BlacK */
#define CEPT_MSR 0x91 /* MoSaic Red */
#define CEPT_MSG 0x92 /* MoSaic Green */
#define CEPT_MSY 0x93 /* MoSaic Yellow */
#define CEPT_MSB 0x94 /* MoSaic Blue */
#define CEPT_MSM 0x95 /* MoSaic Magenta */
#define CEPT_MSC 0x96 /* MoSaic Cyan */
#define CEPT_MSW 0x97 /* MoSaic White */
#define CEPT_BBD 0x9c /* Black BackgrounD */
#define CEPT_NBD 0x9d /* New BackgrounD */
#define CEPT_HMS 0x9e /* Hold MoSaic */
#define CEPT_RMS 0x9f /* Release MoSaic */
/* C1P control functions set (printf-friendly) */
#define F_CEPT_BKF "\x80" /* BlacK Foreground */
#define F_CEPT_RDF "\x81" /* ReD Foreground */
#define F_CEPT_GRF "\x82" /* GReen Foreground */
#define F_CEPT_YLF "\x83" /* YeLlow Foreground */
#define F_CEPT_BLF "\x84" /* BLue Foreground */
#define F_CEPT_MGF "\x85" /* MaGenta Foreground */
#define F_CEPT_CNF "\x86" /* CyaN Foreground */
#define F_CEPT_WHF "\x87" /* WHite Foreground */
#define F_CEPT_BKB "\x90" /* BlacK Background */
#define F_CEPT_RDB "\x91" /* ReD Background */
#define F_CEPT_GRB "\x92" /* GReen Background */
#define F_CEPT_YLB "\x93" /* YeLlow Background */
#define F_CEPT_BLB "\x94" /* BLue Background */
#define F_CEPT_MGB "\x95" /* MaGenta Background */
#define F_CEPT_CNB "\x96" /* CyaN Background */
#define F_CEPT_WHB "\x97" /* WHite Background */
#define F_CEPT_NPO "\x9c" /* Normal POlarity */
#define F_CEPT_IPO "\x9d" /* Inverted POlarity */
#define F_CEPT_TRB "\x9e" /* TranspaRent Background */
#define F_CEPT_STC "\x9f" /* STop Conceal */
/* C1P control functions set (single byte constants) */
#define CEPT_BKF 0x80 /* BlacK Foreground */
#define CEPT_RDF 0x81 /* ReD Foreground */
#define CEPT_GRF 0x82 /* GReen Foreground */
#define CEPT_YLF 0x83 /* YeLlow Foreground */
#define CEPT_BLF 0x84 /* BLue Foreground */
#define CEPT_MGF 0x85 /* MaGenta Foreground */
#define CEPT_CNF 0x86 /* CyaN Foreground */
#define CEPT_WHF 0x87 /* WHite Foreground */
#define CEPT_BKB 0x90 /* BlacK Background */
#define CEPT_RDB 0x91 /* ReD Background */
#define CEPT_GRB 0x92 /* GReen Background */
#define CEPT_YLB 0x93 /* YeLlow Background */
#define CEPT_BLB 0x94 /* BLue Background */
#define CEPT_MGB 0x95 /* MaGenta Background */
#define CEPT_CNB 0x96 /* CyaN Background */
#define CEPT_WHB 0x97 /* WHite Background */
#define CEPT_NPO 0x9c /* Normal POlarity */
#define CEPT_IPO 0x9d /* Inverted POlarity */
#define CEPT_TRB 0x9e /* TranspaRent Background */
#define CEPT_STC 0x9f /* STop Conceal */
/* FE Full Screen atributes (single byte constants) */
#define CEPT_FBKB 0x50 /* BlacK Background */
#define CEPT_FRDB 0x51 /* ReD Background */
#define CEPT_FGRB 0x52 /* GReen Background */
#define CEPT_FYLB 0x53 /* YeLlow Background */
#define CEPT_FBLB 0x54 /* BLue Background */
#define CEPT_FMGB 0x55 /* MaGenta Background */
#define CEPT_FCNB 0x56 /* CyaN Background */
#define CEPT_FWHB 0x57 /* WHite Background */
#define CEPT_FTRB 0x5E /* TRansparent Background */
/* FE Full Screen atributes (printf-friendly) */
#define F_CEPT_FBKB "\x50" /* BlacK Background */
#define F_CEPT_FRDB "\x51" /* ReD Background */
#define F_CEPT_FGRB "\x52" /* GReen Background */
#define F_CEPT_FYLB "\x53" /* YeLlow Background */
#define F_CEPT_FBLB "\x54" /* BLue Background */
#define F_CEPT_FMGB "\x55" /* MaGenta Background */
#define F_CEPT_FCNB "\x56" /* CyaN Background */
#define F_CEPT_FWHB "\x57" /* WHite Background */
#define F_CEPT_FTRB "\x5E" /* TRansparent Background */
#define CEPT_ECHOPLEX_GUARDTIME 200 /* Echoplex guardtime, time between receiving and echoing */
/* Data structure of a btx-cept-page */
typedef struct
{
/* Contains the cept page in its binary form */
char ceptPage[BTX_CEPT_BINARY_BUFFERSIZE];
/* Contains the length of the cept page */
int ceptPageLength;
/* Contains the meta tag name */
char metaName[BTX_CEPT_META_TAG_MAXCOUNT][BTX_CEPT_META_TAG_NAME_BUFFERSIZE];
/* Contains the corospondenting meta content */
char metaContent[BTX_CEPT_META_TAG_MAXCOUNT][BTX_CEPT_META_TAG_CONTENT_BUFFERSIZE];
/* Contains the number of meta tags that are issued to the page */
int metaTagCount;
}btxCeptPageData;
/* Parse the raw data that was received via http to a btx-cept-page */
int applicationBtxCeptParse(char *dataIn, btxCeptPageData *page);
#endif /*CEPT_H*/
/* #################################################################################### */

View File

@ -0,0 +1,65 @@
/*
####################################################################################
# #
# Bildschirmtricks MikroPAD V2.0.0 #
# mikroPAD configuration #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#ifndef CONFIG_H
#define CONFIG_H
/* ATTENTION! You must do a "make clean" and then "make" to make the changes take effect! */
/* General configuration */
#define DEBUGPORT 0 /* Debug port configuration (0=Disabled, 1=Enabled) */
#define VERSIONSTRING "V 0.0.1" /* Version string */
#define DISPLAYPAGE_RETRYS 3 /* Configures how often the system retrys to display a page */
#define PAGE_HISTORY_SIZE 23 /* Configures how many entered pageIds the integrated history can store */
/* Ulm configuration */
#define BTX_ULM_INITIAL_PAGE "*index#" /* Set the initial page (Wellcomescreen) */
#define BTX_ULM_HOST "btx.runningserver.com" /* Configure where Ulm is */
#define BTX_ULM_PORT 80 /* Configure on which port of Ulm the http-server is running */
#define BTX_ULM_STYLE 1 /* Configure ulm style: 1=Static, 2=Dynamic (see readme file) */
#define BTX_ULM_PAGE_FILE_SUFFIX "btx" /* File type prefix that will be used for http access */
#define BTX_ULM_PAGE_ID_MAXLENGTH 32 /* The length of the page id (see readme file) */
#define BTX_ULM_HYPERLINK_ID_MAXLENGTH 2 /* The lenght of an hyperlink id (recomanded value is 2) */
#define BTX_ULM_PAGE_BASENAME "page" /* When style 2 is selected, this is the name of the page that generates the contnet */
#define BTX_ULM_PAGE_REQUESTVAR "id" /* When style 2 is selected, this is the name of the variable that contains the request */
#define BTX_ULM_IP_RESOLVE_RETRYS 3 /* Configures how often the system retrys to resolve the ulm ip */
/* Internal messages */
#define BTX_MESSAGE_HTTPERROR "SEITE NICHT VERFUEGBAR" /* Message that is displayed if an http-error anounces */
#define BTX_MESSAGE_CONNECTIONERROR "ZENTRALE NICHT ERREICHBAR" /* Message that is displayed when there is a problem with the ulm connection */
#define BTX_MESSAGE_PARSEERROR "SEITE BESCHAEDIGT" /* Message that is displayed when parse errors anounces */
/* Cept parser configuration: */
#define BTX_CEPT_HYPERTEXT_BUFFERSIZE 10000 /* Maximal size of a hypertext cept-page the PAD can process */
#define BTX_CEPT_BINARY_BUFFERSIZE 10000 /* Maximal size of a binary cept-page the PAD can process */
#define BTX_CEPT_TAG_MAXSIZE 32 /* Maximal size of a single tag */
#define BTX_CEPT_META_TAG_MAXCOUNT 8 /* Maximal number of meta tags that can be stored in one page structure */
#define BTX_CEPT_META_TAG_NAME_BUFFERSIZE 32+1 /* Maximal size of a meta tag name (+1 for \0) */
#define BTX_CEPT_META_TAG_CONTENT_BUFFERSIZE 128+1 /* Maximal size of a meta tag content (+1 for \0) */
#define BTX_CEPT_META_TAG_HYPERLINKLIST_BUFFER 256 /* Hyperlinklist buffer size */
#endif /*CONFIG_H*/
/* #################################################################################### */

View File

@ -0,0 +1,63 @@
<!-- This is a system page of the fictional online service 'Bildschirmtrix' -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="load_page" content="*fernbl2#">
<meta name="load_timeout" content="5">
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<aph> <!-- Set cursor to home position -->
Bildschirmtrix<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table (to get a real white) -->
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<apd>
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<trb><blf> <!-- Select Transparent background with blue foreground -->
<csi><0x31><0x40> <!-- Invoke 2nd color table -->
<dbs><apr>Neue<sp>Mitteilungen<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<nsz> <!-- Select normal size font -->
<apd><apr>
Von<sp><sp>Chaos<sp>Team<sp>Hamburg<apd><apr>
An<sp>die<sp>Bundesdatenschutzbeauftragten<apd><apr>
<apd><apr>
<apd><apr>
Liebe<sp>Datensch<ss2>Hutzer,<apd><apr>
wir<sp>werden<sp>Sie<sp>mit<sp>diesem<sp>Schreiben<apd><apr>
fernbeleidigen<sp>Wir<sp>bitten<sp>Sie<sp>uns<apd><apr>
1<sp>St<ss2>Huck<sp>ihres<sp>letzten<sp>T<ss2>Hatigkeitsberichts<!-- apd apr -->
zuzusenden<sp>
<apd><apr>
<apd><apr>
Mit<sp>freundlichen<sp>Gr<ss2>Hussen<apd><apr>
Chaos<sp>Team<sp>Hamburg<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
Zur<ss2>Huck<sp>mit<sp>#<apd><apr>
Eingabe<sp>==><sp>
</body>
</cept>

View File

@ -0,0 +1,62 @@
<!-- This is a system page of the fictional online service 'Bildschirmtrix' -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="next_page" content="*welcome#"> <!-- Define the page that is loaded when '#' is pressed -->
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<aph> <!-- Set cursor to home position -->
Bildschirmtrix<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table (to get a real white) -->
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<apd>
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<trb><blf> <!-- Select Transparent background with blue foreground -->
<csi><0x31><0x40> <!-- Invoke 2nd color table -->
<dbs><apr>Neue<sp>Mitteilungen<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<nsz> <!-- Select normal size font -->
<apd><apr>
Von<sp><sp>Chaos<sp>Team<sp>Hamburg<apd><apr>
An<sp>die<sp>Bundesdatenschutzbeauftragten<apd><apr>
<apd><apr>
<apd><apr>
Liebe<sp>Dateischeisser,<apd><apr>
wir<sp>werden<sp>Sie<sp>mit<sp>diesem<sp>Schreiben<apd><apr>
fernbeleidigen<sp>Wir<sp>bitten<sp>Sie<sp>uns<apd><apr>
1000<sp>St<ss2>Huck<sp>ihres<sp>letzten<apd><apr>
T<ss2>Hatigkeitsberichts<sp>zuzusenden<sp>
<apd><apr>
<apd><apr>
Mit<sp>freundlichen<sp>Gr<ss2>Hussen<apd><apr>
Chaos<sp>Team<sp>Hamburg<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
Zur<ss2>Huck<sp>mit<sp>#<apd><apr>
Eingabe<sp>==><sp>
</body>
</cept>

View File

@ -0,0 +1,68 @@
<!-- This ia an example page that illustrate how a CEPT TCD 6-1
looks when it is formatted in the btxml hypertext language
Propose: How to use the different character sets -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="next_page" content="*0#"> <!-- Define the page that is loaded when '#' is pressed -->
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<aph> <!-- Set cursor to home position -->
Bildschirmtrix<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table (to get a real white) -->
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<apd>
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<trb><blf> <!-- Select Transparent background with blue foreground -->
<csi><0x31><0x40> <!-- Invoke 2nd color table -->
<dbs><apr>Hilfe<sp><sp><sp><sp><sp><sp><sp><sp>*hilfe#<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<nsz> <!-- Select normal size font -->
<!-- Text -->
<apd><apr>
<dbh>Die<sp>wichtigsten<sp>codes:<nsz><apd><apr>
<sp>#<sp><sp><sp><sp>=<sp>Weiter<sp><sp><sp><sp>*0#<sp><sp>=<sp><ss2>HUbersichtsseite<!-- apd apr -->
<sp>*#<sp><sp><sp>=<sp>Zur<ss2>Huck<sp><sp><sp><sp>*00#<sp>=<sp>Neu<sp>laden<apd><apr>
<apd><apr>
<dbh>Direktaufruf<sp>von<sp>Seiten:<nsz><apd><apr>
<sp>*seitenname#<sp>oder<sp>*seitennummer#<apd><apr>
<sp>z.B.:<sp>*wtf#<apd><apr>
<apd><apr>
<dbh>Aufruf<sp>von<sp>Verkn<ss2>Hupfungen:<nsz><apd><apr>
<sp>Einfach<sp>die<sp>entsprechende<sp>zweistellige<apd><apr>
<sp>Zahl<sp>eingeben<sp>(<ss2>HAhnlich<sp>Videotext)<apd><apr>
<apd><apr>
<dbh>Eingabe:<nsz><apd><apr>
<sp>Taste<sp><ss3>\<sp>korrigiert<sp>Eingabe<apd><apr>
<sp>Nicht<sp>zu<sp>schnell<sp>tippen!<apd><apr>
<sp>Ung<ss2>Hultige<sp>Eingaben<sp>werden<sp>ignoriert.<apd><apr>
<apd><apr>
<!-- Input prompt -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
#<sp>um<sp>naechste<sp>Testseite<sp>abzurufen<apd><apr>
Eingabe<sp>==><sp>
</body> <!-- Close page body segment -->
</cept> <!-- Close CEPT page -->

View File

@ -0,0 +1,51 @@
<!-- This is a system page of the fictional online service 'Bildschirmtrix' -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="load_page" content="*welcome#">
<meta name="load_timeout" content="2">
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<apd>
<apd><apr>
<!-- Logo -->
<esc><0x28><0x63> <!-- Invoke G1 set -->
<sp><sp><sp><sp><sp><sp><sp><sp>8######################)0<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp><sp>`x|__________}|p<sp><sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp>h____w######c____}<sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp>*___/'`~___t"/o__?<sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp><sp>"cx~_j_____j_|r#<sp><sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp><sp><sp>____j_____j___5<sp><sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp><sp><sp>____};///y____5<sp><sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp><sp><sp>______________5<sp><sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp>p000<sp>0`<sp><sp>0<sp>0<sp><sp><sp><sp>`<sp><sp>`<sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp>=14575mh$7547jkkj!7h"6<sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>"d#!!!#!#"!!!!!""""!!"""`&<apd><apr>
<sp><sp><sp><sp><sp><sp><sp><sp><sp>######################!<apd><apr>
<esc><0x28><0x40> <!-- Invoke G0 set -->
<apd>
________________________________________<apd><apr>
<sp><sp><sp>BTX-Nummer<sp><sp><sp><sp>:<sp><sp>23422342235<sp><sp>-<sp><sp>1<apd><apr>
<sp><sp><sp>pers.<sp>Kennwort:<sp><sp>usd7000011<apd><apr>
________________________________________<apd><apr>
<apd>
Bitte<sp>warten...
</body>
</cept>

221
pc-software/pageload/main.c Normal file
View File

@ -0,0 +1,221 @@
/*
####################################################################################
# #
# HeardbreakChip V1.0.0 #
# Main-Program #
# #
# Copyright (C) 2010 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
/* Header */
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <libcodebananas/ttybanana.h>
#include <libcodebananas/toolbanana.h>
#include <string.h>
#include <getopt.h>
#include <ctype.h>
#include <unistd.h>
#include <libgen.h>
#include "config.h"
#include "cept.h"
char programName[255];
/* Transmission parameters */
#define MINIBTX_HOOKOFF 0x01 /* Hookoff-token (Do not change) */
#define MINIBTX_CONNECT 0x00 /* Connect-token (Do not change) */
#define MINIBTX_BAUDRATE 1200 /* Baudrate, can not be changed */
/* #################################################################################### */
/* #################################################################################### */
void showUsage(void)
{
printf(" * Usage:\r\n");
printf(" %s -p [PORT] -b [BTX-PAGE] -f\r\n",programName);
printf(" -f = fakeinput\r\n");
printf("\r\n");
}
/* Main program: Perform some testpages */
int main(int argc, char *argv[])
{
int getoptOption;
char *getoptPort = 0;
char *getoptBtxPage = 0;
int getoptVerboseMode = 0;
int getoptFakeInput = 0;
char ceptHypertextBuffer[BTX_CEPT_HYPERTEXT_BUFFERSIZE];
char getchar;
int i;
btxCeptPageData btxCeptPage; /* Contains the page information of the last displayed page */
strcpy(programName,basename(argv[0]));
printf("_______________________________________________________________________________\n\r");
printf("Pageload for miniBTX V.1.0\n\r");
printf("Copyright(c) 2010 Philipp Fabian Benedikt Maier\n\r");
printf("\n\r");
/* Parse Options */
while ((getoptOption = getopt (argc, argv, ":h?p:b:vf")) != -1)
switch (getoptOption)
{
case 'h':
showUsage();
return 0;
case '?':
showUsage();
return 0;
case 'p':
getoptPort = optarg;
break;
case 'v':
getoptVerboseMode = 1;
break;
case 'f':
getoptFakeInput = 1;
break;
case 'b':
getoptBtxPage = optarg;
break;
}
/* Check whether there is a serial port specified */
if(getoptPort)
printf(" * Serial port is: %s\r\n", getoptPort);
else
{
printf(" * Error: You must specify a serial port!\r\n");
printf("\r\n");
exit(1);
}
/* Check whether there is a BTX-Page specified */
if(getoptBtxPage)
{
printf(" * Path to selected BTX-Page is: %s\r\n", getoptBtxPage);
/* Check whether the file is readable */
if(testFile(getoptBtxPage) != 0)
{
printf(" * Error: Can not read BTX-Page from file system - aborting!\r\n");
printf("\r\n");
exit(1);
}
}
else
{
printf(" * Error: You must specify a BTX-Page!\r\n");
printf("\r\n");
exit(1);
}
/* Load Hypertext file into buffer */
if(loadFile(ceptHypertextBuffer, sizeof(ceptHypertextBuffer), getoptBtxPage) != -1)
printf(" * Info: BTX-Hypertext loaded successfully...\r\n");
else
{
printf(" * Error: Could not load BTX-Hypertext page - aborting!\r\n");
printf("\r\n");
exit(1);
}
/* In verbose mode display hypertext page on the screen.. */
if(getoptVerboseMode)
{
printf(" * Info: The following BTX-Hypertext has been loaded:\r\n");
printf("%s\r\n",ceptHypertextBuffer);
}
/* Parse hypertext page */
if(applicationBtxCeptParse(ceptHypertextBuffer, &btxCeptPage) != 1)
printf(" * Info: BTX-Hypertext parsed successfully...\r\n");
else
{
printf(" * Error: Could not parse BTX-Hypertext page - aborting!\r\n");
printf("\r\n");
exit(1);
}
/* In verbose mode display additional information: hexdump, metatags ect.. */
if(getoptVerboseMode)
{
printf(" * Info: The page contains the following meta information (has no effect here)\r\n");
for(i=0; i<btxCeptPage.metaTagCount; i++)
printf(" %s = %s\r\n", btxCeptPage.metaName[i], btxCeptPage.metaContent[i]);
printf(" * Info: The following binary data (%i bytes) will be transmitted to therminal:\r\n", btxCeptPage.ceptPageLength);
hexBinAsciiDump(btxCeptPage.ceptPage, btxCeptPage.ceptPageLength);
}
printf(" * Opening serial port...\n\r");
ttyInitProf(getoptPort,MINIBTX_BAUDRATE,8,NONE); /* Initalize tty */
ttyClearBuffer(getoptPort); /* Clear buffer */
printf(" * Serial port is set to %s at %i Baud\n\r",getoptPort,MINIBTX_BAUDRATE);
printf(" * Transmitting page...\n\r");
ttyWriteLen(getoptPort, btxCeptPage.ceptPage, btxCeptPage.ceptPageLength);
if(getoptFakeInput)
{
printf(" * Input from terminal: ");
while(1)
{
fflush(stdout);
getchar = ttyGetchar(getoptPort);
if(getchar == CEPT_TER)
getchar = '#';
else if(getchar == CEPT_INI)
getchar = '*';
printf("%c",getchar);
ttyPutchar(getoptPort,getchar);
if(getchar == '#')
{
printf("\r\n * Terminator (#) caught, exiting...\n\r");
printf(" * Done!\n\r");
exit(0);
}
}
}
printf(" * Done!\n\r");
printf("\n\r");
return -1;
}
/* #################################################################################### */

Binary file not shown.

View File

@ -0,0 +1,3 @@
This is a small programm that loads a BTXML Hypertext page and transmits it
to the terminal through the miniBTX interface.

View File

@ -0,0 +1,75 @@
<!-- This ia an example page that illustrate how a CEPT TCD 6-1
looks when it is formatted in the btxml hypertext language
Propose: How to use the different character sets -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="next_page" content="*test2#"> <!-- Define the page that is loaded when '#' is pressed -->
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<aph> <!-- Set cursor to home position -->
Bildschirmtrix<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table (to get a real white) -->
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<apd>
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<trb><blf> <!-- Select Transparent background with blue foreground -->
<csi><0x31><0x40> <!-- Invoke 2nd color table -->
<dbs><apr>Testbild<sp><sp><sp><sp><sp><sp>*test#<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<nsz> <!-- Select normal size font -->
<!-- Test-Text -->
BTX<sp>Testbild<sp>nach<sp>CEPT<sp>T/CD<sp>6-1<apd><apd><apr>
<esc><0x28><0x40> <!-- Invoke G0 set (just activate, only for a better understanding) -->
<grb><bkf>G0-SET:<whf><trb> <!-- Green foreground with black background and back -->
<sp>!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~<apd><apr>
<apd><apr>
<esc><0x28><0x40> <!-- Invoke G0 set -->
<grb><bkf>G1-SET:<whf><trb> <!-- Green foreground with black background and back -->
<esc><0x28><0x63> <!-- Invoke G1 set -->
<sp>!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~<apd><apr>
<apd><apr>
<esc><0x28><0x40> <!-- Invoke G0 set -->
<grb><bkf>G2-SET:<whf><trb> <!-- Green foreground with black background and back -->
<esc><0x28><0x62> <!-- Invoke G2 set -->
<sp>!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~<apd><apr>
<apd><apr>
<esc><0x28><0x40> <!-- Invoke G0 set -->
<grb><bkf>G3-SET:<whf><trb> <!-- Green foreground with black background and back -->
<esc><0x28><0x64> <!-- Invoke G3 set -->
<sp>!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~<apd><apr>
<apd><apr>
<!-- Input prompt -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
#<sp>um<sp>naechste<sp>Testseite<sp>abzurufen<apd><apr>
Eingabe<sp>==><sp>
</body> <!-- Close page body segment -->
</cept> <!-- Close CEPT page -->

View File

@ -0,0 +1,61 @@
<!-- This is a system page of the fictional online service 'Bildschirmtrix' -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="next_page" content="*0#"> <!-- Define the page that is loaded when '#' is pressed -->
<meta name="hyperlinks" content="06*88#">
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<aph> <!-- Set cursor to home position -->
Bildschirmtrix<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table (to get a real white) -->
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<apd>
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<trb><blf> <!-- Select Transparent background with blue foreground -->
<csi><0x31><0x40> <!-- Invoke 2nd color table -->
<dbs><apr>Deutsche<sp>Chaospost<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<nsz> <!-- Select normal size font -->
<apd><apr>
<nsz>02.09.1983<sp><sp>23:23<apd><apr>
<apd><apr>
Guten<sp>Tag<apd><apr>
Frau<apd><apr>
Eris<apd><apr>
Discordia<apd><apr>
<apd><apr>
Mitteilungsempfang<sp><ss2>Hoffnen<sp>mit<sp>06<apd><apr>
<apd>
<apd>
<apd>
<apd>
<apd>
<apd><apr>
Sie<sp>benutzten<sp>Bildschirmtext<sp>zuletzt<apd><apr>
am<sp>31.12.2001<sp>bis<sp>23:59<apd><apr>
<apd><apr>
<apd><apr>
Weiter<sp>mit<sp>#<sp>oder<sp><sp><sp>*Seitennummer#<apd><apr>
Eingabe<sp>==><sp>
</body>
</cept>

13
pc-software/test/Makefile Normal file
View File

@ -0,0 +1,13 @@
all: cept.o main.o
gcc -Werror ./*.o -o miniBTX -lcodebananas
main.o: main.c
gcc -Werror -c main.c
cept.o: cept.c
gcc -Werror -c cept.c
clean:
rm ./*.o
rm ./miniBTX

175
pc-software/test/cept.c Normal file
View File

@ -0,0 +1,175 @@
/*
####################################################################################
# #
# Bildschirmtricks miniBTX V1.0.0 #
# a (poor) cept protocol implementation #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <ttybanana.h> /* TTY-Functions of libCodebananas */
#include <toolbanana.h> /* Tool-Functions of libCodebananas */
#include <unistd.h>
#include <string.h>
#include "cept.h" /* Include own header file */
/* #################################################################################### */
/* #################################################################################### */
/* Query CEPT terminal */
void systemCeptQuery(char *string, int length, char *response, char *port, int linkLayer)
{
int i;
int crc16 = 0;
memset(response, 0x00, sizeof(response));
printf("\n\r\n\rPerforming terminal query:\n\r");
if(length == 0)
printf("* Length of transmission data is null - omitting transmission pass ...\n\r");
else
{
if(linkLayer == CEPT_LINKLAYER)
printf("* Transmitting CEPT data block (linklayer secured) ...\n\r");
else
printf("* Transmitting CEPT data block ...\n\r");
if(linkLayer == CEPT_LINKLAYER)
{
printf("* Sending STX 0x%02x...\n\r", CEPT_STX);
ttyPutchar(port,CEPT_STX); /* Transmit STX-Token, form now on the transmission begins */
}
printf("* Sending Data...\n\r");
hexBinAsciiDump(string,length);
for(i=0;i<length;i++) /* Transmit data and calculate CRC */
{
ttyPutchar(port,string[i]);
crc16 = crcComputationCycle(string[i], 0xA001, crc16);
}
if(linkLayer == CEPT_LINKLAYER)
{
crc16 = crcComputationCycle(CEPT_ETX, 0xA001, crc16); /* Send the STX token - the token goes with in the CRC-calculation */
printf("* Sending ETX 0x%02x...\n\r", CEPT_ETX);
ttyPutchar(port,CEPT_ETX);
printf("* Adding lower CRC16 byte %02hhx...\n\r", (char)crc16);
ttyPutchar(port,(char)crc16); /* Transmit the CRC */
printf("* Adding higher CRC16 byte %02hhx...\n\r", (char)(crc16 >> 8));
ttyPutchar(port,(char)(crc16 >> 8));
}
}
printf("* Receiving response...\n\r");
usleep(CEPT_RESPONSE_TIMOUT); /* Wait some time to be sure that some response data is already in buffer when we start receiving) */
ttyReadNonblocking(port, response, CEPT_RESPONSE_TIMOUT); /* Read the data */
if(response[0] == '\0')
printf(" (no data received)\n\r");
else
hexBinAsciiDump(response,strlen(response));
printf("done!\n\r");
fflush(stdout);
return;
}
/* Filter keyboard input from terminal response (Rip off non printable chars and known protocol patterns) */
void systemCeptFilterKeyboardinput(char *responsedata, char *keyboarddata)
{
printf("\n\r\n\rFilter keyboard-data from Transmission response\n\r");
char *keyboarddataPointer;
char *responsedataPointer;
char *keyboarddataAheadPointer;
printf("* Ripping protocol fragments...\n\r");
keyboarddataPointer = keyboarddata;
responsedataPointer = responsedata;
do
{
/* Rip off the CEPT_DLE, 0x30/0x31 acknoledgement token */
if((*responsedataPointer == CEPT_DLE)&&((*(responsedataPointer+1) == 0x30)||(*(responsedataPointer+1) == 0x31)))
responsedataPointer+=2;
else
{
/* Replace Terminator and Initiator with printable characters */
if(*responsedataPointer == CEPT_INI)
*keyboarddataPointer = '*';
else if(*responsedataPointer == CEPT_TER)
*keyboarddataPointer = '#';
else
*keyboarddataPointer = *responsedataPointer;
/* Note: In a serious Videotex application you should NOT replace terminator and initiator
with thier printable pendants to avoid missunderstandings. */
keyboarddataPointer++;
responsedataPointer++;
}
} while(*responsedataPointer != '\0');
*keyboarddataPointer = '\0';
printf("* Ripping non printable characters...\n\r");
keyboarddataPointer = keyboarddata;
keyboarddataAheadPointer = keyboarddata;
do
{
if((*keyboarddataAheadPointer >= 0x20)&&(*keyboarddataAheadPointer <= 0x7E))
{
*keyboarddataPointer = *keyboarddataAheadPointer;
keyboarddataPointer++;
}
keyboarddataAheadPointer++;
} while(*keyboarddataAheadPointer != '\0');
*keyboarddataPointer = '\0';
printf("* The remaining data is:\n\r");
if(keyboarddata[0] == '\0')
printf(" (the string contained no keyboard data)\n\r");
else
hexBinAsciiDump(keyboarddata,strlen(keyboarddata));
fflush(stdout);
return;
}
/* #################################################################################### */

289
pc-software/test/cept.h Normal file
View File

@ -0,0 +1,289 @@
/*
####################################################################################
# #
# Bildschirmtricks miniBTX V1.0.0 #
# a (poor) cept protocol implementation #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#ifndef CEPT_H
#define CEPT_H
/* ==Warning==
This implementation of CEPT T/CD 6-1 is incomplete and for test proposes only.
A complete inplementation would requie much more protocol - so do not wonder
about unexpected effects. Besides you should not use this code in own projects
because this implementation is not really straight forward so you better write
your own implementation */
/* ==Control codes==
The the CEPT protocol includes a wide range of special control codes, here is a
hopefully complete list of all available control codes. A detailed explaination
of nearly all control codes can be found in ETS_300_072 (downloadable from etsi.org) */
/* C0 Control characters (printf-friendly) */
#define F_CEPT_APB "\x08" /* Active Position Back */
#define F_CEPT_APF "\x09" /* Active Position Forward */
#define F_CEPT_APD "\x0A" /* Active Position Down */
#define F_CEPT_APU "\x0B" /* Active Position Up */
#define F_CEPT_CS "\x0C" /* Clear Screen */
#define F_CEPT_APR "\x0D" /* Active Position Return */
#define F_CEPT_SI "\x0E" /* Shift In */
#define F_CEPT_SO "\x0F" /* Shift Out */
#define F_CEPT_CON "\x11" /* Cursor ON */
#define F_CEPT_RPT "\x12" /* Repeat Character */
#define F_CEPT_COF "\x14" /* Cursor OFf */
#define F_CEPT_CAN "\x18" /* CANcel (fills the rest off the line with spaces) */
#define F_CEPT_SS2 "\x19" /* Single Shift 2 (G2 set, Some legents say that this is the magic "YES" character) */
#define F_CEPT_ESC "\x1B" /* ESCape */
#define F_CEPT_SS3 "\x1D" /* Single Shift 3 (G3 set) */
#define F_CEPT_APH "\x1E" /* Active Position Home */
#define F_CEPT_US "\x1F" /* Unit Seperator (also known as APA) */
/* C0 Control characters (single byte constants) */
#define CEPT_APB 0x08 /* Active Position Back */
#define CEPT_APF 0x09 /* Active Position Forward */
#define CEPT_APD 0x0A /* Active Position Down */
#define CEPT_APU 0x0B /* Active Position Up */
#define CEPT_CS 0x0C /* Clear Screen */
#define CEPT_APR 0x0D /* Active Position Return */
#define CEPT_SI 0x0E /* Shift In */
#define CEPT_SO 0x0F /* Shift Out */
#define CEPT_CON 0x11 /* Cursor ON */
#define CEPT_RPT 0x12 /* Repeat Last Character */
#define CEPT_COF 0x14 /* Cursor OFf */
#define CEPT_CAN 0x18 /* CANcel (fills the rest off the line with spaces) */
#define CEPT_SS2 0x19 /* Single Shift 2 (G2 set, Some legents say that this is the magic "YES" character) */
#define CEPT_ESC 0x1B /* ESCape */
#define CEPT_SS3 0x1D /* Single Shift 3 (G3 set) */
#define CEPT_APH 0x1E /* Active Position Home */
#define CEPT_US 0x1F /* Unit Seperator (also known as APA) */
/* C0 Data link control tokens (printf-friendly) */
#define F_CEPT_NUL "\x00" /* NULl */
#define F_CEPT_SOH "\x01" /* Start Of Heading */
#define F_CEPT_STX "\x02" /* Start TeXt */
#define F_CEPT_ETX "\x03" /* End TeXt */
#define F_CEPT_EOT "\x04" /* End Of Transmission */
#define F_CEPT_ENQ "\x05" /* ENQuiry */
#define F_CEPT_ACK "\x06" /* ACKnowledge */
#define F_CEPT_ITB "\x07" /* end InTermediate Block */
#define F_CEPT_DLE "\x10" /* Data Link Escape */
#define F_CEPT_NAK "\x15" /* Negative AcKnowledge */
#define F_CEPT_SYN "\x16" /* SYNcronize */
#define F_CEPT_ETB "\x17" /* End TeXtblock */
/* C0 Data link control tokens (single byte constants) */
#define CEPT_NUL 0x00 /* NULl */
#define CEPT_SOH 0x01 /* Start Of Heading */
#define CEPT_STX 0x02 /* Start TeXt */
#define CEPT_ETX 0x03 /* End TeXt */
#define CEPT_EOT 0x04 /* End Of Transmission */
#define CEPT_ENQ 0x05 /* ENQuiry */
#define CEPT_ACK 0x06 /* ACKnowledge */
#define CEPT_ITB 0x07 /* end InTermediate Block */
#define CEPT_DLE 0x10 /* Data Link Escape */
#define CEPT_NAK 0x15 /* Negative AcKnowledge */
#define CEPT_SYN 0x16 /* SYNcronize */
#define CEPT_ETB 0x17 /* End TeXtblock */
/* NOTE: The Data link control tokens are not mentiond in ETS_300_072 */
/* C0 Propritay-BTX tokens (printf-friendly) */
#define F_CEPT_INI "\x13" /* Initiator (*) */
#define F_CEPT_TER "\x1C" /* Terminator (#) */
#define F_CEPT_DCT "\x1A" /* propritary btx (makes the terminal talking) */
/* C0 Propritay-BTX tokens (single byte constants) */
#define CEPT_INI 0x13 /* Initiator (*) */
#define CEPT_TER 0x1C /* Terminator (#) */
#define CEPT_DCT 0x1A /* propritary btx (makes the terminal talking) */
/* C1S/C1P control functions set (printf-friendly) */
#define F_CEPT_FSH "\x88" /* FlaSH */
#define F_CEPT_STD "\x89" /* STeaDy */
#define F_CEPT_EBX "\x8A" /* End BoX */
#define F_CEPT_SBX "\x8B" /* Start BoX */
#define F_CEPT_NSZ "\x8C" /* Normal-SiZe */
#define F_CEPT_DBH "\x8D" /* DouBle-Height */
#define F_CEPT_DBW "\x8E" /* DouBle-Width */
#define F_CEPT_DBS "\x8F" /* DouBle-Size */
#define F_CEPT_CDY "\x98" /* Conceal DisplaY */
#define F_CEPT_SPL "\x99" /* StoP Lining */
#define F_CEPT_STL "\x9A" /* StarT Lining */
#define F_CEPT_CSI "\x9B" /* Control Sequence Introducer */
/* C1S/C1P control functions set (single byte constants) */
#define CEPT_FSH 0x88 /* FlaSH */
#define CEPT_STD 0x89 /* STeaDy */
#define CEPT_EBX 0x8A /* End BoX */
#define CEPT_SBX 0x8B /* Start BoX */
#define CEPT_NSZ 0x8C /* Normal-SiZe */
#define CEPT_DBH 0x8D /* DouBle-Height */
#define CEPT_DBW 0x8E /* DouBle-Width */
#define CEPT_DBS 0x8F /* DouBle-Size */
#define CEPT_CDY 0x98 /* Conceal DisplaY */
#define CEPT_SPL 0x99 /* StoP Lining */
#define CEPT_STL 0x9A /* StarT Lining */
#define CEPT_CSI 0x9B /* Control Sequence Introducer */
/* C1S control functions set (printf-friendly) */
#define F_CEPT_ABK "\x80" /* Alpha BlacK */
#define F_CEPT_ANR "\x81" /* Alpha Red */
#define F_CEPT_ANG "\x82" /* Alpha Green */
#define F_CEPT_ANY "\x83" /* Alpha Yellow */
#define F_CEPT_ANB "\x84" /* Alpha Blue */
#define F_CEPT_ANM "\x85" /* Alpha Mageta */
#define F_CEPT_ANC "\x86" /* Alpha Cyan */
#define F_CEPT_ANW "\x87" /* Alpha White */
#define F_CEPT_MBK "\x90" /* Mosaic BlacK */
#define F_CEPT_MSR "\x91" /* MoSaic Red */
#define F_CEPT_MSG "\x92" /* MoSaic Green */
#define F_CEPT_MSY "\x93" /* MoSaic Yellow */
#define F_CEPT_MSB "\x94" /* MoSaic Blue */
#define F_CEPT_MSM "\x95" /* MoSaic Magenta */
#define F_CEPT_MSC "\x96" /* MoSaic Cyan */
#define F_CEPT_MSW "\x97" /* MoSaic White */
#define F_CEPT_BBD "\x9c" /* Black BackgrounD */
#define F_CEPT_NBD "\x9d" /* New BackgrounD */
#define F_CEPT_HMS "\x9e" /* Hold MoSaic */
#define F_CEPT_RMS "\x9f" /* Release MoSaic */
/* C1S control functions set (single byte constants) */
#define CEPT_ABK 0x80 /* Alpha BlacK */
#define CEPT_ANR 0x81 /* Alpha Red */
#define CEPT_ANG 0x82 /* Alpha Green */
#define CEPT_ANY 0x83 /* Alpha Yellow */
#define CEPT_ANB 0x84 /* Alpha Blue */
#define CEPT_ANM 0x85 /* Alpha Mageta */
#define CEPT_ANC 0x86 /* Alpha Cyan */
#define CEPT_ANW 0x87 /* Alpha White */
#define CEPT_MBK 0x90 /* Mosaic BlacK */
#define CEPT_MSR 0x91 /* MoSaic Red */
#define CEPT_MSG 0x92 /* MoSaic Green */
#define CEPT_MSY 0x93 /* MoSaic Yellow */
#define CEPT_MSB 0x94 /* MoSaic Blue */
#define CEPT_MSM 0x95 /* MoSaic Magenta */
#define CEPT_MSC 0x96 /* MoSaic Cyan */
#define CEPT_MSW 0x97 /* MoSaic White */
#define CEPT_BBD 0x9c /* Black BackgrounD */
#define CEPT_NBD 0x9d /* New BackgrounD */
#define CEPT_HMS 0x9e /* Hold MoSaic */
#define CEPT_RMS 0x9f /* Release MoSaic */
/* C1P control functions set (printf-friendly) */
#define F_CEPT_BKF "\x80" /* BlacK Foreground */
#define F_CEPT_RDF "\x81" /* ReD Foreground */
#define F_CEPT_GRF "\x82" /* GReen Foreground */
#define F_CEPT_YLF "\x83" /* YeLlow Foreground */
#define F_CEPT_BLF "\x84" /* BLue Foreground */
#define F_CEPT_MGF "\x85" /* MaGenta Foreground */
#define F_CEPT_CNF "\x86" /* CyaN Foreground */
#define F_CEPT_WHF "\x87" /* WHite Foreground */
#define F_CEPT_BKB "\x90" /* BlacK Background */
#define F_CEPT_RDB "\x91" /* ReD Background */
#define F_CEPT_GRB "\x92" /* GReen Background */
#define F_CEPT_YLB "\x93" /* YeLlow Background */
#define F_CEPT_BLB "\x94" /* BLue Background */
#define F_CEPT_MGB "\x95" /* MaGenta Background */
#define F_CEPT_CNB "\x96" /* CyaN Background */
#define F_CEPT_WHB "\x97" /* WHite Background */
#define F_CEPT_NPO "\x9c" /* Normal POlarity */
#define F_CEPT_IPO "\x9d" /* Inverted POlarity */
#define F_CEPT_TRB "\x9e" /* TranspaRent Background */
#define F_CEPT_STC "\x9f" /* STop Conceal */
/* C1P control functions set (single byte constants) */
#define CEPT_BKF 0x80 /* BlacK Foreground */
#define CEPT_RDF 0x81 /* ReD Foreground */
#define CEPT_GRF 0x82 /* GReen Foreground */
#define CEPT_YLF 0x83 /* YeLlow Foreground */
#define CEPT_BLF 0x84 /* BLue Foreground */
#define CEPT_MGF 0x85 /* MaGenta Foreground */
#define CEPT_CNF 0x86 /* CyaN Foreground */
#define CEPT_WHF 0x87 /* WHite Foreground */
#define CEPT_BKB 0x90 /* BlacK Background */
#define CEPT_RDB 0x91 /* ReD Background */
#define CEPT_GRB 0x92 /* GReen Background */
#define CEPT_YLB 0x93 /* YeLlow Background */
#define CEPT_BLB 0x94 /* BLue Background */
#define CEPT_MGB 0x95 /* MaGenta Background */
#define CEPT_CNB 0x96 /* CyaN Background */
#define CEPT_WHB 0x97 /* WHite Background */
#define CEPT_NPO 0x9c /* Normal POlarity */
#define CEPT_IPO 0x9d /* Inverted POlarity */
#define CEPT_TRB 0x9e /* TranspaRent Background */
#define CEPT_STC 0x9f /* STop Conceal */
/* Combined sequences to make the programmers cept-life easyer */
#define CEPTSEQ_C1P F_CEPT_ESC "\x22\x41" /* Invoke C1P Set */
#define CEPTSEQ_C1S F_CEPT_ESC "\x22\x40" /* Invoke C1S Set */
#define CEPTSEQ_CRLF F_CEPT_APD F_CEPT_APR /* Do a carrige-return/line-feed */
#define CEPTSEQ_G0 F_CEPT_ESC "\x28\x40" /* Invoke G0 Set */
#define CEPTSEQ_G1 F_CEPT_ESC "\x28\x63" /* Invoke G1 Set */
#define CEPTSEQ_G2 F_CEPT_ESC "\x28\x62" /* Invoke G2 Set */
#define CEPTSEQ_G3 F_CEPT_ESC "\x28\x64" /* Invoke G3 Set */
/* Linklayer configuration types */
#define CEPT_LINKLAYER 1 /* Use CRC secured connection 0=OFF, 1=ON */
#define CEPT_NOLINKLAYER 0 /* Use no linklayler (recommanded) */
/* Hardcoded Linklayer configuration */
#define CEPT_RESPONSE_TIMOUT 200000 /* Response timout for terminal response */
/* NOTE: The linklayer implementation does not secure the data automaticly. You get
the raw terminal data back and then you can transmit the data again. Automatic
retransmission is not supported. In this case linkleayer means that start/stop
tokens and CRC16 ars automaticly added to the datastream.
/* ==Control functions==
This function set shall provide a hassle free interface to a CEPT terminal. You can send
strings without worring about CRC for example... */
/* Query CEPT terminal */
void systemCeptQuery(char *string, int length, char *response, char *port, int linkLayer);
/* Filter keyboard input from terminal response (Rip off non printable chars and known protocol patterns) */
void systemCeptFilterKeyboardinput(char *responsedata, char *keyboarddata);
#endif /*CEPT_H*/
/* #################################################################################### */

231
pc-software/test/main.c Normal file
View File

@ -0,0 +1,231 @@
/*
####################################################################################
# #
# Bildschirmtricks miniBTX V2.0.0 #
# Main-Program #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
/* Header */
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <ttybanana.h>
#include <toolbanana.h>
#include <string.h>
#include "cept.h" /* Include CEPT protocol layer */
/* Transmission parameters */
#define MINIBTX_HOOKOFF 0x01 /* Hookoff-token (Do not change) */
#define MINIBTX_CONNECT 0x00 /* Connect-token (Do not change) */
#define MINIBTX_LINKLAYER CEPT_NOLINKLAYER /* Configrue linklayer */
#define MINIBTX_BAUDRATE 1200 /* Baudrate, can not be changed */
#define MINIBTX_PORT "/dev/ttyUSB1" /* Serial port - change if needed */
/* Special parameters */
#define MINIBTX_FORCE_TERMINAL_KEYBOARD_DATA 0 /* Force the terminal to transmit the keyboard data by sending DCT (1=ON,0=OFF) */
/* Note: The software has been tested with the following terminals:
* BtxTV (MINIBTX_FORCE_TERMINAL_KEYBOARD_DATA should be set to 1)
* Multitel11/Bitel */
/* #################################################################################### */
/* #################################################################################### */
/* Main program: Perform some testpages */
int main(void)
{
char transmissionBuffer[255]; /* Here we store the data that is sent to the terminal */
char trsnsmissionResponseBuffer[255]; /* Here we store the date that comes from the terminal */
char keyboardInput[255]; /* The users keyboard input */
printf("_____________________________________________________________________________________________\n\r");
printf("MiniBTX Copyright(c) Philipp Fabian Benedikt Maier\n\r");
printf("\n\r");
printf("Note: This is a small example application to explore some features of CEPT/BTX Terminals. \n\r");
printf(" Please notify that this tools requies the miniBTX hardware. \n\r");
printf("\n\r");
printf("Initalizing...\n\r");
printf("* Opening serial port...\n\r");
ttyInitProf(MINIBTX_PORT,MINIBTX_BAUDRATE,8,NONE); /* Initalize tty */
ttyClearBuffer(MINIBTX_PORT); /* Clear buffer */
printf("* Serial port is set to %s at %i Baud - edit the sourcecode to alter this setting.\n\r",MINIBTX_PORT,MINIBTX_BAUDRATE);
printf("\n\r");
printf("Waiting for BTX-Terminal...\n\r");
if(ttyGetchar(MINIBTX_PORT) == MINIBTX_HOOKOFF) /* Wait for hook-off token */
printf("* Hook off\n\r");
else
printf("* Warning: Incorrect hook off token (should be %02hhx)\n\r",MINIBTX_HOOKOFF);
if(ttyGetchar(MINIBTX_PORT) == MINIBTX_CONNECT) /* Wait for connection-ok token */
printf("* Connection ok\n\r");
else
printf("* Warning: Incorrect connection start token (should be %02hhx)\n\r",MINIBTX_CONNECT);
printf("\n\r");
printf("\n\r");
printf("__________________________________\n\r");
printf("Transmitting testpage...\n\r"); /* Transmit testpage */
while(1)
{
/* ==TRANSMISSION TEST== */
/* Note: for a better understanding of the concept of CEPT control codes the most control
codes are sent seperately. This causes a leak of performance because every single
block that is transmitted causes an startup code which must be sent back through
the slow 75-baud line. If you pack the controlcodes within the textblocks you can
get a much faster page transmission */
sprintf(transmissionBuffer, F_CEPT_CS CEPTSEQ_G0); /* Clear screen and switch to G0 set */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, F_CEPT_ANW CEPTSEQ_C1P F_CEPT_DBS F_CEPT_BLB F_CEPT_APR "*BILDSCHIRMTRIX# ");
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF); /* The headline is double hight and covers the next line, so we must add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_C1P F_CEPT_NSZ "miniBTX Testbild nach CEPT T/CD 6-1 ");
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF); /* Add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, "!\"#$%%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF); /* Add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF); /* Add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_G1); /* Switch to G1 character set */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, "!\"#$%%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF); /* Add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF); /* Add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_G2); /* Switch to G2 character set */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, "!\"#$%%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF); /* Add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF); /* Add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_G3); /* Switch to G2 character set */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, "!\"#$%%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF CEPTSEQ_CRLF CEPTSEQ_CRLF CEPTSEQ_CRLF CEPTSEQ_CRLF CEPTSEQ_CRLF); /* Add some blank lines blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_G0); /* Switch to G0 character set */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, F_CEPT_DBH "Testbild neu aufbauen mit # (Terminator)" CEPTSEQ_CRLF); /* Add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
/* ==RECEIVE TEST== */
printf("__________________________________\n\r");
printf("Retrieve keyboard input...\n\r"); /* Receive keyboard data */
/* Note: BTX Terminals are a bit more complex than normal dump terminals - they store the keyboard
input in a buffer. The content of this buffer is transmitted when a DCT-Token is sent
to the terminal. Otherwise the terminal will only transmit the ACK tokens. */
/* Note: Many BTX-Terminal (for example the BtxTV) are equipped with an auto-login function
so the first thing you might see is a long forgotton login password. */
for(;;)
{
/* Note: A terminal can transmit more than one character at a time if you
give the terminal some time it is able to gather some chars */
if(MINIBTX_FORCE_TERMINAL_KEYBOARD_DATA == 1)
{
/* Here we force the terminal to transmit the keyboard buffer data
by sending a DCT token. Warning! This is a cludge! */
sprintf(transmissionBuffer, F_CEPT_DCT);
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
}
else
{
/* Here we got a friendly terminal that talks wihout kicking it */
systemCeptQuery(0,0,trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
}
/* Now we filter out printable characters */
systemCeptFilterKeyboardinput(trsnsmissionResponseBuffer, keyboardInput);
/* Show keyboard data if some data received */
if(keyboardInput[0] != '\0')
printf("\n\r Keyboard input ==>%s<==", keyboardInput);
/* When terminator is pressed - redraw screen */
if(keyboardInput[0] == '#') /* Quick and dirty Terminator detection */
break;
fflush(stdout);
}
}
return 0;
}
/* #################################################################################### */

BIN
pc-software/test/miniBTX Normal file

Binary file not shown.