Friday, November 7, 2014

Amiga Amos Programming: Robot R-29

  This time I'm going to show you screenshots of all levels of the Amiga version of my Robot R-29 game and the entire source code. Let's start from the title screen and the first five original levels. A little translation may be needed: życia - lives; punkty - score; plansza - level

The title screen
Level 1
Level 2
Level 3
Level 4 
Level 5
   As I said earlier, there were only these five levels in the original source code in the Atari magazine in which it was published. I decided to add a few features to make the game more interesting, and at the same time I also designed some new levels. And here they are. Four entirely unique new levels.

Level 6
Level 7
Level 8
Level 9
 And, of course, if the player runs out of the available lives the game over screen appears and on successful completion of congratulations screen. Some more translation: koniec gry - game over; ukończyłeś grę - you have completed the game; naciśnij fire - press fire.

Game over screen
Congratulations screen
  The Amiga Amos was a pretty good implementation of Basic, especially for that time. Although it was an interpreter, its performance was actually pretty good and allowed to write some decent game (for Basic on a 16-bit computer). There is also a compiler available, however I never had a chance to use one back then. Here's a screenshot of the Amos Creator environment, pressing Escape switches from editor to direct mode where one can execute almost any instruction.

The beginning of the source in Amos editor
  And lastly, the source code. If anybody's interested I'll gladly publish a translated version, with variable names and comments all in English language. At the end of the file you'll see level map definitions where different characters represent different elements of each level.
  • @ - wall
  • A, B, C, D - the robot looking at different directions (up, down, left and right)
  • F - spanner
  • E - bomb
  • G - magnet
  • H - magnetic field
  • I - electric field
  • J - land mine
  • K - exit


'--------------------------------------
'|        R O B O T     R - 2 9       |
'|  Autorzy:                          |  
'|        Rafal Bujakowski            |
'|               &                    |
'|        Edyta Bujakowska            |
'|   (c) 1996 Copyright by Tiger.     |
'--------------------------------------
'
Screen Open 0,640,256,4,Hires
Cls 
EXE:
Print : Print : Print 
A=Exist("robot_r-29:")
If A=0 Then Print "Wloz dyskietke gry 'robot r-29'" : Wait 300 : Goto EXE
'
  PL=1
  Dim PLANSZA(32,21)
'
'------------------------------------------------------- 
'
Screen Open 0,320,256,8,Lowres
Flash Off 
 Hide 
Load Iff "robot_r-29:klocki.robot"
'
'     ----   klocki  ----- 
For I=0 To 20
  Get Bob 0,I+1,I*10,0 To I*10+10,10
Next I
'    -----  murki  ----  
For I=0 To 19
  Get Bob 0,I+30,I*10,10 To I*10+10,20
Next I
'    ----  napisy  (zycia,punkty,plansza)  ----- 
   Get Bob 0,68,0,28 To 27,35
   Get Bob 0,69,28,28 To 65,35
   Get Bob 0,67,67,28 To 105,35
'    -----  cyfry  ----- 
For I=0 To 9
   Get Bob 0,70+I,I*8,20 To I*8+7,27
Next I
  Cls 0
Load Iff "robot_r-29:napisy.robot"
  Get Bob 0,60,0,0 To 140,120
Load Iff "robot_r-29:koniec.robot"
  Get Bob 0,56,0,0 To 260,100
  Get Bob 0,57,0,111 To 240,230
Load Iff "robot_r-29:koniec1.robot"
  Get Bob 0,58,0,0 To 260,100
  Get Bob 0,59,0,111 To 240,230
Load Iff "robot_r-29:fire.robot"
  Get Bob 0,55,0,0 To 240,30
'
'--------------- PLANSZA TYTULOWA ---------------------- 
'
TITTLE:
 Screen Open 0,320,256,8,Lowres
 Autoback 0
 Bob Update Off : Flash Off 
 Cls 0 : I=255 : J=90 : DI=1 : DJ=0
 Load Iff "robot_r-29:tytul.robot"
 Double Buffer 
Do 
 If Joy(1)>15 Then Exit 
   Dec I
  If I<-140 Then I=255
   Plot 0,0,1
   Bob 0,60,255-I,55
   Bob 1,100,I-8,60
   Screen Swap : Wait Vbl 
Loop 
 Bob Update On 
 Autoback 2
 Screen Open 0,320,256,8,Lowres
   Flash Off : Hide 
 Get Sprite Palette 
'
'---------------- PETLA GLOWNA ------------------------- 
'
   PL=1 : ZY=3 : PU=0
GAME_START:
 X=2 : Y=2
Gosub RYSUJ
 B=0 : C=0 : D=0 : E=0 : F=0 : MAG=0
 Ink 0,1
   Paste Bob 10,245,68 : PISZ[30,245,ZY,2,1] : Rem zycia
   Paste Bob 90,245,69 : PISZ[120,245,PU,6,1] : Rem punkty 
   Paste Bob 200,245,67 : PISZ[236,245,PL,2,1] : Rem plansza
 BX=(X+DX-1)*10
 BY=(Y+DY-1)*10
   O=0
'  ------------ mruganie na starcie -------------
Do 
   Inc O
   If Joy(1)>15 Then Exit 
   If O>0 and O<25 Then Paste Bob BX,BY,W
   If O>25 Then ZMAZ[BX,BY]
   If O>45 Then O=0
   Wait Vbl 
Loop 
Paste Bob BX,BY,W
'
L100:
 X1=X : Y1=Y
   If PU<>PU1 Then PISZ[120,245,PU,6,1]
   PU1=PU
 If Inkey$=Chr$(27) Then Goto L300
 If Jright(1)=-1 Then Inc X : W=1 : Goto L110
 If Jleft(1)=-1 Then Dec X : W=2 : Goto L110
 If Jdown(1)=-1 Then Inc Y : W=3 : Goto L110
 If Jup(1)=-1 Then Dec Y : W=4 : Goto L110
L110:
 BX=(X1+DX-1)*10
 BY=(Y1+DY-1)*10
   If MAG>0 Then ZMAZ[BX,BY] : Paste Bob BX,BY,W : Wait Vbl : X=X1 : Y=Y1 : Goto L100
 If PLANSZA(X,Y)<>14 Then Gosub L200
   BX=(X1+DX-1)*10
   BY=(Y1+DY-1)*10
  PLANSZA(X1,Y1)=14
 CX=(X+DX-1)*10
 CY=(Y+DY-1)*10
   Wait Vbl 
  ZMAZ[BX,BY]
   Paste Bob CX,CY,W
   Wait 4
 Goto L100
L200:
 L=PLANSZA(X,Y)
 If L=5 Then Inc B : Gosub L400 : Paste Bob B*10,215,5 : PU=PU+5 : Return 
  If L=7 Then Inc C : Gosub L400 : Paste Bob C*10,235,7 : PU=PU+5 : Return 
   If L=6 Then Inc D : Gosub L400 : Paste Bob D*10,225,6 : PU=PU+5 : Return 
    If L=12 Then Inc E : Gosub L400 : Paste Bob E*10,205,12 : PU=PU+5 : Return 
     If L=15 Then Inc F : Gosub L400 : Paste Bob F*10,195,15 : PU=PU+10 : Return 
 If L=10 Then ZMAZ[B*10,215] : Dec B : Gosub L410 : X1=X : Y1=Y : PU=PU+10 : If B<0 Then PU=PU-10 : Goto L300
  If L=8 Then ZMAZ[C*10,235] : Dec C : Gosub L420 : X1=X : Y1=Y : PU=PU+10 : If C<0 Then PU=PU-10 : MAG=1 : Goto L100
   If L=9 Then ZMAZ[D*10,225] : Dec D : Gosub L430 : Gosub L450 : PU=PU+10 : If D<0 Then PU=PU-10 : Goto L301
    If L=13 Then ZMAZ[E*10,205] : Dec E : Gosub DYNAMIT : PU=PU+15 : Return 
     If L=16 Then ZMAZ[F*10,195] : Dec F : Gosub KLUCZ : PU=PU+20 : Return 
 If L=11 Then PU=PU+100 : Goto L350
 X=X1 : Y=Y1
Return 
L300:
 X=X1 : Y=Y1
 Gosub L410 : Gosub L410
 Dec ZY
  If ZY<0 Then Goto L310
 Goto GAME_START
L301:
 X=X1 : Y=Y1
  BX=(X+DX-1)*10
  BY=(Y+DY-1)*10
  ZMAZ[BX,BY]
 For J=0 To 1
   For I=45 To 49
      Paste Bob BX,BY,I : Wait 3
      ZMAZ[BX,BY]
   Next I
 Next J
 Dec ZY
  If ZY<0 Then Goto L310
 Goto GAME_START
L310:
'
'---------------------- KONIEC ------------------------- 
'
 Do 
      Bob 1,30,20,56
      Bob 0,30,70,59 : Wait Vbl 
    For J=0 To 15
      If Joy(1)>15 Then Goto TITTLE
      Wait Vbl 
    Next J
      Bob 1,30,20,58
      Bob 0,30,70,57 : Wait Vbl 
    For J=0 To 15
      If Joy(1)>15 Then Goto TITTLE
      Wait Vbl 
    Next J
 Loop 
Goto TITTLE
'
'------------------------------------------------------- 
'
L350:
  PISZ[120,245,PU,6,1]
  BX=(X1+DX-1)*10
  BY=(Y1+DY-1)*10
 Do 
   For I=0 To 25
      Paste Bob BX,BY,W : Wait Vbl 
      If Joy(1)>15 Then Goto KL
   Next I
   For I=0 To 20
      ZMAZ[BX,BY] : Wait Vbl 
      If Joy(1)>15 Then Goto KL
   Next I
 Loop 
KL:
  Inc PL
Goto GAME_START
'----------- BRANIE ---------
L400:
  Wait 3
  BX=(X+DX-1)*10
  BY=(Y+DY-1)*10
  ZMAZ[BX,BY]
 BX=(X1+DX-1)*10
 BY=(Y1+DY-1)*10
   ZMAZ[BX,BY]
  PLANSZA(X,Y)=14
Return 
'--------- UZYCIE BOMBY -----
L410:
  BX=(X+DX-1)*10
  BY=(Y+DY-1)*10
  ZMAZ[BX,BY]
   For I=40 To 44
      Paste Bob BX,BY,I : Wait 3
      ZMAZ[BX,BY]
   Next I
 BX=(X1+DX-1)*10
 BY=(Y1+DY-1)*10
   ZMAZ[BX,BY]
  PLANSZA(X,Y)=14
   X=X1 : Y=Y1
Return 
'------- UZYCIE MAGNESU -----
L420:
  Wait 5
  BX=(X+DX-1)*10
  BY=(Y+DY-1)*10
  ZMAZ[BX,BY]
 BX=(X1+DX-1)*10
 BY=(Y1+DY-1)*10
   ZMAZ[BX,BY]
  PLANSZA(X,Y)=14
Return 
'------ UZYCIE KLUCZA FR ----
L430:
   Wait 5
  BX=(X+DX-1)*10
  BY=(Y+DY-1)*10
  ZMAZ[BX,BY]
 BX=(X1+DX-1)*10
 BY=(Y1+DY-1)*10
   ZMAZ[BX,BY]
  PLANSZA(X,Y)=14
Return 
'------ UZYCIE DYNAMITU -----
DYNAMIT:
   If E<0 Then E=0 : X=X1 : Y=Y1 : PU=PU-15 : Return 
  BX=(X+DX-1)*10
  BY=(Y+DY-1)*10
  ZMAZ[BX,BY]
   For I=40 To 44
      Paste Bob BX,BY,I : Wait 3
      ZMAZ[BX,BY]
   Next I
 BX=(X1+DX-1)*10
 BY=(Y1+DY-1)*10
   ZMAZ[BX,BY]
  PLANSZA(X,Y)=14
   X=X1 : Y=Y1
Return 
'--------UZYCIE KLUCZA ------
KLUCZ:
   If F<0 Then F=0 : X=X1 : Y=Y1 : PU=PU-20 : Return 
   Wait 5
  BX=(X+DX-1)*10
  BY=(Y+DY-1)*10
  ZMAZ[BX,BY]
 BX=(X1+DX-1)*10
 BY=(Y1+DY-1)*10
   ZMAZ[BX,BY]
  PLANSZA(X,Y)=14
   X=X1 : Y=Y1
Return 
'----------------------------
Goto GAME_START
L450:
 X1=X : Y1=Y
Return 
'
'------------------ UKONCZENIE ------------------------- 
'
KONIEC_GRY:
 Cls 0
 Load Iff "robot_r-29:ukoncz.robot"
  Paste Bob 120,200,69
  PISZ[150,200,PU,6,0]
   I=1 : X=0
 Do 
   X=X+I
   If X>200 or X<-50 Then I=-I
   Bob 0,X,220,55 : Wait Vbl 
   If Joy(1)>15 Then Exit 
 Loop 
Goto TITTLE
'
'------------------------------------------------------- 
'
Procedure ZMAZ[X,Y]
 Ink 0
 Bar X,Y To X+9,Y+9
End Proc
'------------------------------------------------------- 
Procedure PISZ[X,Y,L,C,P]
 For I=C To 1 Step -1
   U=L : L=(L/10)*10 : R=U-L : L=L/10
   XW=X+I*8
   If P>0 Then Ink 0 : Bar XW,Y To XW+7,Y+7
   Paste Bob XW,Y,70+R
 Next I
End Proc
'
'---------------- RYSOWANIE PLANSZY -------------------- 
'    
RYSUJ:
Cls 0
 U$="plansza_"+Chr$(PL+64)
 Restore U$
 Read LINES,W,KLOCEK : SY=LINES
 If LINES=0 Then Pop : Goto KONIEC_GRY
For I=1 To LINES
  Read A$ : L=Len(A$)
  SX=L
   For J=1 To L
     B$=Mid$(A$,J,1)
     A=Asc(B$)-64
     If A<0 Then A=14
      B=A
     If A=0 Then A=30 : B=30+KLOCEK
      If A>0 and A<5 Then X=J : Y=I : W=A
     PLANSZA(J,I)=A
     BX=(J+(32-SX)/2)*10
     BY=(I+(21-SY)/2)*10
     Paste Bob BX,BY,B
   Next J
Next I
    DX=(32-SX)/2+1
    DY=(21-SY)/2+1
Return 
'
'----------------------- M A P Y ----------------------- 
'
'
PLANSZA_A:
Data 8,3,5
Data "@@@@@@@@@@@@@@"
Data "@ @ JEE J@ JJ@"
Data "@AJ @ @@EJE@ @"
Data "@ @ @ @ J@@@ @"
Data "@E@  J@J@@@  @"
Data "@ @@@ @  J  @@"
Data "@JEE@  E@@ J K"
Data "@@@@@@@@@@@@@@"
'
PLANSZA_B:
Data 8,3,1
Data "@@@@@@@@@@@@"
Data "@C@@@@@@@@@@"
Data "@EJ J I  G@@"
Data "@ @ @@@H@H@@"
Data "@J@ EJ@J  @@"
Data "@ @ @E@ @@@@"
Data "@EEJ@F@K@   "
Data "@@@@@@@@@   "
'
PLANSZA_C:
Data 7,3,2
Data "@@@@@@@@@@@@@@"
Data "@ @   @@K@@@@@"
Data "@G@ @H H H @@@"
Data "@G@ @ H H H@@@"
Data "@G@G@HJH H  @@"
Data "@GGG@ H H H@@@"
Data "@@@@@@@@@@@@@@"
'
PLANSZA_D:
Data 6,3,3
Data "@@@@@@@@@"
Data "@ @@@   @"
Data "@GEJFI@H@"
Data "@H@@I@@J@"
Data "@KJ  JFF@"
Data "@@@@@@@@@"
'
PLANSZA_E:
Data 15,1,4
Data "@@@@@@@@@@@@@@@@@@@@@"
Data "@   E  @ G JHHHGGGGG@"
Data "@@@@@@ @J@ @ @@FGGGG@"
Data "@ H HJ J @  H@@@GGGG@"
Data "@H H @J@ @ @@@@@@@@@@"
Data "@ H H@ @G J JIE   @E@"
Data "@HFH @ @@@@@@@@G@ @ @"
Data "@ HEH@ J EE @ @@@   @"
Data "@H H @ @@@@   @@@J@@@"
Data "@@@@@@ EJ@EJ@ @@@ @K@"
Data "@F@@H@ @J@J@@ @ J @ @"
Data "@@H@     J    @E@ @ @"
Data "@E J @@@@ @@@ @J H@F@"
Data "@E@@ J E   JG @@@ I @"
Data "@@@@@@@@@@@@@@@@@@@@@"
'
PLANSZA_F:
Data 10,1,5
Data "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
Data "@F      @ MMMM   @E     @E   @"
Data "@E LLLHIJ MLMM@    J O  P  @ @"
Data "@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @"
Data "@  @K@EEE@MMMMMMMMMMMMMMMMM@ @"
Data "@  @P@EEE@MMJMJMJMJMJMJMJMM@ @"
Data "@        @MMMMMMMMMMMMMMMMM@ @"
Data "@@@@@@P@@@@@@@@@@@@@@@@@@@@@ @"
Data "@        J    O  J   O       @"
Data "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
'
PLANSZA_G:
Data 8,3,8
Data "@@@@@@@@@@@@@@@@@@@@@@@@"
Data "@        J J J J J     @"
Data "@@@@@@@ MMMMMMMMM@@@@@@@"
Data "@   L   M E  O  M   L  @"
Data "@       M     JIM   L  @"
Data "@@@@@P@@@@@@@@@@@@@@@@@@"
Data "@ EEEEEEEEE   F F F F K@"
Data "@@@@@@@@@@@@@@@@@@@@@@@@"
'
PLANSZA_H:
Data 5,1,9
Data "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
Data "@        MMMMMMMMMML@     @@K@"
Data "@@@@@@LMM   O   E   PJ  J @@ @"
Data "@ OJOMMMM     L L L @     P  @"
Data "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
'
PLANSZA_I:
Data 12,3,6
Data "@@@@@@@@@@"
Data "@   MMMMO@"
Data "@L  MLMLM@"
Data "@@@@@@P@@@"
Data "@O   I @@@"
Data "@@@@@@ EF@"
Data "@K   @@P@@"
Data "@@@@ @E  @"
Data "@J   @F  @"
Data "@ J@@@@@ @"
Data "@J  J    @"
Data "@@@@@@@@@@"
'
PLANSZA_J:
Data 0,3,5

Saturday, October 11, 2014

Robot R-29 Update 2

  The last visit at parents' place was very successful. I've transferred lots of my old Amiga files and and now I have a complete Robot R-29 which I can run in emulator. Once more, link to the original article with updates:


  This time you can enjoy screenshots.


Saturday, August 9, 2014

World Premiere of Amiga

Andy Warhol made an electronic portrait of Debbie Harry during the Amiga 1000 World Premiere
  I came across this video during one of my YouTube journeys. It is still a quite impressive footage to watch, especially considering the technical advancement at that time. It was 1985 and apart from the Mac pretty much all other computers ran command-line interfaces. That changed on July the 23rd when Amiga 1000 came out. It featured color graphics with impressive 4096 colors palette and 4-channel digital stereo sound. Whoever owned a computer back then knows how superior that machine was.

The famous "Robocity" animation was also shown for the first time
  Now, all Amiga fans can enjoy it here thanks to Rasvoja who converted this presentation from VHS and uploaded it to YouTube.


Atari, my very first computer

  During my last holiday I typically visited my parents and when I was going through my old papers I came across this jewel. The receipt and warranty for my very first computer, the 8-bit Atari 65XE. Now I know when exactly I got it. It was bought on December the 22nd, 1989 for $127 and I got it two days later on Christmas Eve (that's when most Christmas celebrations take place in Poland). For me it was two days full of suspense and excitement. My Dad would let me see the box, but that was it. I had to wait until the Christmas Eve. I'll never forget the day I opened the box, it was some of the best experiences in  my life.

Receipt, page 1
Receipt, page 2
Guarantee, page 1
Guarantee, page 2 (conditions)
Guarantee, page 3 (free repairs stamps)
Guarantee, page 4 (replace parts)

Restoring my old Amiga files

  During my last holiday I got adventurous and build a null modem cable. I didn't have required plugs and raw cable itself therefore I build it from what I had available, two different PC cables that I cut in the middle and then soldered them together closely following the diagram I've found on Amiga Forever website. 


  That's how my null modem cable came about.
 
Null modem cable
  After several trials and errors I've finally found a software that worked for me. I couldn't write to Amiga disks but at least I could read them. It wasn't the most reliable and error free transfer, but after so many years I'm glad I've managed to restore any files. The software is called ADF Sender Terminal can be found on A.S.T. Amiga PAGE website.


  This time I got all images for my Amiga version of "Robot R-29" game, as well as my other programs, for example games "Snake", "Core Wars", "Ortho-Test" or demo "3D Graphs"and my simple chat bot I called "Mietek". I'm hoping to be able to transfer them all to an emulator and run them again. Once I manage to do that you'll see screenshots and listings here.

Tuesday, June 24, 2014

AMOS The Creator - User Guide (PDF book)


  It took me quite a while, actually six years, until I've finished editing this book. I've found it on some Amiga fan website, it was on a copy of some old school disk magazine. It was a document written in some old Amiga editor, all in the same monotype font. You can imagine how much fun it was to read. That's exactly why I decided to copy it into a word processor (I used NeoOffice from the beginning to the end) and format it so it would look more like a real book. Back then it was the only version of the book I could find on the net. When I checked recently I came across several other AMOS books, including AMOS Pro and AMOS compiler text books and even a scan of entire "AMOS The Creator" book. However the scan makes the file lot larger, and for example it doesn't allow to search within the document. So it's up to you which one you decide to download. Please comment on my book and let me know if you find any typos or other errors.


  Here's a link to a page where you can download a scan of the original book in various formats.

Tuesday, September 3, 2013

Robot R-29 Update 1

  I managed to run my old Amiga adaptation and take some photographs of the screens. Here's the link to that post:


Enjoy great photographs. There'll be more in the future!