Piotr-246
Gość
|
Wysłany: Sob 20:34, 18 Wrz 2021 Temat postu: Test 2+6 bity |
|
|
DECLARE SUB zabranie ()
REM Gra "Serca" UWAGA wersaj gry wymaga
REM emulatora o predkosci 6075 cyklow
REM wymaga pliku bitmap1.scr utworzonego przez modul bsave.bas
DECLARE SUB dreptanie ()
DECLARE SUB animacja ()
DECLARE SUB rysowanie ()
DECLARE SUB palety ()
DECLARE SUB plansze ()
DECLARE SUB cegly ()
REM plansza startowa:
DIM SHARED roomx AS INTEGER, roomy AS INTEGER
roomx = 7: roomy = 4
DIM SHARED kolor$(0 TO 255)
DIM pamiec(0 TO 128) AS LONG
DIM poledzialania(0 TO 240) AS LONG
DIM SHARED p$(0 TO 143)
DIM SHARED kod$
DIM SHARED serca(0 TO 15, 0 TO 8) AS INTEGER
DIM SHARED xserca AS INTEGER, yserca AS INTEGER
REM pamiec tla pod wziatek
DIM SHARED tlo(0 TO 32) AS LONG
REM tlo
DIM SHARED szaretlo(0 TO 74) AS LONG
DIM SHARED szaretlo2(0 TO 148) AS LONG
DIM SHARED szaretlo4(0 TO 300) AS LONG
REM dane elementow planszy
DIM SHARED ceg2(0 TO 75) AS LONG
DIM SHARED ceg40(0 TO 730) AS LONG
DIM SHARED ceg17plus17(0 TO 730) AS LONG
DIM SHARED ceg13plus13(0 TO 760) AS LONG
DIM SHARED ceg4plus20plus4(0 TO 750) AS LONG
DIM SHARED palma(0 TO 64) AS LONG
DIM SHARED blokp(0 TO 74) AS LONG
DIM SHARED bloks(0 TO 74) AS LONG
DIM SHARED blokk(0 TO 74) AS LONG
DIM SHARED blok2(0 TO 158) AS LONG
DIM SHARED blok4(0 TO 296) AS LONG
REM ****************** DANE ANIMACJI
DIM SHARED znakp1(0 TO 128) AS LONG
DIM SHARED znakl1(0 TO 128) AS LONG
DIM SHARED znakp2(0 TO 128) AS LONG
DIM SHARED znakl2(0 TO 128) AS LONG
DIM SHARED znakp3(0 TO 128) AS LONG
DIM SHARED znakl3(0 TO 128) AS LONG
DIM SHARED vertd1(0 TO 128) AS LONG
REM matryce okien
DIM SHARED window1(0 TO 160) AS LONG
DIM SHARED window2(0 TO 160) AS LONG
DIM SHARED window3(0 TO 160) AS LONG
DIM SHARED wentylator(0 TO 64) AS LONG
REM ************************* DANE STARTOWE
SCREEN 13
REM PRINT FRE(-2): END
DEF SEG = 0: REM - to dla pomiaru predkosci
x = 150: y = 35: xs = 150: ys = 35: REM wspolrzedne poczatkowe gracza na ekranie
licz = -1: REM wartosc startowa zegara
REM roomx = 3: roomy = 3 przeniesione wyzej
kolwent = 30 + 30 * 256 + 30 * 65536: REM kolor lopat wentylatora
REM ***** SUB palety - ustawienie nowych wartosci barw
palety
REM ***** SUB cegly - zapelnienie pozostalych tablic
cegly
REM SUB plansze - wypelnienie tablicy wygladu plansz
plansze
REM SUB animacja - tablice animacji postaci
REM animacja
REM ************************* WYBOR POMIESZCZENIA
rysuj:
kod$ = p$(roomx + roomy * 16)
REM ******************** rysowanie pomieszczenia
t0 = PEEK(1132): REM pomiar czasu rysowania
REM SUB rysowanie - rysowanie planszy
rysowanie
REM pomiar czasu rysowania
t1 = PEEK(1132):
REM menu na dole
COLOR 235
REM LOCATE 23, 1: FOR i = 1 TO 40: PRINT CHR$(223); : NEXT i
LOCATE 25, 15: PRINT "L-SHIFT ALT P-SHIFT";
LOCATE 24, 2: COLOR 3: PRINT "T:"; t0; "/"; t1; FRE(-2);
PRINT " ROOM:"; roomx; "/"; roomy; "--";
REM **************** zapamietanie pola pod graczem
GET (x, y)-(x + 15, y + 31), pamiec
GET (x - 4, y - 4)-(x + 19, y + 35), poledzialania
REM PUT (x, y), vertd1, PSET
liczsercaroom = 0: zrobione = 0
GOTO postaw
REM *************************** PETLA GLOWNA
petla:
dx = 0: dy = 0
IF dzwiekbrania = 1 THEN dzwiekbrania = 0: zabranie
REM ******************* czas gry w sekundach
se$ = MID$(TIME$, 7, 2)
se = VAL(se$)
IF se <> ses THEN licz = licz + 1
ses = se
LOCATE 25, 2: COLOR 15: PRINT "Czas:"; licz;
REM ************************ petla opozniajaca
FOR delay = 1 TO 700: NEXT delay
REM faza wentylatora
komorka = PEEK(1132) / 1.5
faz = INT(komorka)
IF faz / 3 = INT(faz / 3) THEN faza = 0
IF (faz + 1) / 3 = INT((faz + 1) / 3) THEN faza = 1
IF (faz + 2) / 3 = INT((faz + 2) / 3) THEN faza = 2
FOR i = 0 TO 2: i16 = i * 16
IF faza = 0 THEN PALETTE 11 + i16, kolwent: PALETTE 12 + i16, kolwent: PALETTE 13 + i16, 0
IF faza = 1 THEN PALETTE 11 + i16, 0: PALETTE 12 + i16, kolwent: PALETTE 13 + i16, kolwent
IF faza = 2 THEN PALETTE 11 + i16, kolwent: PALETTE 12 + i16, 0: PALETTE 13 + i16, kolwent
NEXT i
REM ************************ sprawdzenie klawiszy
alt = 0: lshift = 0: pshift = 0: skos = 0
k$ = INKEY$
IF k$ = "f" THEN roomx = roomx - 1: GOTO rysuj
IF k$ = "h" THEN roomx = roomx + 1: GOTO rysuj
IF k$ = "t" THEN roomy = roomy - 1: GOTO rysuj
IF k$ = "b" THEN roomy = roomy + 1: GOTO rysuj
IF k$ = CHR$(27) THEN END
REM klawisz alt - wznoszenie sie
IF (PEEK(1047) AND 8) = 8 THEN alt = 1
IF (PEEK(1047) AND 2) = 2 THEN lshift = 1
IF (PEEK(1047) AND 1) = 1 THEN pshift = 1
REM bezruch = grawitacja
IF lshift = 0 AND pshift = 0 AND alt = 0 THEN dy = 2: vert = 1: obrot = 0: przebiervert = 0: GOTO czy
POKE 1050, PEEK(1052): REM czyszczenie bufora klawiatury
IF lshift = 1 THEN dx = -4: dy = 2: obrot = -1: vert = 0
IF pshift = 1 THEN dx = 4: dy = 2: obrot = 1: vert = 0
IF alt = 1 THEN dy = -4: vert = 1
IF dx <> 0 AND dy <> 0 THEN skos = 1
czy:
REM ************ sprawdzenie czy jest przejscie do innej planszy
IF x + dx > 300 THEN x = 5: xs = 5: roomx = roomx + 1: GOTO rysuj
IF x + dx < 3 THEN x = 300: xs = 300: roomx = roomx - 1: GOTO rysuj
IF y + dy > 144 THEN y = 5: ys = 5: roomy = roomy + 1: GOTO rysuj
IF y + dy < 4 THEN y = 145: ys = 145: roomy = roomy - 1: GOTO rysuj
REM *********** sprawdzenie czy ruch jest mozliwy
REM sprawdzenie przeszkody. Przeszkoda sa kolory > 200
xmozliwy = 0: xniemozliwy = 0
ymozliwy = 0: yniemozliwy = 0
REM sprawdzenie sasiedztwa obok
IF dx > 0 THEN
FOR i = 0 TO 31: IF POINT(x + 19, y + i) > 200 THEN xniemozliwy = 1: EXIT FOR
NEXT i
END IF
IF dx < 0 THEN
FOR i = 0 TO 31: IF POINT(x - 3, y + i) > 200 THEN xniemozliwy = 1: EXIT FOR
NEXT i
END IF
IF xniemozliwy = 0 THEN xmozliwy = 1
IF xniemozliwy = 1 THEN xmozliwy = 0
REM sprawdzenie sasiedztwa gora dol
IF dy > 0 THEN
FOR i = 0 TO 15:
IF POINT(x + i, y + 32) > 200 THEN yniemozliwy = 1: EXIT FOR
IF POINT(x + i, y + 33) > 200 THEN yniemozliwy = 1: EXIT FOR
NEXT i
END IF
IF dy < 0 THEN
FOR i = 0 TO 15
IF POINT(x + i, y - 4) > 200 THEN yniemozliwy = 1: EXIT FOR
IF POINT(x + i, y - 5) > 200 THEN yniemozliwy = 1: EXIT FOR
NEXT i
END IF
IF yniemozliwy = 0 THEN ymozliwy = 1
IF yniemozliwy = 1 THEN ymozliwy = 0
REM ruch gdy oba mozliwe x oraz y
IF ymozliwy = 1 AND xmozliwy = 1 THEN IF dx <> 0 OR dy <> 0 THEN GOTO ruch
REM szczegolne przypadki gdy tylko x albo y mozliwy
IF ymozliwy = 0 AND xmozliwy = 1 THEN dy = 0: GOTO czy
IF ymozliwy = 1 AND xmozliwy = 0 THEN dx = 0: GOTO czy
REM ruch niemozliwy powrot petli glownej bez zmian pozostaja x y
x = xs: y = ys
GOTO petla
REM ***************** RUCH
ruch:
x = x + dx: y = y + dy
IF dy = 0 AND przebieranie = 0 AND alt = 0 THEN dreptanie: REM dzwiek chodzenia
REM ******************** czy jest wziatek
deltawx = ABS(x + 4 - xserca)
deltawy = ABS(y + 16 - yserca)
IF deltawx < 10 AND deltawy < 22 THEN GOSUB wziatek
REM ************************************** operacja odswiezania tla
postaw:
REM punkt 1 zapamietanie nowego pola dzialania (brudnego)
REM w oparciu o nowe x,y
GET (x - 4, y - 4)-(x + 19, y + 35), poledzialania
REM************ 2 odnowienie pola dzialania uwzgledniajac dawne tlo
deltax = x - xs: deltay = y - ys
inversx = -1 * deltax: inversy = -1 * deltay
inver4 = INT(inversx / 4)
FOR yt = 0 TO 31:
yt4 = yt * 4
yt6 = (yt + inversy) * 6
FOR xt = 0 TO 3
index1 = 1 + (yt6 + 24) + (xt + inver4) + 1
index2 = 1 + yt4 + xt
poledzialania(index1) = pamiec(index2)
NEXT xt: NEXT yt
REM zmazanie serca z pola dzialania
IF liczsercaroom = 1 AND zrobione = 0 THEN
zrobione = 1
PUT (x - 4, y - 4), poledzialania, PSET
PUT (xserca, yserca), tlo, PSET
GET (x - 4, y - 4)-(x + 19, y + 35), poledzialania
END IF
REM nowa mala pamiec
FOR yt = 0 TO 31:
yt4 = yt * 4
yt6 = yt * 6
FOR xt = 0 TO 3:
index1 = 1 + (yt6 + 24) + (xt + 1):
index2 = 1 + yt4 + xt:
pamiec(index2) = poledzialania(index1): NEXT xt: NEXT yt
REM ************* rysowanie nowej postaci WEDLUG FAZY RUCHU
REM aby nie rysowac dwoch postaci w przypadku skosu
IF skos = 1 THEN GOTO bezskosu:
REM ************************** ruch w dol lub gore
IF vert = 1 THEN wkleic = 7: GOTO wklej
bezskosu:
REM ************************** ruch w lewo
IF obrot = -1 THEN
IF dy = 0 THEN przebieranie = przebieranie + 1
IF przebieranie = 3 THEN przebieranie = 0
IF przebieranie = 0 THEN wkleic = 1: GOTO wklej
IF przebieranie = 1 THEN wkleic = 2: GOTO wklej
IF przebieranie = 2 THEN wkleic = 3: GOTO wklej
END IF
REM ****************** ruch w prawo
IF obrot = 1 THEN
IF dy = 0 THEN przebieranie = przebieranie + 1
IF przebieranie = 3 THEN przebieranie = 0
IF przebieranie = 0 THEN wkleic = 4: GOTO wklej
IF przebieranie = 1 THEN wkleic = 5: GOTO wklej
IF przebieranie = 2 THEN wkleic = 6: GOTO wklej
END IF
xs = x: ys = y
GOTO petla
wklej:
IF wkleic = 1 THEN FOR yt = 0 TO 31: yt4 = yt * 4: yt6 = yt * 6: FOR xt = 0 TO 3: index1 = 1 + yt6 + xt + 1 + 24: index2 = 1 + yt4 + xt: poledzialania(index1) = (poledzialania(index1) OR znakl1(index2)): NEXT xt: NEXT yt
IF wkleic = 2 THEN FOR yt = 0 TO 31: yt4 = yt * 4: yt6 = yt * 6: FOR xt = 0 TO 3: index1 = 1 + yt6 + xt + 1 + 24: index2 = 1 + yt4 + xt: poledzialania(index1) = (poledzialania(index1) OR znakl2(index2)): NEXT xt: NEXT yt
IF wkleic = 3 THEN FOR yt = 0 TO 31: yt4 = yt * 4: yt6 = yt * 6: FOR xt = 0 TO 3: index1 = 1 + yt6 + xt + 1 + 24: index2 = 1 + yt4 + xt: poledzialania(index1) = (poledzialania(index1) OR znakl3(index2)): NEXT xt: NEXT yt
IF wkleic = 4 THEN FOR yt = 0 TO 31: yt4 = yt * 4: yt6 = yt * 6: FOR xt = 0 TO 3: index1 = 1 + yt6 + xt + 1 + 24: index2 = 1 + yt4 + xt: poledzialania(index1) = (poledzialania(index1) OR znakp1(index2)): NEXT xt: NEXT yt
IF wkleic = 5 THEN FOR yt = 0 TO 31: yt4 = yt * 4: yt6 = yt * 6: FOR xt = 0 TO 3: index1 = 1 + yt6 + xt + 1 + 24: index2 = 1 + yt4 + xt: poledzialania(index1) = (poledzialania(index1) OR znakp2(index2)): NEXT xt: NEXT yt
IF wkleic = 6 THEN FOR yt = 0 TO 31: yt4 = yt * 4: yt6 = yt * 6: FOR xt = 0 TO 3: index1 = 1 + yt6 + xt + 1 + 24: index2 = 1 + yt4 + xt: poledzialania(index1) = (poledzialania(index1) OR znakp3(index2)): NEXT xt: NEXT yt
IF wkleic = 7 THEN FOR yt = 0 TO 31: yt4 = yt * 4: yt6 = yt * 6: FOR xt = 0 TO 3: index1 = 1 + yt6 + xt + 1 + 24: index2 = 1 + yt4 + xt: poledzialania(index1) = (poledzialania(index1) OR vertd1(index2)): NEXT xt: NEXT yt
REM wklejenie wyniku operacji na tablicy:
PUT (x - 4, y - 4), poledzialania, PSET
xs = x: ys = y
GOTO petla
REM GOSUB-RETURN****************************** obsluga wziatku
wziatek:
IF serca(roomx, roomy) = 0 THEN GOTO niemawziatku
IF liczsercaroom = 1 THEN GOTO niemawziatku
serca(roomx, roomy) = 0
liczserca = liczserca + 1
PUT (xserca, yserca), tlo, PSET
liczsercaroom = 1
dzwiekbrania = 1
LOCATE 1, 1: COLOR 6: PRINT liczserca;
niemawziatku:
RETURN
SUB animacja
REM ************************ znaczek - glowny bohater
REM ****************** DANE ANIMACJI
REM ten SUB jest do skasowania
END SUB
SUB cegly
BLOAD "bitmap1.scr"
REM INPUT a$
REM pobranie z ekranu tablic elementow
REM uwaga! wysokosc elementu to 9 lub 18 px
GET (0, 0)-(31, 8), ceg2
GET (0, 0)-(319, 8), ceg40
GET (0, 9)-(319, 17), ceg17plus17
GET (0, 18)-(319, 26), ceg13plus13
GET (0, 27)-(319, 35), ceg4plus20plus4
GET (0, 36)-(15, 53), szaretlo
GET (0, 36)-(31, 53), szaretlo2
GET (0, 36)-(63, 53), szaretlo4: REM 36+18=46+8=54
GET (16, 64)-(31, 79), palma
GET (32, 64)-(47, 81), blokp
GET (48, 64)-(63, 81), bloks
GET (64, 64)-(79, 81), blokk
GET (0, 156)-(31, 173), blok2
GET (0, 156)-(63, 173), blok4
GET (0, 88)-(15, 119), znakl1
GET (16, 88)-(31, 119), znakp1
GET (32, 88)-(47, 119), znakl2
GET (48, 88)-(63, 119), znakp2
GET (64, 88)-(79, 119), znakl3
GET (80, 88)-(95, 119), znakp3
GET (96, 88)-(111, 119), vertd1
GET (0, 120)-(31, 139), window1
GET (32, 120)-(63, 139), window2
GET (64, 120)-(95, 139), window3
GET (0, 140)-(15, 155), wentylator
CLS
END SUB
SUB dreptanie
DEF SEG = 0
REM wlaczene zegara
OUT 67, 182
REM odczytanie wartosci portu 97
stary.port = INP(97)
REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)
REM wlaczenie glosnika
OUT 97, nowy.port
REM najpierw mlodszy potem starszy bajt
t0 = PEEK(1132)
REM ewentualnie:
REM OUT 66, 30: OUT 66, 0
REM OUT 66, 164: OUT 66, 2
REM OUT 66, 130: OUT 66, 1
REM OUT 66, 74: OUT 66, 0
REM OUT 66, 220: OUT 66, 1
FOR i = 1 TO 10
OUT 66, 30: OUT 66, 0
OUT 66, 84: OUT 66, 2
OUT 66, 30: OUT 66, 0
OUT 66, 94: OUT 66, 2
OUT 66, 10: OUT 66, 0
OUT 66, 40: OUT 66, 2
OUT 66, 84: OUT 66, 0
OUT 66, 10: OUT 66, 2
NEXT i
REM FOR i = 1 TO 150: NEXT i
t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port
END SUB
SUB palety
REM palety kolorow *********************************
REM max koloru=3F
FOR i = 0 TO 255: kolor$(i) = "00 00 00 00": NEXT i
REM kolory za ludzikiem
kolor$(0) = "00 00 00 00": REM rejestr zero- wolny
kolor$(1) = "01 05 05 06": REM tlo plyta
kolor$(2) = "02 02 03 02": REM tlo fuga
kolor$(3) = "03 07 06 06": REM tlo krawedz
kolor$(4) = "04 00 22 00": REM liscie
kolor$(5) = "05 3F 08 00": REM serce
kolor$(6) = "06 30 30 30": REM framuga okna
kolor$(7) = "07 28 0A 00": REM doniczka drzewa
kolor$(8) = "08 00 21 39": REM niebo
kolor$(9) = "09 3F 3F 00": REM slonce
kolor$(10) = "0A 14 14 14": REM framuga zewnetrzna
kolor$(11) = "0B 00 00 00": REM wentylator faza 1
kolor$(12) = "0C 00 00 00": REM wentylator faza 2
kolor$(13) = "0D 00 00 00": REM wentylator faza 3
kolor$(14) = "0E 3F 3F 3F"
kolor$(15) = "0F 3F 3F 3F": REM napis startowy / zastrzezony dla gracza
REM rejestry przezroczyste gracza
kolor$(16) = "10 18 02 02": REM sweter + zero
kolor$(17) = "11 18 02 02": REM
kolor$(18) = "12 18 02 02": REM
kolor$(19) = "13 18 02 02": REM
kolor$(20) = "14 22 12 00": REM sweter + liscie
kolor$(21) = "15 3F 00 00": REM
kolor$(22) = "16 2F 09 09": REM sweter + framuga okna
kolor$(23) = "17 2B 08 00": REM sweter + doniczka drzewa
kolor$(24) = "18 25 16 24": REM sweter + niebo
kolor$(25) = "19 3F 3F 3F": REM sweter + slonce
kolor$(26) = "1A 16 0F 0F": REM sweter + framuga zew
kolor$(27) = "1B 3F 3F 3F": REM
kolor$(28) = "1C 3F 3F 3F": REM
kolor$(29) = "1D 3F 3F 3F": REM
kolor$(30) = "1E 3F 3F 3F": REM
REM kolor 31 1F zastrzezony dla gracza
kolor$(32) = "20 0A 13 29": REM spodnie + zero
kolor$(33) = "21 0A 13 29": REM
kolor$(34) = "22 0A 13 29": REM
kolor$(35) = "23 0A 13 29": REM
kolor$(36) = "24 05 1D 24": REM spodnie+ liscie
kolor$(37) = "25 3F 3F 3F": REM
kolor$(38) = "26 1B 1B 32": REM spodnie + framuga okna
kolor$(39) = "27 1A 10 3F": REM spodnie + doniczka
kolor$(40) = "28 00 1A 3F": REM spodnie + niebo
kolor$(41) = "29 3F 3F 3F": REM spodnie +slonce
kolor$(42) = "2A 10 14 20": REM spodnie + framuga zew
kolor$(43) = "2B 3F 3F 3F": REM
kolor$(44) = "2C 3F 3F 3F": REM
kolor$(45) = "2D 3F 3F 3F": REM
kolor$(46) = "2E 3F 3F 3F": REM
REM rejestr 47 2F zastrzezony dla gracza
REM ******* ludzik - uwaga rejestry sa rozrzucone nF (1F-FF)
REM rejestry nieprzezroczyste
kolor$(31) = "1F 2F 09 09": REM sweter
kolor$(47) = "2F 0D 1A 37": REM spodnie
kolor$(63) = "3F 1A 1A 1A": REM wlosy i buty
kolor$(79) = "4F 10 10 10": REM pasek2
kolor$(95) = "5F 3F 2F 0F":
kolor$(111) = "6F 3F 30 20": REM skora1
kolor$(127) = "7F 1A 02 02": REM sweter 2 przeniesiony do przezroczystych
kolor$(143) = "8F 32 22 02": REM nos
kolor$(159) = "9F 0A 13 29": REM spodnie2 przeniesiony do przezroczystych
kolor$(175) = "AF 22 02 02": REM sweter3
kolor$(191) = "BF 20 20 20": REM pasek
kolor$(207) = "CF 37 27 06": REM usta
REM bloczek
kolor$(224) = "E0 00 00 00": REM
kolor$(225) = "E1 04 04 04": REM
kolor$(226) = "E2 08 08 08": REM
kolor$(227) = "E3 0B 0B 0B": REM
kolor$(228) = "E4 10 10 10": REM
kolor$(229) = "E5 14 14 14": REM
kolor$(230) = "E6 18 18 18": REM
kolor$(231) = "E7 1B 1B 1B": REM
kolor$(232) = "E8 20 20 20": REM
kolor$(233) = "E9 24 24 24": REM
kolor$(234) = "EA 28 28 28": REM
kolor$(235) = "EB 2B 2B 2B": REM
kolor$(236) = "EC 30 30 30": REM
kolor$(237) = "ED 34 34 34": REM
kolor$(238) = "EE 38 38 38": REM
kolor$(239) = "EF 3F 3F 3F": REM zarezerwowany dla ludzika
REM cegly male
kolor$(252) = "FC 30 27 27": REM krawedz
kolor$(253) = "FD 14 0E 0E": REM fuga
kolor$(254) = "FE 1F 17 17": REM cegla
kolor$(255) = "FF 3F 3F 3F": REM zarezerwowany dla ludzika
FOR i = 0 TO 255: rej$ = "&H" + MID$(kolor$(i), 1, 2)
red$ = "&H" + MID$(kolor$(i), 4, 2)
gre$ = "&H" + MID$(kolor$(i), 7, 2)
blu$ = "&H" + MID$(kolor$(i), 10, 2)
REM PRINT rej$; " "; red$; " "; gre$; " "; blu$
rej = VAL(rej$)
red = VAL(red$)
gre = VAL(gre$)
blu = VAL(blu$)
REM PRINT rej; " "; red; " "; gre; " "; blu
PALETTE rej, red + gre * 256 + blu * 65536
NEXT i
END SUB
SUB plansze
REM ************************** DANE pomieszczen
REM ***************** obliczane od roomx=1,roomy=1
REM ***************** roomy*16+roomx
REM kody plansz +++nr.po.ok.we.se_kw_dod
REM ************ plansze wiersza roomy=0
p$(0) = "h22233322d.0.UI.YO....GN_______"
p$(1) = "h000fff11h.1....MD...._________"
p$(2) = "h11133333f.2.UI.HE....___EQ____"
p$(3) = "hh2223cchh.3..........SJ_______"
p$(4) = "h300033fff.4....ZK...._________"
p$(5) = "h2001c333f.5....LG....______AQG"
p$(6) = "h111g3222f.6....LD....___EQ____"
p$(7) = "hh222d111g.7.BE....DF.aH_WI____"
p$(8) = "hhDDDfCCCg.8.........._________"
p$(9) = "hhCCCf111c.9.........._________"
p$(10) = "hhDDDf222g.A..........GG_EQ____"
p$(11) = "hh333f111d.B....HG...._________"
p$(12) = "hhffff333g.C.........._________"
p$(13) = "h22233333c.D.UN.aK.DF.MK____AYC"
p$(14) = "h111ff22hh.E..........___aG_BLM"
p$(15) = "h3333311cc.F....ZK....aH____AIG"
REM ************ plansze wiersza roomy=1
p$(16) = "d333c2223h.0.......FN._________"
p$(17) = "h33330003h.1.WH.YO....RN_______"
p$(18) = "ff333111ff.2.WJ.ML...._________"
p$(19) = "hc222c333c.3..........___QQ____"
p$(20) = "f31113333h.4.UM.aI.aO._________"
p$(21) = "f333aa333h.5..........RN_GQ____"
p$(22) = "ffff333fff.6....DJ....aM_______"
p$(23) = "gg333a33ff.7.........._________"
p$(24) = "gg333333ff.8.AK....IF._________"
p$(25) = "cccc33cccc.9..........SJ_______"
p$(26) = "gg33dd33ff.A....LF....aO_______"
p$(27) = "ddaa22cccc.B.........._________"
p$(28) = "g33300333h.C.AM....aO._________"
p$(29) = "c33311333c.D.0M.......ZK____AQO"
p$(30) = "h3322233dd.E.......aF._________"
p$(31) = "c33111333h.F.AM.bD....___QQ____"
REM ************* plansze wiersza roomy=2
p$(32) = "h333ff333c.0..........KE_WQ___"
p$(33) = "h333c2222c.1....MD....UP______"
p$(34) = "faaaa0000h.2....WO.VI.________"
p$(35) = "ccccc1111f.3....MM....___EQ____"
p$(36) = "h33333c333.4.WO.NP....SM_______"
p$(37) = "haa33222af.5.UJ....GL._________"
p$(38) = "f333c111ah.6....aM....UP_______"
p$(39) = "ff333d333g.7....YP....___KQ____"
p$(40) = "ff3333333g.8.#I.......KM_______"
p$(41) = "c33g33d33c.9.........._________"
p$(42) = "ff3333333g.A.WM.LI...._________"
p$(43) = "cc333322cc.B.UJ......._________"
p$(44) = "hhaacc00hh.C.......JG.ZM____AQM_!"
p$(45) = "c333cc11gg.D....aN....______AQM_!"
p$(46) = "dd33cc22hh.E..........______AQE_!"
p$(47) = "hh3331113c.F.UK....VI.___EQ_____!"
REM ************ plansze wiersza roomy=3
p$(48) = "c333c2222f.0....ZM.ZD.SF________!"
p$(49) = "ccccc1111h.1..........________"
p$(50) = "ha3222333c.2.#F.LO....UO_SQ___"
p$(51) = "ff3111333f.3.WM.YI.VI.SJ_GQ___"
p$(52) = "h3333c333f.4..........NG______"
p$(53) = "ff333c222f.5....ZO....SG________!"
p$(54) = "hhaaff000f.6..........___KQ___"
p$(55) = "gggg33111f.7....LO.VJ.________"
p$(56) = "gg3322ffff.8..........GG______"
p$(57) = "cccc00hfff.9..........________"
p$(58) = "gg33DDffff.A..........___KK___"
p$(59) = "cccccfffff.B.......TL.________"
p$(60) = "hh3333333f.C....KK....DP______"
p$(61) = "g333333hhh.D.UJ....TF.__________!"
p$(62) = "hh3222333f.E..........___GQ___"
p$(63) = "c331113hhh.F....ZK....________"
REM ****************** plansze wiersza roomy=4
p$(64) = "f22322322h.0....DD....SP_YQ___"
p$(65) = "h00f00f00h.1..........________"
p$(66) = "c11311311f.2....aP.KP.__________!"
p$(67) = "ff3332223h.3.UJ.ML....___YQ___"
p$(68) = "f3333111hh.4.WJ.YL....________"
p$(69) = "ffaafaaaff.5.......VI.________"
p$(70) = "ffa333c33h.6....OG....SQ_YQ___"
p$(71) = "ff223c333d.7....aO....__________!_3D3D_2m2k_3#3#_3#3#_3R3g": REM startowa
p$(72) = "ff113c333d.8..........aO________!"
p$(73) = "ff33cc33ff.9..........__________!"
p$(74) = "ff3322333d.A.WM.LI.ZP.PP________!"
p$(75) = "ff22DD333f.B.UM.......___EQ_____!"
p$(76) = "ff11333hhh.C.......KH.________"
p$(77) = "h333333333.D....SK....bF______"
p$(78) = "ff22233hhh.E.UJ.......________"
p$(79) = "h311133fff.F.WJ.......MM______"
REM ******************* plansze wiersza roomy=5
p$(80) = "haf222faff.0.......VI.___KK___"
p$(81) = "hhf111222h.1..........SP______"
p$(82) = "fa333c000h.2....GO....________"
p$(83) = "h222fa111f.3..........___YQ___"
p$(84) = "h111c2223h.4.0Q....EE.MM______"
p$(85) = "ffffa111ff.5..........________"
p$(86) = "h333c333af.6....DD....ZF_MQ___"
p$(87) = "dd333f333g.7.......VI.___aI___"
p$(88) = "dd3333333g.8.UK.KO....________"
p$(89) = "f32233f33f.9.......ED.KK______"
p$(90) = "ddDDCC333g.A....ZK....KO______"
p$(91) = "f33300f33f.B..........________"
p$(92) = "h33300333c.C....NN....________"
p$(93) = "333311333h.D.0M....TG.GG______"
p$(94) = "h33222333c.E.AM.......________"
p$(95) = "ff3111333h.F.WM.FF....___YQ___"
REM ******************* plansze wiersza roomy=6
p$(96) = "fffa222hhh.0....EJ....___YM___"
p$(97) = "hhhf000bbb.1....SJ....ML______"
p$(98) = "h222111hhh.2..........___KM___"
p$(99) = "f111aaafff.3....PH....ZJ______"
p$(100) = "h222ahhhhh.4..........EE______"
p$(101) = "f11133222h.5.0I.......___GQ___"
p$(102) = "ffffff000h.6....LO....________"
p$(103) = "gg333d111f.7....MO....aP______"
p$(104) = "gg333hCCCh.8.......ZN.KH______"
p$(105) = "ffffffDDDh.9..........________"
p$(106) = "gg333fCCCh.A..........___KI___"
p$(107) = "ff3333111h.B.0I....KK.aP______"
p$(108) = "cc22dd22ff.C..........________"
p$(109) = "hhDDffDDhh.D.......TJ.LN______"
p$(110) = "ccc2222hhh.E..........________"
p$(111) = "hhhDDDDhhh.F..........TK_KM___"
REM ******************* plansze wiersza roomy=7
p$(112) = "hffa222hhh.0..........__________!"
p$(113) = "bbbb000hhh.1....KK....__________!"
p$(114) = "h222111fff.2.BJ.......ZE____AIK_!"
p$(115) = "f000aaahhh.3..........___KM_____!"
p$(116) = "h000ahhhhh.4.......KF.__________!"
p$(117) = "h111hh222h.5..........KQ________!"
p$(118) = "hfffff000f.6....KO....__________!"
p$(119) = "fffeee000h.7..........___KQ_____!"
p$(120) = "hh3333000h.8.BL.......__________!"
p$(121) = "hCCCffDDDh.9..........KO________!"
p$(122) = "hDDDccCCCh.A..........___MK_____!"
p$(123) = "hf333300Df.B.AL.......__________!"
p$(124) = "ffffff00hh.C....KN....__________!"
p$(125) = "hhhhhf00fh.D.......TK.__________!"
p$(126) = "h33c3300ff.E..........KK________!"
p$(127) = "hhheefDDhh.F....KN....__________!"
REM ******************* plansze wiersza roomy=8
p$(128) = "hffa222hhh.0..........__________!"
p$(129) = "hbbb000hhh.1..........__________!"
p$(130) = "f222111hhh.2..........__________!"
p$(131) = "h000aaahhh.3..........______COI_!"
p$(132) = "h000ahhhhh.4..........__________!"
p$(133) = "h111hh222h.5..........__________!"
p$(134) = "ffffff000h.6..........______DQK_!"
p$(135) = "hhhhha000h.7..........______ESK_!"
p$(136) = "hh3333000h.8..........______CKK_!"
p$(137) = "hCCCffDDDh.9..........__________!"
p$(138) = "hDDDccCCCh.A..........__________!"
p$(139) = "ff333300Dh.B..........__________!"
p$(140) = "hfffff00hh.C..........__________!"
p$(141) = "hhhhhf00fh.D..........__________!"
p$(142) = "f3333300hh.E..........______COL_!"
p$(143) = "hhheefDDhh.F..........__________!"
REM tablica serc
FOR xr = 0 TO 15
FOR yr = 0 TO 8
s = xr + yr * 16
znak$ = MID$(p$(s), 23, 1)
IF znak$ <> "_" THEN serca(xr, yr) = 1
NEXT yr: NEXT xr
END SUB
SUB rysowanie
IF MID$(kod$, 35, 1) = "" THEN GOTO omin
FOR yw = 0 TO 9
IF yw = 0 THEN e1$ = MID$(kod$, 35, 1): e2$ = MID$(kod$, 36, 1)
IF yw = 1 THEN e1$ = MID$(kod$, 37, 1): e2$ = MID$(kod$, 38, 1)
REM 39 przerwa
IF yw = 2 THEN e1$ = MID$(kod$, 40, 1): e2$ = MID$(kod$, 41, 1)
IF yw = 3 THEN e1$ = MID$(kod$, 42, 1): e2$ = MID$(kod$, 43, 1)
REM 44 przerwa
IF yw = 4 THEN e1$ = MID$(kod$, 45, 1): e2$ = MID$(kod$, 46, 1)
IF yw = 5 THEN e1$ = MID$(kod$, 47, 1): e2$ = MID$(kod$, 48, 1)
REM 49 przerwa
IF yw = 6 THEN e1$ = MID$(kod$, 50, 1): e2$ = MID$(kod$, 51, 1)
IF yw = 7 THEN e1$ = MID$(kod$, 52, 1): e2$ = MID$(kod$, 53, 1)
REM 54 przerwa
IF yw = 8 THEN e1$ = MID$(kod$, 55, 1): e2$ = MID$(kod$, 56, 1)
IF yw = 9 THEN e1$ = MID$(kod$, 57, 1): e2$ = MID$(kod$, 58, 1)
e = ASC(e1$) - 48
IF (e AND 2) = 2 THEN LINE (0, yw * 18)-(39, yw * 18 + 17), 235, BF
IF (e AND 2) = 0 THEN LINE (0, yw * 18)-(39, yw * 18 + 17), 0, BF
IF (e AND 1) = 1 THEN LINE (279, yw * 18)-(319, yw * 18 + 17), 235, BF
IF (e AND 1) = 0 THEN LINE (279, yw * 18)-(319, yw * 18 + 17), 0, BF
f = ASC(e2$) - 35
IF (f AND 32) = 32 THEN LINE (40, yw * 18)-(79, yw * 18 + 17), 235, BF
IF (f AND 32) = 0 THEN LINE (40, yw * 18)-(79, yw * 18 + 17), 0, BF
IF (f AND 16) = 16 THEN LINE (80, yw * 18)-(119, yw * 18 + 17), 235, BF
IF (f AND 16) = 0 THEN LINE (80, yw * 18)-(119, yw * 18 + 17), 0, BF
IF (f AND 8) = 8 THEN LINE (120, yw * 18)-(159, yw * 18 + 17), 235, BF
IF (f AND 8) = 0 THEN LINE (120, yw * 18)-(159, yw * 18 + 17), 0, BF
IF (f AND 4) = 4 THEN LINE (160, yw * 18)-(199, yw * 18 + 17), 235, BF
IF (f AND 4) = 0 THEN LINE (160, yw * 18)-(199, yw * 18 + 17), 0, BF
IF (f AND 2) = 2 THEN LINE (200, yw * 18)-(239, yw * 18 + 17), 235, BF
IF (f AND 2) = 0 THEN LINE (200, yw * 18)-(239, yw * 18 + 17), 0, BF
IF (f AND 1) = 1 THEN LINE (240, yw * 18)-(279, yw * 18 + 17), 235, BF
IF (f AND 1) = 0 THEN LINE (240, yw * 18)-(279, yw * 18 + 17), 0, BF
NEXT yw
omin:
IF MID$(kod$, 35, 1) <> "" THEN GOTO omin2
FOR yw = 0 TO 9
el$ = MID$(kod$, yw + 1, 1)
y16 = yw * 18
REM tymczasowe sygnalizacje bledow:
IF el$ = "Q" OR el$ = "L" THEN COLOR 15: LINE (0, y16)-(200, y16)
IF el$ = "P" OR el$ = "W" OR el$ = "=" THEN COLOR 15: LINE (0, y16)-(200, y16)
IF el$ = "A" OR el$ = "B" OR el$ = "U" THEN COLOR 15: LINE (0, y16)-(200, y16)
IF el$ = "@" THEN COLOR 15: LINE (0, y16)-(200, y16)
REM elementy uzupelniajace
IF el$ = "C" THEN
PUT (128, y16), szaretlo4, PSET: PUT (192, y16), szaretlo4, PSET
PUT (256, y16), szaretlo4, PSET
PUT (0, y16), blok4, PSET: PUT (64, y16), blok2, PSET:
PUT (96, y16), bloks, PSET: PUT (112, y16), blokk, PSET
END IF
IF el$ = "D" THEN
PUT (0, y16), szaretlo4, PSET: PUT (64, y16), szaretlo4, PSET
PUT (128, y16), szaretlo4, PSET
PUT (192, y16), blokp, PSET: PUT (208, y16), blok4, PSET
PUT (272, y16), blok2, PSET: PUT (304, y16), bloks, PSET
END IF
REM czesc automatyczna, znaki a-h
ascii = ASC(el$)
IF ascii > 96 THEN
bity = ascii - 97
PUT (0, y16), blok4, PSET:
pop1 = 0
pop2 = 0
pop3 = 0
IF (bity AND 4) = 4 THEN PUT (64, y16), blok4, PSET: pop1 = 1
IF (bity AND 4) = 0 THEN PUT (48, y16), blokk, PSET: PUT (64, y16), szaretlo4, PSET: pop1 = 0
REM
IF (bity AND 2) = 2 THEN pop2 = 1: PUT (128, y16), blok4, PSET: IF pop1 = 0 THEN PUT (128, y16), blokp, PSET
IF (bity AND 2) = 0 THEN pop2 = 0: PUT (128, y16), szaretlo4, PSET: IF pop1 = 1 THEN PUT (112, y16), blokk, PSET
REM
IF (bity AND 1) = 1 THEN pop3 = 1: PUT (192, y16), blok4, PSET: IF pop2 = 0 THEN PUT (192, y16), blokp, PSET
IF (bity AND 1) = 0 THEN pop3 = 0: PUT (192, y16), szaretlo4, PSET: IF pop2 = 1 THEN PUT (176, y16), blokk, PSET
PUT (256, y16), blok4, PSET
IF pop3 = 0 THEN PUT (256, y16), blokp, PSET
END IF
REM znaki 0-3
IF ascii < 58 THEN
bity = ascii - 48
IF (bity AND 2) = 2 THEN PUT (0, y16), blokk, PSET
IF (bity AND 2) = 0 THEN PUT (0, y16), szaretlo, PSET
PUT (16, y16), szaretlo4, PSET
PUT (80, y16), szaretlo4, PSET
PUT (144, y16), szaretlo4, PSET
PUT (208, y16), szaretlo4, PSET
PUT (272, y16), szaretlo2, PSET
IF (bity AND 1) = 1 THEN PUT (304, y16), blokp, PSET
IF (bity AND 1) = 0 THEN PUT (304, y16), szaretlo, PSET
END IF
NEXT yw
REM rysowanie podestow
el$ = MID$(kod$, 14, 1)
IF el$ = "" OR el$ = "." THEN GOTO dodatek
el2$ = MID$(kod$, 15, 1)
yokna = (ASC(el2$) - 65) * 9
IF el$ = "#" THEN PUT (0, yokna), ceg40, PSET
IF el$ = "W" THEN PUT (0, yokna), ceg4plus20plus4, PSET
IF el$ = "U" THEN PUT (0, yokna), ceg17plus17, PSET
IF el$ = "0" THEN PUT (0, yokna), ceg13plus13, PSET
IF el$ = "A" THEN FOR xx = 0 TO 4: PUT (16 + xx * 64, yokna), ceg2, PSET: NEXT xx
IF el$ = "B" THEN FOR xx = 0 TO 5: PUT (64 + xx * 32, yokna), ceg2, PSET: NEXT xx
REM dodatkowy element
dodatek:
el$ = MID$(kod$, 29, 1)
IF el$ = "" OR el$ = "_" THEN GOTO okna
el2$ = MID$(kod$, 30, 1)
xokna = (ASC(el2$) - 65) * 8
el2$ = MID$(kod$, 31, 1)
yokna = (ASC(el2$) - 65) * 9
IF el$ = "A" THEN
PUT (xokna, yokna), blokp, PSET:
PUT (xokna, yokna + 18), blokp, PSET
PUT (xokna + 16, yokna), blok2, PSET:
PUT (xokna + 16, yokna + 18), blok2, PSET
PUT (xokna + 48, yokna), blokk, PSET:
PUT (xokna + 48, yokna + 18), blokk, PSET
END IF
IF el$ = "B" THEN COLOR 235: LINE (xokna + 5, yokna)-(xokna + 9, yokna + 35), , BF
IF el$ = "C" THEN PUT (xokna, yokna), ceg2, PSET: PUT (xokna + 32, yokna), ceg2, PSET: PUT (xokna + 64, yokna), ceg2, PSET
IF el$ = "D" THEN LINE (xokna, yokna)-(xokna + 22, yokna + 17), 235, BF: LINE (xokna + 42, yokna)-(xokna + 63, yokna + 17), 235, BF
IF el$ = "E" THEN LINE (xokna, yokna)-(xokna + 5, yokna + 35), 235, BF: LINE (xokna + 26, yokna + 36)-(xokna + 31, yokna + 72), 235, BF
okna:
REM rysowanie okien
el$ = MID$(kod$, 17, 1)
IF el$ = "" OR el$ = "." THEN GOTO serce
xokna = (ASC(el$) - 65) * 8
el$ = MID$(kod$, 18, 1)
yokna = (ASC(el$) - 65) * 9
IF roomy < 2 THEN PUT (xokna, yokna), window2, PSET
IF roomy > 1 AND roomy < 5 THEN PUT (xokna, yokna), window1, PSET
IF roomy > 4 THEN PUT (xokna, yokna), window3, PSET
serce:
REM serce
xserca = -20
yokna = -20
IF serca(roomx, roomy) = 0 THEN GOTO donica
el$ = MID$(kod$, 23, 1)
IF el$ = "" OR el$ = "_" THEN GOTO donica
xserca = (ASC(el$) - 65) * 8
el$ = MID$(kod$, 24, 1)
yserca = (ASC(el$) - 65) * 9
GET (xserca, yserca)-(xserca + 15, yserca + 7), tlo
COLOR 5
LINE (xserca, yserca + 1)-(xserca, yserca + 3)
LINE (xserca + 1, yserca)-(xserca + 1, yserca + 4)
LINE (xserca + 2, yserca)-(xserca + 2, yserca + 5)
LINE (xserca + 3, yserca + 1)-(xserca + 3, yserca + 6)
LINE (xserca + 4, yserca)-(xserca + 4, yserca + 5)
LINE (xserca + 5, yserca)-(xserca + 5, yserca + 4)
LINE (xserca + 6, yserca + 1)-(xserca + 6, yserca + 3)
donica:
el$ = MID$(kod$, 26, 1)
IF el$ = "" OR el$ = "_" THEN GOTO wentyl
xokna = (ASC(el$) - 65) * 8
el$ = MID$(kod$, 27, 1)
yokna = (ASC(el$) - 65) * 9 + 2
PUT (xokna, yokna), palma, PSET
wentyl:
el$ = MID$(kod$, 20, 1)
IF el$ = "" OR el$ = "." THEN GOTO koniecrysowania
xokna = (ASC(el$) - 65) * 8
el$ = MID$(kod$, 21, 1)
yokna = (ASC(el$) - 65) * 9
PUT (xokna, yokna), wentylator, PSET
omin2:
koniecrysowania:
LOCATE 24, 2: COLOR 15: PRINT "Czas:"; licz;
END SUB
SUB zabranie
DEF SEG = 0
REM wlaczene zegara
OUT 67, 182
REM odczytanie wartosci portu 97
stary.port = INP(97)
REM ustawienie wartosci "1" dla bitow 1 i 0
nowy.port = (stary.port OR 3)
REM wlaczenie glosnika
OUT 97, nowy.port
REM najpierw mlodszy potem starszy bajt
t0 = PEEK(1132)
OUT 66, 32: OUT 66, 3
FOR i = 1 TO 6000: NEXT i
OUT 66, 204: OUT 66, 4
FOR i = 1 TO 6000: NEXT i
t1 = PEEK(1132)
REM wylaczenie glosnika
OUT 97, stary.port
END SUB
|
|