Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_18.ADF » F/MCTut2
F/MCTut2
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_18.ADF |
Filename: | F/MCTut2 |
Read OK: | ✔ |
File size: | 11DA bytes |
Load address: | 4D204556 |
Exec address: | 74755443 |
File contents
The sections are for: 1. Main loop 2. Subroutines 3. Data The first routine is for printing text to screen. As it stands, the program will run but will simply list the code for theroutine and return to BASIC as the only code in the Main loop is theopcode RTS. This is the code for RETURN from subroutine and M/code mustalways end with this to return to BASIC. The text that you want to print must be entered in the Data section in theform: .text EQUS" <TEXT> "+CHR$&FF EQUS tells the computer that a String follows and the CHR$&FF signifiesthe end of the String. The label can be anything you like with the limitsof a normal BASIS variable but must always start with a '.'. The address at which the text is stored must first be entered into theprint routine. To do this you need to add in the main loop: LDX#text MOD256 \ LoaDX with Low byte of text address LDY#text DIV256 \ LoaDY with High byte of text address JSRprint \ Jump SubRoutine The '\' is equivalent to REM in BASIC and is ignored - you neednot type these in. The routine firstSTores the address into &70 and &71, a zero page addressfor Post-indexed indirect addressing mode (see p207 of manual). Since Yregister is then loaded with zero, A register is loaded from the addressof the start of the string (text address + 0) and is printed to the screenwith JSR&FFEE as explained above. Y register is INCremented and the routine jumps back to the label .prtlp to point to the next charactersince the byte &FF has not been reached yet. When the string has beenprinted and A register loaded with &FF the CoMParison is met and theroutine branches to the label .endprt and returns to the main loop. Thisreturns to BASIC with the second RTS. While other types of Indexed addressing may be used for printing, the oneused here enables you print out several different texts simply by loadingthe text addresses into &70 using a different label for each. Try addingfurther text data say text1, text2. You will see that all these are strung together. So the routine is likePRINT;"...."; as we have not told the computer to move onto a new line. This is done using OSNEWL (&FFE7). So add this after each time the printroutine is called. There is also another Operatimg System routine for printing to the screenwhich is a combination of the above routines. This is OSASCI (&FFE3). Thedifference is that loadong A register with &0D (the carriage return value)with OSWRCH returns the print position to the beginning of the same linenot to the next line but with OSASCI it does. Try entering - .text EQUS"<text>"+CHR$&0D+"<text>"+CHR$&FF With OSWRCH these will be printed on the same line - the second overprintsthe first. Now change &FFEE to &FFE3 in the print subroutine and run theprogram again. The text will then be correctly printed on two lines. To indent text simply add spaces to the beginningof the beginning of thestring but to print at any point of the screen the equivalent of TAB(x,y)or VDU31,x,y is needed. As will be seen from the use of &0D with OSWRCH,the control codes and any data needed may be used also so that this becomes - LDA #31:JSR&FFEE:LDX #x:JSR&FFEE:LDY #y:JSR&FFEE It is more convenient to make this into a subroutine - .tab LDA #31:JSR&FFEE:TXA:JSR&FFEE:TYA:JMP&FFEE Add this routine in section 2 after the print routine. The last call toOSWRCH is a JMP instruction as the routine includes the RTS which returnsto the main loop. To use the routine, X and Y registers must be loaded with the x and yprint co-ordinates in the main loop by - LDX #x:LDY #y:JSRtab The values are transferred to A register by TXA and TYA by the routine. Try this before calling the print routine. If you want to underline a title or print a string of the same characteruse this short routine in a similar way - .uline JSR&FFEE:DEX:BNEuline:RTS A register should be loaded with the ASC value of the character and Xregister with the number of characters by - LDA #ASC"<char>":LDX #<no of chars>:JSRuline Here X register is used as a counter and the routine repeats printinguntil X reaches zero. This is like the STRING$ routine in BASIC. With similar routines as the above you may be able to make up routines forMODE, COLOUR, GCOL, CLS, and CLG. I will be covering these and more next time. Keep experimenting!!
00000000 54 68 65 20 73 65 63 74 69 6f 6e 73 20 61 72 65 |The sections are| 00000010 20 66 6f 72 3a 0d 20 20 20 20 20 31 2e 20 4d 61 | for:. 1. Ma| 00000020 69 6e 20 6c 6f 6f 70 20 20 20 0d 20 20 20 20 20 |in loop . | 00000030 32 2e 20 53 75 62 72 6f 75 74 69 6e 65 73 0d 20 |2. Subroutines. | 00000040 20 20 20 20 33 2e 20 44 61 74 61 0d 0d 54 68 65 | 3. Data..The| 00000050 1a 20 66 69 72 73 74 1a 20 72 6f 75 74 69 6e 65 |. first. routine| 00000060 1a 20 69 73 1a 20 66 6f 72 20 70 72 69 6e 74 69 |. is. for printi| 00000070 6e 67 20 74 65 78 74 20 74 6f 20 73 63 72 65 65 |ng text to scree| 00000080 6e 2e 0d 0d 41 73 20 69 74 20 73 74 61 6e 64 73 |n...As it stands| 00000090 2c 20 74 68 65 20 70 72 6f 67 72 61 6d 1a 20 77 |, the program. w| 000000a0 69 6c 6c 1a 20 72 75 6e 20 62 75 74 20 77 69 6c |ill. run but wil| 000000b0 6c 20 73 69 6d 70 6c 79 20 6c 69 73 74 20 74 68 |l simply list th| 000000c0 65 20 0d 63 6f 64 65 20 66 6f 72 20 74 68 65 10 |e .code for the.| 000000d0 72 6f 75 74 69 6e 65 20 61 6e 64 20 72 65 74 75 |routine and retu| 000000e0 72 6e 20 74 6f 20 42 41 53 49 43 20 61 73 20 74 |rn to BASIC as t| 000000f0 68 65 1a 20 6f 6e 6c 79 1a 20 63 6f 64 65 1a 20 |he. only. code. | 00000100 69 6e 1a 20 0d 74 68 65 1a 20 4d 61 69 6e 1a 20 |in. .the. Main. | 00000110 6c 6f 6f 70 20 69 73 20 74 68 65 10 6f 70 63 6f |loop is the.opco| 00000120 64 65 1a 20 52 54 53 2e 1a 20 54 68 69 73 1a 20 |de. RTS.. This. | 00000130 69 73 20 74 68 65 20 63 6f 64 65 20 66 6f 72 20 |is the code for | 00000140 52 45 54 55 52 4e 20 0d 66 72 6f 6d 20 73 75 62 |RETURN .from sub| 00000150 72 6f 75 74 69 6e 65 20 61 6e 64 20 4d 2f 63 6f |routine and M/co| 00000160 64 65 20 6d 75 73 74 10 61 6c 77 61 79 73 20 65 |de must.always e| 00000170 6e 64 20 77 69 74 68 20 74 68 69 73 20 74 6f 20 |nd with this to | 00000180 72 65 74 75 72 6e 20 0d 74 6f 20 42 41 53 49 43 |return .to BASIC| 00000190 2e 20 20 0d 0d 54 68 65 20 74 65 78 74 20 74 68 |. ..The text th| 000001a0 61 74 20 79 6f 75 20 77 61 6e 74 20 74 6f 20 70 |at you want to p| 000001b0 72 69 6e 74 20 6d 75 73 74 20 62 65 20 65 6e 74 |rint must be ent| 000001c0 65 72 65 64 20 69 6e 20 74 68 65 20 44 61 74 61 |ered in the Data| 000001d0 20 0d 73 65 63 74 69 6f 6e 20 69 6e 20 74 68 65 | .section in the| 000001e0 10 66 6f 72 6d 3a 0d 20 20 20 20 20 2e 74 65 78 |.form:. .tex| 000001f0 74 20 45 51 55 53 22 20 3c 54 45 58 54 3e 20 22 |t EQUS" <TEXT> "| 00000200 2b 43 48 52 24 26 46 46 0d 45 51 55 53 20 74 65 |+CHR$&FF.EQUS te| 00000210 6c 6c 73 20 74 68 65 20 63 6f 6d 70 75 74 65 72 |lls the computer| 00000220 1a 20 74 68 61 74 1a 20 61 1a 20 53 74 72 69 6e |. that. a. Strin| 00000230 67 20 66 6f 6c 6c 6f 77 73 20 61 6e 64 20 74 68 |g follows and th| 00000240 65 20 43 48 52 24 26 46 46 20 0d 73 69 67 6e 69 |e CHR$&FF .signi| 00000250 66 69 65 73 10 74 68 65 20 65 6e 64 20 6f 66 20 |fies.the end of | 00000260 74 68 65 20 53 74 72 69 6e 67 2e 20 20 54 68 65 |the String. The| 00000270 20 6c 61 62 65 6c 20 63 61 6e 20 62 65 20 61 6e | label can be an| 00000280 79 74 68 69 6e 67 20 0d 79 6f 75 20 6c 69 6b 65 |ything .you like| 00000290 20 77 69 74 68 20 74 68 65 20 6c 69 6d 69 74 73 | with the limits| 000002a0 10 6f 66 20 61 20 6e 6f 72 6d 61 6c 20 42 41 53 |.of a normal BAS| 000002b0 49 53 20 76 61 72 69 61 62 6c 65 20 62 75 74 20 |IS variable but | 000002c0 6d 75 73 74 20 0d 61 6c 77 61 79 73 20 73 74 61 |must .always sta| 000002d0 72 74 20 77 69 74 68 20 61 20 27 2e 27 2e 0d 0d |rt with a '.'...| 000002e0 54 68 65 20 61 64 64 72 65 73 73 20 61 74 20 77 |The address at w| 000002f0 68 69 63 68 20 74 68 65 1a 20 74 65 78 74 1a 20 |hich the. text. | 00000300 69 73 1a 20 73 74 6f 72 65 64 1a 20 6d 75 73 74 |is. stored. must| 00000310 20 66 69 72 73 74 20 62 65 20 65 6e 74 65 72 65 | first be entere| 00000320 64 20 0d 69 6e 74 6f 20 74 68 65 10 70 72 69 6e |d .into the.prin| 00000330 74 20 72 6f 75 74 69 6e 65 2e 20 20 0d 54 6f 20 |t routine. .To | 00000340 64 6f 20 74 68 69 73 20 79 6f 75 20 6e 65 65 64 |do this you need| 00000350 20 74 6f 20 61 64 64 20 69 6e 20 74 68 65 20 6d | to add in the m| 00000360 61 69 6e 20 6c 6f 6f 70 3a 0d 20 20 20 20 20 4c |ain loop:. L| 00000370 44 58 23 74 65 78 74 20 4d 4f 44 32 35 36 20 20 |DX#text MOD256 | 00000380 20 20 5c 20 4c 6f 61 44 58 20 77 69 74 68 20 4c | \ LoaDX with L| 00000390 6f 77 20 62 79 74 65 20 6f 66 20 74 65 78 74 20 |ow byte of text | 000003a0 61 64 64 72 65 73 73 0d 20 20 20 20 20 4c 44 59 |address. LDY| 000003b0 23 74 65 78 74 20 44 49 56 32 35 36 20 20 20 20 |#text DIV256 | 000003c0 5c 20 4c 6f 61 44 59 20 77 69 74 68 20 48 69 67 |\ LoaDY with Hig| 000003d0 68 20 62 79 74 65 20 6f 66 20 74 65 78 74 20 61 |h byte of text a| 000003e0 64 64 72 65 73 73 0d 20 20 20 20 20 4a 53 52 70 |ddress. JSRp| 000003f0 72 69 6e 74 20 20 20 20 20 20 20 20 20 20 20 5c |rint \| 00000400 20 4a 75 6d 70 20 53 75 62 52 6f 75 74 69 6e 65 | Jump SubRoutine| 00000410 0d 0d 20 20 20 20 20 20 20 20 54 68 65 20 27 5c |.. The '\| 00000420 27 20 69 73 20 65 71 75 69 76 61 6c 65 6e 74 20 |' is equivalent | 00000430 74 6f 1a 20 52 45 4d 1a 20 69 6e 1a 20 42 41 53 |to. REM. in. BAS| 00000440 49 43 20 61 6e 64 20 69 73 20 69 67 6e 6f 72 65 |IC and is ignore| 00000450 64 20 2d 20 0d 20 20 20 20 20 20 20 20 79 6f 75 |d - . you| 00000460 20 6e 65 65 64 10 6e 6f 74 20 74 79 70 65 20 74 | need.not type t| 00000470 68 65 73 65 20 69 6e 2e 0d 0d 54 68 65 20 72 6f |hese in...The ro| 00000480 75 74 69 6e 65 20 66 69 72 73 74 1a 53 54 6f 72 |utine first.STor| 00000490 65 73 20 74 68 65 20 61 64 64 72 65 73 73 20 69 |es the address i| 000004a0 6e 74 6f 20 26 37 30 20 61 6e 64 20 26 37 31 2c |nto &70 and &71,| 000004b0 20 61 20 7a 65 72 6f 20 0d 70 61 67 65 20 61 64 | a zero .page ad| 000004c0 64 72 65 73 73 10 66 6f 72 20 50 6f 73 74 2d 69 |dress.for Post-i| 000004d0 6e 64 65 78 65 64 20 69 6e 64 69 72 65 63 74 20 |ndexed indirect | 000004e0 61 64 64 72 65 73 73 69 6e 67 20 6d 6f 64 65 1a |addressing mode.| 000004f0 20 28 73 65 65 1a 20 0d 70 32 30 37 20 6f 66 20 | (see. .p207 of | 00000500 6d 61 6e 75 61 6c 29 2e 20 20 53 69 6e 63 65 20 |manual). Since | 00000510 59 10 72 65 67 69 73 74 65 72 20 69 73 20 74 68 |Y.register is th| 00000520 65 6e 20 6c 6f 61 64 65 64 20 77 69 74 68 1a 20 |en loaded with. | 00000530 7a 65 72 6f 2c 1a 20 41 20 0d 72 65 67 69 73 74 |zero,. A .regist| 00000540 65 72 20 69 73 20 6c 6f 61 64 65 64 20 66 72 6f |er is loaded fro| 00000550 6d 20 74 68 65 20 61 64 64 72 65 73 73 10 6f 66 |m the address.of| 00000560 20 74 68 65 20 73 74 61 72 74 20 6f 66 20 74 68 | the start of th| 00000570 65 20 73 74 72 69 6e 67 20 0d 28 74 65 78 74 20 |e string .(text | 00000580 61 64 64 72 65 73 73 20 2b 20 30 29 20 61 6e 64 |address + 0) and| 00000590 20 69 73 20 70 72 69 6e 74 65 64 20 74 6f 20 74 | is printed to t| 000005a0 68 65 20 73 63 72 65 65 6e 10 77 69 74 68 1a 20 |he screen.with. | 000005b0 4a 53 52 26 46 46 45 45 20 0d 61 73 20 65 78 70 |JSR&FFEE .as exp| 000005c0 6c 61 69 6e 65 64 20 61 62 6f 76 65 2e 20 20 59 |lained above. Y| 000005d0 20 20 72 65 67 69 73 74 65 72 1a 20 69 73 1a 20 | register. is. | 000005e0 49 4e 43 72 65 6d 65 6e 74 65 64 1a 20 61 6e 64 |INCremented. and| 000005f0 1a 20 74 68 65 10 0d 72 6f 75 74 69 6e 65 20 6a |. the..routine j| 00000600 75 6d 70 73 1a 20 62 61 63 6b 1a 20 74 6f 1a 20 |umps. back. to. | 00000610 74 68 65 1a 20 6c 61 62 65 6c 20 2e 70 72 74 6c |the. label .prtl| 00000620 70 20 74 6f 20 70 6f 69 6e 74 20 74 6f 20 74 68 |p to point to th| 00000630 65 20 20 6e 65 78 74 20 0d 63 68 61 72 61 63 74 |e next .charact| 00000640 65 72 10 73 69 6e 63 65 20 74 68 65 20 62 79 74 |er.since the byt| 00000650 65 20 26 46 46 20 68 61 73 20 6e 6f 74 1a 20 62 |e &FF has not. b| 00000660 65 65 6e 1a 20 72 65 61 63 68 65 64 1a 20 79 65 |een. reached. ye| 00000670 74 2e 1a 20 20 57 68 65 6e 20 0d 74 68 65 20 73 |t.. When .the s| 00000680 74 72 69 6e 67 20 68 61 73 20 62 65 65 6e 10 70 |tring has been.p| 00000690 72 69 6e 74 65 64 1a 20 61 6e 64 1a 20 41 20 72 |rinted. and. A r| 000006a0 65 67 69 73 74 65 72 20 20 6c 6f 61 64 65 64 20 |egister loaded | 000006b0 77 69 74 68 20 26 46 46 20 0d 74 68 65 20 43 6f |with &FF .the Co| 000006c0 4d 50 61 72 69 73 6f 6e 20 69 73 1a 20 6d 65 74 |MParison is. met| 000006d0 1a 20 61 6e 64 1a 20 74 68 65 10 72 6f 75 74 69 |. and. the.routi| 000006e0 6e 65 20 62 72 61 6e 63 68 65 73 20 74 6f 1a 20 |ne branches to. | 000006f0 74 68 65 20 6c 61 62 65 6c 20 0d 2e 65 6e 64 70 |the label ..endp| 00000700 72 74 20 61 6e 64 20 72 65 74 75 72 6e 73 20 74 |rt and returns t| 00000710 6f 20 74 68 65 20 6d 61 69 6e 20 6c 6f 6f 70 2e |o the main loop.| 00000720 20 20 54 68 69 73 10 72 65 74 75 72 6e 73 20 74 | This.returns t| 00000730 6f 20 42 41 53 49 43 20 0d 77 69 74 68 20 74 68 |o BASIC .with th| 00000740 65 20 73 65 63 6f 6e 64 20 52 54 53 2e 0d 0d 57 |e second RTS...W| 00000750 68 69 6c 65 1a 20 6f 74 68 65 72 20 74 79 70 65 |hile. other type| 00000760 73 20 6f 66 20 49 6e 64 65 78 65 64 20 61 64 64 |s of Indexed add| 00000770 72 65 73 73 69 6e 67 20 6d 61 79 20 62 65 20 75 |ressing may be u| 00000780 73 65 64 20 66 6f 72 20 0d 70 72 69 6e 74 69 6e |sed for .printin| 00000790 67 2c 20 74 68 65 20 6f 6e 65 10 75 73 65 64 20 |g, the one.used | 000007a0 68 65 72 65 1a 20 65 6e 61 62 6c 65 73 20 79 6f |here. enables yo| 000007b0 75 20 70 72 69 6e 74 20 6f 75 74 20 73 65 76 65 |u print out seve| 000007c0 72 61 6c 20 0d 64 69 66 66 65 72 65 6e 74 20 74 |ral .different t| 000007d0 65 78 74 73 20 73 69 6d 70 6c 79 20 62 79 20 6c |exts simply by l| 000007e0 6f 61 64 69 6e 67 10 74 68 65 20 74 65 78 74 20 |oading.the text | 000007f0 61 64 64 72 65 73 73 65 73 1a 20 69 6e 74 6f 20 |addresses. into | 00000800 26 37 30 20 0d 75 73 69 6e 67 20 61 20 64 69 66 |&70 .using a dif| 00000810 66 65 72 65 6e 74 20 6c 61 62 65 6c 20 66 6f 72 |ferent label for| 00000820 20 65 61 63 68 2e 20 20 54 72 79 20 61 64 64 69 | each. Try addi| 00000830 6e 67 10 66 75 72 74 68 65 72 20 74 65 78 74 20 |ng.further text | 00000840 0d 64 61 74 61 20 73 61 79 20 74 65 78 74 31 2c |.data say text1,| 00000850 20 74 65 78 74 32 2e 0d 0d 59 6f 75 20 77 69 6c | text2...You wil| 00000860 6c 20 73 65 65 20 74 68 61 74 1a 20 61 6c 6c 1a |l see that. all.| 00000870 20 74 68 65 73 65 20 61 72 65 20 73 74 72 75 6e | these are strun| 00000880 67 20 74 6f 67 65 74 68 65 72 2e 20 20 53 6f 20 |g together. So | 00000890 74 68 65 20 0d 72 6f 75 74 69 6e 65 20 69 73 20 |the .routine is | 000008a0 6c 69 6b 65 10 50 52 49 4e 54 3b 22 2e 2e 2e 2e |like.PRINT;"....| 000008b0 22 3b 20 61 73 20 77 65 20 68 61 76 65 20 6e 6f |"; as we have no| 000008c0 74 20 74 6f 6c 64 1a 20 74 68 65 1a 20 63 6f 6d |t told. the. com| 000008d0 70 75 74 65 72 1a 20 0d 74 6f 20 6d 6f 76 65 20 |puter. .to move | 000008e0 6f 6e 74 6f 20 61 20 6e 65 77 20 6c 69 6e 65 2e |onto a new line.| 000008f0 20 10 54 68 69 73 20 69 73 20 64 6f 6e 65 20 75 | .This is done u| 00000900 73 69 6e 67 20 4f 53 4e 45 57 4c 20 28 26 46 46 |sing OSNEWL (&FF| 00000910 45 37 29 2e 20 20 0d 53 6f 20 61 64 64 20 74 68 |E7). .So add th| 00000920 69 73 1a 20 61 66 74 65 72 20 65 61 63 68 20 74 |is. after each t| 00000930 69 6d 65 20 74 68 65 20 70 72 69 6e 74 10 72 6f |ime the print.ro| 00000940 75 74 69 6e 65 20 69 73 20 63 61 6c 6c 65 64 2e |utine is called.| 00000950 0d 0d 54 68 65 72 65 20 69 73 20 61 6c 73 6f 20 |..There is also | 00000960 61 6e 6f 74 68 65 72 20 4f 70 65 72 61 74 69 6d |another Operatim| 00000970 67 20 53 79 73 74 65 6d 1a 20 72 6f 75 74 69 6e |g System. routin| 00000980 65 20 66 6f 72 20 70 72 69 6e 74 69 6e 67 20 74 |e for printing t| 00000990 6f 20 0d 74 68 65 20 73 63 72 65 65 6e 10 77 68 |o .the screen.wh| 000009a0 69 63 68 20 69 73 20 61 20 63 6f 6d 62 69 6e 61 |ich is a combina| 000009b0 74 69 6f 6e 20 6f 66 20 74 68 65 20 61 62 6f 76 |tion of the abov| 000009c0 65 1a 20 72 6f 75 74 69 6e 65 73 2e 20 54 68 69 |e. routines. Thi| 000009d0 73 20 0d 69 73 20 4f 53 41 53 43 49 20 28 26 46 |s .is OSASCI (&F| 000009e0 46 45 33 29 2e 20 54 68 65 10 64 69 66 66 65 72 |FE3). The.differ| 000009f0 65 6e 63 65 20 69 73 20 74 68 61 74 20 6c 6f 61 |ence is that loa| 00000a00 64 6f 6e 67 20 41 20 72 65 67 69 73 74 65 72 20 |dong A register | 00000a10 0d 77 69 74 68 20 26 30 44 20 28 74 68 65 20 63 |.with &0D (the c| 00000a20 61 72 72 69 61 67 65 20 72 65 74 75 72 6e 20 76 |arriage return v| 00000a30 61 6c 75 65 29 10 77 69 74 68 20 4f 53 57 52 43 |alue).with OSWRC| 00000a40 48 20 72 65 74 75 72 6e 73 20 74 68 65 20 0d 70 |H returns the .p| 00000a50 72 69 6e 74 1a 20 70 6f 73 69 74 69 6f 6e 1a 20 |rint. position. | 00000a60 74 6f 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 |to the beginning| 00000a70 20 6f 66 20 74 68 65 20 73 61 6d 65 20 6c 69 6e | of the same lin| 00000a80 65 10 6e 6f 74 20 74 6f 20 74 68 65 20 0d 6e 65 |e.not to the .ne| 00000a90 78 74 20 6c 69 6e 65 20 62 75 74 20 77 69 74 68 |xt line but with| 00000aa0 20 4f 53 41 53 43 49 20 69 74 20 64 6f 65 73 2e | OSASCI it does.| 00000ab0 0d 0d 54 72 79 20 65 6e 74 65 72 69 6e 67 20 2d |..Try entering -| 00000ac0 20 2e 74 65 78 74 20 45 51 55 53 22 3c 74 65 78 | .text EQUS"<tex| 00000ad0 74 3e 22 2b 43 48 52 24 26 30 44 2b 22 3c 74 65 |t>"+CHR$&0D+"<te| 00000ae0 78 74 3e 22 2b 43 48 52 24 26 46 46 0d 0d 57 69 |xt>"+CHR$&FF..Wi| 00000af0 74 68 20 4f 53 57 52 43 48 20 74 68 65 73 65 20 |th OSWRCH these | 00000b00 77 69 6c 6c 20 62 65 20 70 72 69 6e 74 65 64 20 |will be printed | 00000b10 6f 6e 20 74 68 65 20 73 61 6d 65 20 6c 69 6e 65 |on the same line| 00000b20 20 2d 20 74 68 65 20 0d 73 65 63 6f 6e 64 20 6f | - the .second o| 00000b30 76 65 72 70 72 69 6e 74 73 10 74 68 65 20 66 69 |verprints.the fi| 00000b40 72 73 74 2e 20 20 4e 6f 77 20 63 68 61 6e 67 65 |rst. Now change| 00000b50 20 26 46 46 45 45 20 74 6f 20 26 46 46 45 33 20 | &FFEE to &FFE3 | 00000b60 69 6e 1a 20 74 68 65 20 0d 70 72 69 6e 74 20 73 |in. the .print s| 00000b70 75 62 72 6f 75 74 69 6e 65 20 61 6e 64 20 72 75 |ubroutine and ru| 00000b80 6e 20 74 68 65 10 70 72 6f 67 72 61 6d 20 61 67 |n the.program ag| 00000b90 61 69 6e 2e 20 20 54 68 65 20 74 65 78 74 20 77 |ain. The text w| 00000ba0 69 6c 6c 20 0d 74 68 65 6e 20 62 65 20 63 6f 72 |ill .then be cor| 00000bb0 72 65 63 74 6c 79 20 70 72 69 6e 74 65 64 20 6f |rectly printed o| 00000bc0 6e 20 74 77 6f 20 6c 69 6e 65 73 2e 0d 0d 54 6f |n two lines...To| 00000bd0 20 69 6e 64 65 6e 74 20 74 65 78 74 20 73 69 6d | indent text sim| 00000be0 70 6c 79 20 61 64 64 1a 20 73 70 61 63 65 73 20 |ply add. spaces | 00000bf0 74 6f 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 |to the beginning| 00000c00 1a 6f 66 20 74 68 65 20 0d 62 65 67 69 6e 6e 69 |.of the .beginni| 00000c10 6e 67 20 6f 66 20 74 68 65 10 73 74 72 69 6e 67 |ng of the.string| 00000c20 20 62 75 74 20 74 6f 20 70 72 69 6e 74 20 61 74 | but to print at| 00000c30 20 61 6e 79 1a 20 70 6f 69 6e 74 20 6f 66 20 74 | any. point of t| 00000c40 68 65 20 0d 73 63 72 65 65 6e 20 74 68 65 20 65 |he .screen the e| 00000c50 71 75 69 76 61 6c 65 6e 74 20 6f 66 20 54 41 42 |quivalent of TAB| 00000c60 28 78 2c 79 29 10 6f 72 20 56 44 55 33 31 2c 78 |(x,y).or VDU31,x| 00000c70 2c 79 20 69 73 20 6e 65 65 64 65 64 2e 20 20 41 |,y is needed. A| 00000c80 73 20 0d 77 69 6c 6c 20 62 65 1a 20 73 65 65 6e |s .will be. seen| 00000c90 20 66 72 6f 6d 20 74 68 65 20 75 73 65 20 6f 66 | from the use of| 00000ca0 20 26 30 44 20 77 69 74 68 20 4f 53 57 52 43 48 | &0D with OSWRCH| 00000cb0 2c 10 74 68 65 20 63 6f 6e 74 72 6f 6c 20 0d 63 |,.the control .c| 00000cc0 6f 64 65 73 20 61 6e 64 20 61 6e 79 1a 20 64 61 |odes and any. da| 00000cd0 74 61 1a 20 6e 65 65 64 65 64 1a 20 6d 61 79 1a |ta. needed. may.| 00000ce0 20 62 65 1a 20 75 73 65 64 1a 20 61 6c 73 6f 1a | be. used. also.| 00000cf0 20 73 6f 20 74 68 61 74 20 74 68 69 73 10 0d 62 | so that this..b| 00000d00 65 63 6f 6d 65 73 20 2d 0d 0d 09 4c 44 41 20 23 |ecomes -...LDA #| 00000d10 33 31 3a 4a 53 52 26 46 46 45 45 3a 4c 44 58 20 |31:JSR&FFEE:LDX | 00000d20 23 78 3a 4a 53 52 26 46 46 45 45 3a 4c 44 59 20 |#x:JSR&FFEE:LDY | 00000d30 23 79 3a 4a 53 52 26 46 46 45 45 0d 0d 49 74 20 |#y:JSR&FFEE..It | 00000d40 69 73 20 6d 6f 72 65 20 63 6f 6e 76 65 6e 69 65 |is more convenie| 00000d50 6e 74 20 74 6f 20 6d 61 6b 65 20 74 68 69 73 20 |nt to make this | 00000d60 69 6e 74 6f 20 61 20 73 75 62 72 6f 75 74 69 6e |into a subroutin| 00000d70 65 20 2d 0d 0d 09 2e 74 61 62 20 4c 44 41 20 23 |e -....tab LDA #| 00000d80 33 31 3a 4a 53 52 26 46 46 45 45 3a 54 58 41 3a |31:JSR&FFEE:TXA:| 00000d90 4a 53 52 26 46 46 45 45 3a 54 59 41 3a 4a 4d 50 |JSR&FFEE:TYA:JMP| 00000da0 26 46 46 45 45 0d 0d 41 64 64 20 74 68 69 73 20 |&FFEE..Add this | 00000db0 72 6f 75 74 69 6e 65 20 69 6e 20 73 65 63 74 69 |routine in secti| 00000dc0 6f 6e 20 32 20 61 66 74 65 72 20 74 68 65 1a 20 |on 2 after the. | 00000dd0 70 72 69 6e 74 1a 20 72 6f 75 74 69 6e 65 2e 20 |print. routine. | 00000de0 20 54 68 65 20 0d 6c 61 73 74 20 63 61 6c 6c 20 | The .last call | 00000df0 74 6f 10 4f 53 57 52 43 48 20 69 73 20 61 20 4a |to.OSWRCH is a J| 00000e00 4d 50 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 61 |MP instruction a| 00000e10 73 20 74 68 65 20 72 6f 75 74 69 6e 65 20 0d 69 |s the routine .i| 00000e20 6e 63 6c 75 64 65 73 20 74 68 65 1a 20 52 54 53 |ncludes the. RTS| 00000e30 20 77 68 69 63 68 20 72 65 74 75 72 6e 73 10 74 | which returns.t| 00000e40 6f 20 74 68 65 20 6d 61 69 6e 20 6c 6f 6f 70 2e |o the main loop.| 00000e50 0d 0d 54 6f 20 75 73 65 20 74 68 65 20 72 6f 75 |..To use the rou| 00000e60 74 69 6e 65 2c 20 58 20 61 6e 64 20 59 20 72 65 |tine, X and Y re| 00000e70 67 69 73 74 65 72 73 20 6d 75 73 74 20 62 65 20 |gisters must be | 00000e80 6c 6f 61 64 65 64 1a 20 77 69 74 68 1a 20 74 68 |loaded. with. th| 00000e90 65 1a 20 0d 78 1a 20 61 6e 64 1a 20 79 10 70 72 |e. .x. and. y.pr| 00000ea0 69 6e 74 20 63 6f 2d 6f 72 64 69 6e 61 74 65 73 |int co-ordinates| 00000eb0 20 69 6e 20 74 68 65 20 6d 61 69 6e 20 6c 6f 6f | in the main loo| 00000ec0 70 20 62 79 20 2d 0d 0d 09 4c 44 58 20 23 78 3a |p by -...LDX #x:| 00000ed0 4c 44 59 20 23 79 3a 4a 53 52 74 61 62 0d 0d 54 |LDY #y:JSRtab..T| 00000ee0 68 65 20 76 61 6c 75 65 73 20 61 72 65 20 74 72 |he values are tr| 00000ef0 61 6e 73 66 65 72 72 65 64 20 74 6f 20 41 20 72 |ansferred to A r| 00000f00 65 67 69 73 74 65 72 20 62 79 20 54 58 41 20 61 |egister by TXA a| 00000f10 6e 64 20 54 59 41 20 62 79 20 74 68 65 20 0d 72 |nd TYA by the .r| 00000f20 6f 75 74 69 6e 65 2e 0d 0d 54 72 79 20 74 68 69 |outine...Try thi| 00000f30 73 20 62 65 66 6f 72 65 20 63 61 6c 6c 69 6e 67 |s before calling| 00000f40 20 74 68 65 20 70 72 69 6e 74 20 72 6f 75 74 69 | the print routi| 00000f50 6e 65 2e 0d 0d 49 66 1a 20 79 6f 75 1a 20 77 61 |ne...If. you. wa| 00000f60 6e 74 20 74 6f 20 75 6e 64 65 72 6c 69 6e 65 20 |nt to underline | 00000f70 61 20 74 69 74 6c 65 20 6f 72 20 70 72 69 6e 74 |a title or print| 00000f80 20 61 20 73 74 72 69 6e 67 20 6f 66 20 74 68 65 | a string of the| 00000f90 20 73 61 6d 65 20 0d 63 68 61 72 61 63 74 65 72 | same .character| 00000fa0 10 75 73 65 20 74 68 69 73 20 73 68 6f 72 74 20 |.use this short | 00000fb0 72 6f 75 74 69 6e 65 20 69 6e 20 61 20 73 69 6d |routine in a sim| 00000fc0 69 6c 61 72 20 77 61 79 20 2d 0d 0d 09 2e 75 6c |ilar way -....ul| 00000fd0 69 6e 65 20 4a 53 52 26 46 46 45 45 3a 44 45 58 |ine JSR&FFEE:DEX| 00000fe0 3a 42 4e 45 75 6c 69 6e 65 3a 52 54 53 0d 0d 41 |:BNEuline:RTS..A| 00000ff0 20 72 65 67 69 73 74 65 72 20 73 68 6f 75 6c 64 | register should| 00001000 1a 20 62 65 1a 20 6c 6f 61 64 65 64 1a 20 77 69 |. be. loaded. wi| 00001010 74 68 1a 20 74 68 65 1a 20 41 53 43 20 76 61 6c |th. the. ASC val| 00001020 75 65 20 6f 66 20 74 68 65 20 0d 63 68 61 72 61 |ue of the .chara| 00001030 63 74 65 72 20 61 6e 64 20 58 10 72 65 67 69 73 |cter and X.regis| 00001040 74 65 72 20 77 69 74 68 20 74 68 65 20 6e 75 6d |ter with the num| 00001050 62 65 72 20 6f 66 20 63 68 61 72 61 63 74 65 72 |ber of character| 00001060 73 20 62 79 20 2d 0d 0d 09 4c 44 41 20 23 41 53 |s by -...LDA #AS| 00001070 43 22 3c 63 68 61 72 3e 22 3a 4c 44 58 20 23 3c |C"<char>":LDX #<| 00001080 6e 6f 20 6f 66 20 63 68 61 72 73 3e 3a 4a 53 52 |no of chars>:JSR| 00001090 75 6c 69 6e 65 0d 0d 48 65 72 65 20 58 20 72 65 |uline..Here X re| 000010a0 67 69 73 74 65 72 20 69 73 20 75 73 65 64 20 61 |gister is used a| 000010b0 73 20 61 20 63 6f 75 6e 74 65 72 1a 20 61 6e 64 |s a counter. and| 000010c0 1a 20 74 68 65 1a 20 72 6f 75 74 69 6e 65 1a 20 |. the. routine. | 000010d0 72 65 70 65 61 74 73 1a 20 0d 70 72 69 6e 74 69 |repeats. .printi| 000010e0 6e 67 10 75 6e 74 69 6c 20 58 20 72 65 61 63 68 |ng.until X reach| 000010f0 65 73 20 7a 65 72 6f 2e 20 20 54 68 69 73 20 69 |es zero. This i| 00001100 73 20 6c 69 6b 65 20 74 68 65 20 53 54 52 49 4e |s like the STRIN| 00001110 47 24 20 0d 72 6f 75 74 69 6e 65 20 69 6e 20 42 |G$ .routine in B| 00001120 41 53 49 43 2e 0d 0d 57 69 74 68 20 73 69 6d 69 |ASIC...With simi| 00001130 6c 61 72 20 72 6f 75 74 69 6e 65 73 20 61 73 20 |lar routines as | 00001140 74 68 65 20 61 62 6f 76 65 20 79 6f 75 20 6d 61 |the above you ma| 00001150 79 20 62 65 20 61 62 6c 65 20 74 6f 20 6d 61 6b |y be able to mak| 00001160 65 20 75 70 20 0d 72 6f 75 74 69 6e 65 73 20 66 |e up .routines f| 00001170 6f 72 10 4d 4f 44 45 2c 20 43 4f 4c 4f 55 52 2c |or.MODE, COLOUR,| 00001180 20 47 43 4f 4c 2c 20 43 4c 53 2c 20 61 6e 64 20 | GCOL, CLS, and | 00001190 43 4c 47 2e 0d 0d 49 20 77 69 6c 6c 20 62 65 20 |CLG...I will be | 000011a0 63 6f 76 65 72 69 6e 67 20 74 68 65 73 65 20 61 |covering these a| 000011b0 6e 64 20 6d 6f 72 65 20 6e 65 78 74 20 74 69 6d |nd more next tim| 000011c0 65 2e 20 20 4b 65 65 70 20 0d 65 78 70 65 72 69 |e. Keep .experi| 000011d0 6d 65 6e 74 69 6e 67 21 21 0d |menting!!.| 000011da