Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_55.ADF » V/+BRR2
V/+BRR2
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_55.ADF |
Filename: | V/+BRR2 |
Read OK: | ✔ |
File size: | 0EDB bytes |
Load address: | 56204556 |
Exec address: | 52422B2E |
Duplicates
There are 3 duplicate copies of this file in the archive:
- AEW website » eug » eug_3_5_discs_Eug-55_A-EUG55.adf » V/+BRR2
- AEW website » eug » eug_5_25_discs_Eug-55_D-EUG55.dsd » V.+BRR2
- Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_55.ADF » V/+BRR2
- Personal collection » Acorn ADFS disks » Greaseweazled » adfs_EUG_55.adf » V/+BRR2
File contents
[ BASIC ROM ROUTINES ARTICLE - CONTINUATION ] 4. Routine: Print A in hex Basic 2: &B545 Basic 4: &BD6C Entry: The Accumulator contains the byte to be printed in hex Ex.: LDA #&CD JSR &B545 This one can be quickly demonstrated from Basic, if you really want, by typing A%=&CD:CALL&B545. 5. Routine: Print 16-bit number in decimal Basic 2: &991F Basic 4: &A081 Entry: &2B/&2C (the 2 least significant bytes of the IWA) should contain the number to be printed. Ex.: LDA #1023 MOD 256 \put the number 1023 STA &2B LDA #1023 DIV 256 \onto the two lsb's of the IWA STA &2C JSR &991F This is the routine which I promised we would discuss at the beginning of this article, so let's take some time going through it in detail. If you have a disassembler then you could look at the actual machine code, which in English goes something like this. You first of all see how many times 10,000 can be subtracted from the given number before it becomes negative. For example, you can subtract 10,000 six times from the number 60,000. This is the 10,000s count. Then you see how many times 1,000 can be subtracted from the remainder, then how many times 100 can be taken away from the remainder of that, and so on down to the 1s count. In order to do this, we need a table of two-byte values: 10,000, 1,000, 100, 10 and 1. There are two tables in Rom; the first table con- tains the low bytes, and the second table contains the high bytes: Basic 2 Low bytes: High bytes ---------- ---------- &996B [&01] &99B9 [&00] &0001 = 1 &996C [&0A] &99BA [&00] &000A = 10 &996D [&64] &99BB [&00] &0064 = 100 &996E [&E8] &99BC [&03] &03E8 = 1000 &996F [&10] &99BD [&27] &2710 = 10000 Basic 4 Low bytes High bytes --------- ---------- &8026 [&01] &8021 [&00] &0001 = 1 &8027 [&0A] &8022 [&00] &000A = 10 &8028 [&64] &8023 [&00] &0064 = 100 &8029 [&E8] &8024 [&03] &03E8 = 1000 &802A [&10] &8025 [&27] &2710 = 10000 If you haven't got a disassembler, then the program below demonstrates how it works: 10 FORI%=0TO2STEP2 20 P%=&900 30 [OPTI% 40 LDX #&50 \copy integer from zero page 50 JSR &AF56 \to IWA 60 70 LDX #4 80 .loop LDA#0 90 STA &3F,X 100 SEC 110 .loop2 LDA&2A 120 SBC &996B,X \&8026 for BBC M 130 TAY 140 LDA &2B 150 SBC &99B9,X \&8021 for Basic 4 160 BCC skip 170 STA &2B 180 STY &2A 190 INC &3F,X 200 BNE loop2 210 .skip DEX 220 BPL loop 270 280 LDX #5 \suppress leading zeroes 290 .loop3 DEX \by indexing to first 300 BEQ print \non-zero number 310 LDA &3F,X 320 BEQ loop3 330 .print LDA &3F,X 340 ORA #&30 350 JSR &FFEE 360 DEX 370 BPL print 380 RTS 390 ] 400 NEXT 410 INPUT !&50 420 CALL &900 The section of code from line 280 to 320 suppresses leading zeros. This just means that if you had the number 234, then it will be printed as 234 and not 00234. Sometimes you might not care for leading zero suppression. In most games, for instance, your score is displayed as 00000 at the start then changes to 00010 when you score some points and so on. In this case, you can dispense with lines 290-320 in the above program and replace line 280 with LDX #4. This article continued in V.+BRR3. First published EUG #55.
00000000 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 20 | [ | 00000010 42 41 53 49 43 20 52 4f 4d 20 52 4f 55 54 49 4e |BASIC ROM ROUTIN| 00000020 45 53 20 41 52 54 49 43 4c 45 20 2d 20 43 4f 4e |ES ARTICLE - CON| 00000030 54 49 4e 55 41 54 49 4f 4e 20 5d 0d 0d 34 2e 20 |TINUATION ]..4. | 00000040 20 20 20 20 20 52 6f 75 74 69 6e 65 3a 20 50 72 | Routine: Pr| 00000050 69 6e 74 20 41 20 69 6e 20 68 65 78 0d 20 20 20 |int A in hex. | 00000060 20 20 20 20 20 42 61 73 69 63 20 32 3a 20 26 42 | Basic 2: &B| 00000070 35 34 35 0d 20 20 20 20 20 20 20 20 42 61 73 69 |545. Basi| 00000080 63 20 34 3a 20 26 42 44 36 43 0d 0d 20 20 20 20 |c 4: &BD6C.. | 00000090 20 20 20 20 45 6e 74 72 79 3a 20 54 68 65 20 41 | Entry: The A| 000000a0 63 63 75 6d 75 6c 61 74 6f 72 20 63 6f 6e 74 61 |ccumulator conta| 000000b0 69 6e 73 20 74 68 65 20 62 79 74 65 20 74 6f 20 |ins the byte to | 000000c0 62 65 20 70 72 69 6e 74 65 64 20 69 6e 20 68 65 |be printed in he| 000000d0 78 0d 20 20 20 20 20 20 20 20 45 78 2e 3a 20 20 |x. Ex.: | 000000e0 20 20 4c 44 41 20 23 26 43 44 0d 20 20 20 20 20 | LDA #&CD. | 000000f0 20 20 20 20 20 20 20 20 20 20 20 4a 53 52 20 26 | JSR &| 00000100 42 35 34 35 0d 0d 54 68 69 73 20 6f 6e 65 20 63 |B545..This one c| 00000110 61 6e 20 62 65 20 71 75 69 63 6b 6c 79 20 64 65 |an be quickly de| 00000120 6d 6f 6e 73 74 72 61 74 65 64 20 66 72 6f 6d 20 |monstrated from | 00000130 42 61 73 69 63 2c 20 69 66 20 79 6f 75 20 72 65 |Basic, if you re| 00000140 61 6c 6c 79 20 77 61 6e 74 2c 20 62 79 0d 74 79 |ally want, by.ty| 00000150 70 69 6e 67 20 41 25 3d 26 43 44 3a 43 41 4c 4c |ping A%=&CD:CALL| 00000160 26 42 35 34 35 2e 0d 0d 35 2e 20 20 20 20 20 20 |&B545...5. | 00000170 52 6f 75 74 69 6e 65 3a 20 50 72 69 6e 74 20 31 |Routine: Print 1| 00000180 36 2d 62 69 74 20 6e 75 6d 62 65 72 20 69 6e 20 |6-bit number in | 00000190 64 65 63 69 6d 61 6c 0d 20 20 20 20 20 20 20 20 |decimal. | 000001a0 42 61 73 69 63 20 32 3a 20 26 39 39 31 46 0d 20 |Basic 2: &991F. | 000001b0 20 20 20 20 20 20 20 42 61 73 69 63 20 34 3a 20 | Basic 4: | 000001c0 26 41 30 38 31 0d 0d 20 20 20 20 20 20 20 20 45 |&A081.. E| 000001d0 6e 74 72 79 3a 20 26 32 42 2f 26 32 43 20 28 74 |ntry: &2B/&2C (t| 000001e0 68 65 20 32 20 6c 65 61 73 74 20 73 69 67 6e 69 |he 2 least signi| 000001f0 66 69 63 61 6e 74 20 62 79 74 65 73 20 6f 66 20 |ficant bytes of | 00000200 74 68 65 20 49 57 41 29 20 73 68 6f 75 6c 64 0d |the IWA) should.| 00000210 20 20 20 20 20 20 20 20 63 6f 6e 74 61 69 6e 20 | contain | 00000220 74 68 65 20 6e 75 6d 62 65 72 20 74 6f 20 62 65 |the number to be| 00000230 20 70 72 69 6e 74 65 64 2e 0d 20 20 20 20 20 20 | printed.. | 00000240 20 20 45 78 2e 3a 20 20 20 20 4c 44 41 20 23 31 | Ex.: LDA #1| 00000250 30 32 33 20 4d 4f 44 20 32 35 36 20 20 5c 70 75 |023 MOD 256 \pu| 00000260 74 20 74 68 65 20 6e 75 6d 62 65 72 20 31 30 32 |t the number 102| 00000270 33 0d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |3. | 00000280 20 20 53 54 41 20 26 32 42 0d 20 20 20 20 20 20 | STA &2B. | 00000290 20 20 20 20 20 20 20 20 20 20 4c 44 41 20 23 31 | LDA #1| 000002a0 30 32 33 20 44 49 56 20 32 35 36 20 20 5c 6f 6e |023 DIV 256 \on| 000002b0 74 6f 20 74 68 65 20 74 77 6f 20 6c 73 62 27 73 |to the two lsb's| 000002c0 20 6f 66 20 74 68 65 20 49 57 41 0d 20 20 20 20 | of the IWA. | 000002d0 20 20 20 20 20 20 20 20 20 20 20 20 53 54 41 20 | STA | 000002e0 26 32 43 0d 20 20 20 20 20 20 20 20 20 20 20 20 |&2C. | 000002f0 20 20 20 20 4a 53 52 20 26 39 39 31 46 0d 0d 54 | JSR &991F..T| 00000300 68 69 73 20 69 73 20 74 68 65 20 72 6f 75 74 69 |his is the routi| 00000310 6e 65 20 77 68 69 63 68 20 49 20 70 72 6f 6d 69 |ne which I promi| 00000320 73 65 64 20 77 65 20 77 6f 75 6c 64 20 64 69 73 |sed we would dis| 00000330 63 75 73 73 20 61 74 20 74 68 65 20 62 65 67 69 |cuss at the begi| 00000340 6e 6e 69 6e 67 0d 6f 66 20 74 68 69 73 20 61 72 |nning.of this ar| 00000350 74 69 63 6c 65 2c 20 73 6f 20 6c 65 74 27 73 20 |ticle, so let's | 00000360 74 61 6b 65 20 73 6f 6d 65 20 74 69 6d 65 20 67 |take some time g| 00000370 6f 69 6e 67 20 74 68 72 6f 75 67 68 20 69 74 20 |oing through it | 00000380 69 6e 20 64 65 74 61 69 6c 2e 20 49 66 0d 79 6f |in detail. If.yo| 00000390 75 20 68 61 76 65 20 61 20 64 69 73 61 73 73 65 |u have a disasse| 000003a0 6d 62 6c 65 72 20 74 68 65 6e 20 79 6f 75 20 63 |mbler then you c| 000003b0 6f 75 6c 64 20 6c 6f 6f 6b 20 61 74 20 74 68 65 |ould look at the| 000003c0 20 61 63 74 75 61 6c 20 6d 61 63 68 69 6e 65 20 | actual machine | 000003d0 63 6f 64 65 2c 20 0d 77 68 69 63 68 20 69 6e 20 |code, .which in | 000003e0 45 6e 67 6c 69 73 68 20 67 6f 65 73 20 73 6f 6d |English goes som| 000003f0 65 74 68 69 6e 67 20 6c 69 6b 65 20 74 68 69 73 |ething like this| 00000400 2e 20 59 6f 75 20 66 69 72 73 74 20 6f 66 20 61 |. You first of a| 00000410 6c 6c 20 73 65 65 20 68 6f 77 20 6d 61 6e 79 0d |ll see how many.| 00000420 74 69 6d 65 73 20 31 30 2c 30 30 30 20 63 61 6e |times 10,000 can| 00000430 20 62 65 20 73 75 62 74 72 61 63 74 65 64 20 66 | be subtracted f| 00000440 72 6f 6d 20 74 68 65 20 67 69 76 65 6e 20 6e 75 |rom the given nu| 00000450 6d 62 65 72 20 62 65 66 6f 72 65 20 69 74 20 62 |mber before it b| 00000460 65 63 6f 6d 65 73 20 0d 6e 65 67 61 74 69 76 65 |ecomes .negative| 00000470 2e 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 79 |. For example, y| 00000480 6f 75 20 63 61 6e 20 73 75 62 74 72 61 63 74 20 |ou can subtract | 00000490 31 30 2c 30 30 30 20 73 69 78 20 74 69 6d 65 73 |10,000 six times| 000004a0 20 66 72 6f 6d 20 74 68 65 20 6e 75 6d 62 65 72 | from the number| 000004b0 20 0d 36 30 2c 30 30 30 2e 20 54 68 69 73 20 69 | .60,000. This i| 000004c0 73 20 74 68 65 20 31 30 2c 30 30 30 73 20 63 6f |s the 10,000s co| 000004d0 75 6e 74 2e 20 54 68 65 6e 20 79 6f 75 20 73 65 |unt. Then you se| 000004e0 65 20 68 6f 77 20 6d 61 6e 79 20 74 69 6d 65 73 |e how many times| 000004f0 20 31 2c 30 30 30 20 63 61 6e 0d 62 65 20 73 75 | 1,000 can.be su| 00000500 62 74 72 61 63 74 65 64 20 66 72 6f 6d 20 74 68 |btracted from th| 00000510 65 20 72 65 6d 61 69 6e 64 65 72 2c 20 74 68 65 |e remainder, the| 00000520 6e 20 68 6f 77 20 6d 61 6e 79 20 74 69 6d 65 73 |n how many times| 00000530 20 31 30 30 20 63 61 6e 20 62 65 20 74 61 6b 65 | 100 can be take| 00000540 6e 20 0d 61 77 61 79 20 66 72 6f 6d 20 74 68 65 |n .away from the| 00000550 20 72 65 6d 61 69 6e 64 65 72 20 6f 66 20 74 68 | remainder of th| 00000560 61 74 2c 20 61 6e 64 20 73 6f 20 6f 6e 20 64 6f |at, and so on do| 00000570 77 6e 20 74 6f 20 74 68 65 20 31 73 20 63 6f 75 |wn to the 1s cou| 00000580 6e 74 2e 0d 20 20 20 49 6e 20 6f 72 64 65 72 20 |nt.. In order | 00000590 74 6f 20 64 6f 20 74 68 69 73 2c 20 77 65 20 6e |to do this, we n| 000005a0 65 65 64 20 61 20 74 61 62 6c 65 20 6f 66 20 74 |eed a table of t| 000005b0 77 6f 2d 62 79 74 65 20 76 61 6c 75 65 73 3a 20 |wo-byte values: | 000005c0 31 30 2c 30 30 30 2c 0d 31 2c 30 30 30 2c 20 31 |10,000,.1,000, 1| 000005d0 30 30 2c 20 31 30 20 61 6e 64 20 31 2e 20 54 68 |00, 10 and 1. Th| 000005e0 65 72 65 20 61 72 65 20 74 77 6f 20 74 61 62 6c |ere are two tabl| 000005f0 65 73 20 69 6e 20 52 6f 6d 3b 20 74 68 65 20 66 |es in Rom; the f| 00000600 69 72 73 74 20 74 61 62 6c 65 20 63 6f 6e 2d 0d |irst table con-.| 00000610 74 61 69 6e 73 20 74 68 65 20 6c 6f 77 20 62 79 |tains the low by| 00000620 74 65 73 2c 20 61 6e 64 20 74 68 65 20 73 65 63 |tes, and the sec| 00000630 6f 6e 64 20 74 61 62 6c 65 20 63 6f 6e 74 61 69 |ond table contai| 00000640 6e 73 20 74 68 65 20 68 69 67 68 20 62 79 74 65 |ns the high byte| 00000650 73 3a 0d 0d 42 61 73 69 63 20 32 20 4c 6f 77 20 |s:..Basic 2 Low | 00000660 62 79 74 65 73 3a 20 20 20 20 20 20 48 69 67 68 |bytes: High| 00000670 20 62 79 74 65 73 0d 20 20 20 20 20 20 20 20 2d | bytes. -| 00000680 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 20 20 20 20 20 2d |--------- -| 00000690 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 20 20 20 20 20 20 |---------. | 000006a0 20 20 26 39 39 36 42 20 5b 26 30 31 5d 20 20 20 | &996B [&01] | 000006b0 20 20 26 39 39 42 39 20 5b 26 30 30 5d 20 20 20 | &99B9 [&00] | 000006c0 20 20 26 30 30 30 31 20 3d 20 31 0d 20 20 20 20 | &0001 = 1. | 000006d0 20 20 20 20 26 39 39 36 43 20 5b 26 30 41 5d 20 | &996C [&0A] | 000006e0 20 20 20 20 26 39 39 42 41 20 5b 26 30 30 5d 20 | &99BA [&00] | 000006f0 20 20 20 20 26 30 30 30 41 20 3d 20 31 30 0d 20 | &000A = 10. | 00000700 20 20 20 20 20 20 20 26 39 39 36 44 20 5b 26 36 | &996D [&6| 00000710 34 5d 20 20 20 20 20 26 39 39 42 42 20 5b 26 30 |4] &99BB [&0| 00000720 30 5d 20 20 20 20 20 26 30 30 36 34 20 3d 20 31 |0] &0064 = 1| 00000730 30 30 0d 20 20 20 20 20 20 20 20 26 39 39 36 45 |00. &996E| 00000740 20 5b 26 45 38 5d 20 20 20 20 20 26 39 39 42 43 | [&E8] &99BC| 00000750 20 5b 26 30 33 5d 20 20 20 20 20 26 30 33 45 38 | [&03] &03E8| 00000760 20 3d 20 31 30 30 30 0d 20 20 20 20 20 20 20 20 | = 1000. | 00000770 26 39 39 36 46 20 5b 26 31 30 5d 20 20 20 20 20 |&996F [&10] | 00000780 26 39 39 42 44 20 5b 26 32 37 5d 20 20 20 20 20 |&99BD [&27] | 00000790 26 32 37 31 30 20 3d 20 31 30 30 30 30 0d 0d 42 |&2710 = 10000..B| 000007a0 61 73 69 63 20 34 20 4c 6f 77 20 62 79 74 65 73 |asic 4 Low bytes| 000007b0 20 20 20 20 20 20 20 48 69 67 68 20 62 79 74 65 | High byte| 000007c0 73 0d 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d |s. ------| 000007d0 2d 2d 2d 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d |--- ------| 000007e0 2d 2d 2d 2d 0d 20 20 20 20 20 20 20 20 26 38 30 |----. &80| 000007f0 32 36 20 5b 26 30 31 5d 20 20 20 20 20 26 38 30 |26 [&01] &80| 00000800 32 31 20 5b 26 30 30 5d 20 20 20 20 20 26 30 30 |21 [&00] &00| 00000810 30 31 20 3d 20 31 0d 20 20 20 20 20 20 20 20 26 |01 = 1. &| 00000820 38 30 32 37 20 5b 26 30 41 5d 20 20 20 20 20 26 |8027 [&0A] &| 00000830 38 30 32 32 20 5b 26 30 30 5d 20 20 20 20 20 26 |8022 [&00] &| 00000840 30 30 30 41 20 3d 20 31 30 0d 20 20 20 20 20 20 |000A = 10. | 00000850 20 20 26 38 30 32 38 20 5b 26 36 34 5d 20 20 20 | &8028 [&64] | 00000860 20 20 26 38 30 32 33 20 5b 26 30 30 5d 20 20 20 | &8023 [&00] | 00000870 20 20 26 30 30 36 34 20 3d 20 31 30 30 0d 20 20 | &0064 = 100. | 00000880 20 20 20 20 20 20 26 38 30 32 39 20 5b 26 45 38 | &8029 [&E8| 00000890 5d 20 20 20 20 20 26 38 30 32 34 20 5b 26 30 33 |] &8024 [&03| 000008a0 5d 20 20 20 20 20 26 30 33 45 38 20 3d 20 31 30 |] &03E8 = 10| 000008b0 30 30 0d 20 20 20 20 20 20 20 20 26 38 30 32 41 |00. &802A| 000008c0 20 5b 26 31 30 5d 20 20 20 20 20 26 38 30 32 35 | [&10] &8025| 000008d0 20 5b 26 32 37 5d 20 20 20 20 20 26 32 37 31 30 | [&27] &2710| 000008e0 20 3d 20 31 30 30 30 30 0d 0d 49 66 20 79 6f 75 | = 10000..If you| 000008f0 20 68 61 76 65 6e 27 74 20 67 6f 74 20 61 20 64 | haven't got a d| 00000900 69 73 61 73 73 65 6d 62 6c 65 72 2c 20 74 68 65 |isassembler, the| 00000910 6e 20 74 68 65 20 70 72 6f 67 72 61 6d 20 62 65 |n the program be| 00000920 6c 6f 77 20 64 65 6d 6f 6e 73 74 72 61 74 65 73 |low demonstrates| 00000930 0d 68 6f 77 20 69 74 20 77 6f 72 6b 73 3a 0d 0d |.how it works:..| 00000940 20 20 20 20 20 20 20 31 30 20 46 4f 52 49 25 3d | 10 FORI%=| 00000950 30 54 4f 32 53 54 45 50 32 20 20 0d 20 20 20 20 |0TO2STEP2 . | 00000960 20 20 20 32 30 20 50 25 3d 26 39 30 30 20 20 0d | 20 P%=&900 .| 00000970 20 20 20 20 20 20 20 33 30 20 5b 4f 50 54 49 25 | 30 [OPTI%| 00000980 20 20 0d 20 20 20 20 20 20 20 34 30 20 4c 44 58 | . 40 LDX| 00000990 20 23 26 35 30 20 20 5c 63 6f 70 79 20 69 6e 74 | #&50 \copy int| 000009a0 65 67 65 72 20 66 72 6f 6d 20 7a 65 72 6f 20 70 |eger from zero p| 000009b0 61 67 65 20 20 0d 20 20 20 20 20 20 20 35 30 20 |age . 50 | 000009c0 4a 53 52 20 26 41 46 35 36 20 20 5c 74 6f 20 49 |JSR &AF56 \to I| 000009d0 57 41 0d 20 20 20 20 20 20 20 36 30 0d 20 20 20 |WA. 60. | 000009e0 20 20 20 20 37 30 20 4c 44 58 20 23 34 0d 20 20 | 70 LDX #4. | 000009f0 20 20 20 20 20 38 30 20 2e 6c 6f 6f 70 20 4c 44 | 80 .loop LD| 00000a00 41 23 30 20 20 0d 20 20 20 20 20 20 20 39 30 20 |A#0 . 90 | 00000a10 53 54 41 20 26 33 46 2c 58 20 20 0d 20 20 20 20 |STA &3F,X . | 00000a20 20 20 31 30 30 20 53 45 43 20 20 0d 20 20 20 20 | 100 SEC . | 00000a30 20 20 31 31 30 20 2e 6c 6f 6f 70 32 20 4c 44 41 | 110 .loop2 LDA| 00000a40 26 32 41 20 20 0d 20 20 20 20 20 20 31 32 30 20 |&2A . 120 | 00000a50 53 42 43 20 26 39 39 36 42 2c 58 20 20 5c 26 38 |SBC &996B,X \&8| 00000a60 30 32 36 20 66 6f 72 20 42 42 43 20 4d 20 20 0d |026 for BBC M .| 00000a70 20 20 20 20 20 20 31 33 30 20 54 41 59 20 20 0d | 130 TAY .| 00000a80 20 20 20 20 20 20 31 34 30 20 4c 44 41 20 26 32 | 140 LDA &2| 00000a90 42 20 0d 20 20 20 20 20 20 31 35 30 20 53 42 43 |B . 150 SBC| 00000aa0 20 26 39 39 42 39 2c 58 20 20 5c 26 38 30 32 31 | &99B9,X \&8021| 00000ab0 20 66 6f 72 20 42 61 73 69 63 20 34 20 20 0d 20 | for Basic 4 . | 00000ac0 20 20 20 20 20 31 36 30 20 42 43 43 20 73 6b 69 | 160 BCC ski| 00000ad0 70 20 20 0d 20 20 20 20 20 20 31 37 30 20 53 54 |p . 170 ST| 00000ae0 41 20 26 32 42 20 20 0d 20 20 20 20 20 20 31 38 |A &2B . 18| 00000af0 30 20 53 54 59 20 26 32 41 20 20 0d 20 20 20 20 |0 STY &2A . | 00000b00 20 20 31 39 30 20 49 4e 43 20 26 33 46 2c 58 20 | 190 INC &3F,X | 00000b10 20 0d 20 20 20 20 20 20 32 30 30 20 42 4e 45 20 | . 200 BNE | 00000b20 6c 6f 6f 70 32 20 20 0d 20 20 20 20 20 20 32 31 |loop2 . 21| 00000b30 30 20 2e 73 6b 69 70 20 44 45 58 20 20 0d 20 20 |0 .skip DEX . | 00000b40 20 20 20 20 32 32 30 20 42 50 4c 20 6c 6f 6f 70 | 220 BPL loop| 00000b50 0d 20 20 20 20 20 20 32 37 30 20 20 0d 20 20 20 |. 270 . | 00000b60 20 20 20 32 38 30 20 4c 44 58 20 23 35 20 20 5c | 280 LDX #5 \| 00000b70 73 75 70 70 72 65 73 73 20 6c 65 61 64 69 6e 67 |suppress leading| 00000b80 20 7a 65 72 6f 65 73 20 20 0d 20 20 20 20 20 20 | zeroes . | 00000b90 32 39 30 20 2e 6c 6f 6f 70 33 20 44 45 58 20 20 |290 .loop3 DEX | 00000ba0 5c 62 79 20 69 6e 64 65 78 69 6e 67 20 74 6f 20 |\by indexing to | 00000bb0 66 69 72 73 74 20 20 0d 20 20 20 20 20 20 33 30 |first . 30| 00000bc0 30 20 42 45 51 20 70 72 69 6e 74 20 20 5c 6e 6f |0 BEQ print \no| 00000bd0 6e 2d 7a 65 72 6f 20 6e 75 6d 62 65 72 20 20 0d |n-zero number .| 00000be0 20 20 20 20 20 20 33 31 30 20 4c 44 41 20 26 33 | 310 LDA &3| 00000bf0 46 2c 58 20 20 0d 20 20 20 20 20 20 33 32 30 20 |F,X . 320 | 00000c00 42 45 51 20 6c 6f 6f 70 33 20 20 0d 20 20 20 20 |BEQ loop3 . | 00000c10 20 20 33 33 30 20 2e 70 72 69 6e 74 20 4c 44 41 | 330 .print LDA| 00000c20 20 26 33 46 2c 58 20 20 0d 20 20 20 20 20 20 33 | &3F,X . 3| 00000c30 34 30 20 4f 52 41 20 23 26 33 30 20 20 0d 20 20 |40 ORA #&30 . | 00000c40 20 20 20 20 33 35 30 20 4a 53 52 20 26 46 46 45 | 350 JSR &FFE| 00000c50 45 20 20 0d 20 20 20 20 20 20 33 36 30 20 44 45 |E . 360 DE| 00000c60 58 20 20 0d 20 20 20 20 20 20 33 37 30 20 42 50 |X . 370 BP| 00000c70 4c 20 70 72 69 6e 74 0d 20 20 20 20 20 20 33 38 |L print. 38| 00000c80 30 20 52 54 53 0d 20 20 20 20 20 20 33 39 30 20 |0 RTS. 390 | 00000c90 5d 20 0d 20 20 20 20 20 20 34 30 30 20 4e 45 58 |] . 400 NEX| 00000ca0 54 20 0d 20 20 20 20 20 20 34 31 30 20 49 4e 50 |T . 410 INP| 00000cb0 55 54 20 21 26 35 30 0d 20 20 20 20 20 20 34 32 |UT !&50. 42| 00000cc0 30 20 43 41 4c 4c 20 26 39 30 30 20 0d 20 20 0d |0 CALL &900 . .| 00000cd0 54 68 65 20 73 65 63 74 69 6f 6e 20 6f 66 20 63 |The section of c| 00000ce0 6f 64 65 20 66 72 6f 6d 20 6c 69 6e 65 20 32 38 |ode from line 28| 00000cf0 30 20 74 6f 20 33 32 30 20 73 75 70 70 72 65 73 |0 to 320 suppres| 00000d00 73 65 73 20 6c 65 61 64 69 6e 67 20 7a 65 72 6f |ses leading zero| 00000d10 73 2e 20 54 68 69 73 0d 6a 75 73 74 20 6d 65 61 |s. This.just mea| 00000d20 6e 73 20 74 68 61 74 20 69 66 20 79 6f 75 20 68 |ns that if you h| 00000d30 61 64 20 74 68 65 20 6e 75 6d 62 65 72 20 32 33 |ad the number 23| 00000d40 34 2c 20 74 68 65 6e 20 69 74 20 77 69 6c 6c 20 |4, then it will | 00000d50 62 65 20 70 72 69 6e 74 65 64 20 61 73 20 0d 32 |be printed as .2| 00000d60 33 34 20 61 6e 64 20 6e 6f 74 20 30 30 32 33 34 |34 and not 00234| 00000d70 2e 20 53 6f 6d 65 74 69 6d 65 73 20 79 6f 75 20 |. Sometimes you | 00000d80 6d 69 67 68 74 20 6e 6f 74 20 63 61 72 65 20 66 |might not care f| 00000d90 6f 72 20 6c 65 61 64 69 6e 67 20 7a 65 72 6f 20 |or leading zero | 00000da0 0d 73 75 70 70 72 65 73 73 69 6f 6e 2e 20 49 6e |.suppression. In| 00000db0 20 6d 6f 73 74 20 67 61 6d 65 73 2c 20 66 6f 72 | most games, for| 00000dc0 20 69 6e 73 74 61 6e 63 65 2c 20 79 6f 75 72 20 | instance, your | 00000dd0 73 63 6f 72 65 20 69 73 20 64 69 73 70 6c 61 79 |score is display| 00000de0 65 64 20 61 73 0d 30 30 30 30 30 20 61 74 20 74 |ed as.00000 at t| 00000df0 68 65 20 73 74 61 72 74 20 74 68 65 6e 20 63 68 |he start then ch| 00000e00 61 6e 67 65 73 20 74 6f 20 30 30 30 31 30 20 77 |anges to 00010 w| 00000e10 68 65 6e 20 79 6f 75 20 73 63 6f 72 65 20 73 6f |hen you score so| 00000e20 6d 65 20 70 6f 69 6e 74 73 20 61 6e 64 0d 73 6f |me points and.so| 00000e30 20 6f 6e 2e 20 49 6e 20 74 68 69 73 20 63 61 73 | on. In this cas| 00000e40 65 2c 20 79 6f 75 20 63 61 6e 20 64 69 73 70 65 |e, you can dispe| 00000e50 6e 73 65 20 77 69 74 68 20 6c 69 6e 65 73 20 32 |nse with lines 2| 00000e60 39 30 2d 33 32 30 20 69 6e 20 74 68 65 20 61 62 |90-320 in the ab| 00000e70 6f 76 65 0d 70 72 6f 67 72 61 6d 20 61 6e 64 20 |ove.program and | 00000e80 72 65 70 6c 61 63 65 20 6c 69 6e 65 20 32 38 30 |replace line 280| 00000e90 20 77 69 74 68 20 4c 44 58 20 23 34 2e 0d 0d 54 | with LDX #4...T| 00000ea0 68 69 73 20 61 72 74 69 63 6c 65 20 63 6f 6e 74 |his article cont| 00000eb0 69 6e 75 65 64 20 69 6e 20 56 2e 2b 42 52 52 33 |inued in V.+BRR3| 00000ec0 2e 20 46 69 72 73 74 20 70 75 62 6c 69 73 68 65 |. First publishe| 00000ed0 64 20 45 55 47 20 23 35 35 2e 0d |d EUG #55..| 00000edb