Projekt Project
Hardware Hardware
Bedienung Operation
BASIC (1) BASIC (1)
BASIC (2) BASIC (2)
BASIC (3) BASIC (3)
Interna Internals
Beispiele Examples
Erweiterungen Extensions
Bibliotheken Libraries
Treiber Driver
Programme Programs


Bezugsquellen: Where to buy:
Bausatz Kit
Leerplatine Empty board

AVR-ChipBasic2: BASIC-Referenz (3) AVR ChipBasic2: BASIC Reference (3)
Ein-/Ausgabe, Dateien Input and output, files
V1.45 (c) 2006-2012 Jörg Wolfram V1.45 (c) 2006-2012 Jörg Wolfram




1 Ein- und Ausgabe über den Parallelport 1 input and output via the parallel port



1.1 DIR n 1.1 DIR n

setzt die I/O-Richtung der 8 Portpins an der parallelen Schnittstelle. sets the I / O direction of the 8 port pins on the parallel port. Eine 0 bedeutet Eingang, eine 1 Ausgang. A 0 means input, a 1 output.
10 DIR $F0 10 DIR $ F0
Pin D0-D3 werden als Eingang, D4-D7 als Ausgang konfiguriert. Pin D0-D3 are used as input, D4-D7 configured as an output.
Die Funktion kann durch Treiber auf Programmplatz 8 deaktiviert werden, in diesem Fall wird mit der Meldung "IO disabled" das Programm abgebrochen. The feature can be disabled by driver to channel 8, in this case, with the message "IO disabled" the program is aborted.

1.2 OUT n,b 2.1 OUT n, b

Hier gibt es mehrere Funktionen, n=0..7 setzt einzelne Bits, n=$100 bis $1ff erlaubt es, mehrere Bits gleichzeitig zu setzen bzw. zu löschen. It has several functions, n = 0 to 7 sets individual bits, n = $ 100 to $ 1ff allows you to set several bits at a time or to delete. dabei dienen die unteren 8 Bits von n als Maske. while the lower 8 bits of n are used as a mask.
Beispiele: Examples:
10 OUT 7,0 10 OUT 7.0
Setzt D0 auf 0-Pegel. D0 set to 0 level.
10 OUT $1F0,$F0 10 OUT $ 1F0, $ F0
Setzt D3-D7 auf 1-Pegel. Sets D3-D7 on 1 level.
Die Funktion kann durch Treiber auf Programmplatz 8 deaktiviert werden, in diesem Fall wird mit der Meldung "IO disabled" das Programm abgebrochen. The feature can be disabled by driver to channel 8, in this case, with the message "IO disabled" the program is aborted. Mit n=512 ($200) wird die SPI-Schnittstelle konfiguriert. With n = 512 ($ 200), the SPI interface is configured. Ist b=255 ($ff), wird die SPI-Schnittstelle auf Standardwerte und zurückgesetzt. B = 255 ($ ff), the SPI interface and reset to default values. Bei anderen Werten wird die SPI-Schnittstelle nach folgendem Schema konfiguriert: Die Bits 0-5 werden in des SPCR-Register des Mikrocontrollers geschrieben, Bit 6 in das SPSR-Register. For other values, the SPI interface is configured as follows: The bits 0-5 are written in the SPCR register of the microcontroller, bit 6 in the SPSR register.


Bit Bit Bit=0 Bit = 0 Bit=1 Bit = 1
0 0 siehe SCK-clockteiler see SCK clock divider siehe SCK-clockteiler see SCK clock divider
1 1 siehe SCK-clockteiler see SCK clock divider siehe SCK-clockteiler see SCK clock divider
2 2 Datenübernahme mit Vorderflanke des Taktes Data transfer with front edge of the clock Datenübernahme mit Rückflanke des Taktes Data transfer with back edge of the clock
3 3 Takt in Ruhelage LOW Clock at rest LOW Takt in Ruhelage HIGH Clock at rest HIGH
4 4 SPI Slave SPI slave SPI Master SPI Master
5 5 Bit 7 wird zuerst gesendet Bit 7 is transmitted first Bit 0 wird zuerst gesendet Bit 0 is transmitted first
6 6 Bitrate x 1 Bitrate x 1 Bitrate x 2 Bitrate x 2


Über den SCK Clockteiler kann im Master-Mode die SPI-Clockfrequenz eingestellt werden. About the SCK clock divider in the master mode, the SPI clock frequency can be adjusted. Dabei sind folgende Werte möglich: The following values ​​are possible:


Bit 6 Bit 6 Bit 1 Bit 1 Bit 0 Bit 0 Frequenz Frequency
0 0 0 0 0 0 5 MHz 5 MHz
0 0 0 0 1 1 1,25 MHz 1.25MHz
0 0 1 1 0 0 312,5 KHz 312.5 KHz
0 0 1 1 1 1 156,25 KHz 156.25 KHz
1 1 0 0 0 0 10 MHz 10 MHz
1 1 0 0 1 1 2,5 MHz 2.5MHz
1 1 1 1 0 0 625 KHz 625 KHz
1 1 1 1 1 1 312,5 KHz 312.5 KHz


Die Clockfrequenz von 10MHz kann nur im Master-Mode verwendet werden, wobei der Slave-Mode nur bedingt einsetzbar ist, da die CPU während der Bildausgabe (ca. 70% der Zeit) die SPI-Schnittstelle nicht bedienen kann. The clock frequency of 10 MHz can be used only in master mode, the slave mode is only limited use, because the CPU while the image output (about 70% of the time) do not operate the SPI interface can. Direkter Zugriff auf die I/O Register des ATMega644 steht im Bereich n=$400 bis $4ff zur Verfügung. Direct access to the I / O registers of the ATmega644 is in the range $ 400 to $ n = 4 onwards are available. Hier sollte man Vorsicht walten lassen, es ist damit auch möglich das System zu Stillstand zu bringen. Here one should be cautious, it is thus possible to bring the system to a halt.
01 OUT $4B9,92 01 OUT $ 4B9, 92
Setzt das TWBR Register (I2C-Bitrate) auf 92 (100KHz bei Vorteiler 1). Sets the TWBR register (I2C bit rate) to 92 (at 100KHz prescaler 1).
Bei Adressen im Bereich n=$0800 bis $ffff wird auf eine Funktion im Treiber (Programmplatz 8) zugegriffen. For addresses in the range n = $ 0800 to $ ffff to access a function in the driver (program number 8). Ist kein entsprechender Treiber geladen ist dies nur eine Dummy-Funktion, die das Fehlerregister setzt. Is no appropriate drivers are loaded, this is just a dummy function that sets the error register.

1.3 Die Funktion IN(n) 1.3 The function IN (s)

Hier gibt es mehrere Möglichkeiten, n=0..7 liest einzelne Bits des I/O-Ports, n=$1xx erlaubt es, mehrere Bits gleichzeitig zu lesen wobei xx als Bitmaske dient. Here there are several possibilities, n = 0 to 7 are the individual bits of the I / O ports, n = $ 1xx allows to read a plurality of bits simultaneously, where xx is a bit mask.
Eine erweiterte Funktionalität steht im Bereich n=$400 bis $4ff zur Verfügung. More functionality is in the range $ 400 to $ n = 4 onwards are available. Hier kann direkt auf die I/O Register des ATMega644 zugegriffen werden. This allows direct access to the I / O registers of the ATmega644.
01 D=IN($426) 01 D = IN ($ 426)
liest das PIN-Register (Port-Input) von Port C in die Variable D ein. reads the PIN register (input port) of Port C to the D variable.
Bei Adressen im Bereich n=$0800 bis $ffff wird auf eine Funktion im Treiber (Programmplatz 8) zugegriffen. For addresses in the range n = $ 0800 to $ ffff to access a function in the driver (program number 8). Ist kein entsprechender Treiber geladen oder benutzt dieser die angegebene Adresse nicht, wird ein Fehler (NO IO DRIVER) generiert. Is no corresponding driver is loaded or not the address you use this, an error (IO NO DRIVER) is generated.

1.4 Die Funktion ADC(n) 1.4 The ADC function (s)

Diese Funktion dient zum Einlesen von Analogwerten über den integrierten Analog-Digital-Wandler. This function is used for reading in analog values ​​via the integrated analog-digital converter. Auch hier gibt es mehrere Möglichkeiten, n=0..7 werden die I/O-Leitungen D0...D7 mit der internen Referenzspannung von 2,56 Volt eingelesen. Again, there are several possibilities, n = 0 to 7, the I / O lines D0 ... D7 read with the internal reference voltage of 2.56 volts. Im Parameterbereich n=$1xx ist es möglich, das ADMUX Register direkt zu steuern. In the parameter range n = $ 1xx it is possible to control the ADMUX register directly. Damit lassen neben unterschiedlichen Referenzen auch die differentiellen Modes nutzen. Thus can be used in addition to various references, the differential mode.

1.5 Die Funktion SPI(n) 1.5 The SPI feature (s)

Mit dieser Funktion wird ein Byte über die SPI-Schnittstelle ausgegeben und der eingelesene Wert zurückgegeben. With this function, a byte is output via the SPI interface and the read value returned.
10 IF SPI(67)<>67 PRINT "ERROR" 10 IF SPI (67) <> 67 PRINT "ERROR"
Wenn MOSI mit MISO verbunden und die SPI-Schnittstelle aktiviert ist, sollte kein "ERROR" angezeigt werden. When connected to MOSI MISO and the SPI interface is enabled, there should be no "ERROR" will be displayed.

1.6 SPISEL n 1.6 SPISEL n

Mittels diesem Signal lässt sich der SPI-SS Portpin schalten. By means of this signal can be switched to the SPI-SS port pin. Ab Version 1.44 hat sich die Auswertung des Parameters geändert, damit die SPI-Multiselect Erweiterung genutzt werden kann. From version 1.44, the evaluation of the parameter has changed, so the SPI MultiSelect extension can be used. Dazu wird bei Werten < 255 das Byte mit deaktiviertem SS Signal ausgegeben und erst danach das SS Signal aktiviert. This is at values ​​<255 output byte with deactivated SS signal and only then the SS signal is activated.
  • SPISEL nn(0...254) aktiviert das SS Signal (LOW-Pegel an PORTB.4) SPISEL nn (0 .. 254) activates the SS signal (LOW level at PORTB.4)
  • SPISEL 255 deaktiviert das SS Signal (HIGH-Pegel an PORTB.4) SPISEL 255 disables the SS signal (HIGH level at PORTB.4)
01 SPISEL $F7 01 SPISEL $ F7
02 A=SPI($FF) 02 A = SPI ($ FF)
03 SPISEL $FF 03 SPISEL $ FF
Mit diesem Befehl wird die Selectleitung aktiviert, 0xFF über die SPI-Schnittstelle ausgegeben und danach die Selectleitung wieder deaktivert. This command displays the Select line is activated 0xFF output via the SPI interface and then deactivated the select line again. Mit SPI-Multiselect Erweiterung wird ser SS-Ausgang an Bit 3 aktiviert. With SPI MultiSelect extension ser SS output is enabled on bit 3.

2 Kommunikation 2 Communication



2.1 SPUT a,b... 1.2 SPUT a, b ...

ein oder mehrere Bytes werden an die serielle Schnittstelle ausgegeben. one or more bytes are output to the serial interface.
01 SPUT 65,10 01 SPUT 65.10
gibt ein großes "A" und einen Zeilenvorschub an die serielle Schnittstelle aus. outputs a capital "A" and a line feed to the serial port.

2.2 SGET V 2.2 V SGET

Ein Zeichen von der seriellen Schnittstelle wird eingelesen und in die Varaiable V gespeichert. A character from the serial port is read and stored in the Varaiable V. Diese Funktion ist aber nur beim ATMega644P nutzbar, und nur wenn der Eingangspin der seriellen System-Schnittstelle auf PD1 liegt. This feature is, however, only when ATmega644P usable, and only when the input pin of the serial system interface located on PD1. Ansonsten wird mit einer Fehlermeldung abgebrochen. Otherwise is aborted with an error message. Die Funktion kehrt erst zurück wenn das Zeichen eingelesen wurde, alternativ kann mit der ESC Taste abgebrochen werden. The function returns only if the character has been read, alternatively, can be canceled with the ESC key. In diesem Fall wird der Wert -1 zurückgegeben. In this case the value of -1 is returned.
01 SGET C 01 SGET C
wartet auf ein Zeichen von der seriellen Schnittstelle und speichert die in die Variable C waiting for a signal from the serial port and stores the C in the variable

2.3 BAUD n 2.3 BAUD n

Hiermit kann die Bitrate der seriellen Schnittstelle eingestellt werden. This adjusts the bit rate of the serial interface can be set. Diese Einstellung gilt aber nur zur Laufzeit der Programmes und wird nach Programmende wieder durch die Systemeinstellung überschrieben. This setting applies only to the duration of the program and after the program ends will be overwritten by the system setting. Es sind folgende Bitraten möglich: It is possible the following bit rates:


n n Bitrate (Bps) Bitrate (bps)
0 0 1200 1200
1 1 2400 2400
01 BAUD 1 01 BAUD 1
setzt die Bitrate auf 2400Bps. sets the bit rate to 2400bps.

2.4 ESPUT a,b... 4.2 ESPUT a, b ...

ein oder mehrere Bytes werden an die zweite serielle Schnittstelle ausgegeben. one or more bytes are output to the second serial interface. Diese Funktion ist aber nur beim ATMega644P nutzbar, und nur wenn der Eingangspin der seriellen System-Schnittstelle auf PD1 liegt. This feature is, however, only when ATmega644P usable, and only when the input pin of the serial system interface located on PD1. Ansonsten wird mit einer Fehlermeldung abgebrochen. Otherwise is aborted with an error message.
01 ESPUT 65,66,10 01 ESPUT 65,66,10
gibt einen Zeilenvorschub an die zweite serielle Schnittstelle aus. is a line feed to the second serial port.

2.5 ESGET V 2.5 V ESGET

Ein Zeichen von der zweiten seriellen Schnittstelle wird eingelesen und in die Varaiable V gespeichert. A sign of the second serial port is read and stored in the Varaiable V. Diese Funktion ist aber nur beim ATMega644P nutzbar, und nur wenn der Eingangspin der seriellen System-Schnittstelle auf PD1 liegt. This feature is, however, only when ATmega644P usable, and only when the input pin of the serial system interface located on PD1. Ansonsten wird mit einer Fehlermeldung abgebrochen. Otherwise is aborted with an error message. Die Funktion kehrt erst zurück wenn das Zeichen eingelesen wurde, alternativ kann mit der ESC Taste abgebrochen werden. The function returns only if the character has been read, alternatively, can be canceled with the ESC key. In diesem fall wird der Wert -1 zurückgegeben. In this case, a value of -1 is returned.
01 ESGET C 01 ESGET C
wartet auf ein Zeichen von der zweiten seriellen Schnittstelle und speichert die in die Variable C waiting for a signal from the second serial port and stores the C in the variable

2.6 EBAUD n 2.6 EBAUD n

Hiermit können die Bitrate und weitere Parameter der zweiten seriellen Schnittstelle des ATMega644P eingestellt werden. This allows the bit rate and other parameters of the second serial interface of the ATmega644P be set. Diese Funktion ist aber nur nutzbar, wenn der Eingangspin der seriellen System-Schnittstelle auf PD1 liegt. This feature is only available when the input pin of the serial system interface is at PD1. Ansonsten wird mit einer Fehlermeldung abgebrochen. Otherwise is aborted with an error message.
Die Bits 0...2 sind für die Bitrate verantwortlich, dabei sind folgende Bitraten möglich: Bits 0 .. 2 are responsible for the bit rate, there are the following bit rates are possible:


bbb bbb Bitrate (Bps) Bitrate (bps)
000 000 1200 1200
001 001 2400 2400
010 010 4800 4800
011 011 9600 (default) 9600 (default)
100 100 19200 19200
101 101 31250 (MIDI) 31250 (MIDI)
110 110 38400 38400
111 111 57600 57600


Mit Bit 4 kann die Anzahl der Stopp-Bits eingestellt werden: Bit 4, the number of stop bits can be set:


b b Stopp-Bits Stop Bits
0 0 1 Stopp-Bit 1 stop bit
1 1 2 Stopp-Bits 2 stop bits


Mit den Bits 5...7 lässt sich eines von 8 verschiedenen Datenformaten wählen: With bits 5 .. 7 can be chosen one of 8 different data formats:


bbb bbb Format Format
000 000 8 Bit, kein Parity-Bit 8 bits, no parity bit
001 001 8 Bit, gerade Parity 8 bits, even parity
010 010 6 Bit, kein Parity-Bit 6 bits, no parity bit
011 011 8 Bit, ungerade Parity 8 bits, odd parity
100 100 7 Bit, kein Parity-Bit 7 bits, no parity bit
101 101 7 Bit, gerade Parity 7 bits, even parity
110 110 5 Bit, kein Parity-Bit 5 bits, no parity bit
111 111 7 Bit, ungerade Parity 7 bits, odd parity


Die Modi 0x00...0x07 sind dabei kompatibel zu früheren Versionen. The modes 0x00 0x07 ... are compatible with earlier versions. Weitere Einstellmöglichkeiten ergeben sich natürlich, wenn über OUT Befehle direkt auf die Register des USART zugegriffen wird. Further setting arise naturally when transitioning OUT commands directly access the registers of the USART.
01 EBAUD 5 01 EBAUD 5
setzt die Bitrate der zweiten seriellen Schnittstelle auf 31250Bps (MIDI), Format 8/N/1. sets the bit rate of the second serial port on 31250Bps (MIDI) format 8/N/1.

2.7 PUMP n 2.7 PUMP n

Schaltet die Ladungspumpe für die serielle Schnittstelle aus (n=0) oder ein (n=1). Switches the charge pump for the serial interface (n = 0) or (n = 1).
01 PU 1 01 PU 1
schaltet die Ladungspumpe ein. turns on the charge pump. Die Ladungspumpe ist auch per default nach dem Start eingeschaltet. The charge pump is turned on by default even after the start.

2.8 XSEND n,a 2.8 XSEND n, a

gibt einen Datenblock aus dem Array über das XMODEM Protokoll aus. outputs a block of data from the array via the XMODEM protocol. N ist dabei die Blocknummer und a die Arrayposition (0...640). N is the block number and a position of the array (0 .. 640). Um das ACK/NAK Handling muss man allerdings selbst kümmern. To the ACK / NAK handling even though you have to worry.
01 SGET C:IF C<>21 THEN GOTO 1 01 SGET C: IF C <> 21 THEN GOTO 1
02 FOR Z=0 TO 5:A=Z*128 02 FOR Z = 0 TO 5: A = Z * 128
03 XSEND Z,A 03 XSEND Z, A
04 SGET C:IF C=21 THEN GOTO 3 04 SGET C: IF C = 21 THEN GOTO 3
05 NEXT:SPUT 4 05 NEXT: SPUT 4
Dieses Programm sendet den kompletten Array-Inhalt via X-Modem an ein anderes Gerät. This program sends the complete array content via X-Modem to another device.

2.9 XREC(a) 9.2 XREC (a)

liest einen Datenblock über das XMODEM Protokoll in das Array ein. reads a data block on the XMODEM protocol into the array. A ist dabei die Arrayposition (0...640). A is the array position (0 .. 640). Um das ACK/NAK und Error Handling muss man allerdings wieder selbst kümmern. To the ACK / NAK and error handling has to take care, however, again yourself.
01 SPUT 21 01 SPUT 21
02 FOR Z=0 TO 5:A=Z*128 02 FOR Z = 0 TO 5: A = Z * 128
03 C=XREC(A):SPUT 6:NEXT 03 C = XREC (A): SPUT 6: NEXT
04 SGET C: SPUT 6 04 SGET C: SPUT 6
Dieses Programm liest den kompletten Array-Inhalt via X-Modem von einem anderen Gerät. This program reads the complete array content via X-modem from another device. Bei einem Empfangsfehler wird einfach abgebrochen. At a reception error is canceled simply. Dies könnte aber mit ONERR abgefangen werden. But this could be trapped with ONERR.

2.10 ICOMM adr,start,num [IC] 2:10 ICOMM start addr, num [IC]

Generische I2C Routine. Generic I2C routine. Der Erste Parameter adr gibt die Slave-Adresse an. The first parameter addr specifies the slave address. Gleichzeitig wird mit Bit 0 festgelgt, ob geschrieben (0) oder gelesen (1) werden soll. Simultaneously festgelgt with bit 0, whether written (0) or is to be read (1). Die beiden anderen Parameter geben die Startadresse im Array und die Anzahl der zu übertragenden Bytes an. The other two parameters specify the starting address of the array and the number of bytes to be transferred.
01 DATA HI(B),LO(B),LO(A),HI(A):ICOMM $a0,0,4 01 DATA HI (B), LO (B) LO (A), HI (A): ICOMM $ a0, 0.4
02 SYNC 1 02 SYNC 1
Schreibt den Wert der Variable A an die Adresse B eines I2C-EEPROMs (>24C16) mit der Adresse 0. Writes the value of variable A to the B address of an I2C EEPROMs (> 24C16) 0 with address Dabei ist auf die Reihenfolge der Bytes zu achten, da Beim I2C EEPROM zuerst das High-Byte der Adresse und danach das Low-Byte der Adresseübertragen werden muss. Attention must be paid to the sequence of bytes, because when I2C EEPROM first the high byte of the address and then the low byte must be the address is transmitted. Um eventuelle Wartezeiten nach der Aktion muss man sich selbst kümmern, Ein Schreiben in den EEPROM mit darauffolgendem Lesen gibt mit hoher Sicherheit einen I2C-Fehler, SYNC 2 schafft eine Pause von mindestens 20ms. To any waiting time after the action has to take care of yourself, a letter to the EEPROM with subsequent reading is highly secure an I2C error, SYNC 2 creates a pause of at least 20ms. Wird die Anzahl der zu schreibenden Bytes auf 0 gesetzt, werden solange Bytes aus dem Array ausgegeben, bis 0x00 erkannt wird. The number of bytes to be written is set to 0 as long as bytes are output from the array will be recognized to 0x00. Im Lesemodus bedeutet eine 0 als Anzahl, dass als erstes die Anzahl der zu lesenden Bytes eingelesen wird. In read mode, one of the number 0 means that the first is the number of bytes to be read is read. Ein I2C-Slave, der nichts senden möchte, muss also nur ein 0x00 zurücksenden, welches mit einem ACK beantwortet wird. An I2C slave who wants to send anything, must therefore return only a 0x00, which is answered with an ACK. Ein Dummy-Byte wie in vorherigen Versionen ist nicht mehr nötig. Dummy byte as in previous versions is no longer necessary.

3 Speicher 3 Memory



3.1 EPOKE adr,dat [EP] 3.1 EPOKE adr, dat [EP]

Speichert ein Datenbyte in den internen EEPROM. Saves a byte of data in the internal EEPROM. Als Adressen sind 0...1999 möglich. As addresses 0 .. 1999 are possible.
02 EPOKE V,$12 EPOKE 02 V, $ 12
speichert den Wert 18 an die Adresse V im internen EEPROM. stores the value 18 to the address V in the internal EEPROM.

3.2 EPEEK(adr) 3.2 EPEEK (adr)

Die Funktion liest ein Byte aus dem internen EEPROM. The function reads a byte from the internal EEPROM. Als Adressen sind 0...1999 möglich. As addresses 0 .. 1999 are possible.
02 W=EPEEK(V) 02 W = EPEEK (V)
liest den Wert von EEPROM-Adresse V (internes EEPROM) und speichert diesen in der Variable W. reads the value of EEPROM address V (internal EEPROM), and stores it in the variable W.
An die I2C-Schnittstelle kann ein zusätzlichs EEPROM (derzeit nur 24C64...24C512) angeschlossen werden. The I2C interface, an EEPROM can zusätzlichs (currently only 24C64 ... 24C512) can be connected. Bei anderen Typen lässt sich die gleiche Funktionalität (etwas umständlicher) über ICOMM realisieren. For other types, the same functionality can be realized (a little more complicated) than ICOMM.

3.3 XPOKE adr,dat [XP] 3.3 XPOKE adr, dat [XP]

Speichert ein Byte im externen EEPROM, die Baustein-Adresse ist im Konfigurationsmenü festgelegt und nur dort einstellbar. Stores a byte in external EEPROM, the module address is set in the configuration menu, and only there adjustable. Die Baustein-Adressen 6 und 7 sind für SRAM/FRAM vorbehalten, da hier nicht gewartet wird, bis der Schreibvorgang abgeschlossen ist. The module addresses 6 and 7 are for SRAM / FRAM reserved because here is not to wait until the write is complete.
01 XPOKE 100,C 01 XPOKE 100, C
speichert den Wert der Variablen C an die Adresse 100. stores the value of the variable C to the address 100

3.4 XPEEK(adr) 3.4 XPEEK (adr)

Die Funktion liest ein Byte aus dem externen EEPROM. The function reads a byte from the external EEPROM. Als Adressen sind 0...$FFFF möglich. As addresses 0 .. $ FFFF are possible.
02 W=XPEEK(100) 02 W = XPEEK (100)
liest den Wert von EEPROM-Adresse 100 /externes EEPROM) und speichert diesen in der Variable W. reads the value from EEPROM address 100 / external EEPROM) and stores it in the variable W.

3.5 VPOKE adr,dat [VP] 3.5 VPOKE adr, dat [VP]

Dieser Befehl schreibt ein Byte in den Bildspeicher. This command writes a byte into the image memory. Als Adressen sind 0...2759 möglich. As addresses 0 .. 2759 are possible.
01 VPOKE 0,66:VPOKE 690,$08 01 VPOKE 0.66: VPOKE 690, $ 08
schreibt ein schwarzes "B" auf grünem Grund in die linke obere Bildschirmecke. writes a black "B" on a green background in the upper left corner.

3.6 VPOKE adr,arrayadr,num [VP] 3.6 VPOKE adr arrayadr, num [VP]

Werden bei VPOKE drei Parameter angegeben, ist es möglich ganze Byte-Sequenzen auf einmal in den Bildspeicher zu schreiben. Be specified when VPOKE three parameters, it is possible to write all byte sequences at once in the frame buffer. Als Adresse wieder sind 0...2759 möglich. Address again as 0 .. 2759 are possible. Zweiter Parameter ist eine Arrayposition im Bytebereich, ab der die zu schreibenden Daten stehen. Second parameter is an array position in the range of bytes from the data to be written are. Als dritter Parameter wird angegeben, wie oft die Sequenz in den Bildspeicher geschrieben wird. As the third parameter is the number of occurrences, the sequence is written into the image memory.
Im Array selbst stehen die Daten paarweise als Bytes. The array itself, the data are paired as bytes. Das erste Byte gibt den zu schreibenden Wert an und das zweite Byte die danach zu überspringenden Bytes. The first byte contains the value to be written, and the second byte after the skipped bytes. Der zweite Wert kann zwischen 0 und 127 liegen, ist Bit 7 gesetzt (Wert > 127) wird 128 abgezogen, der Offset normal ausgeführt und danach die Sequenz beendet. The second value can be between 0 and 127, is bit 7 (value> 127) is deducted 128, the offset running normally and then terminates the sequence.
01 DA 0,65,0,66,0,67,27+128 01 DA 0,65,0,66,0,67,27 +128
02 VP 0,0,10 02 VP 0,0,10
schreibt 10x untereinander "ABC". 10x writing with each other "ABC."

3.7 VPEEK(adr) 3.7 VPEEK (adr)

Die Funktion liest ein Byte aus dem Bildspeicher. The function reads a byte from the image memory. Als Adressen sind 0...2759 möglich. As addresses 0 .. 2759 are possible.
01 ? 01? "A" "A"
02 ? 02? VPEEK(0) VPEEK (0)
sollte in der ersten Zeile ein "A" und in der zweiten Zeile 65 (das ist der ASCII-Wert von "A") ausgeben. The first line should be a "A" and the second line 65 (which is the ASCII value of 'A') it.

3.8 PAGE num 3.8 PAGE num

Mit dieser Funktionlässt sich die Position des Array-Bereiches 768...1023 im externen Speicher festlegen. This function Allows you to define the location of the array area .. 1023 768th in external memory. Als Werte sind 0...255 möglich, das gibt einen theoretisch nutzbaren Speicherbereich von 64 Kilobytes. As values ​​0 .. 255 are possible, which is a theoretically effective memory area of ​​64 kilobytes.
01 PAGE 0 01 PAGE 0
setzt das Fenster auf die ersten 256 Bytes im externen RAM. is the window to the first 256 bytes in the external RAM.

3.9 CCHAR src-char,dest-char 3.9 CCHAR char src, dest-char

Kopiert im Videomodus 4 einzelne Zeichen vom eingebauten ROM-Zeichensatz in den benutzerdefinierten Zeichensatz. Src-char ist dabei die Zeichennummer im ROM-Zeichensatz (0...255) und dest-char die Zeichennummer im RAM Zeichensatz (0...127). Copied in video mode 4 individual characters from the built-in ROM character set in the custom character set. Src char here is the character number in ROM character set (0 .. 255) and least-char the character number in RAM character set (0 .. 127) . Sollen mehrere Zeichen kopiert werden, muß dies zB in einer Schleife geschehen. If several characters are copied, as this must be done in a loop.

3.10 CCHAR src-char,dest-char,color 3:10 CCHAR char src, dest-char, color

Kopiert im Videomodus 6 einzelne Zeichen vom eingebauten ROM-Zeichensatz in den benutzerdefinierten Zeichensatz. Src-char ist dabei die Zeichennummer im ROM-Zeichensatz (0...255) und dest-char die Zeichennummer im RAM Zeichensatz (0...63). Copied in video mode 6 individual characters from the built-in ROM character set in the custom character set. Src char here is the character number in ROM character set (0 .. 255) and least-char the character number in RAM character set (0 .. 63) . Der Wert color ergibt sich aus Vordergrundfarbe+16*Hintergrundfarbe für die Kopie. The color value is derived from +16 * Foreground color Background color for the copy. Sollen mehrere Zeichen kopiert werden, muß dies zB in einer Schleife geschehen. If several characters are copied, as this must be done in a loop.

4 Dateisystem-Funktionen 4 file system functions

Wenn Sie bereits mit Personal Computern vertraut sind, werden Sie jetzt ein klein wenig umdenken müssen, da das Dateisystem von AVR-ChipBasic2 ein bisschen anders aufgebaut ist. If you are familiar with personal computers before, you are now a little bit to rethink, because the file system of AVR ChipBasic2 a little differently constructed. Voraussetzung um mit Dateien arbeiten zu können ist ein Dataflash-Modul, welches in den Programmier-Port gesteckt wird. Prerequisite for working with files to a data flash module that plugs into the programming port. Je nach Typ können bis zu 0,5 oder 1 Megabyte Daten gespeichert werden. Depending on the type, up to 0.5 or 1 megabyte of data are stored. Natürlich ist es immer etwas weniger, denn die Daten wollen auch organisiert werden, was wiederum Speicherplatz auf dem Medium beansprucht. Of course, there is always a little less, because the data will also be organized, which in turn consumes disk space on the media. Um mit dem Dataflash-Modul arbeiten zu können, muss dieses "formatiert" werden. To work with the Data Flash module, it must be "formatted". Das geschieht im DFLASH Menü, welches über das Hauptmenü erreichbar ist. That happens in DFLASH menu, which is accessible via the main menu. Im Gegensatz zu flüchtigen Speichern (RAM) oder Festplatten sind Schreibzugriffe auf Flash oder EEPROM Speicher nur in begrenzter Anzahl möglich. Unlike volatile memory (RAM) and hard drives are writes to Flash or EEPROM memory available only in limited quantities. Meistens liegt diese Zahl zwischen 10000 und 1 Million, je nach Speichertyp und Hersteller. In most cases, this number is between 10000 and 1 million, depending on the storage type and manufacturer. Um die Speicherblöcke möglichst gleichmäßig "abzunutzen" enthalten sie einen Zähler, der bei jedem Schreibvorgang um 1 erhöht wird. The memory blocks as uniformly as possible, "wear out" they contain a counter that is incremented at each write operation by 1. Wenn eine Datei erzeugt wird, werden nun Blöcke mit möglichst niedrigem Zählerstand verwendet und auch beim häufigen Schreiben auf den gleichen Block kann es passieren, dass ein neuer Block mit niedrigerem Zählerstand gesucht wird. When a file is created, then blocks are used with the lowest possible count and also when frequent writes to the same block, it may happen that a new block with a lower count is searched. Darum muss man sich aber nicht kümmern, das Ganze passiert völlig transparent, kann aber zu kurzzeitigen Verzögerungen im Programmablauf führen. Why you need to take care of but not the whole thing happens completely transparent, but may result in brief delays in program execution. Die Dataflash-Module sollten nicht allzu häufig formatiert werden, da dabei die Informationen über den "Abnutzungsgrad" der Blöcke verloren gehen. The Data Flash Modules should not be formatted too often, because the information is lost while the "wear level" the blocks. Der freie Speicherplatz ist in Blöcke (Pages) von 256 Bytes aufgeteilt, die wiederum maximal 128/256 Dateien (Files) zugeordnet werden können. The free space is divided into blocks (pages) of 256 bytes, which in turn can max 128/256 files (files) are assigned. Jede Datei kann minimal 1 und maximal 128 Datenblöcke enthalten was Dateigrößen von 256 Bytes bis 32 Kilobytes erlaubt. Each file can be a minimum of 1 and a maximum of 128 data blocks which contain file sizes of 256 bytes to 32 kilobytes allowed. Dateinamen, wie man sie vom PC her kennt, gibt es hier aber nicht. File name, how you know them from the PC, there is not. Damit Dateien in der Fileselect-Box unterscheidbar sind, haben sie einen fest eincodierten Typ und die ersten 12 Bytes werden als Dateiname angezeigt. So files distinguishable in the file select box, they have a fixed-encoded type and the first 12 bytes are displayed as a file name. Wenn USR Dateien angelegt werden, sollte auch in die ersten 12 Bytes eine mehr oder weniger eindeutige Identifizierung geschrieben werden. If USR files are created in the first 12 bytes should be a more or less unique identifier is written. Der Einfachkeit halber kann man auch den ersten Block der Datei nur für den Namen reservieren, auch wenn dadurch Speicherplatz verschenkt wird. For simplicity, you can also book the first block of the file just for the name, even if that space is wasted. Ansonsten wird einfach mit der Dateinummer gearbeitet. Otherwise, simply worked with the file number. Zusätzlich gibt es noch die Befehle RREAD und RWRITE, mit denen Pages im Dataflash direkt gelesen oder geschrieben werden können. In addition, there are the commands and RREAD RWRITE with which pages the DataFlash can be read or written.

4.1 FTYPE(n) 4.1 FTYPE (s)

Die Funktion FTYPE liefert entweder den Flashtyp (n=-1) oder der Dateityp der Datei n. Für n=-1 ist das Resultat The function returns either the FTYPE Flash type (n = -1) or the type of the file is n for n = -1, the result


Wert Value Bedeutung Importance
0 0 kein Dataflash angeschlossen no DataFlash connected
2048 2048 4MBit Dataflash angeschlossen Connected 4Mbit DataFlash
4096 4096 8MBit Dataflash angeschlossen Connected 8Mbit dataflash


für 0<=n<=255 ist das Resultat (derzeit) for 0 <= n <= 255 the result is (currently)


Wert Value Bedeutung Importance
252 252 Datei ist nicht belegt File is not in use
16 16 BASIC-Programm BASIC program
18 18 Backup-Datei Backup file
20 20 USR-Datei USR file
22 22 Chip8-Datei Chip8 file
24 24 AVR-Binärdatei AVR binary
26 26 GPS-Positionsliste GPS location list
28 28 Sampling data (Messdaten) Sampling data (metrics)
30 30 Logikblock-Definition Logic block definition
31 31 Image-Datei Image File
32 32 Screenshot-Datei Screenshot File
34 34 S12(X)-Binärdatei S12 (X) binary
-1 -1 Dateinummer existiert nicht File number does not exist




4.2 FSIZE(n) 4.2 FSIZE (s)

Die Funktion FSIZE(n) liefert entweder die Zahl der verfügbaren Files/Pages oder die Größe einer datei in 256Bytes-Pages. The function FSIZE (n) returns either the number of available files / pages or the size of a file in 256Bytes pages.


n n Rückgabewert Return Value
-1 -1 Anzahl der freien Files # Of Files
-2 -2 Anzahl der freien Pages Number of free pages
0...255 0 .. 255 Anzahl der Pages in der Datei oder 0 (nicht belegt) Number of pages in the file, or 0 (not used)




4.3 FCREATE f,p [FCR] FCREATE f 4.3, p [FCR]

Erzeugt das USR-File f mit p Pages. Generates the USR file with f p Pages. Die Anzahl der Pages kann dabei zwischen 1 und 128 liegen was einer Dateigröße von 256 Bytes...32 Kbytes entspricht. The number of pages may be from 1 to 128 representing a file size of 256 bytes ... equivalent to 32 Kbytes. Da FCREATE im Fehlerfall abbricht, sollte vorher mit FTYPE und FSIZE sichergestellt werden, dass die Datei auch erzeugt werden kann. Since FCREATE aborts on failure should first be ensured with FTYPE FSIZE and that the file can also be generated. Es werden immer Files vom Typ USR (Dateityp 0x14) erzeugt, ausser es wird als dritter Parameter ein anderer Dateityp angegeben. It always generates files of type USR (file type 0x14), unless it is specified as the third argument to another file type.
40 'create file F with P pages 40 'create file F with P pages
41 'R=F or -1 if failed 41 'R = F or -1 if failed
42 R=-1:IF P<1 THEN RETURN 42 R = -1: IF P <1 THEN RETURN
43 IF P>128 THEN RETURN 43 IF P> 128 THEN RETURN
44 IF FTYPE(-1)=0 THEN RETURN 44 IF FTYPE (-1) = 0 THEN RETURN
45 IF FTYPE(F)<>0 THEN RETURN 45 IF FTYPE (F) <> 0 THEN RETURN
46 IF FSIZE(-2)<P THEN RETURN IF FSIZE 46 (-2) <P THEN RETURN
47 FCREATE F,P: R=F: RETURN 47 FCREATE F, P: R = F: RETURN
Die Subroutine erzeugt das File F mit P Pages, wenn dies möglich ist. The sub-routine generates the file F with P pages, if this is possible. In der Variable R steht dann das Resultat: entweder die Filenummer F oder -1, falls das Anlegen des Files nicht möglich ist. In the variable R is then the result of either the file number F or -1, if the creation of the file is not possible. Zu beachten ist dabei, daß für diese Funktion das letzte Drittel des Array (Zelle 512-767) temporär genutzt wird und dort befindliche Daten überschrieben werden. It should be noted that for this function, the last third of the array (cells 512-767) and used temporarily located there will be overwritten.

4.4 FWRITE f,p,a [FWR] 04.04 FWRITE f, p, a [FWR]

Schreibt 256 Bytes aus dem Array in die Page P von File F. Der dritte Parameter bestimmt die Arrayposition: Writes 256 bytes from the array in the Page File P of F. The third parameter specifies the array position:


a a Arraybereich Array area
0 0 0...255 0 .. 255
1 1 256...511 256th .. 511
2 2 512...767 512th .. 767


Da FWRITE im Fehlerfall abbricht, sollte vorher mit FTYPE und FSIZE sichergestellt werden, dass die Page auch geschrieben werden kann. Since FWRITE aborts on failure should first be ensured with FTYPE FSIZE and that the page can be written.
50 'write array 0...255 to 50 'writeArray 0 .. 255 to
51 'file F in page P 51 'F file in page P
52 R=-1:IF P<1 THEN RETURN 52 R = -1: IF P <1 THEN RETURN
53 IF FTYPE(F)<>20 THEN RETURN 53 IF FTYPE (F) <> 20 THEN RETURN
54 IF P>FSIZE(F) THEN RETURN 54 IF P> FSIZE (F) THEN RETURN
55 FWRITE F,N,0: R=F: RETURN 55 FWRITE F, N 0, R = F: RETURN
Die Subroutine schreibt den Inhalt der Arrayzellen 0...255 in die Page P von File F. In der Variable R steht das Resultat: entweder die Filenummer F oder -1, falls das Schreiben der Page nicht möglich ist. The subroutine writes the contents of the cell array 0 .. 255 in the Page File P of F. The variable R is the result: either the file number F or -1 if the letter of the page is not possible.

4.5 FREAD f,p,a [FRD] 5.4 FREAD f, p, a [FRD]

Liest 256 Bytes aus Page P von File F und schreibt sie in das Array. Reads 256 bytes of file F from Page P and writes to the array. Der dritte Parameter bestimmt wieder die Arrayposition: The third parameter specifies the array position again:


a a Arraybereich Array area
0 0 0...255 0 .. 255
1 1 256...511 256th .. 511
2 2 512...767 512th .. 767


Da FREAD im Fehlerfall abbricht, sollte vorher mit FTYPE und FSIZE sichergestellt werden, dass die Page auch gelesen werden kann. Since FREAD aborts on failure should first be ensured with FTYPE FSIZE and that the page can be read.
50 'read page P of file F to 50 'read page of file F to P
51 'array 256...511 51 array '256th .. 511
52 R=-1:IF P<1 THEN RETURN 52 R = -1: IF P <1 THEN RETURN
53 IF FTYPE(F)<>20 THEN RETURN 53 IF FTYPE (F) <> 20 THEN RETURN
54 IF P>FSIZE(F) THEN RETURN 54 IF P> FSIZE (F) THEN RETURN
55 FREAD F,N,1: R=F: RETURN 55 FREAD F, N 1, R = F: RETURN
Die Subroutine liest den Inhalt der Page P von File F in die Arrayzellen 256...511. The subroutine reads the contents of page P of file F in the array cells .. 256th 511th In der Variable R steht das Resultat: entweder die Filenummer F oder -1, falls das Lesen der Page nicht möglich ist. In the variable R is the result of either the file number F or -1 if the reading of the page is not possible.

4.6 FDELETE f [FDEL] 4.6 FDELETE f [FDEL]

Löscht das File F, wenn es vorhanden und vom Typ USR ist. Deletes the file F, if it exists, and the type USR. Da FDELETE im Fehlerfall abbricht, sollte vorher mit FTYPE und FSIZE sichergestellt werden, dass das File vorhanden ist. Since FDELETE aborts on failure should first be ensured with FTYPE FSIZE and that the file exists.
56 'delete file F 56 'delete file F
57 R=-1 57 R = -1
58 IF FTYPE(F)<>20 THEN RETURN 58 IF FTYPE (F) <> 20 THEN RETURN
59 FDELETE F: R=F: RETURN 59 FDELETE F: R = F: RETURN
Die Subroutine löscht das File F, falls es vorhanden ist. The subroutine deletes the file F, if it exists.

4.7 FSELECT v,a [FSEL] FSELECT v 4.7, a [FSEL]

Stellt die Fileselect-Box dar, falls ein formatierter Dataflash-Baustein angeschlossen ist. Represents the file select box, if a formatted data flash module is connected. Die Nummer des gewählten Files liegt im Anschluss in der Variable v. Ist der Dataflash nicht ansprechbar oder wird die Auswahl mit der ESC-Taste abgebrochen, wird die Variable v auf -1 gesetzt. The number of the selected file is located in the port in the variable v. If the data flash can not be addressed or the selection canceled with the ESC key, the variable v is set to -1. Der wert a ist die Array-Position, ab der die nullterminierte Boxüberschrift steht. The value a is the array position, from which the zero-terminated Boxüberschrift stands. Der Rahmen der Fileselct-Box wird mit der aktuell eingestellten Vordergrundfarbe gezeichnet, der Hintergrund ist immer schwarz. The frame of the Fileselct box is drawn with the currently set foreground color, the background is always black. Der ursprüngliche Bildinhalt wird nach Verlassen der Fileselect-Box wiederhergestellt. The original image content is restored after leaving the file select box.
60 'draw fileselct box 60 'draw fileselct box
61 DATA 0,"Select file:",0 61 DATA 0, "Select file:", 0
62 FSELECT F,0: RETURN 62 FSELECT F, 0: RETURN
Die Subroutine zeigt eine Filelesect-Box mit dem Titel "Select file:". The subroutine Filelesect shows a box with the title "Select file".

4.8 FFIND(a) 8.4 FFIND (a)

Da das Dateisystem nicht mit Verzeichnissen arbeitet, braucht man die Dateinummer um in eine bestimmte Datei zu schreiben oder von ihr zu lesen. Because the file system does not work with directories, you need to write the file number to a specified file or read from it. Dazu dient die Funktion FFIND . Serves the function FFIND. Der Parameter a ist wieder ein Zeiger auf den Bytebereich des Arrays. The parameter a is again a pointer to the byte range of the array. Das erste Byte gibt den gesuchten Dateityp an (siehe Tabelle oben), danach folgt die Anzahl der zu vergleichenden Bytes am Anfang der Datei und das Vergleichsmuster. The first byte is the desired file type (see table above), then the number of bytes to be compared, followed by the beginning of the file and the comparison sample. Rückgabewert ist die erste gefundene Dateinummer oder -1, falls keine entsprechende Datei gefunden wurde. Returns the first file number, or -1 if no such file exists.
10 DATA 0,252,0:F=FFIND(0) 0,252,0 10 DATA: F = FFIND (0)
Es wird nach der ersten freien Datei gesucht (Kennung 252) und liefert die Dateinummer bzw. -1 falls keine freie Datei mehr vorhanden ist. It searches for the first free file (code 252) and returns the file number, or -1 if no more free file exists.

5 Direktzugriff auf das Dataflash-Modul 5 direct access to the data flash module

In manchen Fällen kann es sinnvoll sein, anstelle der Dateisystemfunktionen Daten direkt auf das Dataflash-Modul zu schreiben oder von dort zu lesen. In some cases it may make sense, instead of the file system functions to write data directly to the data flash module or read from there. Dazu dienen die folgenden beiden Befehle: Serve the following two commands:

5.1 RREAD p,a [RRD] 5.1 RREAD p, a [RRD]

Liest 256 Bytes aus Page P und schreibt sie in das Array. Reads 256 bytes from Page P and writes to the array. P ist hierbei die Page-Nummer im Dataflash und bezieht sich nicht auf eine Datei. P is the page number in the Data Flash and does not refer to a file. Der zweite Parameter bestimmt wieder die Arrayposition: The second parameter specifies the array position again:


a a Arraybereich Array area
0 0 0...255 0 .. 255
1 1 256...511 256th .. 511
2 2 512...767 512th .. 767


Da RREAD im Fehlerfall abbricht, sollte sichergestellt sein, dass die Page auch gelesen werden kann. Since RREAD aborts on failure, it should be ensured that the page can be read.

5.2 RWRITE p,a [RWR] 2.5 RWRITE p, a [RWR]

Schreibt 256 Bytes aus dem Array in die Page P. P ist hierbei die Page-Nummer im Dataflash und bezieht sich nicht auf eine Datei. Writes 256 bytes from the array into the Page P. P here is the page number in the Data Flash and does not refer to a file.
Achtung! Diese Funktion kann das Dateisystem zerstören und sollte deshalb nur mit Vorsicht oder auf unformatierte Dataflash-Bausteine angewendet werden. Attention This feature can damage the file system and should therefore be used with caution or unformatted data flash devices. Der zweite Parameter bestimmt die Arrayposition: The second parameter specifies the array position:


a a Arraybereich Array area
0 0 0...255 0 .. 255
1 1 256...511 256th .. 511
2 2 512...767 512th .. 767


Da RWRITE im Fehlerfall abbricht, sollte sichergestellt sein, dass die Page auch geschrieben werden kann. Since RWRITE aborts on failure, it should be ensured that the page can be written.

6 Laden und Speichern von Programmen 6 Loading and saving programs

Da die BASIC Programme mit 95 Zeilen a 32 Zeichen nicht gerade sehr üppig ausgestattet sind, gibt es die Möglichkeit, Programme während der Laufzeit auf den Dataflash zu schreiben oder von dort zu laden. Since the BASIC programs with 95 lines of 32 characters is not just equipped very rich, it is possible to write programs during the term of the Data Flash or to download it from there.

6.1 LOADP f,p 1.6 LOADP f, p

Lädt das Programm mit der Dateinummer f an den Programmplatz p. The program loads the file number of f p at the program location. Dabei ist es nicht möglich, das gerade laufende Programm zu überschreiben. It is not possible to overwrite the currently running program. Wird dies versucht, bricht das Programm mit einer Fehlermeldung ab. If this is attempted, the program terminates with an error message.

6.2 SAVEP f,p 2.6 SAVEP f, p

Schreibt das Programm von Programmplatz n in die Datei mit der Nummer f. Dazu muß die Datei entweder nicht vorhanden oder eine Programmdatei sein. VORSICHT , eine eventuell vorhandene Datei wird ohne Nachfrage überschrieben! Writes the program on channel position n in the file f with the number given by the file must be either non-existent or a program file. CAUTION, an existing file is overwritten without asking!
10 DATA 0,252,0:C=FFIND(0) 0,252,0 10 DATA: C = FFIND (0)
11 IF C<0 THEN E=1:RETURN 11 IF C <0 then e = 1: RETURN 
12 DATA 0,16,4,"Test" 12 DATA 0,16,4, "test"
13 D=FFIND(0) 13 D = FFIND (0)
14 IF D<0 THEN E=2:RETURN 14 IF D <0 THEN A = 2: RETURN 
15 SAVEP C,8:LOADP D,8 SAVEP 15 C, 8: LOADP D, 8
16 GOSUB 8,1:LOADP C,8 GOSUB 16 8.1: LOADP C, 8
17 FDELETE C:E=0:RETURN 17 FDELETE C: E = 0: RETURN
Dieses Unterprogramm sucht nach einem freien Dateiplatz und nach einer Programmdatei, die mit "Hallo" beginnt. This subroutine searches for a free space and file for a program file that starts with "Hello". Ist beides gefunden, wird das aktuelle Programm 8 auf dem freien Speicherplatz gesichert, das Hallo-Programm in Programmplatz 8 geladen und dann mittelx GOSUB gestartet. If both are found, the current program is backed up 8 on the free space, loaded the Hello program in program No. 8 and then started mittelx GOSUB. Wenn das Programm dann mittels RETURN zurückkehrt, wird das ursprünglich an Programmplatz 8 befindliche Programm wiederhergestellt und die temporär erzeugte Datei gelöscht. If the program then returns via RETURN, the program originally located at position 8 program restores deleted and the temporary file generated. Das aufgerufene Programm sollte dabei die Variable C nicht ändern. The called program should not change while the variable C.

7 Meldungen und Fragen in der Box 7 Messages and questions in the box



7.1 ALERT n 7.1 ALERT n

Zeigt eine Alert-Box an. Displays an alert box. Die Daten dazu befinden sich im Array ab Position n. Als Erstes steht dort ein Byte (Vordergrundfarbe + 16 * Hintergrundfarbe), gefolgt von nullterminiertem Text. The data for these are in the array at position n First, there is a byte (foreground color, background color + 16 *), followed by nullterminiertem text. Fehlt der Abschluss mit 0x00, wird die Ausgabe nach 20 Zeichen abgebrochen. Missing the final with 0x00, the output is only the first 20 characters. Der aktuelle Bildschirminhalt wird vorher gesichert und nach Betätigen der ENTER Taste wieder restauriert. The graphics are saved before and after pressing the ENTER key again restored.
01 DATA 0,97,"Hallo Welt",0 01 DATA 0.97, "Hello World", 0
02 ALERT 0 02 ALERT 0
Zeichnet eine Alertbox mit blauer Schrift Hallo Welt auf gelbem Grund. Draw an alert box with blue text Hello World on a yellow background. Wird die Enter Taste gedrückt, verschwindet die Box wieder. When the Enter key is pressed, the box disappears.

7.2 ASK V,n ASK 2.7 V, n

Zeigt eine Frage-Box an. Shows a question box. Die Daten dazu befinden sich im Array ab Position n. Zuerst steht dort ein Byte (Vordergrundfarbe + 16 * Hintergrundfarbe), gefolgt von nullterminiertem Text. The data for these are in the array at position n First, there is a byte (foreground color, background color + 16 *), followed by nullterminiertem text. Fehlt der Wert 0x00, wird die Ausgabe nach 20 Zeichen abgebrochen. 0x00 is missing the value, the output is only the first 20 characters.
01 DATA 0,97,"Weitermachen?",0 01 DATA 0.97, "continue", 0
02 ASK P,0 ASK 02 P 0
03 IF P=0 WAIT 20: GOTO 2 03 IF P = 0 WAIT 20: GOTO 2
04 ? 04? "Ende" "End"
Wenn "Y" oder Enter gedrückt wurde, bekommt P den Wert 1 zugewiesen, wurde "N" oder ESC gedrückt, erhält P den Wert 0. If "Y" or Enter is pressed, P gets assigned a value of 1, was "N" or ESC is pressed in, the P value 0 Groß- und Kleinschreibung spielt dabei keine Rolle. Uppercase and lowercase letters does not matter. Der aktuelle Bildschirminhalt wird vorher gesichert und nach Betätigen einer gültigen Taste wieder restauriert. The graphics are saved before and after pressing a button valid restored.

8 Menü-Funktionen 8 Menu functions



8.1 MENU(n) 8.1 MENU (s)

Die Funktion MENU(n) zeigt ein User-definiertes Menu an. The function MENU (n) indicates a user-defined menu. Dabei zeigt n auf eine Zeile im aktuellen Programm, ab der in 1 oder 2 Kommentarzeilen Arraytext hinterlegt sind. Here, n points to a line in the current program from the stored in 1 or 2 comment lines are array text. Das letzte Zeichen in der ersten Zeile enthält zwei Steuerbits. The last character in the first line contains two control bits. Diese lsssen sich zB mittels der Ziffern "0"..."3" einstellen: This lsssen for example the digit "0" ... "3":


Zeichen Sign Menü-Eigenschaften Menu Properties
0 0 Eine Menü-Ebene, Funktion kehrt nur beim Drücken einer der in der nächsten Tabelle gelisteten Tasten zurück. One menu level, function returns only when you press any of the keys listed in the following table.
1 1 Zwei Menü-Ebenen, Funktion kehrt nur beim Drücken einer der in der nächsten Tabelle gelisteten Tasten zurück. Two menu levels, function returns only when you press any of the keys listed in the following table.
2 2 Eine Menü-Ebene, Funktion kehrt nur beim Drücken einer beliebigen Taste zurück (ausser Shift, CTrl und Alt). One menu level, function returns only when you press any button (except Shift, Ctrl and Alt).
2 2 Zwei Menü-Ebenen, Funktion kehrt nur beim Drücken einer beliebigen Taste zurück (ausser Shift, CTrl und Alt). Two menu levels, function returns only when you press any button (except Shift, Ctrl and Alt).


Die folgende Tabelle listet die Rückgabewerte auf, die beim Betätigen der Tasten ESC und F1...F3 auf. The following table lists the return values ​​on when you press the ESC and F1 ... F3. Für alle anderen tasten wird der "normale" Tastencode zurückgeliefert. Keys for all the other "normal" key code is returned.
Offset Offset Taste Button Rückgabewert Return Value
0...5 0 .. 5 ESC ESC 1 1
6...11 6th .. 11 F1 F1 2 2
12...17 12 .. 17 F2 F2 3 3
18...23 18th .. 23 F3 F3 4 4
24...29 24th .. 29 F4 F4 5 5
30...35 30th .. 35 linke CTRL + ESC Left CTRL + ESC 6 6
36...41 36 .. 41 linke CTRL + F1 Left CTRL + F1 7 7
42...47 42 .. 47 linke CTRL + F2 Left CTRL + F2 8 8
48...53 48th .. 53 linke CTRL + F3 Left CTRL + F3 9 9
54...59 54th .. 59 linke CTRL + F4 Left CTRL + F4 10 10


Das folgende Programm zeigt ein Beispielmenü an. The following program shows an example menu. Die Daten dazu befinden sich in den Zeillen 1 und 2 The data to be found in the 1 and 2 Zeillen
01 '1111112222223333334444445555551 01 '1111112222223333334444445555551
02 '666666777777888888999999AAAAAA 02 '666666777777888888999999AAAAAA
03 A=MENU(1) MENU = 03 A (1)
04 ? 04? @0,0;"Menu:",A," " @ 0.0, "Menu:" A, ""
05 B=KEY(2):IF A>1 GOTO 3 KEY = 05 B (2): IF A> 1 GOTO 3
Mit der linken CTRL-Taste kann zwischen beiden Menüebenen hin- und hergeschaltet werden. With the left CTRL key can be between two menu levels and forth. Dabei wird gewartet, bis eine gültige Taste (ESC, F1...F4) gedrückt wurde und in der obersten Zeile wird der letzte Rückgabewert angezeigt. ESC bricht das Programm ab. It waits until a valid key (Esc, F1 ... F4) was pressed and the top line is the last return value displayed. ESC aborts the program.

created with latex2web.pl v0.62 © 2006-2011 Joerg Wolfram Created with latex2web.pl v0.62 © 2006-2011 Joerg tungsten