Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_39.ADF » P/+BB1
P/+BB1
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_39.ADF |
Filename: | P/+BB1 |
Read OK: | ✔ |
File size: | 0943 bytes |
Load address: | D4556 |
Exec address: | 0000 |
Duplicates
There is 1 duplicate copy of this file in the archive:
- Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_39.ADF » P/+BB1
- Personal collection » Acorn hard disk » zipped_disks » elk03 » eug39/P/+BB1
File contents
Bat & Ball Demonstration Written by Dominic Ford This simple game was written to illustrate the use the User-Defined Characters module to a BASIC programmer wanting to achieve high-speed graphics. The program was purposely written entirely in BASIC to illustrate how you don't need any knowledge of machine code to use the system. These instructions consist of two parts: firstly instructions on how to play the game, and then a detailed line-by-line breakdown of how it actually works. Playing instructions -------------------- When you start the game, you are confronted by a ball bouncing around the screen and a bat at the bottom of the screen which you can move left and right using the Z and X keys. The idea, as with all BreakOut style games, is to move the bat so that the ball bounces off it and does not go off the bottom of the screen. When the ball strikes one of the blocks at the top of the screen, at disappears. If you fail to hit the ball with the bat, the ball will freeze. Press SPACE to restart it - it will restart again from its initial position. Program Notes ------------- This program is intended as a demonstration of what the sprites module can do, and I would encourage you to print it out and study the BASIC more closely. There follows a list of the variables used, and a line-by-line breakdown of what the program does. Variable list: (xball, yball) - The position of the ball on the screen, measured in pixels. xbat - The x position of the bat at the bottom of the screen, measured in characters. (xnew, ynew) - Used as a temporary storage area while new co-ordinates are being worked out. This means that the removal of the old image can be left as late as possible to reduce flicker to a minimum. left - Is the ball moving left? (TRUE = left, FALSE = right) up - Is the ball moving up? (TRUE = up, FALSE = down) Sorry! I only tried out the Bat&Ball program on an Elk at the last minute, having written it on a Beeb, and had to make a few quick alterations. Therefore, the program comments which follow should be used in conjenction with the program listed with the comments, not with 'BatBall' itself. Also- I only found out how terribly slow it runs on an Elk at the last minute, but didn't have time to sort thst one out. You should get the idea, though.
00000000 42 61 74 20 26 20 42 61 6c 6c 20 44 65 6d 6f 6e |Bat & Ball Demon| 00000010 73 74 72 61 74 69 6f 6e 0d 0d 57 72 69 74 74 65 |stration..Writte| 00000020 6e 20 62 79 20 44 6f 6d 69 6e 69 63 20 46 6f 72 |n by Dominic For| 00000030 64 0d 0d 54 68 69 73 20 73 69 6d 70 6c 65 20 67 |d..This simple g| 00000040 61 6d 65 20 77 61 73 20 77 72 69 74 74 65 6e 20 |ame was written | 00000050 74 6f 20 69 6c 6c 75 73 74 72 61 74 65 20 74 68 |to illustrate th| 00000060 65 20 75 73 65 20 74 68 65 20 55 73 65 72 2d 44 |e use the User-D| 00000070 65 66 69 6e 65 64 0d 43 68 61 72 61 63 74 65 72 |efined.Character| 00000080 73 20 6d 6f 64 75 6c 65 20 74 6f 20 61 20 42 41 |s module to a BA| 00000090 53 49 43 20 70 72 6f 67 72 61 6d 6d 65 72 20 77 |SIC programmer w| 000000a0 61 6e 74 69 6e 67 20 74 6f 20 61 63 68 69 65 76 |anting to achiev| 000000b0 65 20 68 69 67 68 2d 73 70 65 65 64 0d 67 72 61 |e high-speed.gra| 000000c0 70 68 69 63 73 2e 20 54 68 65 20 70 72 6f 67 72 |phics. The progr| 000000d0 61 6d 20 77 61 73 20 70 75 72 70 6f 73 65 6c 79 |am was purposely| 000000e0 20 77 72 69 74 74 65 6e 20 65 6e 74 69 72 65 6c | written entirel| 000000f0 79 20 69 6e 20 42 41 53 49 43 20 74 6f 0d 69 6c |y in BASIC to.il| 00000100 6c 75 73 74 72 61 74 65 20 68 6f 77 20 79 6f 75 |lustrate how you| 00000110 20 64 6f 6e 27 74 20 6e 65 65 64 20 61 6e 79 20 | don't need any | 00000120 6b 6e 6f 77 6c 65 64 67 65 20 6f 66 20 6d 61 63 |knowledge of mac| 00000130 68 69 6e 65 20 63 6f 64 65 20 74 6f 20 75 73 65 |hine code to use| 00000140 20 74 68 65 0d 73 79 73 74 65 6d 2e 0d 0d 54 68 | the.system...Th| 00000150 65 73 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 |ese instructions| 00000160 20 63 6f 6e 73 69 73 74 20 6f 66 20 74 77 6f 20 | consist of two | 00000170 70 61 72 74 73 3a 20 66 69 72 73 74 6c 79 20 69 |parts: firstly i| 00000180 6e 73 74 72 75 63 74 69 6f 6e 73 20 6f 6e 20 68 |nstructions on h| 00000190 6f 77 20 74 6f 0d 70 6c 61 79 20 74 68 65 20 67 |ow to.play the g| 000001a0 61 6d 65 2c 20 61 6e 64 20 74 68 65 6e 20 61 20 |ame, and then a | 000001b0 64 65 74 61 69 6c 65 64 20 6c 69 6e 65 2d 62 79 |detailed line-by| 000001c0 2d 6c 69 6e 65 20 62 72 65 61 6b 64 6f 77 6e 20 |-line breakdown | 000001d0 6f 66 20 68 6f 77 20 69 74 0d 61 63 74 75 61 6c |of how it.actual| 000001e0 6c 79 20 77 6f 72 6b 73 2e 0d 0d 50 6c 61 79 69 |ly works...Playi| 000001f0 6e 67 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 0d |ng instructions.| 00000200 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| 00000210 2d 2d 2d 2d 0d 0d 57 68 65 6e 20 79 6f 75 20 73 |----..When you s| 00000220 74 61 72 74 20 74 68 65 20 67 61 6d 65 2c 20 79 |tart the game, y| 00000230 6f 75 20 61 72 65 20 63 6f 6e 66 72 6f 6e 74 65 |ou are confronte| 00000240 64 20 62 79 20 61 20 62 61 6c 6c 20 62 6f 75 6e |d by a ball boun| 00000250 63 69 6e 67 20 61 72 6f 75 6e 64 0d 74 68 65 20 |cing around.the | 00000260 73 63 72 65 65 6e 20 61 6e 64 20 61 20 62 61 74 |screen and a bat| 00000270 20 61 74 20 74 68 65 20 62 6f 74 74 6f 6d 20 6f | at the bottom o| 00000280 66 20 74 68 65 20 73 63 72 65 65 6e 20 77 68 69 |f the screen whi| 00000290 63 68 20 79 6f 75 20 63 61 6e 20 6d 6f 76 65 0d |ch you can move.| 000002a0 6c 65 66 74 20 61 6e 64 20 72 69 67 68 74 20 75 |left and right u| 000002b0 73 69 6e 67 20 74 68 65 20 5a 20 61 6e 64 20 58 |sing the Z and X| 000002c0 20 6b 65 79 73 2e 20 54 68 65 20 69 64 65 61 2c | keys. The idea,| 000002d0 20 61 73 20 77 69 74 68 20 61 6c 6c 20 42 72 65 | as with all Bre| 000002e0 61 6b 4f 75 74 0d 73 74 79 6c 65 20 67 61 6d 65 |akOut.style game| 000002f0 73 2c 20 69 73 20 74 6f 20 6d 6f 76 65 20 74 68 |s, is to move th| 00000300 65 20 62 61 74 20 73 6f 20 74 68 61 74 20 74 68 |e bat so that th| 00000310 65 20 62 61 6c 6c 20 62 6f 75 6e 63 65 73 20 6f |e ball bounces o| 00000320 66 66 20 69 74 20 61 6e 64 0d 64 6f 65 73 20 6e |ff it and.does n| 00000330 6f 74 20 67 6f 20 6f 66 66 20 74 68 65 20 62 6f |ot go off the bo| 00000340 74 74 6f 6d 20 6f 66 20 74 68 65 20 73 63 72 65 |ttom of the scre| 00000350 65 6e 2e 20 57 68 65 6e 20 74 68 65 20 62 61 6c |en. When the bal| 00000360 6c 20 73 74 72 69 6b 65 73 20 6f 6e 65 0d 6f 66 |l strikes one.of| 00000370 20 74 68 65 20 62 6c 6f 63 6b 73 20 61 74 20 74 | the blocks at t| 00000380 68 65 20 74 6f 70 20 6f 66 20 74 68 65 20 73 63 |he top of the sc| 00000390 72 65 65 6e 2c 20 61 74 20 64 69 73 61 70 70 65 |reen, at disappe| 000003a0 61 72 73 2e 0d 0d 49 66 20 79 6f 75 20 66 61 69 |ars...If you fai| 000003b0 6c 20 74 6f 20 68 69 74 20 74 68 65 20 62 61 6c |l to hit the bal| 000003c0 6c 20 77 69 74 68 20 74 68 65 20 62 61 74 2c 20 |l with the bat, | 000003d0 74 68 65 20 62 61 6c 6c 20 77 69 6c 6c 20 66 72 |the ball will fr| 000003e0 65 65 7a 65 2e 20 50 72 65 73 73 0d 53 50 41 43 |eeze. Press.SPAC| 000003f0 45 20 74 6f 20 72 65 73 74 61 72 74 20 69 74 20 |E to restart it | 00000400 2d 20 69 74 20 77 69 6c 6c 20 72 65 73 74 61 72 |- it will restar| 00000410 74 20 61 67 61 69 6e 20 66 72 6f 6d 20 69 74 73 |t again from its| 00000420 20 69 6e 69 74 69 61 6c 20 70 6f 73 69 74 69 6f | initial positio| 00000430 6e 2e 0d 0d 50 72 6f 67 72 61 6d 20 4e 6f 74 65 |n...Program Note| 00000440 73 0d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d |s.-------------.| 00000450 0d 54 68 69 73 20 70 72 6f 67 72 61 6d 20 69 73 |.This program is| 00000460 20 69 6e 74 65 6e 64 65 64 20 61 73 20 61 20 64 | intended as a d| 00000470 65 6d 6f 6e 73 74 72 61 74 69 6f 6e 20 6f 66 20 |emonstration of | 00000480 77 68 61 74 20 74 68 65 20 73 70 72 69 74 65 73 |what the sprites| 00000490 20 6d 6f 64 75 6c 65 0d 63 61 6e 20 64 6f 2c 20 | module.can do, | 000004a0 61 6e 64 20 49 20 77 6f 75 6c 64 20 65 6e 63 6f |and I would enco| 000004b0 75 72 61 67 65 20 79 6f 75 20 74 6f 20 70 72 69 |urage you to pri| 000004c0 6e 74 20 69 74 20 6f 75 74 20 61 6e 64 20 73 74 |nt it out and st| 000004d0 75 64 79 20 74 68 65 20 42 41 53 49 43 0d 6d 6f |udy the BASIC.mo| 000004e0 72 65 20 63 6c 6f 73 65 6c 79 2e 20 54 68 65 72 |re closely. Ther| 000004f0 65 20 66 6f 6c 6c 6f 77 73 20 61 20 6c 69 73 74 |e follows a list| 00000500 20 6f 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 | of the variable| 00000510 73 20 75 73 65 64 2c 20 61 6e 64 20 61 0d 6c 69 |s used, and a.li| 00000520 6e 65 2d 62 79 2d 6c 69 6e 65 20 62 72 65 61 6b |ne-by-line break| 00000530 64 6f 77 6e 20 6f 66 20 77 68 61 74 20 74 68 65 |down of what the| 00000540 20 70 72 6f 67 72 61 6d 20 64 6f 65 73 2e 0d 0d | program does...| 00000550 56 61 72 69 61 62 6c 65 20 6c 69 73 74 3a 0d 0d |Variable list:..| 00000560 28 78 62 61 6c 6c 2c 20 79 62 61 6c 6c 29 20 2d |(xball, yball) -| 00000570 20 54 68 65 20 70 6f 73 69 74 69 6f 6e 20 6f 66 | The position of| 00000580 20 74 68 65 20 62 61 6c 6c 20 6f 6e 20 74 68 65 | the ball on the| 00000590 20 73 63 72 65 65 6e 2c 20 6d 65 61 73 75 72 65 | screen, measure| 000005a0 64 20 69 6e 0d 20 20 20 20 20 20 20 20 20 20 20 |d in. | 000005b0 20 20 20 20 20 20 70 69 78 65 6c 73 2e 0d 78 62 | pixels..xb| 000005c0 61 74 20 2d 20 54 68 65 20 78 20 70 6f 73 69 74 |at - The x posit| 000005d0 69 6f 6e 20 6f 66 20 74 68 65 20 62 61 74 20 61 |ion of the bat a| 000005e0 74 20 74 68 65 20 62 6f 74 74 6f 6d 20 6f 66 20 |t the bottom of | 000005f0 74 68 65 20 73 63 72 65 65 6e 2c 20 6d 65 61 73 |the screen, meas| 00000600 75 72 65 64 0d 20 20 20 20 20 20 20 69 6e 20 63 |ured. in c| 00000610 68 61 72 61 63 74 65 72 73 2e 0d 28 78 6e 65 77 |haracters..(xnew| 00000620 2c 20 79 6e 65 77 29 20 2d 20 55 73 65 64 20 61 |, ynew) - Used a| 00000630 73 20 61 20 74 65 6d 70 6f 72 61 72 79 20 73 74 |s a temporary st| 00000640 6f 72 61 67 65 20 61 72 65 61 20 77 68 69 6c 65 |orage area while| 00000650 20 6e 65 77 20 63 6f 2d 6f 72 64 69 6e 61 74 65 | new co-ordinate| 00000660 73 0d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |s. | 00000670 20 61 72 65 20 62 65 69 6e 67 20 77 6f 72 6b 65 | are being worke| 00000680 64 20 6f 75 74 2e 20 54 68 69 73 20 6d 65 61 6e |d out. This mean| 00000690 73 20 74 68 61 74 20 74 68 65 20 72 65 6d 6f 76 |s that the remov| 000006a0 61 6c 20 6f 66 20 74 68 65 0d 20 20 20 20 20 20 |al of the. | 000006b0 20 20 20 20 20 20 20 20 20 6f 6c 64 20 69 6d 61 | old ima| 000006c0 67 65 20 63 61 6e 20 62 65 20 6c 65 66 74 20 61 |ge can be left a| 000006d0 73 20 6c 61 74 65 20 61 73 20 70 6f 73 73 69 62 |s late as possib| 000006e0 6c 65 20 74 6f 20 72 65 64 75 63 65 20 66 6c 69 |le to reduce fli| 000006f0 63 6b 65 72 0d 20 20 20 20 20 20 20 20 20 20 20 |cker. | 00000700 20 20 20 20 74 6f 20 61 20 6d 69 6e 69 6d 75 6d | to a minimum| 00000710 2e 0d 6c 65 66 74 20 2d 20 49 73 20 74 68 65 20 |..left - Is the | 00000720 62 61 6c 6c 20 6d 6f 76 69 6e 67 20 6c 65 66 74 |ball moving left| 00000730 3f 20 28 54 52 55 45 20 3d 20 6c 65 66 74 2c 20 |? (TRUE = left, | 00000740 46 41 4c 53 45 20 3d 20 72 69 67 68 74 29 0d 75 |FALSE = right).u| 00000750 70 20 2d 20 49 73 20 74 68 65 20 62 61 6c 6c 20 |p - Is the ball | 00000760 6d 6f 76 69 6e 67 20 75 70 3f 20 28 54 52 55 45 |moving up? (TRUE| 00000770 20 3d 20 75 70 2c 20 46 41 4c 53 45 20 3d 20 64 | = up, FALSE = d| 00000780 6f 77 6e 29 0d 0d 53 6f 72 72 79 21 20 49 20 6f |own)..Sorry! I o| 00000790 6e 6c 79 20 74 72 69 65 64 20 6f 75 74 20 74 68 |nly tried out th| 000007a0 65 20 42 61 74 26 42 61 6c 6c 20 70 72 6f 67 72 |e Bat&Ball progr| 000007b0 61 6d 20 6f 6e 20 61 6e 20 45 6c 6b 20 61 74 20 |am on an Elk at | 000007c0 74 68 65 20 6c 61 73 74 20 6d 69 6e 75 74 65 2c |the last minute,| 000007d0 0d 68 61 76 69 6e 67 20 77 72 69 74 74 65 6e 20 |.having written | 000007e0 69 74 20 6f 6e 20 61 20 42 65 65 62 2c 20 61 6e |it on a Beeb, an| 000007f0 64 20 68 61 64 20 74 6f 20 6d 61 6b 65 20 61 20 |d had to make a | 00000800 66 65 77 20 71 75 69 63 6b 20 61 6c 74 65 72 61 |few quick altera| 00000810 74 69 6f 6e 73 2e 0d 54 68 65 72 65 66 6f 72 65 |tions..Therefore| 00000820 2c 20 74 68 65 20 70 72 6f 67 72 61 6d 20 63 6f |, the program co| 00000830 6d 6d 65 6e 74 73 20 77 68 69 63 68 20 66 6f 6c |mments which fol| 00000840 6c 6f 77 20 73 68 6f 75 6c 64 20 62 65 20 75 73 |low should be us| 00000850 65 64 20 69 6e 20 63 6f 6e 6a 65 6e 63 74 69 6f |ed in conjenctio| 00000860 6e 0d 77 69 74 68 20 74 68 65 20 70 72 6f 67 72 |n.with the progr| 00000870 61 6d 20 6c 69 73 74 65 64 20 77 69 74 68 20 74 |am listed with t| 00000880 68 65 20 63 6f 6d 6d 65 6e 74 73 2c 20 6e 6f 74 |he comments, not| 00000890 20 77 69 74 68 20 27 42 61 74 42 61 6c 6c 27 20 | with 'BatBall' | 000008a0 69 74 73 65 6c 66 2e 0d 41 6c 73 6f 2d 20 49 20 |itself..Also- I | 000008b0 6f 6e 6c 79 20 66 6f 75 6e 64 20 6f 75 74 20 68 |only found out h| 000008c0 6f 77 20 74 65 72 72 69 62 6c 79 20 73 6c 6f 77 |ow terribly slow| 000008d0 20 69 74 20 72 75 6e 73 20 6f 6e 20 61 6e 20 45 | it runs on an E| 000008e0 6c 6b 20 61 74 20 74 68 65 20 6c 61 73 74 0d 6d |lk at the last.m| 000008f0 69 6e 75 74 65 2c 20 62 75 74 20 64 69 64 6e 27 |inute, but didn'| 00000900 74 20 68 61 76 65 20 74 69 6d 65 20 74 6f 20 73 |t have time to s| 00000910 6f 72 74 20 74 68 73 74 20 6f 6e 65 20 6f 75 74 |ort thst one out| 00000920 2e 20 59 6f 75 20 73 68 6f 75 6c 64 20 67 65 74 |. You should get| 00000930 20 74 68 65 0d 69 64 65 61 2c 20 74 68 6f 75 67 | the.idea, thoug| 00000940 68 2e 0d |h..| 00000943