2014-05-18 19:57:12 +02:00
|
|
|
{{ VGA-64Farben
|
2014-04-30 20:24:00 +02:00
|
|
|
┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
2014-05-18 19:57:12 +02:00
|
|
|
│ Autor: Ingo Kripahle,Reinhard Zielinski │
|
|
|
|
│ Copyright (c) 2013 Ingo Kriphale,Reinhard Zielinski │
|
2014-04-30 20:24:00 +02:00
|
|
|
│ See end of file for terms of use. │
|
|
|
|
│ Die Nutzungsbedingungen befinden sich am Ende der Datei │
|
|
|
|
└──────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
|
|
|
|
Informationen : hive-project.de
|
2014-05-18 19:57:12 +02:00
|
|
|
Kontakt : zille9@googlemail.com
|
2014-04-30 20:24:00 +02:00
|
|
|
System : Hive
|
2014-05-18 19:57:12 +02:00
|
|
|
Name : VGA-Tile-Treiber 640x480 Pixel, 40x28 Tiles
|
2014-04-30 20:24:00 +02:00
|
|
|
Chip : Bellatrix
|
|
|
|
Typ : Treiber
|
2014-05-18 19:57:12 +02:00
|
|
|
Version : 01
|
|
|
|
Subversion : 00
|
2014-04-30 20:24:00 +02:00
|
|
|
Funktion : Standard VGA-Text- und Tastatur-Treiber
|
|
|
|
|
|
|
|
Dieser Bellatrix-Code kann als Stadardcode im EEPROM gespeichert werden Tilebasierten-Textbildschirm
|
|
|
|
und Tastaturfunktionen. Mit dem integrierten Loader kann Bellatrix
|
|
|
|
mit einem beliebigen anderen Code geladen werden.
|
|
|
|
|
|
|
|
Komponenten : VGA64 Tilemap Engine // Author: Kwabena W. Agyeman
|
|
|
|
PS/2 Keyboard Driver v1.0.1 Chip Gracey, ogg MIT
|
|
|
|
|
|
|
|
COG's : MANAGMENT 1 COG
|
|
|
|
VGA 1 COG's
|
|
|
|
KEYB 1 COG
|
|
|
|
-------------------
|
|
|
|
3 COG's
|
|
|
|
|
|
|
|
Logbuch :
|
|
|
|
|
|
|
|
23-10-2008-dr235 - erste funktionsfähige version erstellt
|
|
|
|
- cursor eingebaut
|
|
|
|
06-11-2008-dr235 - keyb auf deutsche zeichenbelegung angepasst (ohne umlaute)
|
|
|
|
24-11-2008-dr235 - tab, setcur, pos1, setx, sety, getx, gety, setcol, sline, screeninit
|
|
|
|
curon, curoff
|
|
|
|
- beltest
|
|
|
|
13-03-2009-dr235 - LF als Zeichencode ausgeblendet
|
|
|
|
22-03-2009-dr235 - abfrage für statustasten eingefügt
|
|
|
|
05-09-2009-dr235 - abfrage der laufenden cogs eingefügt
|
|
|
|
- deutschen tastaturtreiber mit vollständiger belegung! von ogg eingebunden
|
|
|
|
22-03-2010-dr235 - anpassung trios
|
|
|
|
01-05-2010-dr235 - scrollup/scrolldown eingebunden & getestet
|
|
|
|
03-05-2010-dr235 - settab/getcols/getrows/getresx/getresy eingefügt & getestet
|
|
|
|
- hive-logo eingefügt
|
|
|
|
-------------------
|
|
|
|
26-01-2011-dr235 - übernahme und anpassung des treibers aus trios
|
|
|
|
31-01-2011-dr235 - backspace als direktes steuerzeichen ($C8) eingefügt
|
|
|
|
01-02-2011-dr235 - multiscreenfähigkeit implementiert
|
|
|
|
- 88 - mgr_wscr: steuert, in welchen screen zeichen geschrieben werden
|
|
|
|
- 89 - mgr_dscr: steuert welcher screen angezeigt wird
|
|
|
|
05-02-2011-dr235 - umwandlung backspace $c8 --> $08
|
|
|
|
06-03-2011-dr235 - revision der steuercodes; nur noch funktionen mit parameter
|
|
|
|
werden über eine 0-sequenz aufgerufen, alle anderen steuerzeichen
|
|
|
|
werden auf 1-byte-zeichen abgebildet
|
|
|
|
20-04-2011-dr235 - integration einer kompatiblen loaderroutine, damit kann der treiber
|
|
|
|
jetzt direkt aus dem rom gestartet und dennoch bella-code nachgeladen
|
|
|
|
werden kann
|
|
|
|
31.12.2011-dr235 - anpassung für verschiedene zeilenumbrüche in print_char eingefügt
|
|
|
|
|
|
|
|
02-04-2013-zille9 - Kompletter Umbau durch Einbindung eines anderen Grafiktreibers
|
|
|
|
|
|
|
|
02-06-2013-zille9 - Startbild ala Amiga eingebunden, fordert zum Einlegen einer SD-Card mit TRIOS auf
|
|
|
|
|
|
|
|
28-12-2013-zille9 - Fensterfunktionen für 8 Windows mit 8 verschiedenen Stilen geschaffen
|
|
|
|
- Button-Funktionen auf Abfrage der Mauskoordinaten beschränkt, grafische Funktionen werden wieder von Regnatix erledigt
|
|
|
|
- dadurch Code gespart, da nur noch die Koordinaten-Puffer und die Button-Nummer benötigt werden
|
|
|
|
05-01-2014-zille9 - Fensterverwaltung überarbeitet, bei Klick auf ein Fensterbutton wird die Fensternummer*10+Buttonnummer zurückgegeben
|
|
|
|
- Beispiel:Schließen Symbol im Fenster 2 gibt 22 zurück (20 für Fenster 2 und 2 für Fensterbutton 2)
|
|
|
|
- dadurch wird es möglich, mehrere Fenster auf Funktionen abzufragen
|
2014-05-18 19:57:12 +02:00
|
|
|
- 234 Longs frei
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
Notizen:
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
|
|
|
|
CON
|
|
|
|
|
|
|
|
_CLKMODE = XTAL1 + PLL16X
|
|
|
|
_XINFREQ = 5_000_000
|
|
|
|
|
|
|
|
'signaldefinitionen bellatrixix
|
|
|
|
|
|
|
|
#0, D0,D1,D2,D3,D4,D5,D6,D7 'datenbus
|
|
|
|
#8, BEL_VGABASE 'vga-signale (8pin)
|
|
|
|
#16, BEL_KEYBC,BEL_KEYBD 'keyboard-signale
|
|
|
|
#18, BEL_MOUSEC,BEL_MOUSED 'maus-signale
|
|
|
|
#20, BEL_VIDBASE 'video-signale(3pin)
|
|
|
|
#23, BEL_SELECT 'belatrix-auswahlsignal
|
|
|
|
#24, HBEAT 'front-led
|
|
|
|
BUSCLK 'bustakt
|
|
|
|
BUS_WR '/wr - schreibsignal
|
|
|
|
BUS_HS ' '/hs - quittungssignal
|
|
|
|
#41, RTC_GETSECONDS 'Returns the current second (0 - 59) from the real time clock.
|
|
|
|
RTC_GETMINUTES 'Returns the current minute (0 - 59) from the real time clock.
|
|
|
|
RTC_GETHOURS 'Returns the current hour (0 - 23) from the real time clock.
|
|
|
|
' +----------
|
|
|
|
' | +------- system
|
|
|
|
' | | +---- version (änderungen)
|
|
|
|
' | | | +- subversion (hinzufügungen)
|
|
|
|
'CHIP_VER = $00_01_02_01
|
|
|
|
'
|
|
|
|
' +----------
|
|
|
|
' | +--------
|
|
|
|
' | |+------- vektor
|
|
|
|
' | ||+------ grafik
|
|
|
|
' | |||+----- text
|
|
|
|
' | ||||+---- maus
|
|
|
|
' | |||||+--- tastatur
|
|
|
|
' | ||||||+-- vga
|
|
|
|
' | |||||||+- tv
|
|
|
|
CHIP_SPEC = %00000000_00000000_00000000_00011110
|
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
|
2014-04-30 20:24:00 +02:00
|
|
|
KEYB_DPORT = BEL_KEYBD 'tastatur datenport
|
|
|
|
KEYB_CPORT = BEL_KEYBC 'tastatur taktport
|
|
|
|
mouse_dport = BEL_MOUSED
|
|
|
|
mouse_cport = BEL_MOUSEC
|
|
|
|
|
|
|
|
' hbeat --------+
|
|
|
|
' clk -------+|
|
|
|
|
' /wr ------+||
|
|
|
|
' /hs -----+||| +------------------------- /cs
|
|
|
|
' |||| | -------- d0..d7
|
|
|
|
DB_IN = %00001001_00000000_00000000_00000000 'maske: dbus-eingabe
|
|
|
|
DB_OUT = %00001001_00000000_00000000_11111111 'maske: dbus-ausgabe
|
|
|
|
|
|
|
|
M1 = %00000010_00000000_00000000_00000000
|
|
|
|
M2 = %00000010_10000000_00000000_00000000 'busclk=1? & /cs=0?
|
|
|
|
|
|
|
|
M3 = %00000000_00000000_00000000_00000000
|
|
|
|
M4 = %00000010_00000000_00000000_00000000 'busclk=0?
|
2014-05-18 19:57:12 +02:00
|
|
|
|
2014-04-30 20:24:00 +02:00
|
|
|
_pinGroup = 1
|
2014-05-18 19:57:12 +02:00
|
|
|
_startUpWait = 2
|
|
|
|
|
2014-04-30 20:24:00 +02:00
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
buttonbuff=33 'Buttonanzahl 1-32 Textbutton oder icon
|
2014-04-30 20:24:00 +02:00
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
Bel_Treiber_Ver=88 'Bellatrix-Treiberversion
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
OBJ
|
|
|
|
vga : "VGA64_Engine"
|
2014-05-18 19:57:12 +02:00
|
|
|
keyb : "bel-keyb"
|
2014-04-30 20:24:00 +02:00
|
|
|
mouse : "mouse64"
|
|
|
|
|
|
|
|
VAR
|
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
long keycode 'letzter tastencode
|
2014-04-30 20:24:00 +02:00
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
long plen 'länge datenblock loader
|
|
|
|
byte proghdr[16] 'puffer für objektkopf
|
|
|
|
byte mouseshow 'Mouse-Pfeil anzeigen oder nicht
|
|
|
|
byte strkette[40] 'stringpuffer fuer Scrolltext
|
2014-04-30 20:24:00 +02:00
|
|
|
word tnr,XPos,YPos
|
2014-05-18 19:57:12 +02:00
|
|
|
byte bnumber[buttonbuff],bx[buttonbuff],by[buttonbuff],bxx[buttonbuff] 'buttonvariable fuer 33 Buttons
|
|
|
|
word xbound,ybound,xxbound,yybound 'x und y bereich der Mouse eingrenzen
|
|
|
|
long mousetile[16] 'User-Mousetilebuffer
|
2014-04-30 20:24:00 +02:00
|
|
|
byte hintergr
|
2014-05-18 19:57:12 +02:00
|
|
|
byte actor[5] 'Actor-Sprite [Tilenr,col1,col2,col3,x,y] Spielerfigur
|
2014-04-30 20:24:00 +02:00
|
|
|
byte action_x,old_action_x
|
|
|
|
byte action_y,old_action_y
|
2014-05-18 19:57:12 +02:00
|
|
|
byte sprite_x[8],sprite_y[8],sprite_old_x[8],sprite_old_y[8] 'x,y-Parameter der Sprites
|
|
|
|
byte spritenr[16] 'Tilenr der Sprites+Alternativ-Sprites
|
|
|
|
byte spritef1[8],spritef2[8],spritef3[8] 'farben der Sprites
|
|
|
|
byte sprite_dir[8] 'Bewegungsrichtung der Sprites
|
2014-04-30 20:24:00 +02:00
|
|
|
byte action_key[5]
|
|
|
|
byte sprite_start[8]
|
|
|
|
byte sprite_end[8]
|
|
|
|
byte Sprite_Move
|
|
|
|
byte collision
|
|
|
|
byte block_tile[10]
|
|
|
|
byte sp_alter
|
2014-05-18 19:57:12 +02:00
|
|
|
byte wind[112]
|
|
|
|
byte wint[17] 'Tilenummern für die Fenster
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
CON ''------------------------------------------------- BELLATRIX
|
|
|
|
|
|
|
|
PUB main | zeichen,n,i,x,y ,speed 'chip: kommandointerpreter
|
|
|
|
''funktionsgruppe : chip
|
|
|
|
''funktion : kommandointerpreter
|
|
|
|
''eingabe : -
|
|
|
|
''ausgabe : -
|
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
init_subsysteme 'bus/vga/keyboard/maus initialisieren
|
2014-04-30 20:24:00 +02:00
|
|
|
n:=0
|
|
|
|
speed:=30
|
|
|
|
|
|
|
|
repeat
|
2014-05-18 19:57:12 +02:00
|
|
|
if mouseshow==1 'Mauspfeil anzeigen
|
2014-04-30 20:24:00 +02:00
|
|
|
x+=mouse.delta_x
|
|
|
|
if x=<xbound '<1
|
|
|
|
x:=xbound '1
|
|
|
|
if x=>xxbound'639
|
|
|
|
x:=xxbound'639
|
|
|
|
y+= -mouse.delta_y
|
|
|
|
if y=<ybound'1
|
|
|
|
y:=ybound'1
|
|
|
|
if y=>yybound'479
|
|
|
|
y:=yybound'479
|
|
|
|
XPos :=x
|
|
|
|
YPos :=y
|
|
|
|
'++++++++++++++++++++++++ Sprite-Bewegung ++++++++++++++++++++++++++++++++++++++++++++++++++
|
2014-05-18 19:57:12 +02:00
|
|
|
if Sprite_Move==1
|
2014-04-30 20:24:00 +02:00
|
|
|
repeat i from 0 to 7
|
2014-05-18 19:57:12 +02:00
|
|
|
if(spritenr[i]<176) and collision==0 'sprite definiert? und noch keine Kollision passiert
|
|
|
|
if (sprite_x[i]==action_x) and (sprite_y[i]==action_y) 'sprite an Player-Position?
|
2014-04-30 20:24:00 +02:00
|
|
|
collision:=1
|
|
|
|
quit
|
|
|
|
n++
|
|
|
|
if n==speed
|
|
|
|
Set_Sprite_XY
|
|
|
|
if n>speed+1
|
|
|
|
n:=0
|
|
|
|
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
zeichen := bus_getchar '1. zeichen empfangen
|
|
|
|
if zeichen ' > 0
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
vga.printCharacter(zeichen)
|
|
|
|
|
|
|
|
else
|
2014-05-18 19:57:12 +02:00
|
|
|
zeichen := bus_getchar '2. zeichen kommando empfangen
|
2014-04-30 20:24:00 +02:00
|
|
|
case zeichen
|
2014-05-18 19:57:12 +02:00
|
|
|
1: key_stat '1: Tastaturstatus senden
|
|
|
|
2: key_code '2: Tastaturzeichen senden
|
2014-04-30 20:24:00 +02:00
|
|
|
3: vga.sety(bus_getchar)
|
2014-05-18 19:57:12 +02:00
|
|
|
4: key_spec '4: Statustasten ($100..$1FF) abfragen
|
|
|
|
5: displaymouse '5: Mousezeiger anzeigen
|
|
|
|
6: pchar(bus_getchar) '6: zeichen ohne steuerzeichen ausgeben
|
2014-04-30 20:24:00 +02:00
|
|
|
7: bus_putchar(keyb.taster)
|
|
|
|
keyb.clearkeys
|
2014-05-18 19:57:12 +02:00
|
|
|
8: vga.setx(bus_getchar) '8: x-position setzen
|
|
|
|
9: mousebound '9: mousebereich eingrenzen
|
|
|
|
10: mousex '10:abfrage absulute x-position
|
|
|
|
11: mousey '11:abfrage absulute y-position
|
|
|
|
12: mousez '12:abfrage absulute z-position (Scrollrad)
|
|
|
|
13: keyb.clearkeys 'tastaturpuffer loeschen
|
|
|
|
14: mouse_button(bus_getchar) '14:abfrage Mouse Button
|
|
|
|
15: BoxSize '15:BoxSize
|
2014-04-30 20:24:00 +02:00
|
|
|
' 16: vga.printCursorColor(bus_getchar)
|
|
|
|
17: vga.printCursorRate(bus_getchar)
|
|
|
|
18: PrintBoxColor
|
|
|
|
19: destroy_Button
|
|
|
|
20: scrollup
|
|
|
|
21: scrolldown
|
|
|
|
22: display3DBox
|
|
|
|
23: display3DFrame
|
|
|
|
24: display2DBox
|
|
|
|
25: Get_Button_Param
|
|
|
|
26: scrollString
|
|
|
|
27: displayString
|
|
|
|
30: mousepointer
|
|
|
|
31: vga.printat(bus_getchar,bus_getchar)
|
|
|
|
32: displayTile
|
|
|
|
33: vga.printwindow(bus_getchar)
|
2014-05-18 19:57:12 +02:00
|
|
|
35: loadtile 'Tiledatei in Puffer laden
|
|
|
|
36: displaypic 'komplette Tile-Datei anzeigen
|
|
|
|
37: getx 'Cursor-X-Position abfragen
|
|
|
|
38: gety 'Cursor-Y-Position abfragen
|
2014-04-30 20:24:00 +02:00
|
|
|
39: line(bus_getchar,bus_getchar,bus_getchar,bus_getchar,bus_getchar) 'x,y,xx,yy,farbe
|
|
|
|
40: vga.Plot(bus_getchar,bus_getchar,bus_getchar)
|
2014-05-18 19:57:12 +02:00
|
|
|
41: Sprite_Parameter 'Sprite-Parameter
|
|
|
|
42: Set_Sprite_XY 'Sprite bewegen
|
|
|
|
43: Actor_Parameter 'Player-Parameter
|
|
|
|
44: Set_Actor_XY 'Player bewegen
|
|
|
|
45: Set_Action_Key 'spielertasten
|
|
|
|
46: Reset_Sprite 'Sprite anhalten/loeschen
|
|
|
|
47: SpriteMove 'spritebewegung aktivieren/deaktivieren
|
|
|
|
48: speed:=bus_getchar 'spritegeschwindigkeit
|
|
|
|
49: bus_putchar(collision) 'Kollisionsflag abfragen
|
2014-04-30 20:24:00 +02:00
|
|
|
collision:=0
|
2014-05-18 19:57:12 +02:00
|
|
|
50: Get_Actor_Pos 'Playerposition
|
|
|
|
51: Get_Block 'Tile lesen
|
2014-04-30 20:24:00 +02:00
|
|
|
' 52: Fire_Parameter
|
|
|
|
' 53: Fire
|
2014-05-18 19:57:12 +02:00
|
|
|
54: Displaypalette 'Farbpalette anzeigen
|
|
|
|
55: Del_Window 'Fensterparameter löschen
|
|
|
|
56: Set_Titel_Status 'Titeltext oder Statustext in einem Fenster setzen
|
|
|
|
57: backup_area 'Bildschirmbereich sichern
|
|
|
|
58: restore_area 'Bildschirmbereich wiederherstellen
|
|
|
|
59: Window 'Fensterstil erstellen
|
|
|
|
60: get_window 'Tastendruck im Fenster abfragen
|
|
|
|
61: Change_Backuptile 'Backuptile unter dem Player ändern (Itemsammeln)
|
|
|
|
62: PrintFont 'Text mit Tilefont darstellen
|
|
|
|
63: vga.put(bus_getchar,bus_getchar,bus_getchar)
|
2014-04-30 20:24:00 +02:00
|
|
|
' ---------------------------------------------- CHIP-MANAGMENT
|
2014-05-18 19:57:12 +02:00
|
|
|
96: mgr_getcogs 'freie cogs abfragen
|
|
|
|
87: mgr_load 'neuen bellatrix-code laden
|
|
|
|
98: mgr_bel 'Rückgabe Grafiktreiber 64
|
|
|
|
99: reboot 'bellatrix neu starten
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
PUB init_subsysteme|i',x,y,tn,tmp 'chip: initialisierung des bellatrix-chips
|
|
|
|
''funktionsgruppe : chip
|
|
|
|
''funktion : - initialisierung des businterface
|
|
|
|
'' : - vga & keyboard-treiber starten
|
|
|
|
''eingabe : -
|
|
|
|
''ausgabe : -
|
2014-05-18 19:57:12 +02:00
|
|
|
repeat i from 0 to 7 'evtl. noch laufende cogs stoppen
|
2014-04-30 20:24:00 +02:00
|
|
|
ifnot i == cogid
|
|
|
|
cogstop(i)
|
|
|
|
|
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
dira := db_in 'datenbus auf eingabe schalten
|
|
|
|
outa[bus_hs] := 1 'handshake inaktiv
|
2014-04-30 20:24:00 +02:00
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
keyb.start(keyb_dport, keyb_cport) 'tastaturport starten
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
ifnot vga.TMPEngineStart(_pinGroup, @XPos, @YPos)
|
|
|
|
reboot
|
|
|
|
waitcnt((clkfreq * _startUpWait) + cnt)
|
|
|
|
mouse.start(BEL_MOUSED, BEL_MOUSEC)
|
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
mouseshow:=0 'Mousezeiger aus
|
|
|
|
xbound:=1 'Mouse-Bereich Grundeinstellung
|
2014-04-30 20:24:00 +02:00
|
|
|
xxbound:=639
|
|
|
|
ybound:=1
|
|
|
|
yybound:=479
|
|
|
|
repeat i from 0 to 7
|
2014-05-18 19:57:12 +02:00
|
|
|
spritenr[i]:=255 'sprites abschalten
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
action_key[0]:=2 'action-tasten vorbelegen
|
2014-04-30 20:24:00 +02:00
|
|
|
action_key[1]:=3
|
|
|
|
action_key[2]:=4
|
|
|
|
action_key[3]:=5
|
|
|
|
action_key[4]:=32
|
|
|
|
sp_alter:=0
|
2014-05-18 19:57:12 +02:00
|
|
|
collision:=0
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
vga.printwindow(0)
|
|
|
|
vga.printBoxSize(0,0, 0, 29, 39)
|
|
|
|
vga.printBoxColor(0,0,255)
|
2014-05-18 19:57:12 +02:00
|
|
|
vga.printCharacter(12) 'cls
|
2014-04-30 20:24:00 +02:00
|
|
|
vga.printCursorRate(0)
|
|
|
|
'##### Fensterparameter #####
|
|
|
|
wind[0]:=0
|
|
|
|
wind[1]:=1
|
|
|
|
wind[2]:=0
|
|
|
|
wind[3]:=0
|
|
|
|
wind[4]:=39
|
|
|
|
wind[5]:=29
|
|
|
|
wind[6]:=0
|
|
|
|
wind[7]:=255
|
|
|
|
wind[8]:=0
|
|
|
|
|
|
|
|
PUB bus_putchar(zeichen) 'chip: ein byte an regnatix senden
|
|
|
|
''funktionsgruppe : chip
|
|
|
|
''funktion : ein byte an regnatix senden
|
|
|
|
''eingabe : byte
|
|
|
|
''ausgabe : -
|
|
|
|
|
|
|
|
waitpeq(M1,M2,0) 'busclk=1? & prop2=0?
|
|
|
|
dira := db_out 'datenbus auf ausgabe stellen
|
|
|
|
outa[7..0] := zeichen 'daten ausgeben
|
|
|
|
outa[bus_hs] := 0 'daten gültig
|
|
|
|
waitpeq(M3,M4,0) 'busclk=0?
|
|
|
|
dira := db_in 'bus freigeben
|
|
|
|
outa[bus_hs] := 1 'daten ungültig
|
|
|
|
|
|
|
|
PUB bus_getchar : zeichen 'chip: ein byte von regnatix empfangen
|
|
|
|
''funktionsgruppe : chip
|
|
|
|
''funktion : ein byte von regnatix empfangen
|
|
|
|
''eingabe : -
|
|
|
|
''ausgabe : byte
|
|
|
|
outa[hbeat]~~
|
|
|
|
waitpeq(M1,M2,0) 'busclk=1? & prop2=0?
|
|
|
|
zeichen := ina[7..0] 'daten einlesen
|
|
|
|
outa[bus_hs] := 0 'daten quittieren
|
|
|
|
waitpeq(M3,M4,0) 'busclk=0?
|
|
|
|
outa[bus_hs] := 1
|
|
|
|
outa[hbeat]~
|
|
|
|
|
|
|
|
CON ''------------------------------------------------- SUBPROTOKOLL-FUNKTIONEN
|
|
|
|
|
|
|
|
PUB sub_putlong(wert) 'sub: long senden
|
|
|
|
''funktionsgruppe : sub
|
|
|
|
''funktion : subprotokoll um einen long-wert an regnatix zu senden
|
|
|
|
''eingabe : 32bit wert der gesendet werden soll
|
|
|
|
''ausgabe : -
|
|
|
|
''busprotokoll : [put.byte1][put.byte2][put.byte3][put.byte4]
|
|
|
|
'' : [ hsb ][ ][ ][ lsb ]
|
|
|
|
|
|
|
|
bus_putchar(wert >> 24) '32bit wert senden hsb/lsb
|
|
|
|
bus_putchar(wert >> 16)
|
|
|
|
bus_putchar(wert >> 8)
|
|
|
|
bus_putchar(wert)
|
|
|
|
|
|
|
|
PUB sub_getlong:wert 'sub: long empfangen
|
|
|
|
''funktionsgruppe : sub
|
|
|
|
''funktion : subprotokoll um einen long-wert von regnatix zu empfangen
|
|
|
|
''eingabe : -
|
|
|
|
''ausgabe : 32bit-wert der empfangen wurde
|
|
|
|
''busprotokoll : [get.byte1][get.byte2][get.byte3][get.byte4]
|
|
|
|
'' : [ hsb ][ ][ ][ lsb ]
|
|
|
|
|
|
|
|
wert := bus_getchar << 24 '32 bit empfangen hsb/lsb
|
|
|
|
wert := wert + bus_getchar << 16
|
|
|
|
wert := wert + bus_getchar << 8
|
|
|
|
wert := wert + bus_getchar
|
|
|
|
PUB sub_putword(wert) 'sub: long senden
|
|
|
|
''funktionsgruppe : sub
|
|
|
|
''funktion : subprotokoll um einen long-wert an regnatix zu senden
|
|
|
|
''eingabe : 32bit wert der gesendet werden soll
|
|
|
|
''ausgabe : -
|
|
|
|
''busprotokoll : [put.byte1][put.byte2][put.byte3][put.byte4]
|
|
|
|
'' : [ hsb ][ ][ ][ lsb ]
|
|
|
|
|
|
|
|
bus_putchar(wert >> 8)
|
|
|
|
bus_putchar(wert)
|
|
|
|
|
|
|
|
PUB sub_getword:wert 'sub: long empfangen
|
|
|
|
''funktionsgruppe : sub
|
|
|
|
''funktion : subprotokoll um einen long-wert von regnatix zu empfangen
|
|
|
|
''eingabe : -
|
|
|
|
''ausgabe : 32bit-wert der empfangen wurde
|
|
|
|
''busprotokoll : [get.byte1][get.byte2][get.byte3][get.byte4]
|
|
|
|
'' : [ hsb ][ ][ ][ lsb ]
|
|
|
|
|
|
|
|
wert := bus_getchar << 8
|
|
|
|
wert := wert + bus_getchar
|
|
|
|
|
|
|
|
CON ''------------------------------------------------- CHIP-MANAGMENT-FUNKTIONEN
|
|
|
|
|
|
|
|
pub mgr_bel
|
2014-05-18 19:57:12 +02:00
|
|
|
sub_putlong(Bel_Treiber_Ver) 'rückgabe 65 für tile-driver 64 farben stark geänderte Version
|
2014-04-30 20:24:00 +02:00
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
PUB mgr_getcogs: cogs |i,c,cog[8] 'cmgr: abfragen wie viele cogs in benutzung sind
|
2014-04-30 20:24:00 +02:00
|
|
|
''funktionsgruppe : cmgr
|
|
|
|
''funktion : abfrage wie viele cogs in benutzung sind
|
|
|
|
''eingabe : -
|
|
|
|
''ausgabe : cogs - anzahl der cogs
|
|
|
|
''busprotokoll : [0][096][put.cogs]
|
|
|
|
'' : cogs - anzahl der belegten cogs
|
|
|
|
|
|
|
|
cogs := i := 0
|
2014-05-18 19:57:12 +02:00
|
|
|
repeat 'loads as many cogs as possible and stores their cog numbers
|
2014-04-30 20:24:00 +02:00
|
|
|
c := cog[i] := cognew(@entry, 0)
|
|
|
|
if c=>0
|
|
|
|
i++
|
|
|
|
while c => 0
|
|
|
|
cogs := i
|
2014-05-18 19:57:12 +02:00
|
|
|
repeat 'unloads the cogs and updates the string
|
2014-04-30 20:24:00 +02:00
|
|
|
i--
|
|
|
|
if i=>0
|
|
|
|
cogstop(cog[i])
|
|
|
|
while i=>0
|
|
|
|
bus_putchar(cogs)
|
|
|
|
|
|
|
|
PUB mgr_load|i 'cmgr: bellatrix-loader
|
|
|
|
''funktionsgruppe : cmgr
|
|
|
|
''funktion : funktion um einen neuen code in bellatrix zu laden
|
|
|
|
''
|
|
|
|
''bekanntes problem: einige wenige bel-dateien werden geladen aber nicht korrekt gestartet
|
|
|
|
''lösung: diese datei als eeprom-image speichern
|
|
|
|
|
|
|
|
' kopf der bin-datei einlesen ------------------------------------------------------
|
2014-05-18 19:57:12 +02:00
|
|
|
repeat i from 0 to 15 '16 bytes --> proghdr
|
2014-04-30 20:24:00 +02:00
|
|
|
byte[@proghdr][i] := bus_getchar
|
|
|
|
|
|
|
|
plen := 0
|
|
|
|
plen := byte[@proghdr + $0B] << 8
|
|
|
|
plen := plen + byte[@proghdr + $0A]
|
|
|
|
plen := plen - 8
|
|
|
|
|
|
|
|
' objektlänge an regnatix senden
|
2014-05-18 19:57:12 +02:00
|
|
|
bus_putchar(plen >> 8) 'hsb senden
|
|
|
|
bus_putchar(plen & $FF) 'lsb senden
|
2014-04-30 20:24:00 +02:00
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
repeat i from 0 to 7 'alle anderen cogs anhalten
|
2014-04-30 20:24:00 +02:00
|
|
|
ifnot i == cogid
|
|
|
|
cogstop(i)
|
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
dira := 0 'diese cog vom bus trennen
|
2014-04-30 20:24:00 +02:00
|
|
|
cognew(@loader, plen)
|
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
cogstop(cogid) 'cog 0 anhalten
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
DAT
|
|
|
|
org 0
|
|
|
|
|
|
|
|
loader
|
|
|
|
mov outa, M_0 'bus inaktiv
|
|
|
|
mov dira, DINP 'bus auf eingabe schalten
|
|
|
|
mov reg_a, PAR 'parameter = plen
|
|
|
|
mov reg_b, #0 'adresse ab 0
|
|
|
|
|
|
|
|
' datenblock empfangen
|
|
|
|
loop
|
|
|
|
call #get 'wert einlesen
|
|
|
|
wrbyte in, reg_b 'wert --> hubram
|
|
|
|
add reg_b, #1 'adresse + 1
|
|
|
|
djnz reg_a, #loop
|
|
|
|
|
|
|
|
' neuen code starten
|
|
|
|
|
|
|
|
rdword reg_a, #$A ' Setup the stack markers.
|
|
|
|
sub reg_a, #4 '
|
|
|
|
wrlong SMARK, reg_a '
|
|
|
|
sub reg_a, #4 '
|
|
|
|
wrlong SMARK, reg_a '
|
|
|
|
|
|
|
|
rdbyte reg_a, #$4 ' Switch to new clock mode.
|
|
|
|
clkset reg_a '
|
|
|
|
|
|
|
|
coginit SINT ' Restart running new code.
|
|
|
|
|
|
|
|
|
|
|
|
cogid reg_a
|
|
|
|
cogstop reg_a 'cog hält sich selbst an
|
|
|
|
|
|
|
|
|
|
|
|
get
|
|
|
|
waitpeq M_1, M_2 'busclk=1? & /cs=0?
|
|
|
|
mov in, ina 'daten einlesen
|
|
|
|
and in, DMASK 'wert maskieren
|
|
|
|
mov outa, M_3 'hs=0
|
|
|
|
waitpeq M_3, M_4 'busclk=0?
|
|
|
|
mov outa, M_0 'hs=1
|
|
|
|
get_ret ret
|
|
|
|
|
|
|
|
|
|
|
|
' hbeat --------+
|
|
|
|
' clk -------+|
|
|
|
|
' /wr ------+||
|
|
|
|
' /hs -----+|||+------------------------- /cs
|
|
|
|
' ||||| -------- d0..d7
|
|
|
|
DINP long %00001001000000000000000000000000 'constant dinp hex \ bus input
|
|
|
|
DOUT long %00001001000000000000000011111111 'constant dout hex \ bus output
|
|
|
|
|
|
|
|
M_0 long %00001000000000000000000000000000 'bus inaktiv
|
|
|
|
|
|
|
|
M_1 long %00000010000000000000000000000000
|
|
|
|
M_2 long %00000010100000000000000000000000 'busclk=1? & /cs=0?
|
|
|
|
|
|
|
|
M_3 long %00000000000000000000000000000000
|
|
|
|
M_4 long %00000010000000000000000000000000 'busclk=0?
|
|
|
|
|
|
|
|
|
|
|
|
DMASK long %00000000000000000000000011111111 'datenmaske
|
|
|
|
|
|
|
|
SINT long ($0001 << 18) | ($3C01 << 4) ' Spin interpreter boot information.
|
|
|
|
SMARK long $FFF9FFFF ' Stack mark used for spin code.
|
|
|
|
|
|
|
|
in res 1
|
|
|
|
reg_a res 1
|
|
|
|
reg_b res 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CON ''------------------------------------------------- KEYBOARD-FUNKTIONEN
|
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
PUB key_stat 'key: tastaturstatus abfragen
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
bus_putchar(keyb.gotkey)
|
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
PUB key_code 'key: tastencode abfragen
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
keycode := keyb.key
|
|
|
|
case keycode
|
2014-05-18 19:57:12 +02:00
|
|
|
$c8: keycode := $08 'backspace wandeln
|
2014-04-30 20:24:00 +02:00
|
|
|
bus_putchar(keycode)
|
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
PUB key_spec 'key: statustaten vom letzten tastencode abfragen
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
bus_putchar(keycode >> 8)
|
|
|
|
CON ''------------------------------------------------- SCREEN-FUNKTIONEN
|
|
|
|
|
|
|
|
pub Window|win,f1,f2,f3,f4,f5,f6,f7,f8,x,y,xx,yy,modus,a,b,c,d,posi,shd
|
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
win:=bus_getchar 'fensternummer
|
|
|
|
f1:=bus_getchar 'farbe1 'vordergrund
|
|
|
|
f2:=bus_getchar 'farbe2 'hintergrund
|
|
|
|
f3:=bus_getchar 'farbe3 'titel
|
|
|
|
f4:=bus_getchar 'farbe4 'frame
|
|
|
|
f5:=bus_getchar 'farbe5 'titelhintergrund
|
|
|
|
f6:=bus_getchar 'farbe6 'titeltext
|
|
|
|
f7:=bus_getchar 'farbe7 'statusback
|
|
|
|
f8:=bus_getchar 'farbe8 'statustext
|
|
|
|
y:=bus_getchar 'y
|
|
|
|
x:=bus_getchar 'x
|
|
|
|
yy:=bus_getchar 'yy
|
|
|
|
xx:=bus_getchar 'xx
|
|
|
|
modus:=bus_getchar 'art des Fensters (mit oder ohne Titel,rahmen,Pfeiltasten,Statusleiste)
|
|
|
|
shd :=bus_getchar 'Schatten
|
2014-04-30 20:24:00 +02:00
|
|
|
a:=b:=c:=d:=0
|
|
|
|
if shd
|
2014-05-18 19:57:12 +02:00
|
|
|
vga.display2DBox($56, y+1, x+1, yy+1, xx+1) 'Fensterschatten
|
2014-04-30 20:24:00 +02:00
|
|
|
if modus==2 or modus>3
|
|
|
|
rahmen(y,x,yy,xx,modus,f1,f2,f4)
|
|
|
|
a:=b:=c:=d:=1
|
|
|
|
if modus==3 or modus==4 or modus>5
|
|
|
|
titel(y,x,xx,f1,f2,f5,f4)
|
|
|
|
a:=1
|
|
|
|
if modus==5 or modus==6 or modus==8
|
|
|
|
pfeile(y,yy,xx,f1,f2,f4,modus)
|
|
|
|
if modus>6
|
|
|
|
status(yy,x,xx,f1,f2,f7)
|
|
|
|
|
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
vga.printBoxColor(win,f1,f2) 'fenster vorder und hintergrundfarbe setzen
|
2014-04-30 20:24:00 +02:00
|
|
|
vga.printCursorColor(f3)
|
2014-05-18 19:57:12 +02:00
|
|
|
vga.printBoxSize(win,y+a, x+b, yy-c, xx-d) 'virtuelles Fenster erstellen
|
2014-04-30 20:24:00 +02:00
|
|
|
posi:=win*14
|
|
|
|
wind[posi++]:=win
|
|
|
|
wind[posi++]:=modus
|
|
|
|
wind[posi++]:=x
|
|
|
|
wind[posi++]:=y
|
|
|
|
wind[posi++]:=xx
|
|
|
|
wind[posi++]:=yy
|
|
|
|
wind[posi++]:=f1
|
|
|
|
wind[posi++]:=f2
|
|
|
|
wind[posi++]:=f3
|
|
|
|
wind[posi++]:=f4
|
|
|
|
wind[posi++]:=f5
|
|
|
|
wind[posi++]:=f6
|
|
|
|
wind[posi++]:=f7
|
|
|
|
wind[posi++]:=f8
|
|
|
|
|
|
|
|
|
|
|
|
pub PrintFont|win,f1,f2,f3,x,y,offset,posi,len,c,of,off
|
2014-05-18 19:57:12 +02:00
|
|
|
win:=bus_getchar 'fensternummer
|
|
|
|
f1:=bus_getchar 'farbe1 'vordergrund
|
|
|
|
f2:=bus_getchar 'farbe2 'hintergrund
|
|
|
|
f3:=bus_getchar 'farbe3 'titel und statusfarbe,cursorfarbe
|
|
|
|
y:=bus_getchar 'y
|
|
|
|
x:=bus_getchar 'x
|
|
|
|
offset:=bus_getchar 'offset für Zeichensätze, wo die Buchstaben vor der Nummer 32 anfangen
|
2014-04-30 20:24:00 +02:00
|
|
|
len:=bus_getchar
|
|
|
|
of:=1
|
|
|
|
off:=1
|
|
|
|
posi:=win*14
|
2014-05-18 19:57:12 +02:00
|
|
|
if wind[posi+1]==1 or wind[posi+1]==3 'Fenster ohne Rahmen benutzen keinen x-Offset, dh.man kann bis an den Rand schreiben
|
2014-04-30 20:24:00 +02:00
|
|
|
of:=0
|
2014-05-18 19:57:12 +02:00
|
|
|
if wind[posi+1]==1 'Fenstertyp 1 benutzt auch keinen y-Offset
|
2014-04-30 20:24:00 +02:00
|
|
|
off:=0
|
|
|
|
x:=x+wind[posi+2]+of
|
|
|
|
y:=y+wind[posi+3]+off
|
|
|
|
repeat len
|
|
|
|
c:=bus_getchar-offset
|
|
|
|
if y>wind[posi+5]-of
|
|
|
|
y:=wind[posi+5]-of
|
|
|
|
vga.displaytile(@tileset[c*16],f1,f2,f3, y, x)
|
|
|
|
x++
|
|
|
|
if x>wind[posi+4]-of
|
|
|
|
x:=wind[posi+2]+of
|
|
|
|
y++
|
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
pri Set_Titel_Status|win,Tit_Stat,len,posi,x,y 'Titel-oder Statustext in einem Fenster setzen
|
2014-04-30 20:24:00 +02:00
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
win :=bus_getchar 'fensternummer
|
|
|
|
Tit_Stat:=bus_getchar 'Titel oder Statustext
|
|
|
|
len :=bus_getchar 'stringlänge
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
posi:=win*14
|
|
|
|
x:=wind[posi+2]
|
|
|
|
|
|
|
|
if (wind[posi+1]==3 or wind[posi+1]==4 or wind[posi+1]>5) and Tit_Stat==1 and wind[posi]
|
|
|
|
y:=wind[posi+3] 'Titeltext
|
|
|
|
bus_getstr_plot(posi,len, y, x+1,1,0)
|
|
|
|
elseif wind[posi+1]>6 and Tit_Stat==2 and wind[posi]
|
|
|
|
y:=wind[posi+5] 'Statustext
|
|
|
|
bus_getstr_plot(posi,len,y, x+1,1,2)
|
|
|
|
else
|
2014-05-18 19:57:12 +02:00
|
|
|
bus_getstr_plot(posi,len,y, x+1,0,0) 'keine Bildschirmausgabe
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
pri bus_getstr_plot(win,len,y,x,m,b)|c
|
|
|
|
|
|
|
|
repeat len
|
|
|
|
c:=bus_getchar
|
|
|
|
if x<wind[win+4] and m==1
|
|
|
|
vga.displaytile(@tileset[c*16],wind[win+10+b],wind[win+11+b],wind[win+7], y, x++)
|
|
|
|
else
|
|
|
|
next
|
|
|
|
|
|
|
|
|
|
|
|
pri get_window|x,y,a,b,i,sd
|
|
|
|
sd:=0
|
2014-05-18 19:57:12 +02:00
|
|
|
if mouseshow and mouse.button(0) 'Mauspfeil anzeigen
|
|
|
|
x:=xpos>>4
|
|
|
|
y:=ypos>>4
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
repeat i from 1 to 7
|
|
|
|
b:=i*14
|
|
|
|
if wind[b]
|
2014-05-18 19:57:12 +02:00
|
|
|
a:=wind[b+1] 'Art des Fensters
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
case a
|
|
|
|
'Titelleiste linke und rechte obere ecke
|
2014-05-18 19:57:12 +02:00
|
|
|
3,4,6,7,8:if x==wind[b+2] and y==wind[b+3] 'linke obere ecke
|
2014-04-30 20:24:00 +02:00
|
|
|
sd:=1
|
2014-05-18 19:57:12 +02:00
|
|
|
if x==wind[b+4] and y==wind[b+3] 'rechte obere ecke
|
2014-04-30 20:24:00 +02:00
|
|
|
sd:=2
|
|
|
|
if a==6 or a==8
|
2014-05-18 19:57:12 +02:00
|
|
|
if x==wind[b+4] and y==wind[b+3]+1 'oberer pfeil
|
2014-04-30 20:24:00 +02:00
|
|
|
sd:=3
|
|
|
|
if a==6
|
2014-05-18 19:57:12 +02:00
|
|
|
if x==wind[b+4] and y==wind[b+5] 'unterer pfeil
|
2014-04-30 20:24:00 +02:00
|
|
|
sd:=4
|
|
|
|
if a==8
|
2014-05-18 19:57:12 +02:00
|
|
|
if x==wind[b+4] and y==wind[b+5]-1 'unterer pfeil
|
2014-04-30 20:24:00 +02:00
|
|
|
sd:=4
|
|
|
|
|
|
|
|
if sd
|
|
|
|
klick_action(x,y,sd,i)
|
2014-05-18 19:57:12 +02:00
|
|
|
sd+=i*10 'Fensternummer*10+Button
|
2014-04-30 20:24:00 +02:00
|
|
|
quit
|
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
5: if x==wind[b+4] and y==wind[b+3] 'oberer pfeil
|
2014-04-30 20:24:00 +02:00
|
|
|
sd:=3
|
2014-05-18 19:57:12 +02:00
|
|
|
if x==wind[b+4] and y==wind[b+5] 'unterer pfeil
|
2014-04-30 20:24:00 +02:00
|
|
|
sd:=4
|
|
|
|
if sd
|
|
|
|
klick_action(x,y,sd,i)
|
2014-05-18 19:57:12 +02:00
|
|
|
sd+=i*10 'Fensternummer*10+Button
|
2014-04-30 20:24:00 +02:00
|
|
|
quit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bus_putchar(sd)
|
|
|
|
|
|
|
|
pri klick_action(x,y,sd,w)|tinr,f1,f2,f3,ff,a
|
|
|
|
a:=w*14
|
|
|
|
f1:=wind[a+6]
|
|
|
|
f2:=wind[a+7]
|
|
|
|
ff:=wind[a+9]'f4
|
|
|
|
f3:=wind[a+10]'f5
|
|
|
|
case sd
|
|
|
|
1:tinr:=wint[8]'128
|
|
|
|
2:tinr:=wint[10]'129
|
|
|
|
3:tinr:=wint[11]'133
|
|
|
|
4:tinr:=wint[13]'131
|
2014-05-18 19:57:12 +02:00
|
|
|
vga.displaytile(@tileset[tinr*16],ff,f2,f1, y, x) 'rechte obere ecke
|
|
|
|
repeat while mouse.button(0) 'warten, bis Maustaste losgelassen wird
|
|
|
|
if sd==1 or sd==2 'Titelleistensymbole
|
|
|
|
vga.displaytile(@tileset[tinr*16],f2,f1,ff, y, x) 'rechte obere ecke
|
|
|
|
else 'Pfeilsymbole
|
|
|
|
vga.displaytile(@tileset[tinr*16],f2,f1,ff, y, x) 'normal darstellen
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
pri Del_Window|wnr,i,a
|
|
|
|
i:=0
|
|
|
|
wnr:=bus_getchar
|
2014-05-18 19:57:12 +02:00
|
|
|
repeat 17 'neue Tilewerte für die Fenster lesen
|
2014-04-30 20:24:00 +02:00
|
|
|
wint[i++]:=bus_getchar
|
|
|
|
|
|
|
|
if wnr==9
|
|
|
|
repeat i from 1 to 7
|
|
|
|
wind[i*10]:=0
|
|
|
|
else
|
|
|
|
a:=wnr*14
|
|
|
|
vga.del_win(wnr)
|
|
|
|
wind[a]:=0
|
|
|
|
|
|
|
|
|
|
|
|
pri titel(y,x,xx,f1,f2,f3,ff)
|
2014-05-18 19:57:12 +02:00
|
|
|
vga.displaytile(@tileset[wint[8]*16],f2,f1,ff, y, x) 'linke obere ecke
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
W_line(wint[9],x+1, y, xx-1,f2,f1,f3)
|
2014-05-18 19:57:12 +02:00
|
|
|
vga.displaytile(@tileset[wint[10]*16],f2,f1,ff, y, xx) 'rechte obere ecke
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
pri status(y,x,xx,f1,f2,f3)
|
2014-05-18 19:57:12 +02:00
|
|
|
vga.displaytile(@tileset[wint[15]*16],f2,f1,f3, y, x) 'linke untere ecke
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
W_line(wint[14],x+1, y, xx-1,f2,f1,f3)
|
2014-05-18 19:57:12 +02:00
|
|
|
vga.displaytile(@tileset[wint[16]*16],f2,f1,f3, y, xx) 'rechte untere ecke
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
pri W_line(tinr,x,y,xx,f1,f2,f3)|i
|
|
|
|
repeat i from x to xx
|
|
|
|
vga.displaytile(@tileset[tinr*16],f1,f2,f3, y, i)
|
|
|
|
|
|
|
|
pri rahmen(y,x,yy,xx,modus,f1,f2,f3)|i
|
|
|
|
if modus==2 or modus==5
|
2014-05-18 19:57:12 +02:00
|
|
|
vga.displaytile(@tileset[wint[0]*16],f2,f1,f3, y, x) 'links oben
|
2014-04-30 20:24:00 +02:00
|
|
|
repeat i from x+1 to xx-1
|
2014-05-18 19:57:12 +02:00
|
|
|
vga.displaytile(@tileset[wint[1]*16],f2,f1,f3, y, i) 'oberer rand
|
2014-04-30 20:24:00 +02:00
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
vga.displaytile(@tileset[wint[2]*16],f2,f1,f3, y, xx) 'rechts oben
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
repeat i from y+1 to yy-1
|
2014-05-18 19:57:12 +02:00
|
|
|
vga.displaytile(@tileset[wint[7]*16],f2,f1,f3, i, x) 'linker rand
|
2014-04-30 20:24:00 +02:00
|
|
|
if modus==2 or modus==4 or modus==7
|
2014-05-18 19:57:12 +02:00
|
|
|
vga.displaytile(@tileset[wint[3]*16],f2,f1,f3, i, xx) 'rechter rand ohne pfeile
|
2014-04-30 20:24:00 +02:00
|
|
|
if modus==5 or modus==6 or modus==8
|
2014-05-18 19:57:12 +02:00
|
|
|
vga.displaytile(@tileset[wint[12]*16],f2,f1,f3, i, xx) 'rechter rand mit pfeilen
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
repeat i from x+1 to xx-1
|
2014-05-18 19:57:12 +02:00
|
|
|
vga.displaytile(@tileset[wint[5]*16],f2,f1,f3, yy, i) 'unterer rand
|
|
|
|
vga.displaytile(@tileset[wint[6]*16],f2,f1,f3, yy, x) 'linke untere ecke
|
|
|
|
vga.displaytile(@tileset[wint[4]*16],f2,f1,f3, yy, xx) 'rechte untere ecke
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
pri pfeile(y,yy,xx,f1,f2,f3,modus)
|
|
|
|
if modus==6 or modus==8
|
|
|
|
y+=1
|
|
|
|
if modus==8
|
|
|
|
yy-=1
|
|
|
|
vga.displaytile(@tileset[wint[11]*16],f2,f1,f3, y, xx)
|
2014-05-18 19:57:12 +02:00
|
|
|
vga.displaytile(@tileset[wint[13]*16],f2,f1,f3, yy, xx) 'unterer pfeil
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
pub Backup_Area|x,y,xx,yy,a,b
|
|
|
|
x:=bus_getchar
|
|
|
|
y:=bus_getchar
|
|
|
|
xx:=bus_getchar
|
|
|
|
yy:=bus_getchar
|
|
|
|
repeat b from y to yy
|
|
|
|
repeat a from x to xx
|
|
|
|
sub_putlong(vga.backup_chroma(a,b))
|
|
|
|
sub_putword(vga.backup_luma(a,b))
|
|
|
|
pub Restore_area|x,y,xx,yy,a,b
|
|
|
|
x:=bus_getchar
|
|
|
|
y:=bus_getchar
|
|
|
|
xx:=bus_getchar
|
|
|
|
yy:=bus_getchar
|
|
|
|
repeat b from y to yy
|
|
|
|
repeat a from x to xx
|
|
|
|
vga.restore_chroma(a,b,sub_getlong)
|
|
|
|
vga.restore_luma(a,b,sub_getword)
|
|
|
|
|
|
|
|
pub mousebound
|
|
|
|
xbound :=sub_getlong
|
|
|
|
ybound:=sub_getlong
|
|
|
|
xxbound :=sub_getlong
|
|
|
|
yybound:=sub_getlong
|
|
|
|
|
|
|
|
pub getx |x
|
|
|
|
x:=vga.getx
|
|
|
|
bus_putchar(x)
|
|
|
|
pub gety |y
|
|
|
|
y:=vga.gety
|
|
|
|
bus_putchar(y)
|
|
|
|
|
|
|
|
pub mousex
|
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
bus_putchar(XPOS>>4)
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
pub mousey
|
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
bus_putchar(YPos>>4)
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
pub mousez
|
|
|
|
sub_putlong(mouse.abs_z)
|
|
|
|
|
|
|
|
pub mouse_button(b)|i,knopf,xp,yp,c
|
|
|
|
knopf:=0
|
2014-05-18 19:57:12 +02:00
|
|
|
xp:=XPOS>>4
|
|
|
|
yp:=YPOS>>4
|
2014-04-30 20:24:00 +02:00
|
|
|
c:=mouse.button(b)
|
2014-05-18 19:57:12 +02:00
|
|
|
if mouse.button(0) 'linke mousetaste gedrueckt?
|
|
|
|
repeat i from 1 to buttonbuff-1 'alle Buttonparameter durchsuchen
|
2014-04-30 20:24:00 +02:00
|
|
|
if bnumber[i]
|
2014-05-18 19:57:12 +02:00
|
|
|
if xp=>bx[i] and xp=< bxx[i] and yp==by[i] 'abfrage auf Buttonposition
|
|
|
|
c:=i 'gefunden !
|
2014-04-30 20:24:00 +02:00
|
|
|
quit
|
2014-05-18 19:57:12 +02:00
|
|
|
bus_putchar(c) 'ansonsten 255 senden
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
pub BoxSize|win,y,x,yy,xx
|
|
|
|
win:=bus_getchar
|
|
|
|
y:=bus_getchar
|
|
|
|
x:=bus_getchar
|
|
|
|
yy:=bus_getchar
|
|
|
|
xx:=bus_getchar
|
|
|
|
vga.printBoxSize(win,y,x,yy,xx)
|
|
|
|
|
|
|
|
pub PrintBoxColor|w,v,h,cur
|
|
|
|
w:=bus_getchar
|
|
|
|
v:=bus_getchar
|
|
|
|
h:=hintergr:=bus_getchar
|
|
|
|
cur:=bus_getchar
|
2014-05-18 19:57:12 +02:00
|
|
|
vga.printBoxColor(w,v,h) 'fenster vorder und hintergrundfarbe setzen
|
|
|
|
vga.printCursorColor(cur) 'Cursorfarbe setzen
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
pub setpos(y,x)
|
|
|
|
y:=bus_getchar
|
|
|
|
x:=bus_getchar
|
|
|
|
vga.printat(y,x)
|
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
PUB pchar(c) 'screen: zeichen auf bildschirm ausgeben
|
2014-04-30 20:24:00 +02:00
|
|
|
{{zeichen auf bildschirm ausgeben}}
|
|
|
|
vga.printqChar(c)
|
|
|
|
|
|
|
|
PUB scrollup | lines,farbe,y,x,yy,xx,rate
|
|
|
|
lines:=bus_getchar
|
|
|
|
farbe:=bus_getchar
|
|
|
|
y :=bus_getchar
|
|
|
|
x :=bus_getchar
|
|
|
|
yy :=bus_getchar
|
|
|
|
xx :=bus_getchar
|
|
|
|
rate :=bus_getchar
|
2014-05-18 19:57:12 +02:00
|
|
|
vga.scrollup(lines,farbe,y,x,yy,xx,rate) 'screen: scrollt den screen nach oben
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
PUB scrolldown | lines,farbe,y,x,yy,xx,rate
|
2014-05-18 19:57:12 +02:00
|
|
|
lines:=bus_getchar 'screen: scrollt den screen nach unten
|
2014-04-30 20:24:00 +02:00
|
|
|
farbe:=bus_getchar
|
|
|
|
y :=bus_getchar
|
|
|
|
x :=bus_getchar
|
|
|
|
yy :=bus_getchar
|
|
|
|
xx :=bus_getchar
|
|
|
|
rate :=bus_getchar
|
|
|
|
vga.scrolldown(lines,farbe,y,x,yy,xx,rate)
|
|
|
|
|
|
|
|
pub display3DBox|top,center,bott,y,x,yy,xx
|
|
|
|
top:=bus_getchar
|
|
|
|
center:=bus_getchar
|
|
|
|
bott:=bus_getchar
|
|
|
|
y :=bus_getchar
|
|
|
|
x :=bus_getchar
|
|
|
|
yy :=bus_getchar
|
|
|
|
xx :=bus_getchar
|
|
|
|
|
|
|
|
vga.display3DBox(top, center, bott, y,x,yy,xx)
|
|
|
|
|
|
|
|
pub display3DFrame|top,center,bott,y,x,yy,xx
|
|
|
|
top:=bus_getchar
|
|
|
|
center:=bus_getchar
|
|
|
|
bott:=bus_getchar
|
|
|
|
y :=bus_getchar
|
|
|
|
x :=bus_getchar
|
|
|
|
yy :=bus_getchar
|
|
|
|
xx :=bus_getchar
|
|
|
|
|
|
|
|
vga.display3DFrame(top, center, bott, y,x,yy,xx)
|
|
|
|
|
|
|
|
pub Get_Button_Param|number,y,x,xx
|
|
|
|
number:=bus_getchar
|
|
|
|
x :=bus_getchar
|
|
|
|
y :=bus_getchar
|
|
|
|
xx :=bus_getchar
|
|
|
|
|
|
|
|
bx[number] :=x
|
|
|
|
by[number] :=y
|
|
|
|
bxx[number] :=xx
|
|
|
|
bnumber[number]:=number
|
|
|
|
|
|
|
|
pub destroy_Button|number
|
|
|
|
number:=bus_getchar
|
|
|
|
vga.display2DBox(hintergr,by[number],bx[number],by[number],bxx[number])
|
|
|
|
bnumber[number]:=0
|
|
|
|
|
|
|
|
pub display2DBox|farbe,y,x,yy,xx,shd
|
|
|
|
farbe:=bus_getchar
|
|
|
|
y :=bus_getchar
|
|
|
|
x :=bus_getchar
|
|
|
|
yy :=bus_getchar
|
|
|
|
xx :=bus_getchar
|
|
|
|
shd :=bus_getchar
|
|
|
|
if shd
|
|
|
|
vga.display2DBox($56,y+1,x+1,yy+1,xx+1)
|
|
|
|
vga.display2DBox(farbe,y,x,yy,xx)
|
|
|
|
|
|
|
|
pub scrollString|rate,vorder,hinter,y,x,xx,i,len',dir
|
|
|
|
rate :=bus_getchar
|
|
|
|
vorder:=bus_getchar
|
|
|
|
hinter:=bus_getchar
|
|
|
|
y :=bus_getchar
|
|
|
|
x :=bus_getchar
|
|
|
|
xx :=bus_getchar
|
|
|
|
len :=bus_getchar
|
|
|
|
repeat len
|
|
|
|
byte[@strkette][i++]:=bus_getchar
|
|
|
|
vga.scrollstring(@strkette,rate, vorder, hinter, y, x, xx)
|
2014-05-18 19:57:12 +02:00
|
|
|
bytefill(@strkette,0,40) 'stringbuffer wieder loeschen
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
pub displayString|vorder,hinter,y,x,c,len
|
|
|
|
vorder:=bus_getchar
|
|
|
|
hinter:=bus_getchar
|
|
|
|
y :=bus_getchar
|
|
|
|
x :=bus_getchar
|
|
|
|
len :=bus_getchar
|
|
|
|
repeat len
|
|
|
|
c:=bus_getchar
|
|
|
|
vga.displaycharacter(c, vorder, hinter, y, x)
|
|
|
|
x++
|
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
pub displayTile|pcol,scol,tcol,y,x 'einzelnes Tile anzeigen
|
2014-04-30 20:24:00 +02:00
|
|
|
tnr:=bus_getchar
|
|
|
|
pcol:=bus_getchar
|
|
|
|
scol:=bus_getchar
|
|
|
|
tcol:=bus_getchar
|
|
|
|
y:=bus_getchar
|
|
|
|
x:=bus_getchar
|
|
|
|
|
|
|
|
vga.displaytile(@tileset[tnr*16],pcol,scol,tcol, y, x)
|
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
pub loadtile|anzahl,i 'Tileset in buffer laden
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
anzahl:=sub_getlong
|
|
|
|
repeat i from 0 to anzahl-1
|
|
|
|
tileset[i]:=sub_getlong
|
|
|
|
|
|
|
|
pub mousepointer|i
|
|
|
|
repeat i from 0 to 15
|
|
|
|
mousetile[i]:=sub_getlong
|
|
|
|
vga.mouseCursorTile(@mousetile)
|
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
pub displaypic|pcol,scol,tcol,y,x,ytile,xtile,xx,c 'komplettes Tileset anzeigen
|
2014-04-30 20:24:00 +02:00
|
|
|
pcol:=bus_getchar
|
|
|
|
scol:=bus_getchar
|
|
|
|
tcol:=bus_getchar
|
|
|
|
y:=bus_getchar
|
|
|
|
x:=bus_getchar
|
|
|
|
ytile:=bus_getchar
|
|
|
|
xtile:=bus_getchar
|
|
|
|
xx:=x
|
|
|
|
c:=0
|
|
|
|
repeat ytile '9
|
|
|
|
repeat xtile '11
|
|
|
|
|
|
|
|
vga.displayTile(@tileset[c], pcol, scol, tcol, y, xx++)
|
|
|
|
c+=16
|
|
|
|
y++
|
|
|
|
xx:=x
|
|
|
|
pub displaymouse |on,farbe,i
|
|
|
|
on:=bus_getchar
|
|
|
|
farbe:=bus_getchar
|
|
|
|
if on==1
|
|
|
|
vga.mouseCursorColor(farbe)
|
|
|
|
vga.mouseCursorTile(vga.displayCursor)
|
|
|
|
mouseshow :=1
|
2014-05-18 19:57:12 +02:00
|
|
|
repeat i from 0 to buttonbuff-1 'buttonanzahl zuruecksetzen
|
2014-04-30 20:24:00 +02:00
|
|
|
bnumber[i]:=0
|
|
|
|
|
|
|
|
else
|
|
|
|
vga.mouseCursorTile(0)
|
|
|
|
mouseshow :=0
|
|
|
|
|
|
|
|
PUB line(x0, y0, x1, y1, frbe) | dX, dY, x, y, err, stp
|
|
|
|
result := ((||(y1 - y0)) > (||(x1 - x0)))
|
|
|
|
if(result)
|
|
|
|
swap(@x0, @y0)
|
|
|
|
swap(@x1, @y1)
|
|
|
|
if(x0 > x1)
|
|
|
|
swap(@x0, @x1)
|
|
|
|
swap(@y0, @y1)
|
|
|
|
dX := (x1 - x0)
|
|
|
|
dY := (||(y1 - y0))
|
|
|
|
err := (dX >> 1)
|
|
|
|
stp := ((y0 => y1) | 1)
|
|
|
|
y := y0
|
|
|
|
repeat x from x0 to x1
|
|
|
|
if(result)
|
|
|
|
vga.Plot(frbe,x,y)
|
|
|
|
else
|
|
|
|
vga.Plot(frbe,y,x)
|
|
|
|
err -= dY
|
|
|
|
if(err < 0)
|
|
|
|
y += stp
|
|
|
|
err += dX
|
|
|
|
|
|
|
|
PRI swap(x, y)
|
|
|
|
result := long[x]
|
|
|
|
long[x] := long[y]
|
|
|
|
long[y] := result
|
|
|
|
con '************************************************ Spriteparameter **********************************************************
|
2014-05-18 19:57:12 +02:00
|
|
|
pub Actor_Parameter|i
|
2014-04-30 20:24:00 +02:00
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
repeat 4
|
|
|
|
actor[i++]:=bus_getchar 'tilenr1
|
2014-04-30 20:24:00 +02:00
|
|
|
action_x:=bus_getchar
|
|
|
|
action_y:=bus_getchar
|
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
vga.dispBackup(action_y, action_x,9)
|
2014-04-30 20:24:00 +02:00
|
|
|
vga.displaytile(@tileset[actor[0]*16],actor[1],actor[2],actor[3], action_y, action_x)
|
|
|
|
old_action_x:=action_x
|
|
|
|
old_action_y:=action_y
|
2014-05-18 19:57:12 +02:00
|
|
|
pub Change_Backuptile|tinr,f1,f2,f3 'Backuptile unter dem Player ändern (für eingesammelte Items)
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
tinr:=bus_getchar
|
|
|
|
f1:=bus_getchar
|
|
|
|
f2:=bus_getchar
|
|
|
|
f3:=bus_getchar
|
|
|
|
|
|
|
|
vga.Change_Backup(@tileset[tinr*16],f1,f2,f3)
|
|
|
|
|
|
|
|
pub Get_Actor_Pos|a
|
|
|
|
a:=bus_getchar
|
|
|
|
case a
|
|
|
|
1:bus_putchar(action_x)
|
|
|
|
2:bus_putchar(action_y)
|
|
|
|
|
|
|
|
pub Set_Actor_XY|k
|
|
|
|
k:=bus_getchar
|
|
|
|
actorxy(k)
|
|
|
|
|
|
|
|
pub actorxy(k)|b
|
|
|
|
|
|
|
|
case k
|
|
|
|
action_key[0]:action_x--
|
|
|
|
b:=1
|
|
|
|
action_key[1]:action_x++
|
|
|
|
b:=1
|
|
|
|
action_key[2]:action_y--
|
|
|
|
b:=1
|
|
|
|
action_key[3]:action_y++
|
|
|
|
b:=1
|
|
|
|
|
|
|
|
if action_x<1
|
|
|
|
action_x:=0
|
|
|
|
if action_x>39
|
|
|
|
action_x:=39
|
|
|
|
if action_y<1
|
|
|
|
action_y:=0
|
|
|
|
if action_y>29
|
|
|
|
action_y:=29
|
|
|
|
|
|
|
|
if b==1
|
|
|
|
playermove
|
|
|
|
|
|
|
|
pri playermove
|
|
|
|
vga.dispRestore(old_action_y, old_action_x,9)
|
|
|
|
vga.dispBackup(action_y, action_x,9)', farbe)
|
|
|
|
vga.displaytile(@tileset[actor[0]*16],actor[1],actor[2],actor[3], action_y, action_x)
|
|
|
|
old_action_x:=action_x
|
|
|
|
old_action_y:=action_y
|
|
|
|
|
|
|
|
pub Sprite_Parameter|nur
|
|
|
|
nur:=bus_getchar
|
|
|
|
nur-=1
|
|
|
|
spritenr[nur]:=bus_getchar
|
|
|
|
spritenr[nur+8]:=bus_getchar
|
|
|
|
spritef1[nur]:=bus_getchar
|
|
|
|
spritef2[nur]:=bus_getchar
|
|
|
|
spritef3[nur]:=bus_getchar
|
2014-05-18 19:57:12 +02:00
|
|
|
sprite_dir[nur]:=bus_getchar 'richtung
|
|
|
|
sprite_start[nur]:=bus_getchar 'startposition
|
|
|
|
sprite_end[nur]:=bus_getchar 'endposition
|
|
|
|
sprite_x[nur]:=bus_getchar 'x
|
|
|
|
sprite_y[nur]:=bus_getchar 'y
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
vga.dispBackup(sprite_y[nur], sprite_x[nur],nur)
|
|
|
|
vga.displaytile(@tileset[spritenr[nur]*16],spritef1[nur],spritef2[nur],spritef3[nur], sprite_y[nur], sprite_x[nur])
|
|
|
|
sprite_old_y[nur]:=sprite_y[nur]
|
|
|
|
sprite_old_x[nur]:=sprite_x[nur]
|
|
|
|
|
|
|
|
pub SpriteMove|nur
|
|
|
|
nur:=bus_getchar
|
|
|
|
case nur
|
|
|
|
0:Sprite_move:=0
|
|
|
|
1:Sprite_move:=1
|
|
|
|
2:Reset_Sprite
|
|
|
|
pub get_block|a,b
|
|
|
|
a:=bus_getchar
|
|
|
|
b:=bus_getchar
|
|
|
|
block_tile[a]:=b
|
|
|
|
|
|
|
|
pub Set_sprite_XY|num,vx,vy,p,b
|
2014-05-18 19:57:12 +02:00
|
|
|
if sp_alter==0 'zweites Sprite-Tile
|
2014-04-30 20:24:00 +02:00
|
|
|
sp_alter:=8
|
|
|
|
else
|
2014-05-18 19:57:12 +02:00
|
|
|
sp_alter:=0 'erstes Sprite-Tile
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
repeat num from 0 to 7
|
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
if spritenr[num]<175 'sprite belegt?
|
2014-04-30 20:24:00 +02:00
|
|
|
case sprite_dir[num]
|
|
|
|
1:sprite_x[num]--
|
2014-05-18 19:57:12 +02:00
|
|
|
if sprite_x[num]<sprite_start[num] 'startpos erreicht? dann richtung umkehren
|
2014-04-30 20:24:00 +02:00
|
|
|
sprite_dir[num]:=2
|
|
|
|
2:sprite_x[num]++
|
2014-05-18 19:57:12 +02:00
|
|
|
if sprite_x[num]>sprite_end[num] 'endpos erreicht dann richtung umkehren
|
2014-04-30 20:24:00 +02:00
|
|
|
sprite_dir[num]:=1
|
|
|
|
3:sprite_y[num]--
|
2014-05-18 19:57:12 +02:00
|
|
|
if sprite_y[num]<sprite_start[num] 'startpos erreicht? dann richtung umkehren
|
2014-04-30 20:24:00 +02:00
|
|
|
sprite_dir[num]:=4
|
|
|
|
4:sprite_y[num]++
|
2014-05-18 19:57:12 +02:00
|
|
|
if sprite_y[num]>sprite_end[num] 'endpos erreicht dann richtung umkehren
|
2014-04-30 20:24:00 +02:00
|
|
|
sprite_dir[num]:=3
|
|
|
|
5:'einfacher verfolgermodus
|
2014-05-18 19:57:12 +02:00
|
|
|
vx:=(action_x-sprite_x[num]) 'Abstand zur Spielerfigur x-Richtung
|
|
|
|
vy:=(action_y-sprite_y[num]) 'Abstand zur Spielerfigur y-Richtung
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
if vy<0
|
|
|
|
p:=((sprite_y[num]-1)*40)+sprite_x[num]
|
2014-05-18 19:57:12 +02:00
|
|
|
b:=position(p) 'Überprüfung auf Blockade-Tile
|
2014-04-30 20:24:00 +02:00
|
|
|
if b==0
|
|
|
|
sprite_y[num]--
|
|
|
|
if sprite_y[num]<1
|
|
|
|
sprite_y[num]:=1
|
|
|
|
if vy>0
|
|
|
|
p:=((sprite_y[num]+1)*40)+sprite_x[num]
|
|
|
|
b:=position(p)
|
|
|
|
if b==0
|
|
|
|
sprite_y[num]++
|
|
|
|
if sprite_y[num]>29
|
|
|
|
sprite_y[num]:=29
|
|
|
|
if vx<0
|
|
|
|
p:=(sprite_y[num]*40)+(sprite_x[num]-1)
|
|
|
|
b:=position(p)
|
|
|
|
if b==0
|
|
|
|
sprite_x[num]--
|
|
|
|
if sprite_x[num]<1
|
|
|
|
sprite_x[num]:=1
|
|
|
|
if vx>0
|
|
|
|
p:=(sprite_y[num]*40)+(sprite_x[num]+1)
|
|
|
|
b:=position(p)
|
|
|
|
if b==0
|
|
|
|
sprite_x[num]++
|
|
|
|
if sprite_x[num]>29
|
|
|
|
sprite_x[num]:=29
|
|
|
|
vga.dispRestore(sprite_old_y[num], sprite_old_x[num],num)
|
|
|
|
vga.dispBackup(sprite_y[num], sprite_x[num],num)
|
|
|
|
vga.displaytile(@tileset[spritenr[num+sp_alter]*16],spritef1[num],spritef2[num],spritef3[num], sprite_y[num], sprite_x[num])
|
|
|
|
sprite_old_x[num]:=sprite_x[num]
|
|
|
|
sprite_old_y[num]:=sprite_y[num]
|
|
|
|
|
|
|
|
pub position(tr):bl|i,block
|
2014-05-18 19:57:12 +02:00
|
|
|
block:=read_block(tr)
|
2014-04-30 20:24:00 +02:00
|
|
|
bl:=0
|
|
|
|
repeat i from 0 to 9
|
|
|
|
if block==block_tile[i]
|
|
|
|
bl:=1
|
|
|
|
|
|
|
|
pub read_block(num):wert|i
|
|
|
|
wert:=vga.getblock(num)
|
2014-05-18 19:57:12 +02:00
|
|
|
repeat i from 0 to 175 'Tiles im Tileset mit Wert vergleichen
|
2014-04-30 20:24:00 +02:00
|
|
|
if wert== @tileset[i*16]
|
|
|
|
quit
|
|
|
|
|
|
|
|
pub Reset_Sprite|i
|
|
|
|
repeat i from 0 to 7
|
|
|
|
if spritenr[i]<177
|
2014-05-18 19:57:12 +02:00
|
|
|
vga.dispRestore(sprite_old_y[i], sprite_old_x[i],i) 'sprite reset
|
2014-04-30 20:24:00 +02:00
|
|
|
spritenr[i]:=255
|
2014-05-18 19:57:12 +02:00
|
|
|
vga.dispRestore(old_action_y, old_action_x,9) 'Player reset
|
|
|
|
Sprite_move:=0 'spritebewegung deaktivieren
|
2014-04-30 20:24:00 +02:00
|
|
|
collision:=0
|
|
|
|
|
2014-05-18 19:57:12 +02:00
|
|
|
pub Set_Action_Key|i
|
|
|
|
repeat 5
|
|
|
|
action_key[i++]:=bus_getchar
|
2014-04-30 20:24:00 +02:00
|
|
|
|
|
|
|
pub Displaypalette|farbe,hy,hx,a
|
|
|
|
hx:=bus_getchar
|
|
|
|
hy:=bus_getchar
|
|
|
|
a:=hx
|
|
|
|
farbe:=0
|
|
|
|
repeat 4
|
|
|
|
repeat 16
|
|
|
|
vga.plot(farbe,hy,hx)
|
|
|
|
hx++
|
|
|
|
farbe+=4
|
|
|
|
hx:=a
|
|
|
|
hy++
|
|
|
|
|
|
|
|
DAT
|
|
|
|
|
|
|
|
|
|
|
|
org
|
|
|
|
'
|
|
|
|
' Entry: dummy-assemblercode fuer cogtest
|
|
|
|
'
|
|
|
|
entry jmp entry 'just loops
|
|
|
|
|
|
|
|
|
|
|
|
tileset long 0[2816]
|
|
|
|
|
|
|
|
|
|
|
|
DAT
|
|
|
|
|
|
|
|
{{
|
|
|
|
|
|
|
|
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
|
|
|
│ TERMS OF USE: MIT License │
|
|
|
|
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
|
|
|
│Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation │
|
|
|
|
│files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, │
|
|
|
|
│modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software│
|
|
|
|
│is furnished to do so, subject to the following conditions: │
|
|
|
|
│ │
|
|
|
|
│The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.│
|
|
|
|
│ │
|
|
|
|
│THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE │
|
|
|
|
│WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR │
|
|
|
|
│COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, │
|
|
|
|
│ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. │
|
|
|
|
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
|
|
|
}}
|