home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / msdos / basic / basman2.arc / CHAP11.DOC < prev    next >
Unknown  |  1987-12-12  |  26.0 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was not able to be converted.
This format is not currently supported by dexvert.

ConfidenceProgramDetectionMatch TypeSupport
1% dexvert WANG Integrated Word Processor (document/wangIWP) ext Unsupported
1% dexvert Excellence! Document (document/excellenceDocument) ext Unsupported
1% dexvert Norton Textra Writer (document/textraWriter) ext Unsupported
1% dexvert IBM DisplayWrite Document (document/ibmDisplayWriteDocument) ext Unsupported
100% file data default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 1b 32 1b 55 00 1b 36 1b | 38 1b 41 0c 1b 32 1b 47 |.2.U..6.|8.A..2.G|
|00000010| 1b 43 42 0d 0a 0d 0a 0d | 0a 0d 0a 20 20 20 20 20 |.CB.....|... |
|00000020| 1b 45 43 48 41 50 54 45 | 52 20 31 31 1b 46 20 20 |.ECHAPTE|R 11.F |
|00000030| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 1b 45 | | .E|
|00000040| 20 47 4f 4f 44 20 53 54 | 55 46 46 2c 20 43 48 45 | GOOD ST|UFF, CHE|
|00000050| 41 50 20 20 1b 46 20 20 | 20 20 20 20 20 20 20 20 |AP .F | |
|00000060| 20 20 20 20 20 20 1b 45 | 43 48 41 50 54 45 52 20 | .E|CHAPTER |
|00000070| 31 31 0d 0a 0d 0a 0d 0a | 20 20 20 20 20 1b 46 43 |11......| .FC|
|00000080| 6f 6e 67 72 61 74 75 6c | 61 74 69 6f 6e 73 2c 20 |ongratul|ations, |
|00000090| 79 6f 75 27 76 65 20 73 | 75 72 76 69 76 65 64 20 |you've s|urvived |
|000000a0| 73 74 72 75 63 74 75 72 | 65 2c 20 6d 61 67 69 63 |structur|e, magic|
|000000b0| 2c 20 66 6c 6f 77 63 68 | 61 72 74 73 20 61 6e 64 |, flowch|arts and|
|000000c0| 20 73 6f 6d 65 0d 0a 20 | 20 20 20 20 70 72 65 74 | some.. | pret|
|000000d0| 74 79 20 73 74 72 61 6e | 67 65 20 68 6f 6d 65 77 |ty stran|ge homew|
|000000e0| 6f 72 6b 2e 20 20 54 6f | 20 74 68 65 20 76 69 63 |ork. To| the vic|
|000000f0| 74 6f 72 20 62 65 6c 6f | 6e 67 20 74 68 65 20 73 |tor belo|ng the s|
|00000100| 70 6f 69 6c 73 2e 20 20 | 44 6f 6e 27 74 20 66 6f |poils. |Don't fo|
|00000110| 72 67 65 74 0d 0a 20 20 | 20 20 20 74 68 61 74 20 |rget.. | that |
|00000120| 73 74 72 75 63 74 75 72 | 65 20 69 73 20 65 71 75 |structur|e is equ|
|00000130| 61 6c 6c 79 20 76 61 6c | 69 64 20 69 6e 20 61 6e |ally val|id in an|
|00000140| 79 20 70 72 6f 67 72 61 | 6d 6d 69 6e 67 20 6c 61 |y progra|mming la|
|00000150| 6e 67 75 61 67 65 2c 20 | 61 6e 64 20 74 68 61 74 |nguage, |and that|
|00000160| 0d 0a 20 20 20 20 20 79 | 6f 75 72 20 64 69 73 63 |.. y|our disc|
|00000170| 69 70 6c 69 6e 65 20 61 | 6e 64 20 70 72 6f 66 65 |ipline a|nd profe|
|00000180| 73 73 69 6f 6e 61 6c 69 | 73 6d 20 69 73 20 77 68 |ssionali|sm is wh|
|00000190| 61 74 20 72 65 61 6c 6c | 79 20 6d 61 6b 65 73 20 |at reall|y makes |
|000001a0| 69 74 20 77 6f 72 6b 2e | 0d 0a 20 20 20 20 20 42 |it work.|.. B|
|000001b0| 65 66 6f 72 65 20 74 68 | 65 20 70 61 67 65 73 20 |efore th|e pages |
|000001c0| 6f 66 20 74 68 69 73 20 | 65 72 73 74 77 68 69 6c |of this |erstwhil|
|000001d0| 65 20 74 6f 6d 65 20 73 | 69 6e 6b 20 73 6c 6f 77 |e tome s|ink slow|
|000001e0| 6c 79 20 69 6e 20 74 68 | 65 20 57 65 73 74 2c 20 |ly in th|e West, |
|000001f0| 77 65 0d 0a 20 20 20 20 | 20 73 68 6f 75 6c 64 20 |we.. | should |
|00000200| 64 6f 20 6a 75 73 74 69 | 63 65 20 74 6f 20 42 41 |do justi|ce to BA|
|00000210| 53 49 43 20 61 73 20 61 | 20 70 72 6f 67 72 61 6d |SIC as a| program|
|00000220| 6d 69 6e 67 20 6c 61 6e | 67 75 61 67 65 2e 20 20 |ming lan|guage. |
|00000230| 4f 75 72 20 67 6f 61 6c | 20 77 61 73 20 74 6f 0d |Our goal| was to.|
|00000240| 0a 20 20 20 20 20 74 65 | 61 63 68 20 79 6f 75 20 |. te|ach you |
|00000250| 73 74 72 75 63 74 75 72 | 65 64 20 70 72 6f 67 72 |structur|ed progr|
|00000260| 61 6d 6d 69 6e 67 2e 20 | 20 42 41 53 49 43 2c 20 |amming. | BASIC, |
|00000270| 77 68 69 63 68 20 77 61 | 73 20 63 68 6f 73 65 6e |which wa|s chosen|
|00000280| 20 62 65 63 61 75 73 65 | 20 69 74 0d 0a 20 20 20 | because| it.. |
|00000290| 20 20 63 6f 6d 65 73 20 | 77 69 74 68 20 6d 6f 73 | comes |with mos|
|000002a0| 74 20 50 43 27 73 2c 20 | 68 61 73 20 62 65 65 6e |t PC's, |has been|
|000002b0| 20 70 6c 61 79 69 6e 67 | 20 73 65 63 6f 6e 64 20 | playing| second |
|000002c0| 66 69 64 64 6c 65 20 75 | 70 20 74 6f 20 6e 6f 77 |fiddle u|p to now|
|000002d0| 2e 0d 0a 0d 0a 20 20 20 | 20 20 4e 65 77 65 72 20 |..... | Newer |
|000002e0| 76 65 72 73 69 6f 6e 73 | 20 6f 66 20 42 41 53 49 |versions| of BASI|
|000002f0| 43 20 61 72 65 20 70 6f | 77 65 72 66 75 6c 2e 20 |C are po|werful. |
|00000300| 20 41 73 20 61 20 66 72 | 61 6d 65 20 6f 66 20 72 | As a fr|ame of r|
|00000310| 65 66 65 72 65 6e 63 65 | 2c 20 79 6f 75 20 6e 6f |eference|, you no|
|00000320| 77 0d 0a 20 20 20 20 20 | 6b 6e 6f 77 20 61 62 6f |w.. |know abo|
|00000330| 75 74 20 33 25 20 6f 66 | 20 77 68 61 74 20 74 68 |ut 3% of| what th|
|00000340| 65 79 20 63 61 6e 20 64 | 6f 20 66 6f 72 20 79 6f |ey can d|o for yo|
|00000350| 75 2e 20 20 54 68 61 74 | 27 73 20 72 69 67 68 74 |u. That|'s right|
|00000360| 2c 20 79 6f 75 20 68 61 | 76 65 20 6a 75 73 74 0d |, you ha|ve just.|
|00000370| 0a 20 20 20 20 20 73 63 | 72 61 74 63 68 65 64 20 |. sc|ratched |
|00000380| 74 68 65 20 73 75 72 66 | 61 63 65 2e 20 20 46 75 |the surf|ace. Fu|
|00000390| 72 74 68 65 72 6d 6f 72 | 65 2c 20 77 65 20 75 73 |rthermor|e, we us|
|000003a0| 65 64 20 74 68 65 20 27 | 69 6e 74 65 72 70 72 65 |ed the '|interpre|
|000003b0| 74 65 72 27 20 42 41 53 | 49 43 0d 0a 20 20 20 20 |ter' BAS|IC.. |
|000003c0| 20 74 68 61 74 20 63 6f | 6d 65 73 20 77 69 74 68 | that co|mes with|
|000003d0| 20 79 6f 75 72 20 50 43 | 2e 20 20 54 68 65 72 65 | your PC|. There|
|000003e0| 20 61 72 65 20 61 74 20 | 6c 65 61 73 74 20 74 77 | are at |least tw|
|000003f0| 6f 20 65 78 63 65 6c 6c | 65 6e 74 20 42 41 53 49 |o excell|ent BASI|
|00000400| 43 0d 0a 20 20 20 20 20 | 63 6f 6d 70 69 6c 65 72 |C.. |compiler|
|00000410| 73 20 61 76 61 69 6c 61 | 62 6c 65 20 66 6f 72 20 |s availa|ble for |
|00000420| 6c 65 73 73 20 74 68 61 | 6e 20 24 31 30 30 20 28 |less tha|n $100 (|
|00000430| 6d 75 63 68 20 6c 65 73 | 73 20 69 66 20 79 6f 75 |much les|s if you|
|00000440| 20 6d 61 69 6c 20 6f 72 | 64 65 72 0d 0a 20 20 20 | mail or|der.. |
|00000450| 20 20 74 68 65 6d 29 20 | 74 68 61 74 20 70 72 6f | them) |that pro|
|00000460| 76 69 64 65 20 6d 6f 72 | 65 20 70 6f 77 65 72 20 |vide mor|e power |
|00000470| 61 6e 64 20 73 70 65 65 | 64 20 74 68 61 6e 20 69 |and spee|d than i|
|00000480| 6e 74 65 72 70 72 65 74 | 65 72 20 42 41 53 49 43 |nterpret|er BASIC|
|00000490| 2e 0d 0a 0d 0a 20 20 20 | 20 20 4c 65 74 27 73 20 |..... | Let's |
|000004a0| 74 61 6b 65 20 61 20 71 | 75 69 63 6b 20 6c 6f 6f |take a q|uick loo|
|000004b0| 6b 20 61 74 20 61 20 66 | 65 77 20 6f 66 20 74 68 |k at a f|ew of th|
|000004c0| 65 20 6f 74 68 65 72 20 | 74 68 69 6e 67 73 20 74 |e other |things t|
|000004d0| 68 61 74 20 42 41 53 49 | 43 20 69 73 0d 0a 20 20 |hat BASI|C is.. |
|000004e0| 20 20 20 63 61 70 61 62 | 6c 65 20 6f 66 20 64 6f | capab|le of do|
|000004f0| 69 6e 67 2e 20 20 54 68 | 65 20 6c 69 73 74 20 69 |ing. Th|e list i|
|00000500| 73 20 6e 6f 74 20 63 6f | 6d 70 6c 65 74 65 2e 20 |s not co|mplete. |
|00000510| 20 54 68 65 73 65 20 61 | 72 65 20 6d 65 72 65 6c | These a|re merel|
|00000520| 79 20 65 78 61 6d 70 6c | 65 73 0d 0a 20 20 20 20 |y exampl|es.. |
|00000530| 20 74 68 61 74 20 77 69 | 6c 6c 20 62 6f 6f 73 74 | that wi|ll boost|
|00000540| 20 79 6f 75 72 20 33 25 | 20 6b 6e 6f 77 6c 65 64 | your 3%| knowled|
|00000550| 67 65 20 62 61 73 65 20 | 75 70 20 74 6f 20 33 2e |ge base |up to 3.|
|00000560| 34 35 37 32 25 2e 0d 0a | 0d 0a 0d 0a 20 20 20 20 |4572%...|.... |
|00000570| 20 1b 45 46 55 4e 43 54 | 49 4f 4e 53 0d 0a 0d 0a | .EFUNCT|IONS....|
|00000580| 20 20 20 20 20 1b 46 57 | 68 61 74 20 61 72 65 20 | .FW|hat are |
|00000590| 66 75 6e 63 74 69 6f 6e | 73 3f 20 20 54 68 65 79 |function|s? They|
|000005a0| 20 61 72 65 20 73 6d 61 | 6c 6c 20 73 75 62 70 72 | are sma|ll subpr|
|000005b0| 6f 67 72 61 6d 73 20 74 | 68 61 74 20 70 65 72 66 |ograms t|hat perf|
|000005c0| 6f 72 6d 20 64 69 73 63 | 72 65 74 65 0d 0a 20 20 |orm disc|rete.. |
|000005d0| 20 20 20 74 61 73 6b 73 | 20 77 69 74 68 6f 75 74 | tasks| without|
|000005e0| 20 47 4f 53 55 42 27 73 | 2e 20 20 46 6f 72 20 69 | GOSUB's|. For i|
|000005f0| 6e 73 74 61 6e 63 65 2c | 0d 0a 0d 0a 20 20 20 20 |nstance,|.... |
|00000600| 20 43 55 52 2e 44 41 54 | 45 24 20 3d 20 44 41 54 | CUR.DAT|E$ = DAT|
|00000610| 45 24 0d 0a 0d 0a 20 20 | 20 20 20 73 65 74 73 20 |E$.... | sets |
|00000620| 43 55 52 2e 44 41 54 45 | 24 20 74 6f 20 74 68 65 |CUR.DATE|$ to the|
|00000630| 20 64 61 74 65 20 74 68 | 61 74 20 69 73 20 73 74 | date th|at is st|
|00000640| 6f 72 65 64 20 69 6e 20 | 79 6f 75 72 20 50 43 2e |ored in |your PC.|
|00000650| 20 20 57 65 20 75 73 65 | 64 20 69 74 20 69 6e 20 | We use|d it in |
|00000660| 74 68 65 0d 0a 20 20 20 | 20 20 70 72 65 76 69 6f |the.. | previo|
|00000670| 75 73 20 63 68 61 70 74 | 65 72 2e 20 20 44 41 54 |us chapt|er. DAT|
|00000680| 45 24 20 69 73 20 61 20 | 66 75 6e 63 74 69 6f 6e |E$ is a |function|
|00000690| 20 74 68 61 74 20 72 65 | 74 75 72 6e 73 20 74 68 | that re|turns th|
|000006a0| 65 20 73 79 73 74 65 6d | 20 64 61 74 65 20 69 6e |e system| date in|
|000006b0| 0d 0a 20 20 20 20 20 74 | 68 65 20 66 6f 72 6d 20 |.. t|he form |
|000006c0| 44 44 2d 4d 4d 2d 59 59 | 59 59 2e 0d 0a 0d 0a 20 |DD-MM-YY|YY..... |
|000006d0| 20 20 20 20 44 41 54 45 | 24 20 69 73 20 6f 6e 65 | DATE|$ is one|
|000006e0| 20 6f 66 20 74 68 65 20 | 6d 61 6e 79 20 73 75 62 | of the |many sub|
|000006f0| 70 72 6f 67 72 61 6d 73 | 20 74 68 61 74 20 61 72 |programs| that ar|
|00000700| 65 20 62 75 6e 64 6c 65 | 64 20 77 69 74 68 20 42 |e bundle|d with B|
|00000710| 41 53 49 43 2e 20 20 54 | 49 4d 45 24 0d 0a 20 20 |ASIC. T|IME$.. |
|00000720| 20 20 20 69 73 20 61 6e | 6f 74 68 65 72 2e 20 20 | is an|other. |
|00000730| 49 74 20 72 65 74 72 69 | 65 76 65 73 20 74 68 65 |It retri|eves the|
|00000740| 20 73 79 73 74 65 6d 20 | 74 69 6d 65 20 28 48 48 | system |time (HH|
|00000750| 3a 4d 4d 3a 53 53 29 2e | 20 20 4f 74 68 65 72 20 |:MM:SS).| Other |
|00000760| 73 75 62 70 72 6f 67 72 | 61 6d 73 0d 0a 20 20 20 |subprogr|ams.. |
|00000770| 20 20 72 61 6e 67 69 6e | 67 20 66 72 6f 6d 20 6d | rangin|g from m|
|00000780| 61 74 68 65 6d 61 74 69 | 63 61 6c 20 66 75 6e 63 |athemati|cal func|
|00000790| 74 69 6f 6e 73 20 74 6f | 20 73 74 72 69 6e 67 20 |tions to| string |
|000007a0| 6d 61 6e 69 70 75 6c 61 | 74 69 6f 6e 73 20 61 6c |manipula|tions al|
|000007b0| 73 6f 20 63 6f 6d 65 0d | 0a 20 20 20 20 20 77 69 |so come.|. wi|
|000007c0| 74 68 20 42 41 53 49 43 | 2e 0d 0a 0d 0a 0d 0a 20 |th BASIC|....... |
|000007d0| 20 20 20 20 1b 45 53 54 | 52 49 4e 47 53 0d 0a 0d | .EST|RINGS...|
|000007e0| 0a 20 20 20 20 20 1b 46 | 48 65 72 65 20 61 72 65 |. .F|Here are|
|000007f0| 20 73 6f 6d 65 20 68 61 | 6e 64 79 20 73 74 72 69 | some ha|ndy stri|
|00000800| 6e 67 20 66 75 6e 63 74 | 69 6f 6e 73 3a 0d 0a 0d |ng funct|ions:...|
|00000810| 0a 20 20 20 20 20 4c 45 | 46 54 24 28 53 74 72 69 |. LE|FT$(Stri|
|00000820| 6e 67 24 2c 4e 29 20 20 | 20 77 68 65 72 65 20 53 |ng$,N) | where S|
|00000830| 74 72 69 6e 67 24 20 69 | 73 20 61 20 73 74 72 69 |tring$ i|s a stri|
|00000840| 6e 67 20 76 61 72 69 61 | 62 6c 65 20 61 6e 64 20 |ng varia|ble and |
|00000850| 4e 20 69 73 20 74 68 65 | 0d 0a 20 20 20 20 20 1b |N is the|.. .|
|00000860| 45 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |E | |
|00000870| 20 20 20 20 1b 46 6e 75 | 6d 62 65 72 20 6f 66 20 | .Fnu|mber of |
|00000880| 63 68 61 72 61 63 74 65 | 72 73 20 79 6f 75 20 77 |characte|rs you w|
|00000890| 61 6e 74 20 74 6f 20 65 | 78 74 72 61 63 74 20 66 |ant to e|xtract f|
|000008a0| 72 6f 6d 20 69 74 2e 0d | 0a 0d 0a 20 20 20 20 20 |rom it..|... |
|000008b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000008c0| 20 20 20 4c 45 46 54 24 | 28 29 20 65 6e 61 62 6c | LEFT$|() enabl|
|000008d0| 65 73 20 79 6f 75 20 74 | 6f 20 65 78 74 72 61 63 |es you t|o extrac|
|000008e0| 74 20 74 68 65 20 66 69 | 72 73 74 20 4e 20 63 68 |t the fi|rst N ch|
|000008f0| 61 72 61 63 74 65 72 73 | 0d 0a 20 20 20 20 20 20 |aracters|.. |
|00000900| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000910| 20 20 66 72 6f 6d 20 61 | 20 73 74 72 69 6e 67 20 | from a| string |
|00000920| 76 61 72 69 61 62 6c 65 | 2e 0d 0a 0d 0a 20 20 20 |variable|..... |
|00000930| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000940| 20 20 20 20 20 45 78 61 | 6d 70 6c 65 3a 20 20 57 | Exa|mple: W|
|00000950| 69 74 68 20 61 20 64 61 | 74 65 20 69 6e 20 74 68 |ith a da|te in th|
|00000960| 65 20 66 6f 72 6d 61 74 | 20 4d 4d 2d 44 44 2d 59 |e format| MM-DD-Y|
|00000970| 59 59 59 2c 20 79 6f 75 | 0d 0a 20 20 20 20 20 20 |YYY, you|.. |
|00000980| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000990| 20 20 63 61 6e 20 65 78 | 74 72 61 63 74 20 74 68 | can ex|tract th|
|000009a0| 65 20 6d 6f 6e 74 68 20 | 28 61 73 20 61 20 73 74 |e month |(as a st|
|000009b0| 72 69 6e 67 29 20 61 73 | 20 66 6f 6c 6c 6f 77 73 |ring) as| follows|
|000009c0| 3a 0d 0a 0d 0a 20 20 20 | 20 20 20 20 20 20 20 20 |:.... | |
|000009d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000009e0| 20 20 20 20 20 20 20 4d | 4f 4e 54 48 24 20 3d 20 | M|ONTH$ = |
|000009f0| 4c 45 46 54 24 28 44 41 | 54 45 24 2c 32 29 0d 0a |LEFT$(DA|TE$,2)..|
|00000a00| 0d 0a 0d 0a 0d 0a 20 20 | 20 20 20 20 20 20 20 20 |...... | |
|00000a10| 20 20 20 20 20 20 20 1b | 45 20 20 20 20 20 20 20 | .|E |
|00000a20| 20 20 20 20 20 20 20 20 | 20 1b 46 20 20 20 20 20 | | .F |
|00000a30| 20 20 1b 45 20 31 33 39 | 0d 0a 0d 0a 0c 0d 0a 0d | .E 139|........|
|00000a40| 0a 0d 0a 0d 0a 1b 46 20 | 20 20 20 20 1b 45 43 48 |......F | .ECH|
|00000a50| 41 50 54 45 52 20 31 31 | 1b 46 20 20 20 20 20 20 |APTER 11|.F |
|00000a60| 20 20 20 20 20 20 20 20 | 20 20 1b 45 20 47 4f 4f | | .E GOO|
|00000a70| 44 20 53 54 55 46 46 2c | 20 43 48 45 41 50 20 20 |D STUFF,| CHEAP |
|00000a80| 1b 46 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |.F | |
|00000a90| 20 20 1b 45 43 48 41 50 | 54 45 52 20 31 31 0d 0a | .ECHAP|TER 11..|
|00000aa0| 0d 0a 0d 0a 20 20 20 20 | 20 1b 46 4d 49 44 24 28 |.... | .FMID$(|
|00000ab0| 53 74 72 69 6e 67 24 2c | 53 2c 4e 29 20 20 77 68 |String$,|S,N) wh|
|00000ac0| 65 72 65 20 53 74 72 69 | 6e 67 24 20 69 73 20 61 |ere Stri|ng$ is a|
|00000ad0| 20 73 74 72 69 6e 67 20 | 76 61 72 69 61 62 6c 65 | string |variable|
|00000ae0| 2c 20 53 20 69 73 20 74 | 68 65 20 70 6f 73 69 74 |, S is t|he posit|
|00000af0| 69 6f 6e 0d 0a 20 20 20 | 20 20 20 20 20 20 20 20 |ion.. | |
|00000b00| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 69 6e 20 | | in |
|00000b10| 74 68 65 20 73 74 72 69 | 6e 67 20 77 68 65 72 65 |the stri|ng where|
|00000b20| 20 74 68 65 20 73 75 62 | 73 74 72 69 6e 67 20 74 | the sub|string t|
|00000b30| 68 61 74 20 79 6f 75 20 | 77 61 6e 74 20 74 6f 0d |hat you |want to.|
|00000b40| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00000b50| 20 20 20 20 20 20 20 20 | 20 65 78 74 72 61 63 74 | | extract|
|00000b60| 20 73 74 61 72 74 73 2c | 20 61 6e 64 20 4e 20 69 | starts,| and N i|
|00000b70| 73 20 74 68 65 20 6e 75 | 6d 62 65 72 20 6f 66 20 |s the nu|mber of |
|00000b80| 63 68 61 72 61 63 74 65 | 72 73 20 69 6e 0d 0a 20 |characte|rs in.. |
|00000b90| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000ba0| 20 20 20 20 20 20 20 74 | 68 65 20 73 75 62 73 74 | t|he subst|
|00000bb0| 72 69 6e 67 2e 0d 0a 0d | 0a 20 20 20 20 20 20 20 |ring....|. |
|00000bc0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000bd0| 20 4d 49 44 24 28 29 20 | 65 6e 61 62 6c 65 73 20 | MID$() |enables |
|00000be0| 79 6f 75 20 74 6f 20 65 | 78 74 72 61 63 74 20 74 |you to e|xtract t|
|00000bf0| 68 65 20 70 61 72 74 20 | 6f 66 20 74 68 65 20 73 |he part |of the s|
|00000c00| 74 72 69 6e 67 0d 0a 20 | 20 20 20 20 20 20 20 20 |tring.. | |
|00000c10| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 76 | | v|
|00000c20| 61 72 69 61 62 6c 65 20 | 74 68 61 74 20 73 74 61 |ariable |that sta|
|00000c30| 72 74 73 20 61 74 20 70 | 6f 73 69 74 69 6f 6e 20 |rts at p|osition |
|00000c40| 53 20 69 6e 20 74 68 65 | 20 73 74 72 69 6e 67 20 |S in the| string |
|00000c50| 61 6e 64 0d 0a 20 20 20 | 20 20 20 20 20 20 20 20 |and.. | |
|00000c60| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 68 61 73 | | has|
|00000c70| 20 61 20 6c 65 6e 67 74 | 68 20 6f 66 20 4e 2e 0d | a lengt|h of N..|
|00000c80| 0a 0d 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |... | |
|00000c90| 20 20 20 20 20 20 20 20 | 20 20 20 45 78 61 6d 70 | | Examp|
|00000ca0| 6c 65 3a 20 20 57 69 74 | 68 20 61 20 64 61 74 65 |le: Wit|h a date|
|00000cb0| 20 69 6e 20 74 68 65 20 | 66 6f 72 6d 61 74 20 4d | in the |format M|
|00000cc0| 4d 2d 44 44 2d 59 59 59 | 59 2c 20 79 6f 75 0d 0a |M-DD-YYY|Y, you..|
|00000cd0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000ce0| 20 20 20 20 20 1b 45 20 | 20 20 20 20 20 20 20 20 | .E | |
|00000cf0| 20 1b 46 20 20 20 63 61 | 6e 20 72 65 74 72 69 65 | .F ca|n retrie|
|00000d00| 76 65 20 74 68 65 20 64 | 61 79 20 28 61 73 20 61 |ve the d|ay (as a|
|00000d10| 20 73 74 72 69 6e 67 29 | 20 61 73 0d 0a 20 20 20 | string)| as.. |
|00000d20| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000d30| 1b 45 20 20 20 20 20 20 | 20 20 20 20 20 20 20 1b |.E | .|
|00000d40| 46 20 20 66 6f 6c 6c 6f | 77 73 3a 0d 0a 0d 0a 20 |F follo|ws:.... |
|00000d50| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000d60| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000d70| 20 44 41 59 24 20 3d 20 | 4d 49 44 24 28 44 41 54 | DAY$ = |MID$(DAT|
|00000d80| 45 24 2c 34 2c 32 29 0d | 0a 0d 0a 20 20 20 20 20 |E$,4,2).|... |
|00000d90| 52 49 47 48 54 24 28 53 | 74 72 69 6e 67 24 2c 4e |RIGHT$(S|tring$,N|
|00000da0| 29 20 20 77 68 65 72 65 | 20 53 74 72 69 6e 67 24 |) where| String$|
|00000db0| 20 69 73 20 61 20 73 74 | 72 69 6e 67 20 76 61 72 | is a st|ring var|
|00000dc0| 69 61 62 6c 65 20 61 6e | 64 20 4e 20 69 73 20 74 |iable an|d N is t|
|00000dd0| 68 65 0d 0a 20 20 20 20 | 20 1b 45 20 20 20 20 20 |he.. | .E |
|00000de0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 1b 46 | | .F|
|00000df0| 6e 75 6d 62 65 72 20 6f | 66 20 63 68 61 72 61 63 |number o|f charac|
|00000e00| 74 65 72 73 20 79 6f 75 | 20 77 61 6e 74 20 74 6f |ters you| want to|
|00000e10| 20 65 78 74 72 61 63 74 | 2e 0d 0a 0d 0a 20 20 20 | extract|..... |
|00000e20| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000e30| 20 20 20 20 20 52 49 47 | 48 54 24 28 29 20 65 6e | RIG|HT$() en|
|00000e40| 61 62 6c 65 73 20 79 6f | 75 20 74 6f 20 72 65 74 |ables yo|u to ret|
|00000e50| 72 69 65 76 65 20 74 68 | 65 20 6c 61 73 74 20 4e |rieve th|e last N|
|00000e60| 0d 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |.. | |
|00000e70| 20 20 20 20 20 20 20 20 | 20 20 63 68 61 72 61 63 | | charac|
|00000e80| 74 65 72 73 20 6f 66 20 | 61 20 73 74 72 69 6e 67 |ters of |a string|
|00000e90| 20 76 61 72 69 61 62 6c | 65 2e 0d 0a 0d 0a 20 20 | variabl|e..... |
|00000ea0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000eb0| 20 20 20 20 20 20 45 78 | 61 6d 70 6c 65 3a 20 20 | Ex|ample: |
|00000ec0| 57 69 74 68 20 61 20 64 | 61 74 65 20 69 6e 20 74 |With a d|ate in t|
|00000ed0| 68 65 20 66 6f 72 6d 61 | 74 20 4d 4d 2d 44 44 2d |he forma|t MM-DD-|
|00000ee0| 59 59 59 59 2c 20 79 6f | 75 0d 0a 20 20 20 20 20 |YYYY, yo|u.. |
|00000ef0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000f00| 20 20 20 63 61 6e 20 65 | 78 74 72 61 63 74 20 74 | can e|xtract t|
|00000f10| 68 65 20 79 65 61 72 20 | 28 61 73 20 61 20 73 74 |he year |(as a st|
|00000f20| 72 69 6e 67 29 20 61 73 | 20 66 6f 6c 6c 6f 77 73 |ring) as| follows|
|00000f30| 3a 0d 0a 0d 0a 20 20 20 | 20 20 20 20 20 20 20 20 |:.... | |
|00000f40| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000f50| 20 20 20 20 20 20 20 59 | 45 41 52 24 20 3d 20 52 | Y|EAR$ = R|
|00000f60| 49 47 48 54 24 28 44 41 | 54 45 24 2c 34 29 0d 0a |IGHT$(DA|TE$,4)..|
|00000f70| 0d 0a 20 20 20 20 20 56 | 41 4c 28 53 74 72 69 6e |.. V|AL(Strin|
|00000f80| 67 24 29 20 20 20 20 20 | 20 20 77 68 65 72 65 20 |g$) | where |
|00000f90| 53 74 72 69 6e 67 24 20 | 63 6f 6e 73 69 73 74 73 |String$ |consists|
|00000fa0| 20 65 6e 74 69 72 65 6c | 79 20 6f 66 20 6e 75 6d | entirel|y of num|
|00000fb0| 65 72 69 63 0d 0a 20 20 | 20 20 20 1b 45 20 20 20 |eric.. | .E |
|00000fc0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000fd0| 1b 46 63 68 61 72 61 63 | 74 65 72 73 2e 0d 0a 0d |.Fcharac|ters....|
|00000fe0| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00000ff0| 20 20 20 20 20 20 20 20 | 20 56 41 4c 28 29 20 65 | | VAL() e|
|00001000| 6e 61 62 6c 65 73 20 79 | 6f 75 20 74 6f 20 63 6f |nables y|ou to co|
|00001010| 6e 76 65 72 74 20 74 68 | 65 20 73 74 72 69 6e 67 |nvert th|e string|
|00001020| 0d 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |.. | |
|00001030| 20 20 20 20 20 20 20 20 | 20 20 72 65 70 72 65 73 | | repres|
|00001040| 65 6e 74 61 74 69 6f 6e | 20 6f 66 20 61 20 6e 75 |entation| of a nu|
|00001050| 6d 62 65 72 20 74 6f 20 | 69 74 73 20 6e 75 6d 65 |mber to |its nume|
|00001060| 72 69 63 20 76 61 6c 75 | 65 2e 20 20 49 66 0d 0a |ric valu|e. If..|
|00001070| 20 20 20 20 20 1b 45 20 | 20 20 20 20 20 20 20 20 | .E | |
|00001080| 20 20 20 20 20 20 20 20 | 20 20 1b 46 74 68 65 20 | | .Fthe |
|00001090| 73 74 72 69 6e 67 20 64 | 6f 65 73 20 6e 6f 74 20 |string d|oes not |
|000010a0| 63 6f 6e 74 61 69 6e 20 | 6e 75 6d 62 65 72 73 2c |contain |numbers,|
|000010b0| 20 56 41 4c 20 77 69 6c | 6c 20 72 65 74 75 72 6e | VAL wil|l return|
|000010c0| 0d 0a 20 20 20 20 20 1b | 45 20 20 20 20 20 20 20 |.. .|E |
|000010d0| 20 20 20 20 20 20 1b 46 | 20 20 20 20 20 20 61 20 | .F| a |
|000010e0| 76 61 6c 75 65 20 6f 66 | 20 30 2e 0d 0a 0d 0a 20 |value of| 0..... |
|000010f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001100| 20 20 20 20 20 20 20 45 | 78 61 6d 70 6c 65 3a 20 | E|xample: |
|00001110| 20 41 6e 79 20 6f 66 20 | 74 68 65 20 61 62 6f 76 | Any of |the abov|
|00001120| 65 20 64 61 74 65 20 63 | 6f 6e 76 65 72 73 69 6f |e date c|onversio|
|00001130| 6e 73 20 63 61 6e 20 62 | 65 0d 0a 20 20 20 20 20 |ns can b|e.. |
|00001140| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001150| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 63 68 61 | | cha|
|00001160| 6e 67 65 64 20 74 6f 20 | 6e 75 6d 62 65 72 73 20 |nged to |numbers |
|00001170| 61 73 20 66 6f 6c 6c 6f | 77 73 3a 0d 0a 0d 0a 20 |as follo|ws:.... |
|00001180| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001190| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000011a0| 20 44 41 59 20 3d 20 56 | 41 4c 28 44 41 59 24 29 | DAY = V|AL(DAY$)|
|000011b0| 0d 0a 0d 0a 20 20 20 20 | 20 53 54 52 24 28 4e 75 |.... | STR$(Nu|
|000011c0| 6d 62 65 72 29 20 20 20 | 20 20 20 20 77 68 65 72 |mber) | wher|
|000011d0| 65 20 4e 75 6d 62 65 72 | 20 69 73 20 61 20 6e 75 |e Number| is a nu|
|000011e0| 6d 65 72 69 63 20 76 61 | 72 69 61 62 6c 65 2e 0d |meric va|riable..|
|000011f0| 0a 0d 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |... | |
|00001200| 20 20 20 20 20 20 20 20 | 20 20 20 53 54 52 24 28 | | STR$(|
|00001210| 29 20 65 6e 61 62 6c 65 | 73 20 79 6f 75 20 74 6f |) enable|s you to|
|00001220| 20 63 6f 6e 76 65 72 74 | 20 61 20 6e 75 6d 62 65 | convert| a numbe|
|00001230| 72 20 74 6f 20 61 20 73 | 74 72 69 6e 67 2e 0d 0a |r to a s|tring...|
|00001240| 0d 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |.. | |
|00001250| 20 20 20 20 20 20 20 20 | 20 20 45 78 61 6d 70 6c | | Exampl|
|00001260| 65 3a 20 20 44 41 59 24 | 20 3d 20 53 54 52 24 28 |e: DAY$| = STR$(|
|00001270| 44 41 59 29 0d 0a 0d 0a | 20 20 20 20 20 4c 45 4e |DAY)....| LEN|
|00001280| 28 53 74 72 69 6e 67 24 | 29 20 20 20 20 20 20 20 |(String$|) |
|00001290| 77 68 65 72 65 20 53 74 | 72 69 6e 67 24 20 69 73 |where St|ring$ is|
|000012a0| 20 61 6e 79 20 73 74 72 | 69 6e 67 20 76 61 72 69 | any str|ing vari|
|000012b0| 61 62 6c 65 2e 0d 0a 0d | 0a 20 20 20 20 20 20 20 |able....|. |
|000012c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000012d0| 20 4c 45 4e 28 29 20 74 | 65 6c 6c 73 20 79 6f 75 | LEN() t|ells you|
|000012e0| 20 74 68 65 20 6c 65 6e | 67 74 68 20 6f 66 20 61 | the len|gth of a|
|000012f0| 20 73 74 72 69 6e 67 20 | 76 61 72 69 61 62 6c 65 | string |variable|
|00001300| 2c 20 69 2e 65 2e 0d 0a | 20 20 20 20 20 20 20 20 |, i.e...| |
|00001310| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001320| 68 6f 77 20 6d 61 6e 79 | 20 63 68 61 72 61 63 74 |how many| charact|
|00001330| 65 72 73 20 69 74 20 63 | 6f 6e 74 61 69 6e 73 2e |ers it c|ontains.|
|00001340| 0d 0a 0d 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |.... | |
|00001350| 20 20 20 20 20 20 20 20 | 20 20 20 20 45 78 61 6d | | Exam|
|00001360| 70 6c 65 3a 20 20 4c 45 | 4e 47 54 48 20 3d 20 4c |ple: LE|NGTH = L|
|00001370| 45 4e 28 44 41 54 45 24 | 29 0d 0a 0d 0a 0d 0a 0d |EN(DATE$|).......|
|00001380| 0a 0d 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |... | |
|00001390| 20 20 20 20 1b 45 20 20 | 20 20 20 20 20 20 20 20 | .E | |
|000013a0| 20 20 20 20 20 20 1b 46 | 20 20 20 20 20 20 20 1b | .F| .|
|000013b0| 45 20 31 34 30 0d 0a 0d | 0a 0c 0d 0a 0d 0a 0d 0a |E 140...|........|
|000013c0| 0d 0a 1b 46 20 20 20 20 | 20 1b 45 43 48 41 50 54 |...F | .ECHAPT|
|000013d0| 45 52 20 31 31 1b 46 20 | 20 20 20 20 20 20 20 20 |ER 11.F | |
|000013e0| 20 20 20 20 20 20 20 1b | 45 20 47 4f 4f 44 20 53 | .|E GOOD S|
|000013f0| 54 55 46 46 2c 20 43 48 | 45 41 50 20 20 1b 46 20 |TUFF, CH|EAP .F |
|00001400| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 1b | | .|
|00001410| 45 43 48 41 50 54 45 52 | 20 31 31 0d 0a 0d 0a 0d |ECHAPTER| 11.....|
|00001420| 0a 20 20 20 20 20 1b 46 | 41 53 43 28 53 74 72 69 |. .F|ASC(Stri|
|00001430| 6e 67 24 29 20 20 20 20 | 20 20 20 77 68 65 72 65 |ng$) | where|
|00001440| 20 53 74 72 69 6e 67 24 | 20 69 73 20 61 6e 79 20 | String$| is any |
|00001450| 73 74 72 69 6e 67 20 76 | 61 72 69 61 62 6c 65 2e |string v|ariable.|
|00001460| 0d 0a 0d 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |.... | |
|00001470| 20 20 20 20 20 20 20 20 | 20 20 20 20 41 53 43 28 | | ASC(|
|00001480| 29 20 72 65 74 75 72 6e | 73 20 74 68 65 20 41 53 |) return|s the AS|
|00001490| 43 49 49 20 63 6f 64 65 | 20 6f 66 20 74 68 65 20 |CII code| of the |
|000014a0| 66 69 72 73 74 20 63 68 | 61 72 61 63 74 65 72 0d |first ch|aracter.|
|000014b0| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|000014c0| 20 20 20 20 20 20 20 20 | 20 6f 66 20 53 74 72 69 | | of Stri|
|000014d0| 6e 67 24 20 28 6e 6f 72 | 6d 61 6c 6c 79 20 61 20 |ng$ (nor|mally a |
|000014e0| 6f 6e 65 20 63 68 61 72 | 61 63 74 65 72 20 76 61 |one char|acter va|
|000014f0| 72 69 61 62 6c 65 29 2e | 0d 0a 0d 0a 20 20 20 20 |riable).|.... |
|00001500| 20 43 48 52 24 28 4e 75 | 6d 62 65 72 29 20 20 20 | CHR$(Nu|mber) |
|00001510| 20 20 20 20 77 68 65 72 | 65 20 4e 75 6d 62 65 72 | wher|e Number|
|00001520| 20 69 73 20 61 6e 79 20 | 6e 75 6d 62 65 72 20 66 | is any |number f|
|00001530| 72 6f 6d 20 30 20 74 6f | 20 32 35 35 2e 0d 0a 0d |rom 0 to| 255....|
|00001540| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00001550| 20 20 20 20 20 20 20 20 | 20 50 72 6f 64 75 63 65 | | Produce|
|00001560| 73 20 74 68 65 20 73 74 | 72 69 6e 67 20 63 68 61 |s the st|ring cha|
|00001570| 72 61 63 74 65 72 20 77 | 68 6f 73 65 20 41 53 43 |racter w|hose ASC|
|00001580| 49 49 20 65 71 75 69 76 | 61 6c 65 6e 74 0d 0a 20 |II equiv|alent.. |
|00001590| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000015a0| 20 20 20 20 20 20 20 69 | 73 20 4e 75 6d 62 65 72 | i|s Number|
|000015b0| 2e 0d 0a 0d 0a 20 20 20 | 20 20 20 20 20 20 20 20 |..... | |
|000015c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 45 78 61 | | Exa|
|000015d0| 6d 70 6c 65 3a 20 20 54 | 6f 20 70 72 69 6e 74 20 |mple: T|o print |
|000015e0| 61 20 73 6d 69 6c 69 6e | 67 20 66 61 63 65 20 63 |a smilin|g face c|
|000015f0| 68 61 72 61 63 74 65 72 | 20 6f 6e 20 79 6f 75 72 |haracter| on your|
|00001600| 0d 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |.. | |
|00001610| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001620| 20 20 20 20 73 63 72 65 | 65 6e 2c 20 75 73 65 0d | scre|en, use.|
|00001630| 0a 0d 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |... | |
|00001640| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001650| 20 20 20 20 20 41 24 20 | 3d 20 43 48 52 24 28 31 | A$ |= CHR$(1|
|00001660| 29 3a 20 50 52 49 4e 54 | 20 41 24 0d 0a 0d 0a 20 |): PRINT| A$.... |
|00001670| 20 20 20 20 53 54 52 49 | 4e 47 24 28 4e 2c 41 29 | STRI|NG$(N,A)|
|00001680| 20 20 20 20 20 20 20 77 | 68 65 72 65 20 4e 20 69 | w|here N i|
|00001690| 73 20 74 68 65 20 6e 75 | 6d 62 65 72 20 6f 66 20 |s the nu|mber of |
|000016a0| 74 69 6d 65 73 20 79 6f | 75 20 77 61 6e 74 20 61 |times yo|u want a|
|000016b0| 20 63 68 61 72 61 63 74 | 65 72 0d 0a 20 20 20 20 | charact|er.. |
|000016c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000016d0| 20 20 20 20 72 65 70 65 | 61 74 65 64 20 61 6e 64 | repe|ated and|
|000016e0| 20 41 20 69 73 20 74 68 | 65 20 41 53 43 49 49 20 | A is th|e ASCII |
|000016f0| 63 6f 64 65 20 6f 66 20 | 74 68 65 20 63 68 61 72 |code of |the char|
|00001700| 61 63 74 65 72 2e 0d 0a | 0d 0a 20 20 20 20 20 20 |acter...|.. |
|00001710| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001720| 20 20 43 72 65 61 74 65 | 73 20 61 20 73 74 72 69 | Create|s a stri|
|00001730| 6e 67 20 6f 66 20 6c 65 | 6e 67 74 68 20 4e 20 74 |ng of le|ngth N t|
|00001740| 68 61 74 20 63 6f 6e 73 | 69 73 74 73 20 6f 66 0d |hat cons|ists of.|
|00001750| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00001760| 20 20 20 20 20 20 20 20 | 20 77 68 61 74 65 76 65 | | whateve|
|00001770| 72 20 63 68 61 72 61 63 | 74 65 72 20 69 73 20 72 |r charac|ter is r|
|00001780| 65 70 72 65 73 65 6e 74 | 65 64 20 62 79 20 41 53 |epresent|ed by AS|
|00001790| 43 49 49 20 63 6f 64 65 | 20 41 2e 0d 0a 20 20 20 |CII code| A... |
|000017a0| 20 20 1b 45 20 20 20 20 | 20 20 20 20 20 20 20 20 | .E | |
|000017b0| 20 20 20 20 20 20 20 1b | 46 59 6f 75 20 64 6f 6e | .|FYou don|
|000017c0| 27 74 20 68 61 76 65 20 | 74 6f 20 70 72 6f 76 69 |'t have |to provi|
|000017d0| 64 65 20 74 68 65 20 41 | 53 43 49 49 20 63 6f 64 |de the A|SCII cod|
|000017e0| 65 2c 20 79 6f 75 20 63 | 61 6e 20 75 73 65 0d 0a |e, you c|an use..|
|000017f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001800| 20 20 20 20 20 20 20 20 | 74 68 65 20 61 63 74 75 | |the actu|
|00001810| 61 6c 20 63 68 61 72 61 | 63 74 65 72 20 69 6e 73 |al chara|cter ins|
|00001820| 74 65 61 64 2e 0d 0a 0d | 0a 20 20 20 20 20 20 20 |tead....|. |
|00001830| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001840| 20 45 78 61 6d 70 6c 65 | 3a 20 20 49 66 20 79 6f | Example|: If yo|
|00001850| 75 20 77 61 6e 74 20 61 | 20 76 61 72 69 61 62 6c |u want a| variabl|
|00001860| 65 20 74 68 61 74 20 63 | 6f 6e 73 69 73 74 73 20 |e that c|onsists |
|00001870| 6f 66 20 32 30 0d 0a 20 | 20 20 20 20 20 20 20 20 |of 20.. | |
|00001880| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001890| 20 20 20 20 20 20 20 20 | 20 6d 69 6e 75 73 20 73 | | minus s|
|000018a0| 69 67 6e 73 2c 20 63 6f | 64 65 3a 0d 0a 0d 0a 20 |igns, co|de:.... |
|000018b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000018c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000018d0| 20 41 24 20 3d 20 53 54 | 52 49 4e 47 24 28 32 30 | A$ = ST|RING$(20|
|000018e0| 2c 22 2b 22 29 20 6f 72 | 20 41 24 20 3d 20 53 54 |,"+") or| A$ = ST|
|000018f0| 52 49 4e 47 24 28 32 30 | 2c 34 33 29 0d 0a 0d 0a |RING$(20|,43)....|
|00001900| 0d 0a 20 20 20 20 20 1b | 45 53 54 52 49 4e 47 49 |.. .|ESTRINGI|
|00001910| 4e 47 20 59 4f 55 20 41 | 4c 4f 4e 47 0d 0a 0d 0a |NG YOU A|LONG....|
|00001920| 20 20 20 20 20 1b 46 43 | 72 65 61 74 69 76 65 20 | .FC|reative |
|00001930| 75 73 65 20 6f 66 20 66 | 75 6e 63 74 69 6f 6e 73 |use of f|unctions|
|00001940| 20 63 61 6e 20 65 6e 68 | 61 6e 63 65 20 61 20 70 | can enh|ance a p|
|00001950| 72 6f 67 72 61 6d 2e 20 | 20 4c 65 74 27 73 20 6c |rogram. | Let's l|
|00001960| 6f 6f 6b 20 61 74 20 61 | 6e 0d 0a 20 20 20 20 20 |ook at a|n.. |
|00001970| 75 70 67 72 61 64 65 20 | 74 6f 20 74 68 65 20 66 |upgrade |to the f|
|00001980| 6f 6c 6c 6f 77 69 6e 67 | 20 63 6f 64 65 20 66 72 |ollowing| code fr|
|00001990| 6f 6d 20 6f 75 72 20 6d | 61 69 6e 74 65 6e 61 6e |om our m|aintenan|
|000019a0| 63 65 20 70 72 6f 67 72 | 61 6d 3a 0d 0a 0d 0a 20 |ce progr|am:.... |
|000019b0| 20 20 20 20 34 33 31 30 | 20 20 20 4c 4f 43 41 54 | 4310| LOCAT|
|000019c0| 45 20 31 35 2c 32 35 3a | 20 49 4e 50 55 54 20 22 |E 15,25:| INPUT "|
|000019d0| 45 6e 74 65 72 20 31 2c | 20 32 2c 20 6f 72 20 33 |Enter 1,| 2, or 3|
|000019e0| 20 6f 72 20 27 45 6e 74 | 65 72 27 20 74 6f 20 65 | or 'Ent|er' to e|
|000019f0| 78 69 74 22 3b 20 41 0d | 0a 20 20 20 20 20 34 33 |xit"; A.|. 43|
|00001a00| 32 30 20 27 0d 0a 20 20 | 20 20 20 34 33 33 30 20 |20 '.. | 4330 |
|00001a10| 20 20 57 48 49 4c 45 20 | 41 20 3c 20 30 20 20 4f | WHILE |A < 0 O|
|00001a20| 52 20 41 20 3e 20 33 0d | 0a 20 20 20 20 20 34 33 |R A > 3.|. 43|
|00001a30| 34 30 20 20 20 20 20 20 | 4c 4f 43 41 54 45 20 31 |40 |LOCATE 1|
|00001a40| 35 2c 36 30 3a 20 50 52 | 49 4e 54 20 22 20 20 20 |5,60: PR|INT " |
|00001a50| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001a60| 20 22 0d 0a 20 20 20 20 | 20 34 33 35 30 20 20 20 | ".. | 4350 |
|00001a70| 20 20 20 4c 4f 43 41 54 | 45 20 32 32 2c 32 35 3a | LOCAT|E 22,25:|
|00001a80| 20 50 52 49 4e 54 20 22 | 20 20 20 20 20 20 20 20 | PRINT "| |
|00001a90| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001aa0| 20 20 20 20 20 20 20 20 | 20 20 22 0d 0a 20 20 20 | | ".. |
|00001ab0| 20 20 34 33 36 30 20 20 | 20 20 20 20 4c 4f 43 41 | 4360 | LOCA|
|00001ac0| 54 45 20 32 32 2c 32 35 | 3a 20 49 4e 50 55 54 20 |TE 22,25|: INPUT |
|00001ad0| 22 54 68 61 74 27 73 20 | 31 2c 20 32 2c 20 33 20 |"That's |1, 2, 3 |
|00001ae0| 6f 72 20 27 45 6e 74 65 | 72 27 22 3b 20 41 0d 0a |or 'Ente|r'"; A..|
|00001af0| 20 20 20 20 20 34 33 37 | 30 20 20 20 57 45 4e 44 | 437|0 WEND|
|00001b00| 0d 0a 20 20 20 20 20 34 | 33 38 30 20 27 0d 0a 20 |.. 4|380 '.. |
|00001b10| 20 20 20 20 34 33 39 30 | 20 20 20 4f 4e 20 41 20 | 4390| ON A |
|00001b20| 47 4f 53 55 42 20 34 35 | 30 30 2c 20 34 36 30 30 |GOSUB 45|00, 4600|
|00001b30| 2c 20 34 37 30 30 0d 0a | 0d 0a 20 20 20 20 20 49 |, 4700..|.. I|
|00001b40| 74 20 77 6f 72 6b 73 20 | 77 65 6c 6c 20 61 73 20 |t works |well as |
|00001b50| 6c 6f 6e 67 20 61 73 20 | 79 6f 75 72 20 75 73 65 |long as |your use|
|00001b60| 72 20 65 6e 74 65 72 73 | 20 61 20 6e 75 6d 62 65 |r enters| a numbe|
|00001b70| 72 2e 20 20 49 66 2c 20 | 6f 6e 20 74 68 65 20 6f |r. If, |on the o|
|00001b80| 74 68 65 72 0d 0a 20 20 | 20 20 20 68 61 6e 64 2c |ther.. | hand,|
|00001b90| 20 74 68 65 20 69 6e 70 | 75 74 20 69 73 20 61 20 | the inp|ut is a |
|00001ba0| 73 74 72 69 6e 67 2c 20 | 6f 75 72 20 70 72 6f 67 |string, |our prog|
|00001bb0| 72 61 6d 20 6a 75 6d 70 | 73 20 6f 75 74 20 6f 66 |ram jump|s out of|
|00001bc0| 20 74 68 65 20 63 61 72 | 65 66 75 6c 6c 79 0d 0a | the car|efully..|
|00001bd0| 20 20 20 20 20 70 72 65 | 70 61 72 65 64 20 73 63 | pre|pared sc|
|00001be0| 72 65 65 6e 20 6c 61 79 | 6f 75 74 20 61 6e 64 20 |reen lay|out and |
|00001bf0| 70 72 69 6e 74 73 3a 0d | 0a 0d 0a 20 20 20 20 20 |prints:.|... |
|00001c00| 3f 52 65 64 6f 20 66 72 | 6f 6d 20 73 74 61 72 74 |?Redo fr|om start|
|00001c10| 0d 0a 20 20 20 20 20 3f | 0d 0a 0d 0a 20 20 20 20 |.. ?|.... |
|00001c20| 20 57 68 79 3f 20 20 42 | 65 63 61 75 73 65 20 69 | Why? B|ecause i|
|00001c30| 74 20 65 78 70 65 63 74 | 73 20 61 20 6e 75 6d 65 |t expect|s a nume|
|00001c40| 72 69 63 20 61 6e 73 77 | 65 72 2e 20 20 57 68 65 |ric answ|er. Whe|
|00001c50| 6e 20 61 20 73 74 72 69 | 6e 67 20 69 73 20 65 6e |n a stri|ng is en|
|00001c60| 74 65 72 65 64 2c 0d 0a | 20 20 20 20 20 42 41 53 |tered,..| BAS|
|00001c70| 49 43 27 73 20 65 72 72 | 6f 72 20 68 61 6e 64 6c |IC's err|or handl|
|00001c80| 69 6e 67 20 63 75 74 73 | 20 69 6e 2e 20 20 57 65 |ing cuts| in. We|
|00001c90| 20 63 61 6e 20 63 69 72 | 63 75 6d 76 65 6e 74 20 | can cir|cumvent |
|00001ca0| 74 68 69 73 20 70 72 6f | 62 6c 65 6d 20 62 79 0d |this pro|blem by.|
|00001cb0| 0a 0d 0a 0d 0a 20 20 20 | 20 20 20 20 20 20 20 20 |..... | |
|00001cc0| 20 20 20 20 20 20 1b 45 | 20 20 20 20 20 20 20 20 | .E| |
|00001cd0| 20 20 20 20 20 20 20 20 | 1b 46 20 20 20 20 20 20 | |.F |
|00001ce0| 20 1b 45 20 31 34 31 0d | 0a 0d 0a 0c 0d 0a 0d 0a | .E 141.|........|
|00001cf0| 0d 0a 0d 0a 1b 46 20 20 | 20 20 20 1b 45 43 48 41 |.....F | .ECHA|
|00001d00| 50 54 45 52 20 31 31 1b | 46 20 20 20 20 20 20 20 |PTER 11.|F |
|00001d10| 20 20 20 20 20 20 20 20 | 20 1b 45 20 47 4f 4f 44 | | .E GOOD|
|00001d20| 20 53 54 55 46 46 2c 20 | 43 48 45 41 50 20 20 1b | STUFF, |CHEAP .|
|00001d30| 46 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |F | |
|00001d40| 20 1b 45 43 48 41 50 54 | 45 52 20 31 31 0d 0a 0d | .ECHAPT|ER 11...|
|00001d50| 0a 0d 0a 20 20 20 20 20 | 1b 46 73 74 6f 72 69 6e |... |.Fstorin|
|00001d60| 67 20 74 68 65 20 69 6e | 70 75 74 20 69 6e 20 61 |g the in|put in a|
|00001d70| 20 73 74 72 69 6e 67 20 | 76 61 72 69 61 62 6c 65 | string |variable|
|00001d80| 2e 20 20 54 68 69 73 20 | 77 69 6c 6c 20 6e 6f 74 |. This |will not|
|00001d90| 20 69 6d 70 61 63 74 20 | 6f 6e 20 77 68 61 74 0d | impact |on what.|
|00001da0| 0a 20 20 20 20 20 74 68 | 65 20 75 73 65 72 20 73 |. th|e user s|
|00001db0| 65 65 73 2e 20 20 54 68 | 65 20 6c 6f 67 69 63 2c |ees. Th|e logic,|
|00001dc0| 20 68 6f 77 65 76 65 72 | 2c 20 77 69 6c 6c 20 62 | however|, will b|
|00001dd0| 65 20 65 61 73 69 65 72 | 20 74 6f 20 63 6f 64 65 |e easier| to code|
|00001de0| 20 69 66 20 77 65 20 75 | 73 65 20 61 0d 0a 20 20 | if we u|se a.. |
|00001df0| 20 20 20 27 30 27 20 74 | 6f 20 65 78 69 74 20 73 | '0' t|o exit s|
|00001e00| 6f 20 6c 65 74 27 73 20 | 6d 61 6b 65 20 74 68 61 |o let's |make tha|
|00001e10| 74 20 6f 6e 65 20 73 6d | 61 6c 6c 20 63 68 61 6e |t one sm|all chan|
|00001e20| 67 65 20 69 6e 20 74 68 | 65 20 6d 65 6e 75 2e 20 |ge in th|e menu. |
|00001e30| 20 54 68 65 20 6e 65 77 | 0d 0a 20 20 20 20 20 63 | The new|.. c|
|00001e40| 6f 64 65 20 69 73 20 73 | 68 6f 77 6e 20 6f 6e 20 |ode is s|hown on |
|00001e50| 74 68 65 20 6e 65 78 74 | 20 70 61 67 65 2e 0d 0a |the next| page...|
|00001e60| 0d 0a 0d 0a 20 20 20 20 | 20 34 33 31 30 20 20 20 |.... | 4310 |
|00001e70| 4c 4f 43 41 54 45 20 31 | 35 2c 32 35 3a 20 49 4e |LOCATE 1|5,25: IN|
|00001e80| 50 55 54 20 22 45 6e 74 | 65 72 20 31 2c 20 32 2c |PUT "Ent|er 1, 2,|
|00001e90| 20 6f 72 20 33 20 28 6f | 72 20 30 20 74 6f 20 65 | or 3 (o|r 0 to e|
|00001ea0| 78 69 74 29 22 3b 20 41 | 24 0d 0a 20 20 20 20 20 |xit)"; A|$.. |
|00001eb0| 34 33 32 30 20 27 0d 0a | 20 20 20 20 20 34 33 33 |4320 '..| 433|
|00001ec0| 30 20 20 20 57 48 49 4c | 45 20 41 24 20 3c 20 22 |0 WHIL|E A$ < "|
|00001ed0| 30 22 20 20 4f 52 20 41 | 24 20 3e 20 22 33 22 0d |0" OR A|$ > "3".|
|00001ee0| 0a 20 20 20 20 20 34 33 | 34 30 20 20 20 20 20 20 |. 43|40 |
|00001ef0| 4c 4f 43 41 54 45 20 31 | 35 2c 36 30 3a 20 50 52 |LOCATE 1|5,60: PR|
|00001f00| 49 4e 54 20 22 20 20 20 | 20 20 20 20 20 20 20 20 |INT " | |
|00001f10| 20 20 20 20 20 20 20 20 | 20 22 0d 0a 20 20 20 20 | | ".. |
|00001f20| 20 34 33 35 30 20 20 20 | 20 20 20 4c 4f 43 41 54 | 4350 | LOCAT|
|00001f30| 45 20 32 32 2c 32 35 3a | 20 50 52 49 4e 54 20 22 |E 22,25:| PRINT "|
|00001f40| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001f50| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001f60| 20 20 22 0d 0a 20 20 20 | 20 20 34 33 36 30 20 20 | ".. | 4360 |
|00001f70| 20 20 20 20 4c 4f 43 41 | 54 45 20 32 32 2c 32 35 | LOCA|TE 22,25|
|00001f80| 3a 20 49 4e 50 55 54 20 | 22 54 68 61 74 27 73 20 |: INPUT |"That's |
|00001f90| 31 2c 20 32 2c 20 33 20 | 6f 72 20 30 22 3b 20 41 |1, 2, 3 |or 0"; A|
|00001fa0| 24 0d 0a 20 20 20 20 20 | 34 33 37 30 20 20 20 57 |$.. |4370 W|
|00001fb0| 45 4e 44 0d 0a 20 20 20 | 20 20 34 33 38 30 20 27 |END.. | 4380 '|
|00001fc0| 0d 0a 20 20 20 20 20 34 | 33 38 35 20 20 20 41 20 |.. 4|385 A |
|00001fd0| 3d 20 56 41 4c 28 41 24 | 29 0d 0a 20 20 20 20 20 |= VAL(A$|).. |
|00001fe0| 34 33 39 30 20 20 20 4f | 4e 20 41 20 47 4f 53 55 |4390 O|N A GOSU|
|00001ff0| 42 20 34 35 30 30 2c 20 | 34 36 30 30 2c 20 34 37 |B 4500, |4600, 47|
|00002000| 30 30 0d 0a 0d 0a 20 20 | 20 20 20 4c 69 6e 65 73 |00.... | Lines|
|00002010| 20 34 33 31 30 20 61 6e | 64 20 34 33 36 30 20 6e | 4310 an|d 4360 n|
|00002020| 6f 77 20 61 63 63 65 70 | 74 20 73 74 72 69 6e 67 |ow accep|t string|
|00002030| 20 69 6e 70 75 74 20 61 | 6e 64 20 6c 69 6e 65 20 | input a|nd line |
|00002040| 34 33 33 30 20 74 65 73 | 74 73 20 6f 6e 20 69 74 |4330 tes|ts on it|
|00002050| 2e 0d 0a 20 20 20 20 20 | 4c 69 6e 65 20 34 33 38 |... |Line 438|
|00002060| 35 20 63 6f 6e 76 65 72 | 74 73 20 69 74 20 74 6f |5 conver|ts it to|
|00002070| 20 61 20 6e 75 6d 62 65 | 72 20 6f 6e 63 65 20 77 | a numbe|r once w|
|00002080| 65 27 72 65 20 64 6f 6e | 65 2e 20 20 53 69 6e 63 |e're don|e. Sinc|
|00002090| 65 20 61 20 73 74 72 69 | 6e 67 20 69 6e 70 75 74 |e a stri|ng input|
|000020a0| 0d 0a 20 20 20 20 20 76 | 61 72 69 61 62 6c 65 20 |.. v|ariable |
|000020b0| 77 69 6c 6c 20 64 69 67 | 65 73 74 20 61 6e 79 74 |will dig|est anyt|
|000020c0| 68 69 6e 67 2c 20 74 68 | 65 20 27 52 65 64 6f 20 |hing, th|e 'Redo |
|000020d0| 66 72 6f 6d 20 73 74 61 | 72 74 27 20 65 72 72 6f |from sta|rt' erro|
|000020e0| 72 20 6d 65 73 73 61 67 | 65 20 67 6f 65 73 0d 0a |r messag|e goes..|
|000020f0| 20 20 20 20 20 61 77 61 | 79 2e 0d 0a 0d 0a 0d 0a | awa|y.......|
|00002100| 20 20 20 20 20 1b 45 53 | 4f 55 54 48 20 4f 46 20 | .ES|OUTH OF |
|00002110| 54 48 45 20 42 4f 52 44 | 45 52 0d 0a 0d 0a 20 20 |THE BORD|ER.... |
|00002120| 20 20 20 1b 46 48 65 72 | 65 27 73 20 61 20 6c 69 | .FHer|e's a li|
|00002130| 74 74 6c 65 20 73 75 62 | 72 6f 75 74 69 6e 65 20 |ttle sub|routine |
|00002140| 74 68 61 74 20 77 69 6c | 6c 20 70 75 74 20 61 20 |that wil|l put a |
|00002150| 62 6f 72 64 65 72 20 61 | 72 6f 75 6e 64 20 79 6f |border a|round yo|
|00002160| 75 72 20 73 63 72 65 65 | 6e 3a 0d 0a 0d 0a 20 20 |ur scree|n:.... |
|00002170| 20 20 20 35 30 30 30 20 | 27 20 2a 2a 2a 2a 2a 2a | 5000 |' ******|
|00002180| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00002190| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000021a0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000021b0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 0d 0a 20 20 20 20 |********|**.. |
|000021c0| 20 35 30 31 30 20 27 20 | 54 48 49 53 20 52 4f 55 | 5010 ' |THIS ROU|
|000021d0| 54 49 4e 45 20 50 55 54 | 53 20 41 20 42 4f 52 44 |TINE PUT|S A BORD|
|000021e0| 45 52 20 4f 4e 20 54 48 | 45 20 53 43 52 45 45 4e |ER ON TH|E SCREEN|
|000021f0| 2e 20 20 43 48 41 4e 47 | 49 4e 47 20 54 48 45 20 |. CHANG|ING THE |
|00002200| 42 55 49 4c 54 20 49 4e | 0d 0a 20 20 20 20 20 35 |BUILT IN|.. 5|
|00002210| 30 32 30 20 27 20 56 41 | 4c 55 45 53 20 57 49 4c |020 ' VA|LUES WIL|
|00002220| 4c 20 43 48 41 4e 47 45 | 20 54 48 45 20 53 49 5a |L CHANGE| THE SIZ|
|00002230| 45 2c 20 4c 4f 43 41 54 | 49 4f 4e 20 41 4e 44 20 |E, LOCAT|ION AND |
|00002240| 4d 41 4b 45 55 50 20 4f | 46 20 54 48 45 20 42 4f |MAKEUP O|F THE BO|
|00002250| 52 44 45 52 2e 0d 0a 20 | 20 20 20 20 35 30 33 30 |RDER... | 5030|
|00002260| 20 27 20 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a | ' *****|********|
|00002270| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00002280| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00002290| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000022a0| 2a 2a 2a 0d 0a 20 20 20 | 20 20 35 30 34 30 20 27 |***.. | 5040 '|
|000022b0| 0d 0a 20 20 20 20 20 35 | 30 35 30 20 43 4c 53 0d |.. 5|050 CLS.|
|000022c0| 0a 20 20 20 20 20 35 30 | 36 30 20 48 4f 52 2e 42 |. 50|60 HOR.B|
|000022d0| 52 44 24 20 3d 20 53 54 | 52 49 4e 47 24 28 37 38 |RD$ = ST|RING$(78|
|000022e0| 2c 32 30 35 29 20 20 20 | 20 20 20 20 20 20 20 20 |,205) | |
|000022f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002300| 20 27 48 4f 52 49 5a 20 | 42 4f 52 44 45 52 0d 0a | 'HORIZ |BORDER..|
|00002310| 20 20 20 20 20 35 30 37 | 30 20 27 0d 0a 20 20 20 | 507|0 '.. |
|00002320| 20 20 35 30 38 30 20 4c | 4f 43 41 54 45 20 20 31 | 5080 L|OCATE 1|
|00002330| 2c 31 3a 20 50 52 49 4e | 54 20 43 48 52 24 28 32 |,1: PRIN|T CHR$(2|
|00002340| 30 31 29 3b 48 4f 52 2e | 42 52 44 24 3b 43 48 52 |01);HOR.|BRD$;CHR|
|00002350| 24 28 31 38 37 29 3b 20 | 20 20 20 20 20 27 54 4f |$(187); | 'TO|
|00002360| 50 0d 0a 20 20 20 20 20 | 35 30 39 30 20 4c 4f 43 |P.. |5090 LOC|
|00002370| 41 54 45 20 32 33 2c 31 | 3a 20 50 52 49 4e 54 20 |ATE 23,1|: PRINT |
|00002380| 43 48 52 24 28 32 30 30 | 29 3b 48 4f 52 2e 42 52 |CHR$(200|);HOR.BR|
|00002390| 44 24 3b 43 48 52 24 28 | 31 38 38 29 3b 20 20 20 |D$;CHR$(|188); |
|000023a0| 20 20 20 27 42 4f 54 54 | 4f 4d 0d 0a 20 20 20 20 | 'BOTT|OM.. |
|000023b0| 20 35 31 30 30 20 27 0d | 0a 20 20 20 20 20 35 31 | 5100 '.|. 51|
|000023c0| 31 30 20 46 4f 52 20 4a | 20 3d 20 32 20 54 4f 20 |10 FOR J| = 2 TO |
|000023d0| 32 32 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |22 | |
|000023e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000023f0| 20 20 20 20 20 20 20 20 | 20 27 53 49 44 45 53 0d | | 'SIDES.|
|00002400| 0a 20 20 20 20 20 35 31 | 32 30 20 20 20 4c 4f 43 |. 51|20 LOC|
|00002410| 41 54 45 20 4a 2c 31 3a | 20 20 50 52 49 4e 54 20 |ATE J,1:| PRINT |
|00002420| 43 48 52 24 28 31 38 36 | 29 3b 0d 0a 20 20 20 20 |CHR$(186|);.. |
|00002430| 20 35 31 33 30 20 20 20 | 4c 4f 43 41 54 45 20 4a | 5130 |LOCATE J|
|00002440| 2c 38 30 3a 20 50 52 49 | 4e 54 20 43 48 52 24 28 |,80: PRI|NT CHR$(|
|00002450| 31 38 36 29 3b 0d 0a 20 | 20 20 20 20 35 31 34 30 |186);.. | 5140|
|00002460| 20 4e 45 58 54 20 4a 0d | 0a 20 20 20 20 20 35 31 | NEXT J.|. 51|
|00002470| 35 30 20 27 0d 0a 20 20 | 20 20 20 35 31 36 30 20 |50 '.. | 5160 |
|00002480| 52 45 54 55 52 4e 0d 0a | 0d 0a 20 20 20 20 20 4c |RETURN..|.. L|
|00002490| 69 6e 65 20 35 30 36 30 | 20 64 65 66 69 6e 65 73 |ine 5060| defines|
|000024a0| 20 61 20 73 74 72 69 6e | 67 20 74 68 61 74 20 68 | a strin|g that h|
|000024b0| 61 73 20 74 68 65 20 65 | 71 75 69 76 61 6c 65 6e |as the e|quivalen|
|000024c0| 74 20 6f 66 20 37 38 20 | 64 6f 75 62 6c 65 20 6c |t of 78 |double l|
|000024d0| 69 6e 65 0d 0a 20 20 20 | 20 20 63 68 61 72 61 63 |ine.. | charac|
|000024e0| 74 65 72 73 20 69 6e 20 | 69 74 2e 20 20 4c 69 6e |ters in |it. Lin|
|000024f0| 65 73 20 35 30 38 30 20 | 61 6e 64 20 35 30 39 30 |es 5080 |and 5090|
|00002500| 20 61 64 64 20 74 68 65 | 20 61 70 70 72 6f 70 72 | add the| appropr|
|00002510| 69 61 74 65 20 63 6f 72 | 6e 65 72 73 20 61 6e 64 |iate cor|ners and|
|00002520| 0d 0a 20 20 20 20 20 70 | 72 69 6e 74 20 6f 75 74 |.. p|rint out|
|00002530| 20 74 68 65 20 74 6f 70 | 20 61 6e 64 20 62 6f 74 | the top| and bot|
|00002540| 74 6f 6d 2e 20 20 54 68 | 65 20 46 4f 52 2f 4e 45 |tom. Th|e FOR/NE|
|00002550| 58 54 20 6c 6f 6f 70 20 | 61 64 64 73 20 74 68 65 |XT loop |adds the|
|00002560| 20 73 69 64 65 73 2e 20 | 20 59 6f 75 0d 0a 20 20 | sides. | You.. |
|00002570| 20 20 20 63 61 6e 20 63 | 68 61 6e 67 65 20 74 68 | can c|hange th|
|00002580| 65 20 62 6f 72 64 65 72 | 20 62 79 20 73 65 6c 65 |e border| by sele|
|00002590| 63 74 69 6e 67 20 64 69 | 66 66 65 72 65 6e 74 20 |cting di|fferent |
|000025a0| 41 53 43 49 49 20 63 68 | 61 72 61 63 74 65 72 73 |ASCII ch|aracters|
|000025b0| 20 28 63 68 65 63 6b 0d | 0a 20 20 20 20 20 79 6f | (check.|. yo|
|000025c0| 75 72 20 42 41 53 49 43 | 20 6d 61 6e 75 61 6c 20 |ur BASIC| manual |
|000025d0| 66 6f 72 20 74 68 65 20 | 61 70 70 72 6f 70 72 69 |for the |appropri|
|000025e0| 61 74 65 20 76 61 6c 75 | 65 73 29 2e 0d 0a 0d 0a |ate valu|es).....|
|000025f0| 20 20 20 20 20 54 68 69 | 73 20 72 6f 75 74 69 6e | Thi|s routin|
|00002600| 65 20 64 6f 65 73 20 6e | 6f 74 20 68 61 76 65 20 |e does n|ot have |
|00002610| 74 6f 20 64 65 66 69 6e | 65 20 74 68 65 20 62 6f |to defin|e the bo|
|00002620| 72 64 65 72 20 62 79 20 | 75 73 69 6e 67 20 74 68 |rder by |using th|
|00002630| 65 20 63 6f 6e 73 74 61 | 6e 74 73 0d 0a 20 20 20 |e consta|nts.. |
|00002640| 20 20 31 2c 20 32 33 2c | 20 6f 72 20 38 30 2e 20 | 1, 23,| or 80. |
|00002650| 20 49 66 20 74 68 65 20 | 63 6f 64 65 20 69 73 20 | If the |code is |
|00002660| 72 65 77 72 69 74 74 65 | 6e 20 77 69 74 68 20 76 |rewritte|n with v|
|00002670| 61 72 69 61 62 6c 65 73 | 20 73 75 63 68 20 61 73 |ariables| such as|
|00002680| 20 53 43 52 2e 54 4f 50 | 2c 0d 0a 0d 0a 0d 0a 20 | SCR.TOP|,...... |
|00002690| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000026a0| 1b 45 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |.E | |
|000026b0| 20 20 1b 46 20 20 20 20 | 20 20 20 1b 45 20 31 34 | .F | .E 14|
|000026c0| 32 0d 0a 0d 0a 0c 0d 0a | 0d 0a 0d 0a 0d 0a 1b 46 |2.......|.......F|
|000026d0| 20 20 20 20 20 1b 45 43 | 48 41 50 54 45 52 20 31 | .EC|HAPTER 1|
|000026e0| 31 1b 46 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |1.F | |
|000026f0| 20 20 20 1b 45 20 47 4f | 4f 44 20 53 54 55 46 46 | .E GO|OD STUFF|
|00002700| 2c 20 43 48 45 41 50 20 | 20 1b 46 20 20 20 20 20 |, CHEAP | .F |
|00002710| 20 20 20 20 20 20 20 20 | 20 20 20 1b 45 43 48 41 | | .ECHA|
|00002720| 50 54 45 52 20 31 31 0d | 0a 0d 0a 0d 0a 20 20 20 |PTER 11.|..... |
|00002730| 20 20 1b 46 53 43 52 2e | 42 4f 54 2c 20 53 43 52 | .FSCR.|BOT, SCR|
|00002740| 2e 4c 45 46 54 20 61 6e | 64 20 53 43 52 2e 52 49 |.LEFT an|d SCR.RI|
|00002750| 47 48 54 20 72 61 74 68 | 65 72 20 74 68 61 6e 20 |GHT rath|er than |
|00002760| 63 6f 6e 73 74 61 6e 74 | 73 2c 20 74 68 65 20 72 |constant|s, the r|
|00002770| 65 73 75 6c 74 20 77 69 | 6c 6c 0d 0a 20 20 20 20 |esult wi|ll.. |
|00002780| 20 62 65 20 61 20 67 65 | 6e 65 72 61 6c 20 75 74 | be a ge|neral ut|
|00002790| 69 6c 69 74 79 20 73 75 | 62 72 6f 75 74 69 6e 65 |ility su|broutine|
|000027a0| 20 74 68 61 74 20 63 61 | 6e 20 62 65 20 75 73 65 | that ca|n be use|
|000027b0| 64 20 62 79 20 61 20 77 | 68 6f 6c 65 20 68 6f 73 |d by a w|hole hos|
|000027c0| 74 20 6f 66 0d 0a 20 20 | 20 20 20 70 72 6f 67 72 |t of.. | progr|
|000027d0| 61 6d 73 2e 20 20 50 72 | 69 6f 72 20 74 6f 20 63 |ams. Pr|ior to c|
|000027e0| 61 6c 6c 69 6e 67 20 69 | 74 2c 20 61 6c 6c 20 74 |alling i|t, all t|
|000027f0| 68 65 20 6d 61 69 6e 20 | 70 72 6f 67 72 61 6d 20 |he main |program |
|00002800| 68 61 73 20 74 6f 20 64 | 6f 20 69 73 20 61 73 73 |has to d|o is ass|
|00002810| 69 67 6e 0d 0a 20 20 20 | 20 20 76 61 6c 75 65 73 |ign.. | values|
|00002820| 20 74 6f 20 74 68 65 20 | 66 6f 75 72 20 76 61 72 | to the |four var|
|00002830| 69 61 62 6c 65 73 20 74 | 68 61 74 20 64 65 66 69 |iables t|hat defi|
|00002840| 6e 65 20 74 68 65 20 72 | 65 63 74 61 6e 67 6c 65 |ne the r|ectangle|
|00002850| 2e 0d 0a 0d 0a 0d 0a 20 | 20 20 20 20 1b 45 52 4f |....... | .ERO|
|00002860| 4c 4c 20 59 4f 55 52 20 | 4f 57 4e 0d 0a 0d 0a 20 |LL YOUR |OWN.... |
|00002870| 20 20 20 20 1b 46 59 6f | 75 20 63 61 6e 20 63 72 | .FYo|u can cr|
|00002880| 65 61 74 65 20 79 6f 75 | 72 20 6f 77 6e 20 42 41 |eate you|r own BA|
|00002890| 53 49 43 20 66 75 6e 63 | 74 69 6f 6e 73 2e 20 20 |SIC func|tions. |
|000028a0| 54 68 65 20 72 75 6c 65 | 73 20 74 68 61 74 20 6d |The rule|s that m|
|000028b0| 75 73 74 20 62 65 0d 0a | 20 20 20 20 20 66 6f 6c |ust be..| fol|
|000028c0| 6c 6f 77 65 64 20 61 72 | 65 3a 0d 0a 0d 0a 20 20 |lowed ar|e:.... |
|000028d0| 20 20 20 2d 20 54 68 65 | 20 66 75 6e 63 74 69 6f | - The| functio|
|000028e0| 6e 20 6d 75 73 74 20 62 | 65 20 64 65 66 69 6e 65 |n must b|e define|
|000028f0| 64 20 61 74 20 74 68 65 | 20 62 65 67 69 6e 6e 69 |d at the| beginni|
|00002900| 6e 67 20 6f 66 20 79 6f | 75 72 20 70 72 6f 67 72 |ng of yo|ur progr|
|00002910| 61 6d 2e 0d 0a 20 20 20 | 20 20 2d 20 54 68 65 20 |am... | - The |
|00002920| 66 75 6e 63 74 69 6f 6e | 20 6d 75 73 74 20 6e 6f |function| must no|
|00002930| 74 20 62 65 20 6c 6f 6e | 67 65 72 20 74 68 61 74 |t be lon|ger that|
|00002940| 20 6f 6e 65 20 32 35 35 | 20 63 68 61 72 61 63 74 | one 255| charact|
|00002950| 65 72 20 6c 69 6e 65 2e | 0d 0a 20 20 20 20 20 2d |er line.|.. -|
|00002960| 20 54 68 65 20 66 75 6e | 63 74 69 6f 6e 20 6e 61 | The fun|ction na|
|00002970| 6d 65 20 6d 75 73 74 20 | 61 6c 77 61 79 73 20 73 |me must |always s|
|00002980| 74 61 72 74 20 77 69 74 | 68 20 46 4e 2e 0d 0a 0d |tart wit|h FN....|
|00002990| 0a 20 20 20 20 20 53 74 | 61 72 74 20 74 68 65 20 |. St|art the |
|000029a0| 70 72 6f 63 65 73 73 20 | 62 79 20 74 65 6c 6c 69 |process |by telli|
|000029b0| 6e 67 20 42 41 53 49 43 | 20 74 68 61 74 20 79 6f |ng BASIC| that yo|
|000029c0| 75 20 61 72 65 20 44 45 | 46 69 6e 69 6e 67 20 61 |u are DE|Fining a|
|000029d0| 20 66 75 6e 63 74 69 6f | 6e 2e 0d 0a 20 20 20 20 | functio|n... |
|000029e0| 20 46 6f 6c 6c 6f 77 20 | 74 68 69 73 20 77 69 74 | Follow |this wit|
|000029f0| 68 20 74 68 65 20 66 75 | 6e 63 74 69 6f 6e 20 6e |h the fu|nction n|
|00002a00| 61 6d 65 20 61 6e 64 20 | 61 6e 20 61 72 67 75 6d |ame and |an argum|
|00002a10| 65 6e 74 2e 20 20 57 68 | 61 74 27 73 20 61 6e 20 |ent. Wh|at's an |
|00002a20| 61 72 67 75 6d 65 6e 74 | 3f 0d 0a 20 20 20 20 20 |argument|?.. |
|00002a30| 41 20 67 61 74 65 77 61 | 79 20 74 68 61 74 20 70 |A gatewa|y that p|
|00002a40| 61 73 73 65 73 20 61 20 | 76 61 72 69 61 62 6c 65 |asses a |variable|
|00002a50| 20 74 6f 20 74 68 65 20 | 66 75 6e 63 74 69 6f 6e | to the |function|
|00002a60| 20 66 6f 72 20 6d 61 6e | 69 70 75 6c 61 74 69 6f | for man|ipulatio|
|00002a70| 6e 2e 0d 0a 20 20 20 20 | 20 48 65 72 65 27 73 20 |n... | Here's |
|00002a80| 61 20 66 75 6e 63 74 69 | 6f 6e 20 74 68 61 74 20 |a functi|on that |
|00002a90| 65 78 74 72 61 63 74 73 | 20 74 68 65 20 6e 75 6d |extracts| the num|
|00002aa0| 65 72 69 63 20 76 61 6c | 75 65 20 6f 66 20 74 68 |eric val|ue of th|
|00002ab0| 65 20 6d 6f 6e 74 68 20 | 66 72 6f 6d 20 61 0d 0a |e month |from a..|
|00002ac0| 20 20 20 20 20 73 74 72 | 69 6e 67 20 64 61 74 65 | str|ing date|
|00002ad0| 20 69 6e 20 4d 4d 2d 44 | 44 2d 59 59 59 59 20 66 | in MM-D|D-YYYY f|
|00002ae0| 6f 72 6d 61 74 2e 20 20 | 54 68 65 20 61 72 67 75 |ormat. |The argu|
|00002af0| 6d 65 6e 74 20 69 73 20 | 61 20 73 74 72 69 6e 67 |ment is |a string|
|00002b00| 20 64 61 74 65 2c 20 44 | 24 2e 0d 0a 0d 0a 20 20 | date, D|$..... |
|00002b10| 20 20 20 32 30 30 20 44 | 45 46 20 46 4e 4d 54 48 | 200 D|EF FNMTH|
|00002b20| 28 44 24 29 20 3d 20 56 | 41 4c 28 4c 45 46 54 24 |(D$) = V|AL(LEFT$|
|00002b30| 28 44 24 2c 32 29 29 0d | 0a 0d 0a 20 20 20 20 20 |(D$,2)).|... |
|00002b40| 54 68 65 20 66 75 6e 63 | 74 69 6f 6e 20 69 73 20 |The func|tion is |
|00002b50| 64 65 66 69 6e 65 64 20 | 6f 6e 20 74 68 65 20 72 |defined |on the r|
|00002b60| 69 67 68 74 20 6f 66 20 | 74 68 65 20 65 71 75 61 |ight of |the equa|
|00002b70| 6c 20 73 69 67 6e 2e 20 | 20 49 74 20 74 61 6b 65 |l sign. | It take|
|00002b80| 73 20 74 68 65 0d 0a 20 | 20 20 20 20 74 77 6f 20 |s the.. | two |
|00002b90| 4c 45 46 54 6d 6f 73 74 | 20 63 68 61 72 61 63 74 |LEFTmost| charact|
|00002ba0| 65 72 73 20 6f 66 20 44 | 24 20 61 6e 64 20 63 6f |ers of D|$ and co|
|00002bb0| 6e 76 65 72 74 73 20 74 | 68 65 6d 20 74 6f 20 61 |nverts t|hem to a|
|00002bc0| 20 6e 75 6d 65 72 69 63 | 20 56 41 4c 75 65 2e 0d | numeric| VALue..|
|00002bd0| 0a 0d 0a 20 20 20 20 20 | 32 33 30 30 20 4d 4f 4e |... |2300 MON|
|00002be0| 54 48 20 3d 20 46 4e 4d | 54 48 28 44 41 54 45 24 |TH = FNM|TH(DATE$|
|00002bf0| 29 0d 0a 0d 0a 20 20 20 | 20 20 54 6f 20 75 73 65 |).... | To use|
|00002c00| 20 74 68 65 20 66 75 6e | 63 74 69 6f 6e 2c 20 79 | the fun|ction, y|
|00002c10| 6f 75 20 70 61 73 73 20 | 69 74 20 74 68 65 20 6e |ou pass |it the n|
|00002c20| 61 6d 65 20 6f 66 20 74 | 68 65 20 76 61 72 69 61 |ame of t|he varia|
|00002c30| 62 6c 65 20 74 68 61 74 | 20 63 6f 6e 74 61 69 6e |ble that| contain|
|00002c40| 73 0d 0a 20 20 20 20 20 | 74 68 65 20 64 61 74 65 |s.. |the date|
|00002c50| 20 28 61 6e 79 20 76 61 | 72 69 61 62 6c 65 20 6e | (any va|riable n|
|00002c60| 61 6d 65 20 63 61 6e 20 | 62 65 20 70 61 73 73 65 |ame can |be passe|
|00002c70| 64 29 2e 20 20 54 68 65 | 20 66 75 6e 63 74 69 6f |d). The| functio|
|00002c80| 6e 20 70 65 72 66 6f 72 | 6d 73 20 74 68 65 0d 0a |n perfor|ms the..|
|00002c90| 20 20 20 20 20 63 6f 6e | 76 65 72 73 69 6f 6e 20 | con|version |
|00002ca0| 61 6e 64 20 61 73 73 69 | 67 6e 73 20 74 68 65 20 |and assi|gns the |
|00002cb0| 72 65 73 75 6c 74 20 74 | 6f 20 4d 4f 4e 54 48 2e |result t|o MONTH.|
|00002cc0| 0d 0a 0d 0a 0d 0a 20 20 | 20 20 20 1b 45 4e 55 4d |...... | .ENUM|
|00002cd0| 45 52 49 43 20 44 41 59 | 0d 0a 0d 0a 20 20 20 20 |ERIC DAY|.... |
|00002ce0| 20 1b 46 54 68 65 20 66 | 6f 6c 6c 6f 77 69 6e 67 | .FThe f|ollowing|
|00002cf0| 20 65 78 74 72 61 63 74 | 73 20 61 20 64 61 79 20 | extract|s a day |
|00002d00| 66 72 6f 6d 20 74 68 65 | 20 73 61 6d 65 20 73 74 |from the| same st|
|00002d10| 72 69 6e 67 20 64 61 74 | 65 3a 0d 0a 0d 0a 20 20 |ring dat|e:.... |
|00002d20| 20 20 20 32 31 30 20 44 | 45 46 20 46 4e 44 41 59 | 210 D|EF FNDAY|
|00002d30| 53 28 44 24 29 20 3d 20 | 56 41 4c 28 4d 49 44 24 |S(D$) = |VAL(MID$|
|00002d40| 28 44 24 2c 34 2c 32 29 | 29 0d 0a 0d 0a 20 20 20 |(D$,4,2)|).... |
|00002d50| 20 20 32 33 31 30 20 44 | 41 59 20 3d 20 46 4e 44 | 2310 D|AY = FND|
|00002d60| 41 59 53 28 44 41 54 45 | 24 29 0d 0a 0d 0a 0d 0a |AYS(DATE|$)......|
|00002d70| 20 20 20 20 20 1b 45 4e | 55 4d 45 52 49 43 20 59 | .EN|UMERIC Y|
|00002d80| 45 41 52 0d 0a 0d 0a 20 | 20 20 20 20 1b 46 54 68 |EAR.... | .FTh|
|00002d90| 65 20 6c 61 73 74 20 74 | 77 6f 20 64 69 67 69 74 |e last t|wo digit|
|00002da0| 73 20 6f 66 20 74 68 65 | 20 79 65 61 72 20 63 61 |s of the| year ca|
|00002db0| 6e 20 62 65 20 72 65 74 | 72 69 65 76 65 64 20 61 |n be ret|rieved a|
|00002dc0| 73 20 66 6f 6c 6c 6f 77 | 73 3a 0d 0a 0d 0a 20 20 |s follow|s:.... |
|00002dd0| 20 20 20 32 32 30 20 44 | 45 46 20 46 4e 59 52 53 | 220 D|EF FNYRS|
|00002de0| 28 44 24 29 20 3d 20 56 | 41 4c 28 52 49 47 48 54 |(D$) = V|AL(RIGHT|
|00002df0| 24 28 44 24 2c 32 29 29 | 0d 0a 0d 0a 20 20 20 20 |$(D$,2))|.... |
|00002e00| 20 32 33 32 30 20 59 45 | 41 52 20 3d 20 46 4e 59 | 2320 YE|AR = FNY|
|00002e10| 52 53 28 44 41 54 45 24 | 29 0d 0a 0d 0a 20 20 20 |RS(DATE$|).... |
|00002e20| 20 20 4f 6e 63 65 20 79 | 6f 75 27 76 65 20 61 73 | Once y|ou've as|
|00002e30| 73 69 67 6e 65 64 20 61 | 20 6e 61 6d 65 20 74 6f |signed a| name to|
|00002e40| 20 61 20 66 75 6e 63 74 | 69 6f 6e 2c 20 74 68 61 | a funct|ion, tha|
|00002e50| 74 20 6e 61 6d 65 20 63 | 61 6e 20 6e 6f 74 20 62 |t name c|an not b|
|00002e60| 65 20 75 73 65 64 20 66 | 6f 72 0d 0a 20 20 20 20 |e used f|or.. |
|00002e70| 20 61 6e 79 20 6f 74 68 | 65 72 20 76 61 72 69 61 | any oth|er varia|
|00002e80| 62 6c 65 2e 20 20 54 68 | 65 20 6e 61 6d 65 20 6d |ble. Th|e name m|
|00002e90| 75 73 74 20 72 65 66 6c | 65 63 74 20 74 68 65 20 |ust refl|ect the |
|00002ea0| 74 79 70 65 20 6f 66 20 | 76 61 72 69 61 62 6c 65 |type of |variable|
|00002eb0| 20 74 68 61 74 20 74 68 | 65 0d 0a 20 20 20 20 20 | that th|e.. |
|00002ec0| 66 75 6e 63 74 69 6f 6e | 20 72 65 74 75 72 6e 73 |function| returns|
|00002ed0| 2c 20 6e 75 6d 65 72 69 | 63 20 6f 72 20 73 74 72 |, numeri|c or str|
|00002ee0| 69 6e 67 2e 0d 0a 0d 0a | 0d 0a 20 20 20 20 20 20 |ing.....|.. |
|00002ef0| 20 20 20 20 20 20 20 20 | 20 20 20 1b 45 20 20 20 | | .E |
|00002f00| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 1b 46 20 | | .F |
|00002f10| 20 20 20 20 20 20 1b 45 | 20 31 34 33 0d 0a 0d 0a | .E| 143....|
|00002f20| 0c 0d 0a 0d 0a 0d 0a 0d | 0a 1b 46 20 20 20 20 20 |........|..F |
|00002f30| 1b 45 43 48 41 50 54 45 | 52 20 31 31 1b 46 20 20 |.ECHAPTE|R 11.F |
|00002f40| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 1b 45 | | .E|
|00002f50| 20 47 4f 4f 44 20 53 54 | 55 46 46 2c 20 43 48 45 | GOOD ST|UFF, CHE|
|00002f60| 41 50 20 20 1b 46 20 20 | 20 20 20 20 20 20 20 20 |AP .F | |
|00002f70| 20 20 20 20 20 20 1b 45 | 43 48 41 50 54 45 52 20 | .E|CHAPTER |
|00002f80| 31 31 0d 0a 0d 0a 0d 0a | 0d 0a 20 20 20 20 20 1b |11......|.. .|
|00002f90| 46 32 34 30 20 44 45 46 | 20 46 4e 54 4f 54 2e 4e |F240 DEF| FNTOT.N|
|00002fa0| 41 4d 45 24 28 4c 41 53 | 54 2e 4e 41 4d 45 24 2c |AME$(LAS|T.NAME$,|
|00002fb0| 46 49 52 53 54 2e 4e 41 | 4d 45 24 2c 4d 49 24 29 |FIRST.NA|ME$,MI$)|
|00002fc0| 20 3d 20 4c 41 53 54 2e | 4e 41 4d 45 24 20 2b 20 | = LAST.|NAME$ + |
|00002fd0| 22 2c 20 22 20 2b 0d 0a | 20 20 20 20 20 20 20 20 |", " +..| |
|00002fe0| 20 20 20 20 20 46 49 52 | 53 54 2e 4e 41 4d 45 24 | FIR|ST.NAME$|
|00002ff0| 20 2b 20 22 20 22 20 2b | 20 4d 49 24 0d 0a 0d 0a | + " " +| MI$....|
|00003000| 20 20 20 20 20 32 33 33 | 30 20 46 55 4c 4c 2e 4e | 233|0 FULL.N|
|00003010| 41 4d 45 24 20 3d 20 46 | 4e 54 4f 54 2e 4e 41 4d |AME$ = F|NTOT.NAM|
|00003020| 45 24 28 4c 41 53 54 2e | 4e 41 4d 45 24 2c 46 49 |E$(LAST.|NAME$,FI|
|00003030| 52 53 54 2e 4e 41 4d 45 | 24 2c 4d 49 24 29 0d 0a |RST.NAME|$,MI$)..|
|00003040| 0d 0a 20 20 20 20 20 54 | 68 65 20 61 62 6f 76 65 |.. T|he above|
|00003050| 20 66 75 6e 63 74 69 6f | 6e 20 70 72 6f 64 75 63 | functio|n produc|
|00003060| 65 73 20 61 20 73 74 72 | 69 6e 67 20 76 61 72 69 |es a str|ing vari|
|00003070| 61 62 6c 65 20 74 68 61 | 74 20 73 74 6f 72 65 73 |able tha|t stores|
|00003080| 20 74 68 65 20 6e 61 6d | 65 73 20 69 6e 0d 0a 20 | the nam|es in.. |
|00003090| 20 20 20 20 74 68 65 20 | 66 6f 72 6d 20 22 4c 41 | the |form "LA|
|000030a0| 53 54 2e 4e 41 4d 45 2c | 20 46 49 52 53 54 2e 4e |ST.NAME,| FIRST.N|
|000030b0| 41 4d 45 20 4d 49 22 2e | 0d 0a 0d 0a 0d 0a 20 20 |AME MI".|...... |
|000030c0| 20 20 20 1b 45 53 54 52 | 49 4e 47 20 43 4f 4e 43 | .ESTR|ING CONC|
|000030d0| 41 54 45 4e 41 54 49 4f | 4e 0d 0a 0d 0a 20 20 20 |ATENATIO|N.... |
|000030e0| 20 20 1b 46 48 6f 6c 64 | 20 69 74 2c 20 64 69 64 | .FHold| it, did|
|000030f0| 20 79 6f 75 20 61 63 74 | 75 61 6c 6c 79 20 61 64 | you act|ually ad|
|00003100| 64 20 73 74 72 69 6e 67 | 73 20 6f 6e 20 74 68 65 |d string|s on the|
|00003110| 20 70 72 65 76 69 6f 75 | 73 20 70 61 67 65 3f 20 | previou|s page? |
|00003120| 20 4e 6f 2c 20 77 65 20 | 64 69 64 0d 0a 20 20 20 | No, we |did.. |
|00003130| 20 20 6e 6f 74 20 61 64 | 64 20 73 74 72 69 6e 67 | not ad|d string|
|00003140| 73 2e 20 20 57 65 20 63 | 61 6e 2c 20 68 6f 77 65 |s. We c|an, howe|
|00003150| 76 65 72 2c 20 63 6f 6e | 63 61 74 65 6e 61 74 65 |ver, con|catenate|
|00003160| 20 28 6a 6f 69 6e 29 20 | 73 74 72 69 6e 67 73 20 | (join) |strings |
|00003170| 69 6e 20 42 41 53 49 43 | 0d 0a 20 20 20 20 20 74 |in BASIC|.. t|
|00003180| 68 72 6f 75 67 68 20 74 | 68 65 20 75 73 65 20 6f |hrough t|he use o|
|00003190| 66 20 74 68 65 20 22 2b | 22 20 73 69 67 6e 73 2e |f the "+|" signs.|
|000031a0| 20 20 54 72 79 20 74 68 | 65 20 66 6f 6c 6c 6f 77 | Try th|e follow|
|000031b0| 69 6e 67 20 70 72 6f 67 | 72 61 6d 3a 0d 0a 0d 0a |ing prog|ram:....|
|000031c0| 20 20 20 20 20 31 30 30 | 20 47 52 45 45 54 24 20 | 100| GREET$ |
|000031d0| 20 20 20 3d 20 22 48 49 | 20 54 48 45 52 45 2c 20 | = "HI| THERE, |
|000031e0| 22 0d 0a 20 20 20 20 20 | 31 31 30 20 50 45 52 53 |".. |110 PERS|
|000031f0| 4f 4e 24 20 20 20 3d 20 | 22 53 57 45 45 54 49 45 |ON$ = |"SWEETIE|
|00003200| 22 0d 0a 20 20 20 20 20 | 31 32 30 20 47 52 45 45 |".. |120 GREE|
|00003210| 54 49 4e 47 24 20 3d 20 | 47 52 45 45 54 24 20 2b |TING$ = |GREET$ +|
|00003220| 20 50 45 52 53 4f 4e 24 | 0d 0a 20 20 20 20 20 31 | PERSON$|.. 1|
|00003230| 33 30 20 50 52 49 4e 54 | 20 47 52 45 45 54 49 4e |30 PRINT| GREETIN|
|00003240| 47 24 0d 0a 20 20 20 20 | 20 31 34 30 20 45 4e 44 |G$.. | 140 END|
|00003250| 0d 0a 0d 0a 20 20 20 20 | 20 4c 65 74 27 73 20 73 |.... | Let's s|
|00003260| 75 6d 6d 61 72 69 7a 65 | 20 77 68 61 74 20 79 6f |ummarize| what yo|
|00003270| 75 20 68 61 76 65 20 6c | 65 61 72 6e 65 64 20 73 |u have l|earned s|
|00003280| 6f 20 66 61 72 2e 20 20 | 59 6f 75 20 63 61 6e 3a |o far. |You can:|
|00003290| 0d 0a 0d 0a 20 20 20 20 | 20 2d 20 50 69 63 6b 20 |.... | - Pick |
|000032a0| 73 74 72 69 6e 67 73 20 | 61 70 61 72 74 20 75 73 |strings |apart us|
|000032b0| 69 6e 67 20 4c 45 46 54 | 24 28 29 2c 20 4d 49 44 |ing LEFT|$(), MID|
|000032c0| 24 28 29 20 61 6e 64 20 | 52 49 47 48 54 24 28 29 |$() and |RIGHT$()|
|000032d0| 0d 0a 20 20 20 20 20 2d | 20 43 6f 6e 63 61 74 65 |.. -| Concate|
|000032e0| 6e 61 74 65 20 73 74 72 | 69 6e 67 73 20 62 79 20 |nate str|ings by |
|000032f0| 75 73 69 6e 67 20 61 20 | 22 2b 22 20 73 69 67 6e |using a |"+" sign|
|00003300| 0d 0a 20 20 20 20 20 2d | 20 47 6f 20 66 72 6f 6d |.. -| Go from|
|00003310| 20 73 74 72 69 6e 67 20 | 74 6f 20 6e 75 6d 62 65 | string |to numbe|
|00003320| 72 20 61 6e 64 20 62 61 | 63 6b 20 75 73 69 6e 67 |r and ba|ck using|
|00003330| 20 56 41 4c 28 29 20 61 | 6e 64 20 53 54 52 24 28 | VAL() a|nd STR$(|
|00003340| 29 0d 0a 20 20 20 20 20 | 2d 20 43 72 65 61 74 65 |).. |- Create|
|00003350| 20 73 70 65 63 69 61 6c | 20 65 66 66 65 63 74 73 | special| effects|
|00003360| 20 75 73 69 6e 67 20 43 | 48 52 24 28 29 20 61 6e | using C|HR$() an|
|00003370| 64 20 53 54 52 49 4e 47 | 24 28 29 0d 0a 0d 0a 20 |d STRING|$().... |
|00003380| 20 20 20 20 49 4e 54 28 | 29 0d 0a 0d 0a 20 20 20 | INT(|).... |
|00003390| 20 20 57 65 20 61 72 65 | 20 67 6f 69 6e 67 20 74 | We are| going t|
|000033a0| 6f 20 6e 65 65 64 20 61 | 20 6e 75 6d 65 72 69 63 |o need a| numeric|
|000033b0| 20 66 75 6e 63 74 69 6f | 6e 2c 20 49 4e 54 28 29 | functio|n, INT()|
|000033c0| 2c 20 69 6e 20 6f 75 72 | 20 6e 65 78 74 20 72 6f |, in our| next ro|
|000033d0| 75 74 69 6e 65 20 73 6f | 0d 0a 20 20 20 20 20 6c |utine so|.. l|
|000033e0| 65 74 27 73 20 65 78 70 | 6c 61 69 6e 20 69 74 20 |et's exp|lain it |
|000033f0| 62 65 66 6f 72 65 20 77 | 65 20 67 6f 20 6f 6e 2e |before w|e go on.|
|00003400| 0d 0a 0d 0a 20 20 20 20 | 20 49 4e 54 28 58 29 20 |.... | INT(X) |
|00003410| 20 20 20 20 20 20 20 20 | 20 20 20 20 77 68 65 72 | | wher|
|00003420| 65 20 58 20 69 73 20 61 | 20 6e 75 6d 65 72 69 63 |e X is a| numeric|
|00003430| 20 76 61 72 69 61 62 6c | 65 20 72 65 74 75 72 6e | variabl|e return|
|00003440| 73 20 74 68 65 20 6c 61 | 72 67 65 73 74 0d 0a 20 |s the la|rgest.. |
|00003450| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003460| 20 20 20 20 20 20 20 69 | 6e 74 65 67 65 72 20 74 | i|nteger t|
|00003470| 68 61 74 20 69 73 20 6c | 65 73 73 20 74 68 61 6e |hat is l|ess than|
|00003480| 20 6f 72 20 65 71 75 61 | 6c 20 74 6f 20 58 2e 0d | or equa|l to X..|
|00003490| 0a 0d 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |... | |
|000034a0| 20 20 20 20 20 20 20 20 | 20 20 20 54 68 65 20 77 | | The w|
|000034b0| 6f 72 64 69 6e 67 20 6d | 65 61 6e 73 20 74 68 61 |ording m|eans tha|
|000034c0| 74 20 49 4e 54 28 29 20 | 74 72 75 6e 63 61 74 65 |t INT() |truncate|
|000034d0| 73 20 28 65 6c 69 6d 69 | 6e 61 74 65 73 0d 0a 20 |s (elimi|nates.. |
|000034e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000034f0| 20 20 20 20 20 20 20 61 | 6e 79 20 72 65 6d 61 69 | a|ny remai|
|00003500| 6e 64 65 72 29 20 77 68 | 65 6e 20 79 6f 75 20 75 |nder) wh|en you u|
|00003510| 73 65 20 70 6f 73 69 74 | 69 76 65 20 6e 75 6d 62 |se posit|ive numb|
|00003520| 65 72 73 20 61 6e 64 0d | 0a 20 20 20 20 20 20 20 |ers and.|. |
|00003530| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003540| 20 72 6f 75 6e 64 73 20 | 75 70 20 77 68 65 6e 20 | rounds |up when |
|00003550| 79 6f 75 20 75 73 65 20 | 6e 65 67 61 74 69 76 65 |you use |negative|
|00003560| 20 6e 75 6d 62 65 72 73 | 2e 0d 0a 0d 0a 20 20 20 | numbers|..... |
|00003570| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003580| 20 20 20 20 20 45 78 61 | 6d 70 6c 65 3a 20 20 49 | Exa|mple: I|
|00003590| 66 20 58 20 69 73 20 33 | 2e 38 39 2c 20 74 68 65 |f X is 3|.89, the|
|000035a0| 6e 3a 0d 0a 0d 0a 20 20 | 20 20 20 20 20 20 20 20 |n:.... | |
|000035b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000035c0| 20 20 20 20 20 20 20 20 | 49 20 3d 20 49 4e 54 28 | |I = INT(|
|000035d0| 58 29 20 72 65 73 75 6c | 74 73 20 69 6e 20 49 20 |X) resul|ts in I |
|000035e0| 3d 20 33 2e 0d 0a 0d 0a | 20 20 20 20 20 20 20 20 |= 3.....| |
|000035f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003600| 20 20 20 20 20 20 20 20 | 20 20 49 66 20 58 20 69 | | If X i|
|00003610| 73 20 2d 31 32 2e 34 2c | 20 74 68 65 6e 3a 0d 0a |s -12.4,| then:..|
|00003620| 0d 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |.. | |
|00003630| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003640| 20 20 20 20 49 20 3d 20 | 49 4e 54 28 58 29 20 72 | I = |INT(X) r|
|00003650| 65 73 75 6c 74 73 20 69 | 6e 20 49 20 3d 20 2d 31 |esults i|n I = -1|
|00003660| 33 20 62 65 63 61 75 73 | 65 20 2d 31 33 0d 0a 20 |3 becaus|e -13.. |
|00003670| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003680| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003690| 20 20 20 20 20 69 73 20 | 74 68 65 20 6e 65 78 74 | is |the next|
|000036a0| 20 69 6e 74 65 67 65 72 | 20 6c 65 73 73 20 74 68 | integer| less th|
|000036b0| 61 6e 20 2d 31 32 2e 34 | 0d 0a 0d 0a 20 20 20 20 |an -12.4|.... |
|000036c0| 20 54 68 65 20 72 6f 75 | 74 69 6e 65 20 74 68 61 | The rou|tine tha|
|000036d0| 74 20 66 6f 6c 6c 6f 77 | 73 20 76 65 72 69 66 69 |t follow|s verifi|
|000036e0| 65 73 20 61 20 64 61 74 | 65 20 62 79 20 63 68 65 |es a dat|e by che|
|000036f0| 63 6b 69 6e 67 20 74 68 | 65 20 6d 6f 6e 74 68 20 |cking th|e month |
|00003700| 66 6f 72 20 61 0d 0a 20 | 20 20 20 20 72 61 6e 67 |for a.. | rang|
|00003710| 65 20 6f 66 20 31 20 74 | 6f 20 31 32 20 61 6e 64 |e of 1 t|o 12 and|
|00003720| 20 74 68 65 20 64 61 79 | 20 66 6f 72 20 61 20 6e | the day| for a n|
|00003730| 75 6d 62 65 72 20 6c 65 | 73 73 20 74 68 61 6e 20 |umber le|ss than |
|00003740| 6f 72 20 65 71 75 61 6c | 20 74 6f 20 74 68 65 0d |or equal| to the.|
|00003750| 0a 20 20 20 20 20 6d 61 | 78 69 6d 75 6d 20 6e 75 |. ma|ximum nu|
|00003760| 6d 62 65 72 20 6f 66 20 | 64 61 79 73 20 69 6e 20 |mber of |days in |
|00003770| 74 68 61 74 20 6d 6f 6e | 74 68 2e 20 20 57 68 61 |that mon|th. Wha|
|00003780| 74 20 61 62 6f 75 74 20 | 6c 65 61 70 69 6e 67 20 |t about |leaping |
|00003790| 46 65 62 72 75 61 72 69 | 65 73 3f 0d 0a 0d 0a 0d |Februari|es?.....|
|000037a0| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|000037b0| 20 20 1b 45 20 20 20 20 | 20 20 20 20 20 20 20 20 | .E | |
|000037c0| 20 20 20 20 1b 46 20 20 | 20 20 20 20 20 1b 45 20 | .F | .E |
|000037d0| 31 34 34 0d 0a 0d 0a 0c | 0d 0a 0d 0a 0d 0a 0d 0a |144.....|........|
|000037e0| 1b 46 20 20 20 20 20 1b | 45 43 48 41 50 54 45 52 |.F .|ECHAPTER|
|000037f0| 20 31 31 1b 46 20 20 20 | 20 20 20 20 20 20 20 20 | 11.F | |
|00003800| 20 20 20 20 20 1b 45 20 | 47 4f 4f 44 20 53 54 55 | .E |GOOD STU|
|00003810| 46 46 2c 20 43 48 45 41 | 50 20 20 1b 46 20 20 20 |FF, CHEA|P .F |
|00003820| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 1b 45 43 | | .EC|
|00003830| 48 41 50 54 45 52 20 31 | 31 0d 0a 0d 0a 0d 0a 20 |HAPTER 1|1...... |
|00003840| 20 20 20 20 1b 46 4c 65 | 61 70 20 79 65 61 72 73 | .FLe|ap years|
|00003850| 20 68 61 76 65 20 6f 6e | 65 20 65 6e 64 65 61 72 | have on|e endear|
|00003860| 69 6e 67 20 66 65 61 74 | 75 72 65 2c 20 74 68 65 |ing feat|ure, the|
|00003870| 20 6c 61 73 74 20 74 77 | 6f 20 64 69 67 69 74 73 | last tw|o digits|
|00003880| 20 61 72 65 20 61 6c 77 | 61 79 73 0d 0a 20 20 20 | are alw|ays.. |
|00003890| 20 20 64 69 76 69 73 69 | 62 6c 65 20 28 74 68 65 | divisi|ble (the|
|000038a0| 20 72 65 73 75 6c 74 20 | 69 73 20 61 6e 20 69 6e | result |is an in|
|000038b0| 74 65 67 65 72 29 20 62 | 79 20 66 6f 75 72 2e 20 |teger) b|y four. |
|000038c0| 20 57 65 20 63 61 6e 20 | 74 61 6b 65 20 61 64 76 | We can |take adv|
|000038d0| 61 6e 74 61 67 65 20 6f | 66 0d 0a 20 20 20 20 20 |antage o|f.. |
|000038e0| 74 68 69 73 20 62 79 20 | 64 69 76 69 64 69 6e 67 |this by |dividing|
|000038f0| 20 74 68 65 20 79 65 61 | 72 20 62 79 20 66 6f 75 | the yea|r by fou|
|00003900| 72 20 61 6e 64 20 63 6f | 6e 76 65 72 74 69 6e 67 |r and co|nverting|
|00003910| 20 74 68 65 20 72 65 73 | 75 6c 74 69 6e 67 20 6e | the res|ulting n|
|00003920| 75 6d 62 65 72 20 74 6f | 0d 0a 20 20 20 20 20 61 |umber to|.. a|
|00003930| 6e 20 69 6e 74 65 67 65 | 72 2e 20 20 46 6f 72 20 |n intege|r. For |
|00003940| 61 20 6c 65 61 70 20 79 | 65 61 72 2c 20 74 68 65 |a leap y|ear, the|
|00003950| 20 63 6f 6e 76 65 72 73 | 69 6f 6e 20 73 68 6f 75 | convers|ion shou|
|00003960| 6c 64 20 68 61 76 65 20 | 6e 6f 20 65 66 66 65 63 |ld have |no effec|
|00003970| 74 20 28 38 30 2f 34 0d | 0a 20 20 20 20 20 3d 20 |t (80/4.|. = |
|00003980| 31 35 2c 20 49 4e 54 28 | 31 35 29 20 3d 20 31 35 |15, INT(|15) = 15|
|00003990| 29 2e 20 20 46 6f 72 20 | 6f 74 68 65 72 20 79 65 |). For |other ye|
|000039a0| 61 72 73 2c 20 74 72 75 | 6e 63 61 74 69 6f 6e 20 |ars, tru|ncation |
|000039b0| 72 65 73 75 6c 74 73 20 | 28 38 31 2f 34 20 3d 20 |results |(81/4 = |
|000039c0| 31 35 2e 32 35 2c 0d 0a | 20 20 20 20 20 49 4e 54 |15.25,..| INT|
|000039d0| 28 31 35 2e 32 35 29 20 | 3d 20 31 35 29 2e 20 20 |(15.25) |= 15). |
|000039e0| 49 66 20 77 65 20 6d 75 | 6c 74 69 70 6c 79 20 74 |If we mu|ltiply t|
|000039f0| 68 65 20 72 65 73 75 6c | 74 20 6f 66 20 74 68 65 |he resul|t of the|
|00003a00| 20 64 69 76 69 73 69 6f | 6e 20 62 79 20 66 6f 75 | divisio|n by fou|
|00003a10| 72 2c 0d 0a 20 20 20 20 | 20 74 68 65 20 70 72 6f |r,.. | the pro|
|00003a20| 64 75 63 74 20 77 69 6c | 6c 20 6f 6e 6c 79 20 65 |duct wil|l only e|
|00003a30| 71 75 61 6c 20 74 68 65 | 20 6f 72 69 67 69 6e 61 |qual the| origina|
|00003a40| 6c 20 6e 75 6d 62 65 72 | 20 69 66 20 6e 6f 20 74 |l number| if no t|
|00003a50| 72 75 6e 63 61 74 69 6f | 6e 0d 0a 20 20 20 20 20 |runcatio|n.. |
|00003a60| 6f 63 63 75 72 72 65 64 | 2e 20 20 53 6f 2c 20 69 |occurred|. So, i|
|00003a70| 66 20 59 45 41 52 2f 34 | 20 3d 20 49 4e 54 28 59 |f YEAR/4| = INT(Y|
|00003a80| 45 41 52 2f 34 29 2a 34 | 20 74 68 65 6e 20 59 45 |EAR/4)*4| then YE|
|00003a90| 41 52 20 6d 75 73 74 20 | 62 65 20 61 20 6c 65 61 |AR must |be a lea|
|00003aa0| 70 20 79 65 61 72 2e 0d | 0a 0d 0a 20 20 20 20 20 |p year..|... |
|00003ab0| 48 65 72 65 27 73 20 74 | 68 65 20 73 75 62 72 6f |Here's t|he subro|
|00003ac0| 75 74 69 6e 65 2e 20 20 | 49 74 20 74 65 73 74 73 |utine. |It tests|
|00003ad0| 20 77 68 65 74 68 65 72 | 20 61 20 6d 6f 6e 74 68 | whether| a month|
|00003ae0| 20 61 6e 64 20 61 20 64 | 61 79 20 61 72 65 20 76 | and a d|ay are v|
|00003af0| 61 6c 69 64 2e 20 20 41 | 0d 0a 20 20 20 20 20 73 |alid. A|.. s|
|00003b00| 74 72 69 6e 67 2c 20 45 | 52 52 2e 4d 53 47 24 2c |tring, E|RR.MSG$,|
|00003b10| 20 69 73 20 72 65 74 75 | 72 6e 65 64 20 61 73 20 | is retu|rned as |
|00003b20| 6e 75 6c 6c 20 2c 22 22 | 2c 20 69 66 20 74 68 65 |null ,""|, if the|
|00003b30| 20 64 61 74 65 20 69 73 | 20 67 6f 6f 64 20 61 6e | date is| good an|
|00003b40| 64 20 77 69 74 68 0d 0a | 20 20 20 20 20 61 6e 20 |d with..| an |
|00003b50| 65 72 72 6f 72 20 6d 65 | 73 73 61 67 65 20 69 66 |error me|ssage if|
|00003b60| 20 69 74 20 69 73 20 62 | 61 64 2e 20 20 54 68 65 | it is b|ad. The|
|00003b70| 20 64 61 74 65 20 6d 75 | 73 74 20 61 73 73 69 67 | date mu|st assig|
|00003b80| 6e 65 64 20 74 6f 20 74 | 68 65 20 76 61 72 69 61 |ned to t|he varia|
|00003b90| 62 6c 65 0d 0a 20 20 20 | 20 20 44 41 54 45 2e 49 |ble.. | DATE.I|
|00003ba0| 4e 24 20 61 6e 64 20 63 | 61 6e 20 62 65 20 69 6e |N$ and c|an be in|
|00003bb0| 20 65 69 74 68 65 72 20 | 4d 4d 2d 44 44 2d 59 59 | either |MM-DD-YY|
|00003bc0| 2c 20 4d 4d 2d 44 44 2d | 59 59 59 59 2c 20 4d 4d |, MM-DD-|YYYY, MM|
|00003bd0| 2f 44 44 2f 59 59 59 59 | 20 6f 72 0d 0a 20 20 20 |/DD/YYYY| or.. |
|00003be0| 20 20 4d 4d 2f 44 44 2f | 59 59 20 66 6f 72 6d 61 | MM/DD/|YY forma|
|00003bf0| 74 2e 0d 0a 0d 0a 20 20 | 20 20 20 35 35 30 30 20 |t..... | 5500 |
|00003c00| 27 20 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |' ******|********|
|00003c10| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00003c20| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00003c30| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00003c40| 2a 2a 0d 0a 20 20 20 20 | 20 35 35 31 30 20 27 20 |**.. | 5510 ' |
|00003c50| 54 48 49 53 20 52 4f 55 | 54 49 4e 45 20 43 48 45 |THIS ROU|TINE CHE|
|00003c60| 43 4b 53 20 41 4e 20 41 | 4c 50 48 41 20 44 41 54 |CKS AN A|LPHA DAT|
|00003c70| 45 20 49 4e 20 54 48 45 | 20 46 4f 52 4d 41 54 20 |E IN THE| FORMAT |
|00003c80| 4d 4d 2d 44 44 2d 59 59 | 59 59 20 4f 52 20 49 4e |MM-DD-YY|YY OR IN|
|00003c90| 0d 0a 20 20 20 20 20 35 | 35 32 30 20 27 20 54 48 |.. 5|520 ' TH|
|00003ca0| 45 20 46 4f 52 4d 41 54 | 20 4d 4d 2d 44 44 2d 59 |E FORMAT| MM-DD-Y|
|00003cb0| 59 20 46 4f 52 20 41 20 | 56 41 4c 49 44 20 44 41 |Y FOR A |VALID DA|
|00003cc0| 59 20 41 4e 44 20 4d 4f | 4e 54 48 20 45 4e 54 52 |Y AND MO|NTH ENTR|
|00003cd0| 59 2e 20 20 54 48 45 20 | 44 41 54 45 0d 0a 20 20 |Y. THE |DATE.. |
|00003ce0| 20 20 20 35 35 33 30 20 | 27 20 4d 55 53 54 20 42 | 5530 |' MUST B|
|00003cf0| 45 20 53 54 4f 52 45 44 | 20 49 4e 20 54 48 45 20 |E STORED| IN THE |
|00003d00| 53 54 52 49 4e 47 20 56 | 41 52 49 41 42 4c 45 20 |STRING V|ARIABLE |
|00003d10| 27 44 41 54 45 2e 49 4e | 24 27 2e 20 20 54 48 45 |'DATE.IN|$'. THE|
|00003d20| 20 4d 41 49 4e 0d 0a 20 | 20 20 20 20 35 35 34 30 | MAIN.. | 5540|
|00003d30| 20 27 20 4c 4f 47 49 43 | 20 53 48 4f 55 4c 44 20 | ' LOGIC| SHOULD |
|00003d40| 54 45 53 54 20 4f 4e 20 | 45 52 52 2e 4d 53 47 24 |TEST ON |ERR.MSG$|
|00003d50| 20 3c 3e 20 22 22 20 54 | 4f 20 44 45 54 45 52 4d | <> "" T|O DETERM|
|00003d60| 49 4e 45 20 49 46 20 45 | 52 52 4f 52 53 20 45 58 |INE IF E|RRORS EX|
|00003d70| 49 53 54 0d 0a 20 20 20 | 20 20 35 35 35 30 20 27 |IST.. | 5550 '|
|00003d80| 20 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a | *******|********|
|00003d90| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00003da0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00003db0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00003dc0| 2a 0d 0a 20 20 20 20 20 | 35 35 36 30 20 27 0d 0a |*.. |5560 '..|
|00003dd0| 20 20 20 20 20 35 35 37 | 30 20 4d 41 58 2e 44 41 | 557|0 MAX.DA|
|00003de0| 59 24 20 3d 20 22 33 31 | 32 38 33 31 33 30 33 31 |Y$ = "31|28313031|
|00003df0| 33 30 33 31 33 31 33 30 | 33 31 33 30 33 31 32 39 |30313130|31303129|
|00003e00| 22 20 20 20 20 20 20 20 | 20 20 20 27 4d 41 58 20 |" | 'MAX |
|00003e10| 44 41 59 53 20 49 4e 20 | 4d 54 48 0d 0a 20 20 20 |DAYS IN |MTH.. |
|00003e20| 20 20 35 35 38 30 20 45 | 52 52 2e 4d 53 47 24 20 | 5580 E|RR.MSG$ |
|00003e30| 3d 20 22 22 0d 0a 20 20 | 20 20 20 35 35 39 30 20 |= "".. | 5590 |
|00003e40| 27 0d 0a 20 20 20 20 20 | 35 36 30 30 20 4d 4f 4e |'.. |5600 MON|
|00003e50| 54 48 20 3d 20 56 41 4c | 28 4c 45 46 54 24 28 44 |TH = VAL|(LEFT$(D|
|00003e60| 41 54 45 2e 49 4e 24 2c | 32 29 29 0d 0a 20 20 20 |ATE.IN$,|2)).. |
|00003e70| 20 20 35 36 31 30 20 44 | 41 59 20 20 20 3d 20 56 | 5610 D|AY = V|
|00003e80| 41 4c 28 4d 49 44 24 28 | 44 41 54 45 2e 49 4e 24 |AL(MID$(|DATE.IN$|
|00003e90| 2c 34 2c 32 29 29 0d 0a | 20 20 20 20 20 35 36 32 |,4,2))..| 562|
|00003ea0| 30 20 59 45 41 52 20 20 | 3d 20 56 41 4c 28 52 49 |0 YEAR |= VAL(RI|
|00003eb0| 47 48 54 24 28 44 41 54 | 45 2e 49 4e 24 2c 32 29 |GHT$(DAT|E.IN$,2)|
|00003ec0| 29 0d 0a 20 20 20 20 20 | 35 36 33 30 20 27 0d 0a |).. |5630 '..|
|00003ed0| 20 20 20 20 20 35 36 34 | 30 20 49 46 20 4d 4f 4e | 564|0 IF MON|
|00003ee0| 54 48 20 3c 20 31 20 20 | 4f 52 20 20 4d 4f 4e 54 |TH < 1 |OR MONT|
|00003ef0| 48 20 3e 20 31 32 0d 0a | 20 20 20 20 20 20 20 20 |H > 12..| |
|00003f00| 20 20 20 20 20 54 48 45 | 4e 20 20 45 52 52 2e 4d | THE|N ERR.M|
|00003f10| 53 47 24 20 3d 20 22 4d | 6f 6e 74 68 20 22 20 2b |SG$ = "M|onth " +|
|00003f20| 20 53 54 52 24 28 4d 4f | 4e 54 48 29 20 2b 20 22 | STR$(MO|NTH) + "|
|00003f30| 20 64 6f 65 73 20 6e 6f | 74 20 65 78 69 73 74 21 | does no|t exist!|
|00003f40| 21 21 22 3a 0d 0a 20 20 | 20 20 20 20 20 20 20 20 |!!":.. | |
|00003f50| 20 20 20 52 45 54 55 52 | 4e 0d 0a 20 20 20 20 20 | RETUR|N.. |
|00003f60| 35 36 35 30 20 27 0d 0a | 20 20 20 20 20 35 36 36 |5650 '..| 566|
|00003f70| 30 20 54 45 53 54 2e 4d | 4f 4e 54 48 20 3d 20 4d |0 TEST.M|ONTH = M|
|00003f80| 4f 4e 54 48 0d 0a 20 20 | 20 20 20 35 36 37 30 20 |ONTH.. | 5670 |
|00003f90| 27 0d 0a 20 20 20 20 20 | 35 36 38 30 20 49 46 20 |'.. |5680 IF |
|00003fa0| 54 45 53 54 2e 4d 4f 4e | 54 48 20 3d 20 32 20 20 |TEST.MON|TH = 2 |
|00003fb0| 41 4e 44 20 20 49 4e 54 | 28 59 45 41 52 29 20 3d |AND INT|(YEAR) =|
|00003fc0| 20 34 20 2a 20 49 4e 54 | 28 59 45 41 52 2f 34 29 | 4 * INT|(YEAR/4)|
|00003fd0| 0d 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 54 |.. | T|
|00003fe0| 48 45 4e 20 54 45 53 54 | 2e 4d 4f 4e 54 48 20 3d |HEN TEST|.MONTH =|
|00003ff0| 20 31 33 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | 13 | |
|00004000| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 27 4c 45 | | 'LE|
|00004010| 41 50 20 59 45 41 52 0d | 0a 20 20 20 20 20 35 36 |AP YEAR.|. 56|
|00004020| 39 30 20 27 0d 0a 20 20 | 20 20 20 35 37 30 30 20 |90 '.. | 5700 |
|00004030| 49 46 20 44 41 59 20 3c | 20 31 20 20 4f 52 20 20 |IF DAY <| 1 OR |
|00004040| 44 41 59 20 3e 20 56 41 | 4c 20 28 4d 49 44 24 20 |DAY > VA|L (MID$ |
|00004050| 28 4d 41 58 2e 44 41 59 | 24 2c 20 32 2a 54 45 53 |(MAX.DAY|$, 2*TES|
|00004060| 54 2e 4d 4f 4e 54 48 2d | 31 2c 20 32 29 29 0d 0a |T.MONTH-|1, 2))..|
|00004070| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 54 48 45 | | THE|
|00004080| 4e 20 45 52 52 2e 4d 53 | 47 24 20 3d 20 53 54 52 |N ERR.MS|G$ = STR|
|00004090| 24 28 44 41 59 29 20 2b | 20 22 20 69 73 20 61 20 |$(DAY) +| " is a |
|000040a0| 62 61 64 20 64 61 79 21 | 21 21 22 0d 0a 20 20 20 |bad day!|!!".. |
|000040b0| 20 20 35 37 31 30 20 27 | 0d 0a 20 20 20 20 20 35 | 5710 '|.. 5|
|000040c0| 37 32 30 20 52 45 54 55 | 52 4e 0d 0a 0d 0a 20 20 |720 RETU|RN.... |
|000040d0| 20 20 20 49 74 20 77 69 | 6c 6c 20 62 65 20 65 61 | It wi|ll be ea|
|000040e0| 73 69 65 72 20 74 6f 20 | 65 78 70 6c 61 69 6e 20 |sier to |explain |
|000040f0| 6c 69 6e 65 20 35 35 37 | 30 20 6c 61 74 65 72 20 |line 557|0 later |
|00004100| 73 6f 20 6c 65 74 27 73 | 20 73 6b 69 70 20 69 74 |so let's| skip it|
|00004110| 20 61 6e 64 20 6d 6f 76 | 65 0d 0a 20 20 20 20 20 | and mov|e.. |
|00004120| 6f 6e 20 74 6f 20 74 68 | 65 20 72 65 73 74 20 6f |on to th|e rest o|
|00004130| 66 20 74 68 65 20 63 6f | 64 65 2e 0d 0a 0d 0a 20 |f the co|de..... |
|00004140| 20 20 20 20 2d 20 4c 69 | 6e 65 73 20 35 36 30 30 | - Li|nes 5600|
|00004150| 20 74 68 72 6f 75 67 68 | 20 35 36 32 30 20 73 69 | through| 5620 si|
|00004160| 6d 70 6c 79 20 65 78 74 | 72 61 63 74 20 74 68 65 |mply ext|ract the|
|00004170| 20 6e 75 6d 65 72 69 63 | 20 65 71 75 69 76 61 6c | numeric| equival|
|00004180| 65 6e 74 20 6f 66 20 74 | 68 65 0d 0a 20 20 20 20 |ent of t|he.. |
|00004190| 20 20 20 6d 6f 6e 74 68 | 2c 20 64 61 79 20 61 6e | month|, day an|
|000041a0| 64 20 6c 61 73 74 20 74 | 77 6f 20 64 69 67 69 74 |d last t|wo digit|
|000041b0| 73 20 6f 66 20 74 68 65 | 20 79 65 61 72 2e 20 20 |s of the| year. |
|000041c0| 53 69 6e 63 65 20 6c 69 | 6e 65 20 35 36 32 30 20 |Since li|ne 5620 |
|000041d0| 6f 6e 6c 79 20 75 73 65 | 73 0d 0a 20 20 20 20 20 |only use|s.. |
|000041e0| 20 20 74 68 65 20 6c 61 | 73 74 20 74 77 6f 20 70 | the la|st two p|
|000041f0| 6f 73 69 74 69 6f 6e 73 | 20 6f 66 20 74 68 65 20 |ositions| of the |
|00004200| 64 61 74 65 2c 20 69 74 | 20 64 6f 65 73 6e 27 74 |date, it| doesn't|
|00004210| 20 63 61 72 65 20 69 66 | 20 69 74 27 73 20 31 39 | care if| it's 19|
|00004220| 38 37 20 6f 72 0d 0a 20 | 20 20 20 20 20 20 38 37 |87 or.. | 87|
|00004230| 2e 20 20 54 68 65 20 72 | 65 73 75 6c 74 73 20 77 |. The r|esults w|
|00004240| 69 6c 6c 20 62 65 20 74 | 68 65 20 73 61 6d 65 2e |ill be t|he same.|
|00004250| 0d 0a 0d 0a 20 20 20 20 | 20 2d 20 4c 69 6e 65 20 |.... | - Line |
|00004260| 35 36 34 30 20 63 68 65 | 63 6b 73 20 74 68 65 20 |5640 che|cks the |
|00004270| 6d 6f 6e 74 68 20 61 6e | 64 20 73 65 74 73 20 61 |month an|d sets a|
|00004280| 6e 20 65 72 72 6f 72 20 | 6d 65 73 73 61 67 65 20 |n error |message |
|00004290| 69 66 20 6e 65 65 64 20 | 62 65 2e 0d 0a 0d 0a 0d |if need |be......|
|000042a0| 0a 0d 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |... | |
|000042b0| 20 20 20 20 1b 45 20 20 | 20 20 20 20 20 20 20 20 | .E | |
|000042c0| 20 20 20 20 20 20 1b 46 | 20 20 20 20 20 20 20 1b | .F| .|
|000042d0| 45 20 31 34 35 0d 0a 0d | 0a 0c 0d 0a 0d 0a 0d 0a |E 145...|........|
|000042e0| 0d 0a 1b 46 20 20 20 20 | 20 1b 45 43 48 41 50 54 |...F | .ECHAPT|
|000042f0| 45 52 20 31 31 1b 46 20 | 20 20 20 20 20 20 20 20 |ER 11.F | |
|00004300| 20 20 20 20 20 20 20 1b | 45 20 47 4f 4f 44 20 53 | .|E GOOD S|
|00004310| 54 55 46 46 2c 20 43 48 | 45 41 50 20 20 1b 46 20 |TUFF, CH|EAP .F |
|00004320| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 1b | | .|
|00004330| 45 43 48 41 50 54 45 52 | 20 31 31 0d 0a 0d 0a 0d |ECHAPTER| 11.....|
|00004340| 0a 20 20 20 20 20 1b 46 | 2d 20 4c 69 6e 65 20 35 |. .F|- Line 5|
|00004350| 36 36 30 20 73 74 61 72 | 74 73 20 74 68 65 20 64 |660 star|ts the d|
|00004360| 61 79 20 63 68 65 63 6b | 2e 20 20 4d 41 58 2e 44 |ay check|. MAX.D|
|00004370| 41 59 24 2c 20 6f 6e 20 | 6c 69 6e 65 20 35 35 37 |AY$, on |line 557|
|00004380| 30 2c 20 68 61 73 20 74 | 68 69 72 74 65 65 6e 0d |0, has t|hirteen.|
|00004390| 0a 20 20 20 20 20 20 20 | 74 77 6f 2d 64 69 67 69 |. |two-digi|
|000043a0| 74 20 6e 75 6d 62 65 72 | 73 2e 20 20 54 68 65 20 |t number|s. The |
|000043b0| 66 69 72 73 74 20 74 77 | 65 6c 76 65 20 63 6f 72 |first tw|elve cor|
|000043c0| 72 65 73 70 6f 6e 64 20 | 74 6f 20 74 68 65 20 6d |respond |to the m|
|000043d0| 61 78 69 6d 75 6d 20 6e | 75 6d 62 65 72 0d 0a 20 |aximum n|umber.. |
|000043e0| 20 20 20 20 20 20 6f 66 | 20 64 61 79 73 20 69 6e | of| days in|
|000043f0| 20 65 61 63 68 20 6f 66 | 20 74 68 65 20 74 77 65 | each of| the twe|
|00004400| 6c 76 65 20 6d 6f 6e 74 | 68 73 2e 20 20 54 68 65 |lve mont|hs. The|
|00004410| 20 74 68 69 72 74 65 65 | 6e 74 68 20 67 6f 65 73 | thirtee|nth goes|
|00004420| 20 77 69 74 68 0d 0a 20 | 20 20 20 20 20 20 6c 65 | with.. | le|
|00004430| 61 70 69 6e 67 20 46 65 | 62 72 75 61 72 69 65 73 |aping Fe|bruaries|
|00004440| 2e 20 20 57 65 20 75 73 | 65 20 54 45 53 54 2e 4d |. We us|e TEST.M|
|00004450| 4f 4e 54 48 20 72 61 74 | 68 65 72 20 74 68 61 6e |ONTH rat|her than|
|00004460| 20 4d 4f 4e 54 48 20 62 | 65 63 61 75 73 65 20 74 | MONTH b|ecause t|
|00004470| 68 65 0d 0a 20 20 20 20 | 20 20 20 76 61 6c 75 65 |he.. | value|
|00004480| 20 67 65 74 73 20 72 65 | 73 65 74 20 74 6f 20 31 | gets re|set to 1|
|00004490| 33 20 66 6f 72 20 46 65 | 62 72 75 61 72 79 20 6f |3 for Fe|bruary o|
|000044a0| 66 20 61 20 6c 65 61 70 | 20 79 65 61 72 2e 20 20 |f a leap| year. |
|000044b0| 54 68 69 73 20 70 6f 69 | 6e 74 73 20 74 6f 0d 0a |This poi|nts to..|
|000044c0| 20 20 20 20 20 20 20 74 | 68 65 20 63 6f 72 72 65 | t|he corre|
|000044d0| 63 74 20 73 65 74 20 6f | 66 20 6e 75 6d 62 65 72 |ct set o|f number|
|000044e0| 73 20 69 6e 20 4d 41 58 | 2e 44 41 59 24 20 28 6c |s in MAX|.DAY$ (l|
|000044f0| 69 6e 65 20 35 36 38 30 | 29 20 77 69 74 68 6f 75 |ine 5680|) withou|
|00004500| 74 20 6d 65 73 73 69 6e | 67 20 75 70 0d 0a 20 20 |t messin|g up.. |
|00004510| 20 20 20 1b 45 20 20 1b | 46 4d 4f 4e 54 48 2e 0d | .E .|FMONTH..|
|00004520| 0a 0d 0a 20 20 20 20 20 | 2d 20 4c 69 6e 65 20 35 |... |- Line 5|
|00004530| 36 38 30 20 77 69 6c 6c | 20 63 68 61 6e 67 65 20 |680 will| change |
|00004540| 54 45 53 54 2e 4d 4f 4e | 54 48 20 74 6f 20 31 33 |TEST.MON|TH to 13|
|00004550| 20 69 66 20 74 68 65 20 | 6d 6f 6e 74 68 20 69 73 | if the |month is|
|00004560| 20 46 65 62 72 75 61 72 | 79 20 69 6e 0d 0a 20 20 | Februar|y in.. |
|00004570| 20 20 20 20 20 61 20 6c | 65 61 70 20 79 65 61 72 | a l|eap year|
|00004580| 2e 20 20 54 68 65 20 6c | 65 61 70 20 79 65 61 72 |. The l|eap year|
|00004590| 20 74 65 73 74 20 68 61 | 73 20 61 6c 72 65 61 64 | test ha|s alread|
|000045a0| 79 20 62 65 65 6e 20 65 | 78 70 6c 61 69 6e 65 64 |y been e|xplained|
|000045b0| 2e 20 20 41 20 76 61 6c | 75 65 0d 0a 20 20 20 20 |. A val|ue.. |
|000045c0| 20 20 20 6f 66 20 31 33 | 20 61 6c 6c 6f 77 73 20 | of 13| allows |
|000045d0| 6c 69 6e 65 20 35 37 30 | 30 20 74 6f 20 65 78 74 |line 570|0 to ext|
|000045e0| 72 61 63 74 20 74 68 65 | 20 31 33 74 68 20 73 65 |ract the| 13th se|
|000045f0| 74 20 28 32 39 29 20 69 | 6e 20 4d 41 58 2e 44 41 |t (29) i|n MAX.DA|
|00004600| 59 24 2e 0d 0a 0d 0a 20 | 20 20 20 20 2d 20 4c 69 |Y$..... | - Li|
|00004610| 6e 65 20 35 37 30 30 20 | 74 65 73 74 73 20 74 68 |ne 5700 |tests th|
|00004620| 65 20 64 61 79 2e 20 20 | 4e 6f 74 65 20 68 6f 77 |e day. |Note how|
|00004630| 20 77 65 20 65 78 74 72 | 61 63 74 20 74 68 65 20 | we extr|act the |
|00004640| 61 70 70 72 6f 70 72 69 | 61 74 65 20 75 70 70 65 |appropri|ate uppe|
|00004650| 72 0d 0a 20 20 20 20 20 | 20 20 6c 69 6d 69 74 20 |r.. | limit |
|00004660| 66 72 6f 6d 20 4d 41 58 | 2e 44 41 59 24 2e 20 20 |from MAX|.DAY$. |
|00004670| 49 66 20 54 45 53 54 2e | 4d 4f 4e 54 48 20 69 73 |If TEST.|MONTH is|
|00004680| 20 31 2c 20 74 68 65 6e | 20 20 32 20 2a 20 54 45 | 1, then| 2 * TE|
|00004690| 53 54 2e 4d 4f 4e 54 48 | 20 2d 20 31 20 3d 0d 0a |ST.MONTH| - 1 =..|
|000046a0| 20 20 20 20 20 20 20 31 | 2e 20 20 49 66 20 54 45 | 1|. If TE|
|000046b0| 53 54 2e 4d 4f 4e 54 48 | 20 69 73 20 32 2c 20 74 |ST.MONTH| is 2, t|
|000046c0| 68 65 6e 20 32 20 2a 20 | 54 45 53 54 2e 4d 4f 4e |hen 2 * |TEST.MON|
|000046d0| 54 48 20 2d 20 31 20 3d | 20 33 2c 20 65 74 63 2e |TH - 1 =| 3, etc.|
|000046e0| 20 20 54 68 69 73 0d 0a | 20 20 20 20 20 20 20 6c | This..| l|
|000046f0| 6f 63 61 74 65 73 20 74 | 68 65 20 62 65 67 69 6e |ocates t|he begin|
|00004700| 6e 69 6e 67 20 6f 66 20 | 74 68 65 20 74 77 6f 20 |ning of |the two |
|00004710| 64 69 67 69 74 20 73 65 | 74 20 74 6f 20 62 65 20 |digit se|t to be |
|00004720| 63 6f 6e 76 65 72 74 65 | 64 2e 20 20 4d 49 44 24 |converte|d. MID$|
|00004730| 28 29 0d 0a 20 20 20 20 | 20 20 20 65 78 74 72 61 |().. | extra|
|00004740| 63 74 73 20 74 68 65 20 | 74 77 6f 20 64 69 67 69 |cts the |two digi|
|00004750| 74 73 2c 20 61 6e 64 20 | 56 41 4c 28 29 20 63 6f |ts, and |VAL() co|
|00004760| 6e 76 65 72 74 73 20 74 | 68 65 6d 2e 0d 0a 0d 0a |nverts t|hem.....|
|00004770| 20 20 20 20 20 54 6f 20 | 75 73 65 20 74 68 65 20 | To |use the |
|00004780| 72 6f 75 74 69 6e 65 2c | 20 73 74 6f 72 65 20 74 |routine,| store t|
|00004790| 68 65 20 64 61 74 65 20 | 79 6f 75 20 77 61 6e 74 |he date |you want|
|000047a0| 20 63 68 65 63 6b 65 64 | 20 69 6e 20 44 41 54 45 | checked| in DATE|
|000047b0| 2e 49 4e 24 20 61 6e 64 | 20 74 68 65 6e 0d 0a 20 |.IN$ and| then.. |
|000047c0| 20 20 20 20 64 6f 20 61 | 20 47 4f 53 55 42 2e 20 | do a| GOSUB. |
|000047d0| 20 54 65 73 74 20 6f 6e | 20 45 52 52 2e 4d 53 47 | Test on| ERR.MSG|
|000047e0| 24 20 61 6e 64 20 70 65 | 72 66 6f 72 6d 20 77 68 |$ and pe|rform wh|
|000047f0| 61 74 65 76 65 72 20 61 | 63 74 69 6f 6e 20 69 73 |atever a|ction is|
|00004800| 20 61 70 70 72 6f 70 72 | 69 61 74 65 0d 0a 20 20 | appropr|iate.. |
|00004810| 20 20 20 77 68 65 6e 20 | 79 6f 75 20 72 65 74 75 | when |you retu|
|00004820| 72 6e 2e 0d 0a 0d 0a 0d | 0a 20 20 20 20 20 1b 45 |rn......|. .E|
|00004830| 54 48 45 20 56 45 52 59 | 20 4c 41 53 54 20 53 50 |THE VERY| LAST SP|
|00004840| 45 43 49 46 49 43 41 54 | 49 4f 4e 0d 0a 0d 0a 20 |ECIFICAT|ION.... |
|00004850| 20 20 20 20 1b 46 54 68 | 65 20 72 6f 75 74 69 6e | .FTh|e routin|
|00004860| 65 20 74 68 61 74 20 68 | 61 6e 64 6c 65 64 20 6c |e that h|andled l|
|00004870| 65 61 70 69 6e 67 20 46 | 65 62 72 75 61 72 69 65 |eaping F|ebruarie|
|00004880| 73 20 6e 65 65 64 73 20 | 74 6f 20 62 65 20 69 6d |s needs |to be im|
|00004890| 70 72 6f 76 65 64 2e 20 | 20 57 65 0d 0a 20 20 20 |proved. | We.. |
|000048a0| 20 20 6e 65 65 64 20 74 | 6f 20 72 65 63 6f 67 6e | need t|o recogn|
|000048b0| 69 7a 65 20 74 68 61 74 | 20 6c 65 61 70 20 79 65 |ize that| leap ye|
|000048c0| 61 72 73 20 64 6f 20 6e | 6f 74 20 6f 63 63 75 72 |ars do n|ot occur|
|000048d0| 20 6f 6e 20 65 76 65 6e | 20 79 65 61 72 73 20 65 | on even| years e|
|000048e0| 76 65 6e 6c 79 0d 0a 20 | 20 20 20 20 64 69 76 69 |venly.. | divi|
|000048f0| 73 69 62 6c 65 20 62 79 | 20 66 6f 75 72 20 77 68 |sible by| four wh|
|00004900| 65 6e 20 74 68 65 79 20 | 61 72 65 20 61 6c 73 6f |en they |are also|
|00004910| 20 65 76 65 6e 6c 79 20 | 64 69 76 69 73 69 62 6c | evenly |divisibl|
|00004920| 65 20 62 79 20 31 30 30 | 2e 20 20 47 65 6e 65 72 |e by 100|. Gener|
|00004930| 61 74 65 0d 0a 20 20 20 | 20 20 61 20 73 75 62 72 |ate.. | a subr|
|00004940| 6f 75 74 69 6e 65 20 74 | 68 61 74 20 68 61 6e 64 |outine t|hat hand|
|00004950| 6c 65 73 20 74 68 6f 73 | 65 20 79 65 61 72 73 2e |les thos|e years.|
|00004960| 0d 0a 0d 0a 20 20 20 20 | 20 49 4e 53 54 52 28 29 |.... | INSTR()|
|00004970| 0d 0a 0d 0a 20 20 20 20 | 20 49 4e 53 54 52 28 53 |.... | INSTR(S|
|00004980| 74 72 69 6e 67 24 2c 53 | 74 24 29 20 77 68 65 72 |tring$,S|t$) wher|
|00004990| 65 20 53 74 72 69 6e 67 | 24 20 69 73 20 61 6e 79 |e String|$ is any|
|000049a0| 20 73 74 72 69 6e 67 20 | 61 6e 64 20 53 74 24 20 | string |and St$ |
|000049b0| 69 73 20 65 69 74 68 65 | 72 20 61 0d 0a 20 20 20 |is eithe|r a.. |
|000049c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000049d0| 20 20 20 20 20 63 68 61 | 72 61 63 74 65 72 20 6f | cha|racter o|
|000049e0| 72 20 61 20 73 74 72 69 | 6e 67 20 6f 66 20 63 68 |r a stri|ng of ch|
|000049f0| 61 72 61 63 74 65 72 73 | 2e 0d 0a 0d 0a 20 20 20 |aracters|..... |
|00004a00| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004a10| 20 20 20 20 20 54 68 69 | 73 20 66 75 6e 63 74 69 | Thi|s functi|
|00004a20| 6f 6e 20 73 65 61 72 63 | 68 20 53 74 72 69 6e 67 |on searc|h String|
|00004a30| 24 20 66 6f 72 20 6f 63 | 63 75 72 72 65 6e 63 65 |$ for oc|currence|
|00004a40| 73 20 6f 66 0d 0a 20 20 | 20 20 20 20 20 20 20 20 |s of.. | |
|00004a50| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 73 74 | | st|
|00004a60| 72 69 6e 67 20 53 74 24 | 2e 20 20 49 66 20 53 74 |ring St$|. If St|
|00004a70| 24 20 69 73 20 66 6f 75 | 6e 64 2c 20 49 4e 53 54 |$ is fou|nd, INST|
|00004a80| 52 28 29 20 72 65 74 75 | 72 6e 73 20 74 68 65 0d |R() retu|rns the.|
|00004a90| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00004aa0| 20 20 20 20 20 20 20 20 | 20 70 6f 73 69 74 69 6f | | positio|
|00004ab0| 6e 20 69 6e 20 53 74 72 | 69 6e 67 24 20 77 68 65 |n in Str|ing$ whe|
|00004ac0| 72 65 20 53 74 24 20 73 | 74 61 72 74 73 2e 20 20 |re St$ s|tarts. |
|00004ad0| 49 66 20 53 74 24 20 69 | 73 20 6e 6f 74 0d 0a 20 |If St$ i|s not.. |
|00004ae0| 20 20 20 20 1b 45 20 20 | 20 20 20 20 20 20 20 20 | .E | |
|00004af0| 20 20 20 20 20 20 20 20 | 20 1b 46 66 6f 75 6e 64 | | .Ffound|
|00004b00| 2c 20 69 74 20 72 65 74 | 75 72 6e 73 20 61 20 30 |, it ret|urns a 0|
|00004b10| 2e 0d 0a 0d 0a 20 20 20 | 20 20 20 20 20 20 20 20 |..... | |
|00004b20| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 45 78 61 | | Exa|
|00004b30| 6d 70 6c 65 3a 20 20 49 | 66 20 79 6f 75 20 77 61 |mple: I|f you wa|
|00004b40| 6e 74 20 74 6f 20 6c 6f | 63 61 74 65 20 74 68 65 |nt to lo|cate the|
|00004b50| 20 73 74 72 69 6e 67 20 | 22 46 22 20 69 6e 20 74 | string |"F" in t|
|00004b60| 68 65 0d 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |he.. | |
|00004b70| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004b80| 20 20 20 20 20 20 73 74 | 72 69 6e 67 20 22 41 42 | st|ring "AB|
|00004b90| 43 44 45 46 47 48 22 2c | 20 73 65 74 3a 0d 0a 0d |CDEFGH",| set:...|
|00004ba0| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00004bb0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004bc0| 20 20 20 4b 20 3d 20 49 | 4e 53 54 52 28 22 41 42 | K = I|NSTR("AB|
|00004bd0| 43 44 45 46 47 48 22 2c | 22 46 22 29 0d 0a 0d 0a |CDEFGH",|"F")....|
|00004be0| 20 20 20 20 20 48 65 72 | 65 27 73 20 61 20 72 6f | Her|e's a ro|
|00004bf0| 75 74 69 6e 65 20 74 68 | 61 74 20 75 73 65 73 20 |utine th|at uses |
|00004c00| 49 4e 53 54 52 28 29 20 | 74 6f 20 63 68 65 63 6b |INSTR() |to check|
|00004c10| 20 61 20 73 69 6e 67 6c | 65 20 63 68 61 72 61 63 | a singl|e charac|
|00004c20| 74 65 72 20 69 6e 70 75 | 74 20 66 6f 72 0d 0a 20 |ter inpu|t for.. |
|00004c30| 20 20 20 20 61 20 6d 61 | 72 69 74 61 6c 20 73 74 | a ma|rital st|
|00004c40| 61 74 75 73 3a 0d 0a 0d | 0a 20 20 20 20 20 36 30 |atus:...|. 60|
|00004c50| 30 30 20 27 20 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |00 ' ***|********|
|00004c60| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004c70| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004c80| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004c90| 2a 2a 2a 0d 0a 20 20 20 | 20 20 36 30 31 30 20 27 |***.. | 6010 '|
|00004ca0| 20 54 48 49 53 20 52 4f | 55 54 49 4e 45 20 43 48 | THIS RO|UTINE CH|
|00004cb0| 45 43 4b 53 20 4d 41 52 | 49 54 41 4c 20 53 54 41 |ECKS MAR|ITAL STA|
|00004cc0| 54 55 53 20 57 48 49 43 | 48 20 4d 55 53 54 20 42 |TUS WHIC|H MUST B|
|00004cd0| 45 20 53 54 4f 52 45 44 | 20 49 4e 20 54 48 45 0d |E STORED| IN THE.|
|00004ce0| 0a 20 20 20 20 20 36 30 | 32 30 20 27 20 56 41 52 |. 60|20 ' VAR|
|00004cf0| 49 41 42 4c 45 20 41 4e | 53 24 2e 20 20 4d 2c 53 |IABLE AN|S$. M,S|
|00004d00| 2c 57 2c 44 2c 6d 2c 73 | 2c 77 2c 20 4f 52 20 64 |,W,D,m,s|,w, OR d|
|00004d10| 20 41 52 45 20 54 48 45 | 20 4f 4e 4c 59 20 41 4c | ARE THE| ONLY AL|
|00004d20| 4c 4f 57 41 42 4c 45 0d | 0a 20 20 20 20 20 36 30 |LOWABLE.|. 60|
|00004d30| 33 30 20 27 20 52 45 53 | 50 4f 4e 53 45 53 2e 20 |30 ' RES|PONSES. |
|00004d40| 20 53 54 41 54 55 53 20 | 4f 46 20 54 48 45 20 45 | STATUS |OF THE E|
|00004d50| 52 52 4f 52 20 43 48 45 | 43 4b 20 49 53 20 52 45 |RROR CHE|CK IS RE|
|00004d60| 54 55 52 4e 45 44 20 49 | 4e 20 45 52 52 2e 4d 53 |TURNED I|N ERR.MS|
|00004d70| 47 24 0d 0a 20 20 20 20 | 20 36 30 34 30 20 27 20 |G$.. | 6040 ' |
|00004d80| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004d90| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004da0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004db0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 0d 0a |********|******..|
|00004dc0| 0d 0a 0d 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |.... | |
|00004dd0| 20 20 20 20 20 1b 45 20 | 20 20 20 20 20 20 20 20 | .E | |
|00004de0| 20 20 20 20 20 20 20 1b | 46 20 20 20 20 20 20 20 | .|F |
|00004df0| 1b 45 20 31 34 36 0d 0a | 0d 0a 0c 0d 0a 0d 0a 0d |.E 146..|........|
|00004e00| 0a 0d 0a 1b 46 20 20 20 | 20 20 1b 45 43 48 41 50 |....F | .ECHAP|
|00004e10| 54 45 52 20 31 31 1b 46 | 20 20 20 20 20 20 20 20 |TER 11.F| |
|00004e20| 20 20 20 20 20 20 20 20 | 1b 45 20 47 4f 4f 44 20 | |.E GOOD |
|00004e30| 53 54 55 46 46 2c 20 43 | 48 45 41 50 20 20 1b 46 |STUFF, C|HEAP .F|
|00004e40| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004e50| 1b 45 43 48 41 50 54 45 | 52 20 31 31 0d 0a 0d 0a |.ECHAPTE|R 11....|
|00004e60| 0d 0a 20 20 20 20 20 1b | 46 36 30 35 30 20 27 0d |.. .|F6050 '.|
|00004e70| 0a 20 20 20 20 20 36 30 | 36 30 20 45 52 52 2e 4d |. 60|60 ERR.M|
|00004e80| 53 47 24 20 3d 20 22 22 | 0d 0a 20 20 20 20 20 36 |SG$ = ""|.. 6|
|00004e90| 30 37 30 20 27 0d 0a 20 | 20 20 20 20 36 30 38 30 |070 '.. | 6080|
|00004ea0| 20 43 48 45 43 4b 20 3d | 20 49 4e 53 54 52 28 22 | CHECK =| INSTR("|
|00004eb0| 4d 53 57 44 6d 73 77 64 | 22 2c 41 4e 53 24 29 0d |MSWDmswd|",ANS$).|
|00004ec0| 0a 20 20 20 20 20 36 30 | 39 30 20 27 0d 0a 20 20 |. 60|90 '.. |
|00004ed0| 20 20 20 36 31 30 30 20 | 49 46 20 43 48 45 43 4b | 6100 |IF CHECK|
|00004ee0| 20 3d 20 30 0d 0a 20 20 | 20 20 20 20 20 20 20 20 | = 0.. | |
|00004ef0| 20 20 20 54 48 45 4e 20 | 45 52 52 2e 4d 53 47 24 | THEN |ERR.MSG$|
|00004f00| 20 3d 20 22 28 4d 29 61 | 72 72 69 65 64 2c 20 28 | = "(M)a|rried, (|
|00004f10| 53 29 69 6e 67 6c 65 2c | 20 28 44 29 69 76 6f 72 |S)ingle,| (D)ivor|
|00004f20| 63 65 64 20 6f 72 20 28 | 57 29 69 64 6f 77 65 64 |ced or (|W)idowed|
|00004f30| 22 0d 0a 20 20 20 20 20 | 36 31 31 30 20 27 0d 0a |".. |6110 '..|
|00004f40| 20 20 20 20 20 36 31 32 | 30 20 52 45 54 55 52 4e | 612|0 RETURN|
|00004f50| 0d 0a 0d 0a 20 20 20 20 | 20 54 68 65 20 66 69 72 |.... | The fir|
|00004f60| 73 74 20 73 74 72 69 6e | 67 20 69 6e 20 49 4e 53 |st strin|g in INS|
|00004f70| 54 52 28 29 20 63 6f 6e | 74 61 69 6e 73 20 61 6c |TR() con|tains al|
|00004f80| 6c 20 74 68 65 20 61 6c | 6c 6f 77 61 62 6c 65 20 |l the al|lowable |
|00004f90| 72 65 73 70 6f 6e 73 65 | 73 2e 20 20 54 68 65 0d |response|s. The.|
|00004fa0| 0a 20 20 20 20 20 75 73 | 65 72 20 69 6e 70 75 74 |. us|er input|
|00004fb0| 20 69 73 20 69 6e 20 41 | 4e 53 24 2e 20 20 49 4e | is in A|NS$. IN|
|00004fc0| 53 54 52 28 29 20 73 65 | 61 72 63 68 65 73 20 74 |STR() se|arches t|
|00004fd0| 68 65 20 73 74 72 69 6e | 67 20 22 4d 53 57 44 6d |he strin|g "MSWDm|
|00004fe0| 73 77 64 22 2e 20 20 49 | 66 20 41 4e 53 24 0d 0a |swd". I|f ANS$..|
|00004ff0| 20 20 20 20 20 6d 61 74 | 63 68 65 73 20 61 6e 79 | mat|ches any|
|00005000| 20 6f 66 20 74 68 65 20 | 63 68 61 72 61 63 74 65 | of the |characte|
|00005010| 72 73 20 69 6e 20 74 68 | 65 20 73 74 72 69 6e 67 |rs in th|e string|
|00005020| 2c 20 43 48 45 43 4b 20 | 69 73 20 73 65 74 20 74 |, CHECK |is set t|
|00005030| 6f 20 74 68 65 0d 0a 20 | 20 20 20 20 70 6f 73 69 |o the.. | posi|
|00005040| 74 69 6f 6e 20 28 31 20 | 74 68 72 6f 75 67 68 20 |tion (1 |through |
|00005050| 38 20 69 6e 20 74 68 69 | 73 20 63 61 73 65 29 20 |8 in thi|s case) |
|00005060| 69 6e 20 22 4d 53 57 44 | 6d 73 77 64 22 20 77 68 |in "MSWD|mswd" wh|
|00005070| 65 72 65 20 74 68 65 20 | 6d 61 74 63 68 0d 0a 20 |ere the |match.. |
|00005080| 20 20 20 20 6f 63 63 75 | 72 72 65 64 2e 20 20 49 | occu|rred. I|
|00005090| 66 20 74 68 65 72 65 20 | 69 73 20 6e 6f 20 6d 61 |f there |is no ma|
|000050a0| 74 63 68 2c 20 74 68 65 | 20 69 6e 70 75 74 20 6d |tch, the| input m|
|000050b0| 75 73 74 20 62 65 20 69 | 6e 76 61 6c 69 64 20 73 |ust be i|nvalid s|
|000050c0| 6f 20 43 48 45 43 4b 20 | 69 73 0d 0a 20 20 20 20 |o CHECK |is.. |
|000050d0| 20 73 65 74 20 74 6f 20 | 30 2e 0d 0a 0d 0a 0d 0a | set to |0.......|
|000050e0| 20 20 20 20 20 1b 45 4f | 54 48 45 52 20 41 53 53 | .EO|THER ASS|
|000050f0| 4f 52 54 45 44 20 46 55 | 4e 43 54 49 4f 4e 53 0d |ORTED FU|NCTIONS.|
|00005100| 0a 0d 0a 20 20 20 20 20 | 1b 46 49 4e 4b 45 59 24 |... |.FINKEY$|
|00005110| 0d 0a 0d 0a 20 20 20 20 | 20 49 4e 4b 45 59 24 20 |.... | INKEY$ |
|00005120| 72 65 74 72 69 65 76 65 | 73 20 69 6e 70 75 74 20 |retrieve|s input |
|00005130| 66 72 6f 6d 20 74 68 65 | 20 6b 65 79 62 6f 61 72 |from the| keyboar|
|00005140| 64 20 62 75 66 66 65 72 | 20 6f 6e 65 20 63 68 61 |d buffer| one cha|
|00005150| 72 61 63 74 65 72 20 61 | 74 20 61 20 74 69 6d 65 |racter a|t a time|
|00005160| 2e 0d 0a 20 20 20 20 20 | 49 74 20 69 73 20 74 72 |... |It is tr|
|00005170| 69 63 6b 79 20 62 65 63 | 61 75 73 65 20 69 74 20 |icky bec|ause it |
|00005180| 64 6f 65 73 20 6e 6f 74 | 20 65 63 68 6f 20 74 68 |does not| echo th|
|00005190| 65 20 63 68 61 72 61 63 | 74 65 72 20 62 61 63 6b |e charac|ter back|
|000051a0| 20 74 6f 20 74 68 65 20 | 73 63 72 65 65 6e 2e 0d | to the |screen..|
|000051b0| 0a 20 20 20 20 20 42 65 | 63 61 75 73 65 20 69 74 |. Be|cause it|
|000051c0| 20 72 65 74 72 69 65 76 | 65 73 20 6f 6e 65 20 63 | retriev|es one c|
|000051d0| 68 61 72 61 63 74 65 72 | 20 61 74 20 61 20 74 69 |haracter| at a ti|
|000051e0| 6d 65 2c 20 79 6f 75 20 | 6e 65 65 64 20 74 6f 20 |me, you |need to |
|000051f0| 62 75 69 6c 64 20 74 68 | 65 0d 0a 20 20 20 20 20 |build th|e.. |
|00005200| 69 6e 70 75 74 20 76 61 | 72 69 61 62 6c 65 20 61 |input va|riable a|
|00005210| 73 20 74 68 65 20 63 68 | 61 72 61 63 74 65 72 73 |s the ch|aracters|
|00005220| 20 61 72 65 20 72 65 74 | 72 69 65 76 65 64 2e 20 | are ret|rieved. |
|00005230| 20 48 65 72 65 27 73 20 | 61 20 73 61 6d 70 6c 65 | Here's |a sample|
|00005240| 20 69 6e 70 75 74 0d 0a | 20 20 20 20 20 72 6f 75 | input..| rou|
|00005250| 74 69 6e 65 3a 0d 0a 0d | 0a 20 20 20 20 20 35 38 |tine:...|. 58|
|00005260| 30 30 20 27 20 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |00 ' ***|********|
|00005270| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005280| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005290| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000052a0| 2a 2a 2a 2a 0d 0a 20 20 | 20 20 20 35 38 31 30 20 |****.. | 5810 |
|000052b0| 27 20 54 48 49 53 20 49 | 4e 50 55 54 20 52 4f 55 |' THIS I|NPUT ROU|
|000052c0| 54 49 4e 45 20 55 53 45 | 53 20 49 4e 4b 45 59 24 |TINE USE|S INKEY$|
|000052d0| 20 54 4f 20 42 55 49 4c | 44 20 41 4e 20 49 4e 50 | TO BUIL|D AN INP|
|000052e0| 55 54 2c 20 43 4f 4e 53 | 49 44 45 52 20 49 54 20 |UT, CONS|IDER IT |
|000052f0| 41 0d 0a 20 20 20 20 20 | 35 38 32 30 20 27 20 44 |A.. |5820 ' D|
|00005300| 45 4d 4f 20 52 4f 55 54 | 49 4e 45 2e 20 20 49 54 |EMO ROUT|INE. IT|
|00005310| 20 4e 45 45 44 53 20 4d | 4f 52 45 20 4c 4f 47 49 | NEEDS M|ORE LOGI|
|00005320| 43 20 54 4f 20 42 45 20 | 45 46 46 45 43 54 49 56 |C TO BE |EFFECTIV|
|00005330| 45 20 49 4e 20 41 20 50 | 52 4f 47 52 41 4d 0d 0a |E IN A P|ROGRAM..|
|00005340| 20 20 20 20 20 35 38 33 | 30 20 27 20 2a 2a 2a 2a | 583|0 ' ****|
|00005350| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005360| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005370| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005380| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 0d 0a 20 20 20 |********|***.. |
|00005390| 20 20 35 38 34 30 20 27 | 0d 0a 20 20 20 20 20 35 | 5840 '|.. 5|
|000053a0| 38 35 30 20 44 4f 57 4e | 20 20 20 3d 20 35 0d 0a |850 DOWN| = 5..|
|000053b0| 20 20 20 20 20 35 38 36 | 30 20 4f 56 45 52 20 20 | 586|0 OVER |
|000053c0| 20 3d 20 33 34 0d 0a 20 | 20 20 20 20 35 38 37 30 | = 34.. | 5870|
|000053d0| 20 41 24 20 20 20 20 20 | 3d 20 22 22 0d 0a 20 20 | A$ |= "".. |
|000053e0| 20 20 20 35 38 38 30 20 | 41 53 43 2e 43 44 20 3d | 5880 |ASC.CD =|
|000053f0| 20 31 0d 0a 20 20 20 20 | 20 35 38 39 30 20 27 0d | 1.. | 5890 '.|
|00005400| 0a 20 20 20 20 20 35 39 | 30 30 20 4c 4f 43 41 54 |. 59|00 LOCAT|
|00005410| 45 20 44 4f 57 4e 2c 31 | 2c 31 3a 20 50 52 49 4e |E DOWN,1|,1: PRIN|
|00005420| 54 20 22 45 4e 54 45 52 | 20 41 20 44 41 54 45 20 |T "ENTER| A DATE |
|00005430| 49 4e 20 4d 4d 2f 44 44 | 2f 59 59 20 46 4f 52 4d |IN MM/DD|/YY FORM|
|00005440| 41 54 3a 20 22 0d 0a 20 | 20 20 20 20 35 39 31 30 |AT: ".. | 5910|
|00005450| 20 27 0d 0a 20 20 20 20 | 20 35 39 32 30 20 57 48 | '.. | 5920 WH|
|00005460| 49 4c 45 20 41 53 43 2e | 43 44 20 3c 3e 20 31 33 |ILE ASC.|CD <> 13|
|00005470| 0d 0a 20 20 20 20 20 35 | 39 33 30 20 20 20 42 24 |.. 5|930 B$|
|00005480| 20 3d 20 49 4e 4b 45 59 | 24 3a 20 49 46 20 42 24 | = INKEY|$: IF B$|
|00005490| 20 3d 20 22 22 20 54 48 | 45 4e 20 35 39 33 30 0d | = "" TH|EN 5930.|
|000054a0| 0a 20 20 20 20 20 35 39 | 34 30 20 20 20 41 53 43 |. 59|40 ASC|
|000054b0| 2e 43 44 20 3d 20 41 53 | 43 28 42 24 29 0d 0a 20 |.CD = AS|C(B$).. |
|000054c0| 20 20 20 20 35 39 35 30 | 20 20 20 49 46 20 41 53 | 5950| IF AS|
|000054d0| 43 2e 43 44 20 3c 3e 20 | 31 33 0d 0a 20 20 20 20 |C.CD <> |13.. |
|000054e0| 20 20 20 20 20 20 20 20 | 20 20 20 54 48 45 4e 20 | | THEN |
|000054f0| 41 24 20 3d 20 41 24 20 | 2b 20 42 24 3a 20 4c 4f |A$ = A$ |+ B$: LO|
|00005500| 43 41 54 45 20 44 4f 57 | 4e 2c 4f 56 45 52 2c 31 |CATE DOW|N,OVER,1|
|00005510| 3a 20 50 52 49 4e 54 20 | 42 24 3b 3a 0d 0a 20 20 |: PRINT |B$;:.. |
|00005520| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005530| 20 20 4f 56 45 52 20 3d | 20 4f 56 45 52 20 2b 20 | OVER =| OVER + |
|00005540| 31 0d 0a 20 20 20 20 20 | 35 39 36 30 20 57 45 4e |1.. |5960 WEN|
|00005550| 44 0d 0a 20 20 20 20 20 | 35 39 37 30 20 27 0d 0a |D.. |5970 '..|
|00005560| 20 20 20 20 20 35 39 38 | 30 20 52 45 54 55 52 4e | 598|0 RETURN|
|00005570| 0d 0a 0d 0a 20 20 20 20 | 20 54 68 65 20 6c 6f 67 |.... | The log|
|00005580| 69 63 20 6e 65 65 64 73 | 20 74 6f 20 68 61 6e 64 |ic needs| to hand|
|00005590| 6c 65 20 74 68 65 20 63 | 75 72 73 6f 72 20 70 6f |le the c|ursor po|
|000055a0| 73 69 74 69 6f 6e 69 6e | 67 20 61 6e 64 20 65 63 |sitionin|g and ec|
|000055b0| 68 6f 20 6f 66 20 74 68 | 65 20 69 6e 70 75 74 2e |ho of th|e input.|
|000055c0| 0d 0a 20 20 20 20 20 44 | 4f 57 4e 20 61 6e 64 20 |.. D|OWN and |
|000055d0| 4f 56 45 52 20 72 65 70 | 72 65 73 65 6e 74 20 74 |OVER rep|resent t|
|000055e0| 68 65 20 73 63 72 65 65 | 6e 20 6c 6f 63 61 74 69 |he scree|n locati|
|000055f0| 6f 6e 20 77 68 65 72 65 | 20 74 68 65 20 65 63 68 |on where| the ech|
|00005600| 6f 20 61 6e 64 20 74 68 | 65 0d 0a 0d 0a 0d 0a 0d |o and th|e.......|
|00005610| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00005620| 20 20 1b 45 20 20 20 20 | 20 20 20 20 20 20 20 20 | .E | |
|00005630| 20 20 20 20 1b 46 20 20 | 20 20 20 20 20 1b 45 20 | .F | .E |
|00005640| 31 34 37 0d 0a 0d 0a 0c | 0d 0a 0d 0a 0d 0a 0d 0a |147.....|........|
|00005650| 1b 46 20 20 20 20 20 1b | 45 43 48 41 50 54 45 52 |.F .|ECHAPTER|
|00005660| 20 31 31 1b 46 20 20 20 | 20 20 20 20 20 20 20 20 | 11.F | |
|00005670| 20 20 20 20 20 1b 45 20 | 47 4f 4f 44 20 53 54 55 | .E |GOOD STU|
|00005680| 46 46 2c 20 43 48 45 41 | 50 20 20 1b 46 20 20 20 |FF, CHEA|P .F |
|00005690| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 1b 45 43 | | .EC|
|000056a0| 48 41 50 54 45 52 20 31 | 31 0d 0a 0d 0a 0d 0a 20 |HAPTER 1|1...... |
|000056b0| 20 20 20 20 1b 46 63 75 | 72 73 6f 72 20 61 72 65 | .Fcu|rsor are|
|000056c0| 20 74 6f 20 62 65 20 64 | 69 73 70 6c 61 79 65 64 | to be d|isplayed|
|000056d0| 2e 20 20 46 69 6e 61 6c | 6c 79 2c 20 74 68 65 20 |. Final|ly, the |
|000056e0| 69 6e 70 75 74 20 61 63 | 63 75 6d 75 6c 61 74 6f |input ac|cumulato|
|000056f0| 72 2c 20 41 24 2c 20 68 | 61 73 20 74 6f 0d 0a 20 |r, A$, h|as to.. |
|00005700| 20 20 20 20 62 65 20 69 | 6e 69 74 69 61 6c 69 7a | be i|nitializ|
|00005710| 65 64 20 74 6f 20 6e 75 | 6c 6c 73 20 61 6e 64 20 |ed to nu|lls and |
|00005720| 41 53 43 2e 43 44 20 68 | 61 73 20 74 6f 20 62 65 |ASC.CD h|as to be|
|00005730| 20 73 65 74 20 74 6f 20 | 61 20 76 61 6c 75 65 20 | set to |a value |
|00005740| 6f 74 68 65 72 20 74 68 | 61 6e 0d 0a 20 20 20 20 |other th|an.. |
|00005750| 20 31 33 20 28 45 6e 74 | 65 72 29 20 74 6f 20 67 | 13 (Ent|er) to g|
|00005760| 65 74 20 69 6e 74 6f 20 | 74 68 65 20 57 48 49 4c |et into |the WHIL|
|00005770| 45 20 6c 6f 6f 70 2e 0d | 0a 0d 0a 20 20 20 20 20 |E loop..|... |
|00005780| 49 6e 74 65 72 6e 61 6c | 6c 79 2c 20 49 4e 4b 45 |Internal|ly, INKE|
|00005790| 59 24 20 6b 65 65 70 73 | 20 72 65 74 72 69 65 76 |Y$ keeps| retriev|
|000057a0| 69 6e 67 20 63 68 61 72 | 61 63 74 65 72 73 2e 20 |ing char|acters. |
|000057b0| 20 49 66 20 74 68 65 20 | 6b 65 79 62 6f 61 72 64 | If the |keyboard|
|000057c0| 20 62 75 66 66 65 72 0d | 0a 20 20 20 20 20 69 73 | buffer.|. is|
|000057d0| 20 65 6d 70 74 79 2c 20 | 49 4e 4b 45 59 24 20 72 | empty, |INKEY$ r|
|000057e0| 65 74 72 69 65 76 65 73 | 20 6e 75 6c 6c 73 2e 20 |etrieves| nulls. |
|000057f0| 20 4c 69 6e 65 20 35 39 | 33 30 20 77 69 6c 6c 20 | Line 59|30 will |
|00005800| 6c 6f 6f 70 20 75 6e 74 | 69 6c 20 61 20 6e 6f 6e |loop unt|il a non|
|00005810| 2d 6e 75 6c 6c 0d 0a 20 | 20 20 20 20 63 68 61 72 |-null.. | char|
|00005820| 61 63 74 65 72 20 69 73 | 20 65 6e 74 65 72 65 64 |acter is| entered|
|00005830| 2e 20 20 4c 69 6e 65 20 | 35 39 34 30 20 6f 62 74 |. Line |5940 obt|
|00005840| 61 69 6e 73 20 74 68 65 | 20 41 53 43 49 49 20 63 |ains the| ASCII c|
|00005850| 6f 64 65 20 66 6f 72 20 | 74 68 65 0d 0a 20 20 20 |ode for |the.. |
|00005860| 20 20 63 68 61 72 61 63 | 74 65 72 2e 20 20 4c 69 | charac|ter. Li|
|00005870| 6e 65 20 35 39 35 30 20 | 74 61 63 6b 73 20 74 68 |ne 5950 |tacks th|
|00005880| 65 20 63 68 61 72 61 63 | 74 65 72 20 6f 6e 20 74 |e charac|ter on t|
|00005890| 6f 20 74 68 65 20 65 6e | 64 20 6f 66 20 41 24 2c |o the en|d of A$,|
|000058a0| 20 65 63 68 6f 65 73 20 | 69 74 0d 0a 20 20 20 20 | echoes |it.. |
|000058b0| 20 74 6f 20 74 68 65 20 | 73 63 72 65 65 6e 2c 20 | to the |screen, |
|000058c0| 61 6e 64 20 69 6e 63 72 | 65 6d 65 6e 74 73 20 74 |and incr|ements t|
|000058d0| 68 65 20 63 75 72 73 6f | 72 20 6c 6f 63 61 74 69 |he curso|r locati|
|000058e0| 6f 6e 20 62 79 20 6f 6e | 65 2e 0d 0a 0d 0a 20 20 |on by on|e..... |
|000058f0| 20 20 20 54 61 6b 65 20 | 61 20 63 6c 6f 73 65 20 | Take |a close |
|00005900| 6c 6f 6f 6b 20 61 74 20 | 74 68 65 20 4c 4f 43 41 |look at |the LOCA|
|00005910| 54 45 2e 20 20 54 68 65 | 20 44 4f 57 4e 2c 4f 56 |TE. The| DOWN,OV|
|00005920| 45 52 2c 31 20 68 61 73 | 20 61 20 6e 65 77 20 61 |ER,1 has| a new a|
|00005930| 64 64 69 74 69 6f 6e 2c | 20 61 0d 0a 20 20 20 20 |ddition,| a.. |
|00005940| 20 27 2c 31 27 2e 20 20 | 54 68 69 73 20 6d 61 6b | ',1'. |This mak|
|00005950| 65 73 20 74 68 65 20 63 | 75 72 73 6f 72 20 76 69 |es the c|ursor vi|
|00005960| 73 69 62 6c 65 2e 20 20 | 52 65 6d 6f 76 65 20 69 |sible. |Remove i|
|00005970| 74 20 61 6e 64 20 74 68 | 65 20 63 75 72 73 6f 72 |t and th|e cursor|
|00005980| 20 77 69 6c 6c 0d 0a 20 | 20 20 20 20 64 69 73 61 | will.. | disa|
|00005990| 70 70 65 61 72 2e 20 20 | 41 6c 73 6f 20 6e 6f 74 |ppear. |Also not|
|000059a0| 65 20 74 68 65 20 73 65 | 6d 69 63 6f 6c 6f 6e 20 |e the se|micolon |
|000059b0| 61 66 74 65 72 20 50 52 | 49 4e 54 20 42 24 2e 20 |after PR|INT B$. |
|000059c0| 20 54 68 69 73 20 73 75 | 70 70 72 65 73 73 65 73 | This su|ppresses|
|000059d0| 0d 0a 20 20 20 20 20 6c | 69 6e 65 20 66 65 65 64 |.. l|ine feed|
|000059e0| 73 2e 20 20 54 68 65 20 | 6c 6f 6f 70 20 66 69 6e |s. The |loop fin|
|000059f0| 69 73 68 65 73 20 77 68 | 65 6e 20 61 6e 20 27 45 |ishes wh|en an 'E|
|00005a00| 6e 74 65 72 27 20 69 73 | 20 64 65 74 65 63 74 65 |nter' is| detecte|
|00005a10| 64 2e 0d 0a 0d 0a 20 20 | 20 20 20 49 66 20 79 6f |d..... | If yo|
|00005a20| 75 20 75 73 65 20 74 68 | 69 73 20 72 6f 75 74 69 |u use th|is routi|
|00005a30| 6e 65 20 69 6e 20 74 68 | 65 20 61 73 2d 69 73 20 |ne in th|e as-is |
|00005a40| 63 6f 6e 64 69 74 69 6f | 6e 2c 20 6b 65 79 73 20 |conditio|n, keys |
|00005a50| 6c 69 6b 65 20 79 6f 75 | 72 20 64 65 6c 65 74 65 |like you|r delete|
|00005a60| 0d 0a 20 20 20 20 20 6b | 65 79 2c 20 61 72 72 6f |.. k|ey, arro|
|00005a70| 77 20 6b 65 79 73 20 65 | 74 63 2e 20 77 69 6c 6c |w keys e|tc. will|
|00005a80| 20 6e 6f 74 20 66 75 6e | 63 74 69 6f 6e 2e 20 20 | not fun|ction. |
|00005a90| 59 6f 75 20 6e 65 65 64 | 20 74 6f 20 61 64 64 20 |You need| to add |
|00005aa0| 6c 6f 67 69 63 20 74 68 | 61 74 20 61 63 74 73 0d |logic th|at acts.|
|00005ab0| 0a 20 20 20 20 20 6f 6e | 20 61 6c 6c 20 6f 66 20 |. on| all of |
|00005ac0| 74 68 65 73 65 20 6f 6e | 20 79 6f 75 72 20 6f 77 |these on| your ow|
|00005ad0| 6e 2e 20 20 54 68 65 20 | 72 6f 75 74 69 6e 65 20 |n. The |routine |
|00005ae0| 69 73 20 69 6e 63 6c 75 | 64 65 64 20 62 65 63 61 |is inclu|ded beca|
|00005af0| 75 73 65 20 69 74 20 63 | 61 6e 20 62 65 0d 0a 20 |use it c|an be.. |
|00005b00| 20 20 20 20 65 78 70 61 | 6e 64 65 64 20 74 6f 20 | expa|nded to |
|00005b10| 66 6f 72 6d 20 74 68 65 | 20 62 61 73 69 73 20 6f |form the| basis o|
|00005b20| 66 20 61 6e 20 65 78 63 | 65 6c 6c 65 6e 74 20 73 |f an exc|ellent s|
|00005b30| 63 72 65 65 6e 20 69 6e | 70 75 74 2f 6f 75 74 70 |creen in|put/outp|
|00005b40| 75 74 20 69 6e 74 65 72 | 66 61 63 65 0d 0a 20 20 |ut inter|face.. |
|00005b50| 20 20 20 69 66 20 79 6f | 75 20 77 61 6e 74 20 74 | if yo|u want t|
|00005b60| 6f 20 74 61 6b 65 20 74 | 68 65 20 74 69 6d 65 20 |o take t|he time |
|00005b70| 61 6e 64 20 74 72 6f 75 | 62 6c 65 20 74 6f 20 64 |and trou|ble to d|
|00005b80| 6f 20 73 6f 2e 0d 0a 0d | 0a 20 20 20 20 20 46 6f |o so....|. Fo|
|00005b90| 72 20 74 68 65 20 66 61 | 69 6e 74 20 6f 66 20 68 |r the fa|int of h|
|00005ba0| 65 61 72 74 20 77 68 6f | 20 64 6f 20 6e 6f 74 20 |eart who| do not |
|00005bb0| 77 61 6e 74 20 74 6f 20 | 65 78 70 61 6e 64 20 74 |want to |expand t|
|00005bc0| 68 65 20 70 72 65 76 69 | 6f 75 73 20 72 6f 75 74 |he previ|ous rout|
|00005bd0| 69 6e 65 2c 0d 0a 20 20 | 20 20 20 68 65 72 65 20 |ine,.. | here |
|00005be0| 69 73 20 73 6f 6d 65 20 | 63 6f 64 65 20 74 68 61 |is some |code tha|
|00005bf0| 74 20 67 65 6e 65 72 61 | 74 65 73 20 61 20 70 61 |t genera|tes a pa|
|00005c00| 67 65 20 62 72 65 61 6b | 20 66 6f 72 20 61 20 73 |ge break| for a s|
|00005c10| 63 72 65 65 6e 20 6c 69 | 73 74 69 6e 67 2e 0d 0a |creen li|sting...|
|00005c20| 20 20 20 20 20 59 65 73 | 2c 20 74 68 65 72 65 20 | Yes|, there |
|00005c30| 61 72 65 20 73 69 6d 70 | 6c 65 20 75 73 65 73 20 |are simp|le uses |
|00005c40| 66 6f 72 20 49 4e 4b 45 | 59 24 2e 0d 0a 0d 0a 20 |for INKE|Y$..... |
|00005c50| 20 20 20 20 34 30 30 30 | 20 4c 4f 43 41 54 45 20 | 4000| LOCATE |
|00005c60| 32 33 2c 32 38 3a 20 50 | 52 49 4e 54 20 22 48 69 |23,28: P|RINT "Hi|
|00005c70| 74 20 61 6e 79 20 6b 65 | 79 20 74 6f 20 63 6f 6e |t any ke|y to con|
|00005c80| 74 69 6e 75 65 22 0d 0a | 20 20 20 20 20 34 30 31 |tinue"..| 401|
|00005c90| 30 20 27 0d 0a 20 20 20 | 20 20 34 30 32 30 20 42 |0 '.. | 4020 B|
|00005ca0| 24 20 3d 20 49 4e 4b 45 | 59 24 3a 20 49 46 20 42 |$ = INKE|Y$: IF B|
|00005cb0| 24 20 3d 20 22 22 20 54 | 48 45 4e 20 34 30 32 30 |$ = "" T|HEN 4020|
|00005cc0| 0d 0a 20 20 20 20 20 34 | 30 33 30 20 27 0d 0a 0d |.. 4|030 '...|
|00005cd0| 0a 20 20 20 20 20 55 6e | 6c 69 6b 65 20 74 68 65 |. Un|like the|
|00005ce0| 20 65 78 61 6d 70 6c 65 | 73 20 69 6e 20 70 72 65 | example|s in pre|
|00005cf0| 76 69 6f 75 73 20 63 68 | 61 70 74 65 72 73 2c 20 |vious ch|apters, |
|00005d00| 74 68 69 73 20 6c 6f 67 | 69 63 20 61 6c 6c 6f 77 |this log|ic allow|
|00005d10| 73 20 74 68 65 20 75 73 | 65 72 20 74 6f 0d 0a 20 |s the us|er to.. |
|00005d20| 20 20 20 20 68 69 74 20 | 61 6e 79 20 6b 65 79 20 | hit |any key |
|00005d30| 74 6f 20 67 6f 20 6f 6e | 2e 20 20 54 68 65 20 65 |to go on|. The e|
|00005d40| 61 72 6c 69 65 72 20 65 | 78 61 6d 70 6c 65 73 20 |arlier e|xamples |
|00005d50| 72 65 71 75 69 72 65 64 | 20 74 68 61 74 20 74 68 |required| that th|
|00005d60| 65 20 27 45 6e 74 65 72 | 27 0d 0a 20 20 20 20 20 |e 'Enter|'.. |
|00005d70| 6b 65 79 20 62 65 20 64 | 65 70 72 65 73 73 65 64 |key be d|epressed|
|00005d80| 20 74 6f 20 63 6f 6e 74 | 69 6e 75 65 2e 20 20 47 | to cont|inue. G|
|00005d90| 72 65 61 74 2c 20 6e 6f | 77 20 79 6f 75 20 63 61 |reat, no|w you ca|
|00005da0| 6e 20 64 65 70 72 65 73 | 73 20 61 6e 79 20 6b 65 |n depres|s any ke|
|00005db0| 79 20 79 6f 75 0d 0a 20 | 20 20 20 20 77 61 6e 74 |y you.. | want|
|00005dc0| 2e 20 20 41 66 74 65 72 | 20 61 6c 6c 2c 20 77 68 |. After| all, wh|
|00005dd0| 79 20 64 69 73 63 72 69 | 6d 69 6e 61 74 65 3f 0d |y discri|minate?.|
|00005de0| 0a 0d 0a 0d 0a 20 20 20 | 20 20 1b 45 53 48 45 4c |..... | .ESHEL|
|00005df0| 4c 0d 0a 0d 0a 20 20 20 | 20 20 1b 46 54 68 65 20 |L.... | .FThe |
|00005e00| 53 48 45 4c 4c 20 63 6f | 6d 6d 61 6e 64 20 69 73 |SHELL co|mmand is|
|00005e10| 20 61 20 42 41 53 49 43 | 20 66 75 6e 63 74 69 6f | a BASIC| functio|
|00005e20| 6e 20 74 68 61 74 20 70 | 72 6f 76 69 64 65 73 20 |n that p|rovides |
|00005e30| 61 20 67 61 74 65 77 61 | 79 20 74 6f 20 44 4f 53 |a gatewa|y to DOS|
|00005e40| 2e 0d 0a 20 20 20 20 20 | 49 74 20 69 73 20 6f 66 |... |It is of|
|00005e50| 66 69 63 69 61 6c 6c 79 | 20 6f 6e 6c 79 20 73 75 |ficially| only su|
|00005e60| 70 70 6f 72 74 65 64 20 | 69 6e 20 44 4f 53 20 72 |pported |in DOS r|
|00005e70| 65 6c 65 61 73 65 73 20 | 33 2e 30 20 6f 72 20 68 |eleases |3.0 or h|
|00005e80| 69 67 68 65 72 20 68 6f | 77 65 76 65 72 20 69 74 |igher ho|wever it|
|00005e90| 0d 0a 20 20 20 20 20 68 | 61 73 20 62 65 65 6e 20 |.. h|as been |
|00005ea0| 6b 6e 6f 77 6e 20 74 6f | 20 77 6f 72 6b 20 73 65 |known to| work se|
|00005eb0| 6c 65 63 74 69 76 65 20 | 69 6e 20 72 65 6c 65 61 |lective |in relea|
|00005ec0| 73 65 20 32 2e 31 20 28 | 61 6c 73 6f 20 6b 6e 6f |se 2.1 (|also kno|
|00005ed0| 77 6e 20 61 73 20 61 6e | 0d 0a 20 20 20 20 20 75 |wn as an|.. u|
|00005ee0| 6e 64 6f 63 75 6d 65 6e | 74 65 64 20 61 6e 64 20 |ndocumen|ted and |
|00005ef0| 75 6e 73 75 70 70 6f 72 | 74 65 64 20 66 65 61 74 |unsuppor|ted feat|
|00005f00| 75 72 65 29 2e 20 20 59 | 6f 75 20 63 61 6e 20 75 |ure). Y|ou can u|
|00005f10| 73 65 20 69 74 20 74 6f | 20 65 6d 62 65 64 20 44 |se it to| embed D|
|00005f20| 4f 53 0d 0a 20 20 20 20 | 20 63 6f 6d 6d 61 6e 64 |OS.. | command|
|00005f30| 73 20 69 6e 20 42 41 53 | 49 43 20 63 6f 64 65 2e |s in BAS|IC code.|
|00005f40| 20 20 41 20 67 6f 6f 64 | 20 61 70 70 6c 69 63 61 | A good| applica|
|00005f50| 74 69 6f 6e 20 69 73 20 | 73 68 6f 77 6e 20 62 65 |tion is |shown be|
|00005f60| 6c 6f 77 3a 0d 0a 0d 0a | 20 20 20 20 20 31 32 35 |low:....| 125|
|00005f70| 30 20 53 48 45 4c 4c 20 | 22 43 4f 50 59 20 46 4c |0 SHELL |"COPY FL|
|00005f80| 49 47 48 54 2e 44 41 54 | 20 46 4c 49 47 48 54 2e |IGHT.DAT| FLIGHT.|
|00005f90| 44 41 54 22 0d 0a 20 20 | 20 20 20 31 32 36 30 20 |DAT".. | 1260 |
|00005fa0| 4f 50 45 4e 20 22 46 4c | 49 47 48 54 2e 44 41 54 |OPEN "FL|IGHT.DAT|
|00005fb0| 22 20 46 4f 52 20 4f 55 | 54 50 55 54 20 41 53 20 |" FOR OU|TPUT AS |
|00005fc0| 23 31 0d 0a 20 20 20 20 | 20 31 32 37 30 20 27 0d |#1.. | 1270 '.|
|00005fd0| 0a 20 20 20 20 20 31 32 | 38 30 20 46 4f 52 20 4c |. 12|80 FOR L|
|00005fe0| 20 3d 20 31 20 54 4f 20 | 54 4f 54 2e 52 45 43 0d | = 1 TO |TOT.REC.|
|00005ff0| 0a 20 20 20 20 20 31 32 | 39 30 20 20 20 57 52 49 |. 12|90 WRI|
|00006000| 54 45 20 23 31 2c 20 46 | 4c 49 47 48 54 24 28 4c |TE #1, F|LIGHT$(L|
|00006010| 29 2c 20 44 45 53 54 24 | 28 4c 29 2c 20 44 45 50 |), DEST$|(L), DEP|
|00006020| 2e 54 49 4d 45 24 28 4c | 29 0d 0a 20 20 20 20 20 |.TIME$(L|).. |
|00006030| 31 33 30 30 20 4e 45 58 | 54 20 4c 0d 0a 20 20 20 |1300 NEX|T L.. |
|00006040| 20 20 31 33 31 30 20 27 | 0d 0a 20 20 20 20 20 31 | 1310 '|.. 1|
|00006050| 33 32 30 20 43 4c 4f 53 | 45 20 23 31 0d 0a 0d 0a |320 CLOS|E #1....|
|00006060| 0d 0a 0d 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |.... | |
|00006070| 20 20 20 20 20 1b 45 20 | 20 20 20 20 20 20 20 20 | .E | |
|00006080| 20 20 20 20 20 20 20 1b | 46 20 20 20 20 20 20 20 | .|F |
|00006090| 1b 45 20 31 34 38 0d 0a | 0d 0a 0c 0d 0a 0d 0a 0d |.E 148..|........|
|000060a0| 0a 0d 0a 1b 46 20 20 20 | 20 20 1b 45 43 48 41 50 |....F | .ECHAP|
|000060b0| 54 45 52 20 31 31 1b 46 | 20 20 20 20 20 20 20 20 |TER 11.F| |
|000060c0| 20 20 20 20 20 20 20 20 | 1b 45 20 47 4f 4f 44 20 | |.E GOOD |
|000060d0| 53 54 55 46 46 2c 20 43 | 48 45 41 50 20 20 1b 46 |STUFF, C|HEAP .F|
|000060e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000060f0| 1b 45 43 48 41 50 54 45 | 52 20 31 31 0d 0a 0d 0a |.ECHAPTE|R 11....|
|00006100| 0d 0a 20 20 20 20 20 1b | 46 54 68 65 20 43 4f 50 |.. .|FThe COP|
|00006110| 59 20 62 61 63 6b 73 20 | 75 70 20 79 6f 75 72 20 |Y backs |up your |
|00006120| 64 61 74 61 20 66 69 6c | 65 2e 20 20 54 68 65 20 |data fil|e. The |
|00006130| 62 61 63 6b 75 70 20 69 | 6e 63 6c 75 64 65 73 20 |backup i|ncludes |
|00006140| 64 61 74 61 20 65 6e 74 | 65 72 65 64 20 75 70 0d |data ent|ered up.|
|00006150| 0a 20 20 20 20 20 74 6f | 20 28 62 75 74 20 6e 6f |. to| (but no|
|00006160| 74 20 69 6e 63 6c 75 64 | 69 6e 67 29 20 74 68 65 |t includ|ing) the|
|00006170| 20 73 65 73 73 69 6f 6e | 20 74 68 61 74 20 6a 75 | session| that ju|
|00006180| 73 74 20 74 65 72 6d 69 | 6e 61 74 65 64 2e 20 20 |st termi|nated. |
|00006190| 49 66 20 61 6e 79 74 68 | 69 6e 67 0d 0a 20 20 20 |If anyth|ing.. |
|000061a0| 20 20 67 6f 65 73 20 77 | 72 6f 6e 67 20 64 75 72 | goes w|rong dur|
|000061b0| 69 6e 67 20 74 68 65 20 | 77 72 69 74 65 20 70 72 |ing the |write pr|
|000061c0| 6f 63 65 64 75 72 65 2c | 20 74 68 65 20 6f 6c 64 |ocedure,| the old|
|000061d0| 20 63 6f 70 79 20 6f 66 | 20 74 68 65 20 66 69 6c | copy of| the fil|
|000061e0| 65 20 63 61 6e 20 62 65 | 0d 0a 20 20 20 20 20 75 |e can be|.. u|
|000061f0| 73 65 64 20 74 6f 20 72 | 65 73 74 6f 72 65 20 46 |sed to r|estore F|
|00006200| 4c 49 47 48 54 2e 44 41 | 54 20 74 6f 20 77 68 61 |LIGHT.DA|T to wha|
|00006210| 74 20 74 68 65 20 76 65 | 72 73 69 6f 6e 20 74 68 |t the ve|rsion th|
|00006220| 61 74 20 74 68 65 20 6c | 61 73 74 20 73 65 73 73 |at the l|ast sess|
|00006230| 69 6f 6e 0d 0a 20 20 20 | 20 20 73 74 61 72 74 65 |ion.. | starte|
|00006240| 64 20 77 69 74 68 2e 20 | 20 54 68 61 74 27 73 20 |d with. | That's |
|00006250| 62 65 74 74 65 72 20 74 | 68 61 6e 20 68 61 76 69 |better t|han havi|
|00006260| 6e 67 20 74 6f 20 72 65 | 63 72 65 61 74 65 20 65 |ng to re|create e|
|00006270| 76 65 72 79 74 68 69 6e | 67 20 66 72 6f 6d 0d 0a |verythin|g from..|
|00006280| 20 20 20 20 20 73 63 72 | 61 74 63 68 2e 0d 0a 0d | scr|atch....|
|00006290| 0a 20 20 20 20 20 49 66 | 20 46 4c 49 47 48 54 2e |. If| FLIGHT.|
|000062a0| 44 41 54 20 69 73 20 77 | 69 70 65 64 20 6f 75 74 |DAT is w|iped out|
|000062b0| 2c 20 73 69 67 6e 20 6f | 6e 20 61 6e 64 20 63 6f |, sign o|n and co|
|000062c0| 70 79 20 46 4c 49 47 48 | 54 2e 42 41 4b 20 62 61 |py FLIGH|T.BAK ba|
|000062d0| 63 6b 20 74 6f 0d 0a 20 | 20 20 20 20 46 4c 49 47 |ck to.. | FLIG|
|000062e0| 48 54 2e 44 41 54 2e 20 | 20 48 6f 70 65 66 75 6c |HT.DAT. | Hopeful|
|000062f0| 6c 79 20 74 68 61 74 20 | 77 69 6c 6c 20 65 61 72 |ly that |will ear|
|00006300| 6e 20 79 6f 75 20 73 6f | 6d 65 62 6f 64 79 27 73 |n you so|mebody's|
|00006310| 20 67 72 61 74 69 74 75 | 64 65 2e 0d 0a 0d 0a 0d | gratitu|de......|
|00006320| 0a 20 20 20 20 20 1b 45 | 42 45 45 50 0d 0a 0d 0a |. .E|BEEP....|
|00006330| 20 20 20 20 20 1b 46 42 | 45 45 50 20 64 6f 65 73 | .FB|EEP does|
|00006340| 20 65 78 61 63 74 6c 79 | 20 77 68 61 74 20 74 68 | exactly| what th|
|00006350| 65 20 6e 61 6d 65 20 69 | 6d 70 6c 69 65 73 2c 20 |e name i|mplies, |
|00006360| 63 61 75 73 65 73 20 74 | 68 65 20 63 6f 6d 70 75 |causes t|he compu|
|00006370| 74 65 72 20 74 6f 20 67 | 69 76 65 20 61 0d 0a 20 |ter to g|ive a.. |
|00006380| 20 20 20 20 6c 69 74 74 | 6c 65 20 62 65 65 70 2e | litt|le beep.|
|00006390| 0d 0a 0d 0a 20 20 20 20 | 20 33 32 30 20 42 45 45 |.... | 320 BEE|
|000063a0| 50 0d 0a 0d 0a 20 20 20 | 20 20 59 6f 75 20 63 61 |P.... | You ca|
|000063b0| 6e 20 75 73 65 20 69 74 | 20 61 73 20 70 61 72 74 |n use it| as part|
|000063c0| 20 6f 66 20 65 72 72 6f | 72 20 6d 65 73 73 61 67 | of erro|r messag|
|000063d0| 65 73 20 6f 72 20 77 68 | 65 6e 20 79 6f 75 20 77 |es or wh|en you w|
|000063e0| 61 6e 74 20 74 6f 20 63 | 61 6c 6c 0d 0a 20 20 20 |ant to c|all.. |
|000063f0| 20 20 73 6f 6d 65 62 6f | 64 79 27 73 20 61 74 74 | somebo|dy's att|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.