home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: Mailbox/MIME Entity
(archive/mbox).
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| Mailbox/MIME Entity (archive/mbox)
| magic
| Supported |
100%
| dexvert
| Internet Message Format (text/imf)
| magic
| Supported |
1%
| dexvert
| Swift 3D 3D Graphic (poly/swift3D3DGraphic)
| ext
| Unsupported |
1%
| dexvert
| Boost Text serialization (other/boostTextSerialization)
| ext
| Unsupported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| Mailbox text, 1st line "From ts@uwasa.fi Sat Sep 7 00:00:00 1996", ASCII text, with CRLF line terminators
| default
| |
100%
| TrID
| E-Mail message (Var. 2)
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| x-fmt/111 Plain Text File
| default
| |
100%
| gt2
| Textdatei (DOS)
| default
| |
100%
| detectItEasy
| Format: Plain text[CRLF]
| default
| |
100%
| xdgMime
| application/mbox
| default
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 46 72 6f 6d 20 74 73 40 | 75 77 61 73 61 2e 66 69 |From ts@|uwasa.fi|
|00000010| 20 53 61 74 20 53 65 70 | 20 37 20 30 30 3a 30 30 | Sat Sep| 7 00:00|
|00000020| 3a 30 30 20 31 39 39 36 | 0d 0a 53 75 62 6a 65 63 |:00 1996|..Subjec|
|00000030| 74 3a 20 46 41 51 50 41 | 53 33 2e 54 58 54 20 63 |t: FAQPA|S3.TXT c|
|00000040| 6f 6e 74 65 6e 74 73 0d | 0a 0d 0a 20 20 20 20 20 |ontents.|... |
|00000050| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000060| 20 20 20 20 20 20 20 20 | 20 20 43 6f 70 79 72 69 | | Copyri|
|00000070| 67 68 74 20 28 63 29 20 | 31 39 39 33 2d 31 39 39 |ght (c) |1993-199|
|00000080| 36 20 62 79 20 54 69 6d | 6f 20 53 61 6c 6d 69 0d |6 by Tim|o Salmi.|
|00000090| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|000000a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000000b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000000c0| 20 20 41 6c 6c 20 72 69 | 67 68 74 73 20 72 65 73 | All ri|ghts res|
|000000d0| 65 72 76 65 64 0d 0a 0d | 0a 46 41 51 50 41 53 33 |erved...|.FAQPAS3|
|000000e0| 2e 54 58 54 20 54 68 65 | 20 74 68 69 72 64 20 73 |.TXT The| third s|
|000000f0| 65 74 20 6f 66 20 66 72 | 65 71 75 65 6e 74 6c 79 |et of fr|equently|
|00000100| 20 28 61 6e 64 20 6e 6f | 74 20 73 6f 20 66 72 65 | (and no|t so fre|
|00000110| 71 75 65 6e 74 6c 79 29 | 0d 0a 61 73 6b 65 64 20 |quently)|..asked |
|00000120| 54 75 72 62 6f 20 50 61 | 73 63 61 6c 20 71 75 65 |Turbo Pa|scal que|
|00000130| 73 74 69 6f 6e 73 20 77 | 69 74 68 20 54 69 6d 6f |stions w|ith Timo|
|00000140| 27 73 20 61 6e 73 77 65 | 72 73 2e 20 54 68 65 20 |'s answe|rs. The |
|00000150| 69 74 65 6d 73 20 61 72 | 65 20 69 6e 0d 0a 6e 6f |items ar|e in..no|
|00000160| 20 70 61 72 74 69 63 75 | 6c 61 72 20 6f 72 64 65 | particu|lar orde|
|00000170| 72 2e 0d 0a 0d 0a 59 6f | 75 20 61 72 65 20 66 72 |r.....Yo|u are fr|
|00000180| 65 65 20 74 6f 20 71 75 | 6f 74 65 20 62 72 69 65 |ee to qu|ote brie|
|00000190| 66 20 70 61 73 73 61 67 | 65 73 20 66 72 6f 6d 20 |f passag|es from |
|000001a0| 74 68 69 73 20 66 69 6c | 65 20 70 72 6f 76 69 64 |this fil|e provid|
|000001b0| 65 64 20 79 6f 75 0d 0a | 63 6c 65 61 72 6c 79 20 |ed you..|clearly |
|000001c0| 69 6e 64 69 63 61 74 65 | 20 74 68 65 20 73 6f 75 |indicate| the sou|
|000001d0| 72 63 65 20 77 69 74 68 | 20 61 20 70 72 6f 70 65 |rce with| a prope|
|000001e0| 72 20 61 63 6b 6e 6f 77 | 6c 65 64 67 6d 65 6e 74 |r acknow|ledgment|
|000001f0| 2e 0d 0a 0d 0a 43 6f 6d | 6d 65 6e 74 73 20 61 6e |.....Com|ments an|
|00000200| 64 20 63 6f 72 72 65 63 | 74 69 6f 6e 73 20 61 72 |d correc|tions ar|
|00000210| 65 20 73 6f 6c 69 63 69 | 74 65 64 2e 20 42 75 74 |e solici|ted. But|
|00000220| 20 69 66 20 79 6f 75 20 | 77 69 73 68 20 74 6f 20 | if you |wish to |
|00000230| 68 61 76 65 0d 0a 69 6e | 64 69 76 69 64 75 61 6c |have..in|dividual|
|00000240| 20 54 75 72 62 6f 20 50 | 61 73 63 61 6c 20 63 6f | Turbo P|ascal co|
|00000250| 6e 73 75 6c 74 61 74 69 | 6f 6e 2c 20 70 6c 65 61 |nsultati|on, plea|
|00000260| 73 65 20 70 6f 73 74 20 | 79 6f 75 72 20 71 75 65 |se post |your que|
|00000270| 73 74 69 6f 6e 73 20 74 | 6f 0d 0a 61 20 73 75 69 |stions t|o..a sui|
|00000280| 74 61 62 6c 65 20 55 73 | 65 6e 65 74 20 6e 65 77 |table Us|enet new|
|00000290| 73 67 72 6f 75 70 20 6c | 69 6b 65 20 6e 65 77 73 |sgroup l|ike news|
|000002a0| 3a 63 6f 6d 70 2e 6c 61 | 6e 67 2e 70 61 73 63 61 |:comp.la|ng.pasca|
|000002b0| 6c 2e 62 6f 72 6c 61 6e | 64 2e 20 49 74 0d 0a 69 |l.borlan|d. It..i|
|000002c0| 73 20 6d 75 63 68 20 6d | 6f 72 65 20 65 66 66 69 |s much m|ore effi|
|000002d0| 63 69 65 6e 74 20 74 68 | 61 6e 20 61 73 6b 69 6e |cient th|an askin|
|000002e0| 67 20 6d 65 20 62 79 20 | 65 6d 61 69 6c 2e 20 49 |g me by |email. I|
|000002f0| 27 64 20 6c 69 6b 65 20 | 74 6f 20 68 65 6c 70 2c |'d like |to help,|
|00000300| 0d 0a 62 75 74 20 49 20 | 61 6d 20 76 65 72 79 20 |..but I |am very |
|00000310| 70 72 65 73 73 65 64 20 | 66 6f 72 20 74 69 6d 65 |pressed |for time|
|00000320| 2e 20 49 20 70 72 65 66 | 65 72 20 74 6f 20 70 69 |. I pref|er to pi|
|00000330| 63 6b 20 74 68 65 20 71 | 75 65 73 74 69 6f 6e 73 |ck the q|uestions|
|00000340| 20 49 0d 0a 61 6e 73 77 | 65 72 20 66 72 6f 6d 20 | I..answ|er from |
|00000350| 74 68 65 20 55 73 65 6e | 65 74 20 6e 65 77 73 2e |the Usen|et news.|
|00000360| 20 54 68 75 73 20 49 20 | 63 61 6e 20 61 6e 73 77 | Thus I |can answ|
|00000370| 65 72 20 70 75 62 6c 69 | 63 6c 79 20 61 74 20 6f |er publi|cly at o|
|00000380| 6e 65 20 67 6f 20 69 66 | 0d 0a 49 20 68 61 70 70 |ne go if|..I happ|
|00000390| 65 6e 20 74 6f 20 68 61 | 76 65 20 61 6e 20 61 6e |en to ha|ve an an|
|000003a0| 73 77 65 72 2e 20 42 65 | 73 69 64 65 73 2c 20 6e |swer. Be|sides, n|
|000003b0| 65 77 73 67 72 6f 75 70 | 73 20 68 61 76 65 20 61 |ewsgroup|s have a|
|000003c0| 20 6e 75 6d 62 65 72 20 | 6f 66 0d 0a 72 65 61 64 | number |of..read|
|000003d0| 65 72 73 20 77 68 6f 20 | 6d 69 67 68 74 20 6b 6e |ers who |might kn|
|000003e0| 6f 77 20 61 20 62 65 74 | 74 65 72 20 6f 72 20 61 |ow a bet|ter or a|
|000003f0| 6e 20 61 6c 74 65 72 6e | 61 74 69 76 65 20 61 6e |n altern|ative an|
|00000400| 73 77 65 72 2e 20 44 6f | 6e 27 74 20 62 65 0d 0a |swer. Do|n't be..|
|00000410| 64 69 73 63 6f 75 72 61 | 67 65 64 2c 20 74 68 6f |discoura|ged, tho|
|00000420| 75 67 68 2c 20 69 66 20 | 79 6f 75 20 67 65 74 20 |ugh, if |you get |
|00000430| 61 20 72 65 70 6c 79 20 | 6c 69 6b 65 20 74 68 69 |a reply |like thi|
|00000440| 73 20 66 72 6f 6d 20 6d | 65 2e 20 49 20 61 6d 0d |s from m|e. I am.|
|00000450| 0a 61 6c 77 61 79 73 20 | 67 6c 61 64 20 74 6f 20 |.always |glad to |
|00000460| 68 65 61 72 20 66 72 6f | 6d 20 66 65 6c 6c 6f 77 |hear fro|m fellow|
|00000470| 20 54 75 72 62 6f 20 50 | 61 73 63 61 6c 20 75 73 | Turbo P|ascal us|
|00000480| 65 72 73 2e 0d 0a 0d 0a | 2e 2e 2e 2e 2e 2e 2e 2e |ers.....|........|
|00000490| 2e 2e 2e 2e 2e 2e 2e 2e | 2e 2e 2e 2e 2e 2e 2e 2e |........|........|
|000004a0| 2e 2e 2e 2e 2e 2e 2e 2e | 2e 2e 2e 2e 2e 2e 2e 2e |........|........|
|000004b0| 2e 2e 2e 2e 2e 2e 2e 2e | 2e 2e 2e 2e 2e 2e 2e 2e |........|........|
|000004c0| 2e 2e 2e 2e 2e 2e 2e 2e | 2e 2e 2e 2e 0d 0a 50 72 |........|......Pr|
|000004d0| 6f 66 2e 20 54 69 6d 6f | 20 53 61 6c 6d 69 20 20 |of. Timo| Salmi |
|000004e0| 20 43 6f 2d 6d 6f 64 65 | 72 61 74 6f 72 20 6f 66 | Co-mode|rator of|
|000004f0| 20 6e 65 77 73 3a 63 6f | 6d 70 2e 61 72 63 68 69 | news:co|mp.archi|
|00000500| 76 65 73 2e 6d 73 64 6f | 73 2e 61 6e 6e 6f 75 6e |ves.msdo|s.announ|
|00000510| 63 65 0d 0a 4d 6f 64 65 | 72 61 74 69 6e 67 20 61 |ce..Mode|rating a|
|00000520| 74 20 66 74 70 3a 2f 2f | 20 26 20 68 74 74 70 3a |t ftp://| & http:|
|00000530| 2f 2f 67 61 72 62 6f 2e | 75 77 61 73 61 2e 66 69 |//garbo.|uwasa.fi|
|00000540| 20 61 72 63 68 69 76 65 | 73 20 20 31 39 33 2e 31 | archive|s 193.1|
|00000550| 36 36 2e 31 32 30 2e 35 | 0d 0a 44 65 70 61 72 74 |66.120.5|..Depart|
|00000560| 6d 65 6e 74 20 6f 66 20 | 41 63 63 6f 75 6e 74 69 |ment of |Accounti|
|00000570| 6e 67 20 61 6e 64 20 42 | 75 73 69 6e 65 73 73 20 |ng and B|usiness |
|00000580| 46 69 6e 61 6e 63 65 20 | 20 3b 20 55 6e 69 76 65 |Finance | ; Unive|
|00000590| 72 73 69 74 79 20 6f 66 | 20 56 61 61 73 61 0d 0a |rsity of| Vaasa..|
|000005a0| 74 73 40 75 77 61 73 61 | 2e 66 69 20 68 74 74 70 |ts@uwasa|.fi http|
|000005b0| 3a 2f 2f 75 77 61 73 61 | 2e 66 69 2f 7e 74 73 20 |://uwasa|.fi/~ts |
|000005c0| 42 42 53 20 39 36 31 2d | 33 31 37 30 39 37 32 3b |BBS 961-|3170972;|
|000005d0| 20 46 49 4e 2d 36 35 31 | 30 31 2c 20 20 46 69 6e | FIN-651|01, Fin|
|000005e0| 6c 61 6e 64 0d 0a 0d 0a | 2d 2d 2d 2d 2d 2d 2d 2d |land....|--------|
|000005f0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000600| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000610| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000620| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 0d 0a 35 31 |--------|----..51|
|00000630| 29 20 49 20 61 6d 20 72 | 75 6e 6e 69 6e 67 20 6f |) I am r|unning o|
|00000640| 75 74 20 6f 66 20 6d 65 | 6d 6f 72 79 20 77 68 65 |ut of me|mory whe|
|00000650| 6e 20 63 6f 6d 70 69 6c | 69 6e 67 20 6d 79 20 6c |n compil|ing my l|
|00000660| 61 72 67 65 20 70 72 6f | 67 72 61 6d 2e 0d 0a 35 |arge pro|gram...5|
|00000670| 32 29 20 48 6f 77 20 64 | 6f 20 49 20 61 76 6f 69 |2) How d|o I avoi|
|00000680| 64 20 73 63 72 6f 6c 6c | 69 6e 67 20 69 6e 20 74 |d scroll|ing in t|
|00000690| 68 65 20 6c 61 73 74 20 | 63 6f 6c 75 6d 6e 20 6f |he last |column o|
|000006a0| 66 20 74 68 65 20 6c 61 | 73 74 20 72 6f 77 3f 0d |f the la|st row?.|
|000006b0| 0a 35 33 29 20 48 6f 77 | 20 63 61 6e 20 6f 6e 65 |.53) How| can one|
|000006c0| 20 68 69 64 65 20 28 6f | 72 20 75 6e 68 69 64 65 | hide (o|r unhide|
|000006d0| 29 20 61 20 64 69 72 65 | 63 74 6f 72 79 20 75 73 |) a dire|ctory us|
|000006e0| 69 6e 67 20 61 20 54 50 | 20 70 72 6f 67 72 61 6d |ing a TP| program|
|000006f0| 3f 0d 0a 35 34 29 20 48 | 6f 77 20 64 6f 20 49 20 |?..54) H|ow do I |
|00000700| 74 65 73 74 20 77 68 65 | 74 68 65 72 20 61 20 66 |test whe|ther a f|
|00000710| 69 6c 65 20 69 73 20 61 | 6c 72 65 61 64 79 20 6f |ile is a|lready o|
|00000720| 70 65 6e 20 69 6e 20 61 | 20 54 50 20 70 72 6f 67 |pen in a| TP prog|
|00000730| 72 61 6d 3f 0d 0a 35 35 | 29 20 48 6f 77 20 63 61 |ram?..55|) How ca|
|00000740| 6e 20 49 20 74 65 73 74 | 20 61 6e 64 20 63 6f 6e |n I test| and con|
|00000750| 76 65 72 74 20 61 20 6e | 75 6d 65 72 69 63 61 6c |vert a n|umerical|
|00000760| 20 73 74 72 69 6e 67 20 | 69 6e 74 6f 20 61 20 72 | string |into a r|
|00000770| 65 61 6c 3f 0d 0a 35 36 | 29 20 48 6f 77 20 63 61 |eal?..56|) How ca|
|00000780| 6e 20 49 20 72 65 76 65 | 72 73 65 20 61 20 54 50 |n I reve|rse a TP|
|00000790| 20 2e 45 58 45 20 6f 72 | 20 2e 54 50 55 20 62 61 | .EXE or| .TPU ba|
|000007a0| 63 6b 20 69 6e 74 6f 20 | 73 6f 75 72 63 65 20 63 |ck into |source c|
|000007b0| 6f 64 65 3f 0d 0a 35 37 | 29 20 48 6f 77 20 63 61 |ode?..57|) How ca|
|000007c0| 6e 20 49 20 63 61 6c 63 | 75 6c 61 74 65 20 74 68 |n I calc|ulate th|
|000007d0| 65 20 64 69 66 66 65 72 | 65 6e 63 65 20 62 65 74 |e differ|ence bet|
|000007e0| 77 65 65 6e 20 74 77 6f | 20 70 6f 69 6e 74 73 20 |ween two| points |
|000007f0| 6f 66 20 74 69 6d 65 3f | 0d 0a 35 38 29 20 49 73 |of time?|..58) Is|
|00000800| 20 61 20 70 72 6f 67 72 | 61 6d 20 72 75 6e 6e 69 | a progr|am runni|
|00000810| 6e 67 20 73 74 61 6e 64 | 2d 61 6c 6f 6e 65 20 6f |ng stand|-alone o|
|00000820| 72 20 66 72 6f 6d 20 77 | 69 74 68 69 6e 20 74 68 |r from w|ithin th|
|00000830| 65 20 49 44 45 3f 0d 0a | 35 39 29 20 50 6c 65 61 |e IDE?..|59) Plea|
|00000840| 73 65 20 65 78 70 6c 61 | 69 6e 20 54 75 72 62 6f |se expla|in Turbo|
|00000850| 20 50 61 73 63 61 6c 20 | 6d 65 6d 6f 72 79 20 61 | Pascal |memory a|
|00000860| 64 64 72 65 73 73 69 6e | 67 20 74 6f 20 6d 65 2e |ddressin|g to me.|
|00000870| 0d 0a 36 30 29 20 48 6f | 77 20 64 6f 20 49 20 6f |..60) Ho|w do I o|
|00000880| 62 74 61 69 6e 20 61 20 | 62 69 74 20 6f 72 20 62 |btain a |bit or b|
|00000890| 69 74 73 20 66 72 6f 6d | 20 61 20 62 79 74 65 2c |its from| a byte,|
|000008a0| 20 61 20 77 6f 72 64 20 | 6f 72 20 61 20 6c 6f 6e | a word |or a lon|
|000008b0| 67 69 6e 74 3f 0d 0a 36 | 31 29 20 57 68 61 74 20 |gint?..6|1) What |
|000008c0| 61 72 65 20 42 69 6e 61 | 72 79 20 43 6f 64 65 64 |are Bina|ry Coded|
|000008d0| 20 44 65 63 69 6d 61 6c | 73 3f 20 48 6f 77 20 74 | Decimal|s? How t|
|000008e0| 6f 20 63 6f 6e 76 65 72 | 74 20 74 68 65 6d 3f 0d |o conver|t them?.|
|000008f0| 0a 36 32 29 20 48 6f 77 | 20 63 61 6e 20 49 20 63 |.62) How| can I c|
|00000900| 6f 70 79 20 61 20 66 69 | 6c 65 20 69 6e 20 61 20 |opy a fi|le in a |
|00000910| 54 75 72 62 6f 20 50 61 | 73 63 61 6c 20 70 72 6f |Turbo Pa|scal pro|
|00000920| 67 72 61 6d 3f 0d 0a 36 | 33 29 20 48 6f 77 20 63 |gram?..6|3) How c|
|00000930| 61 6e 20 49 20 75 73 65 | 20 43 20 63 6f 64 65 20 |an I use| C code |
|00000940| 69 6e 20 6d 79 20 54 75 | 72 62 6f 20 50 61 73 63 |in my Tu|rbo Pasc|
|00000950| 61 6c 20 70 72 6f 67 72 | 61 6d 3f 0d 0a 36 34 29 |al progr|am?..64)|
|00000960| 20 48 6f 77 20 64 6f 20 | 49 20 67 65 74 20 73 74 | How do |I get st|
|00000970| 61 72 74 65 64 20 77 69 | 74 68 20 74 68 65 20 54 |arted wi|th the T|
|00000980| 75 72 62 6f 20 50 72 6f | 66 69 6c 65 72 3f 0d 0a |urbo Pro|filer?..|
|00000990| 36 35 29 20 48 6f 77 20 | 63 61 6e 20 49 20 64 65 |65) How |can I de|
|000009a0| 74 65 63 74 20 69 66 20 | 74 68 65 20 73 68 69 66 |tect if |the shif|
|000009b0| 74 2f 63 74 72 6c 2f 61 | 6c 74 20 65 74 63 20 6b |t/ctrl/a|lt etc k|
|000009c0| 65 79 20 69 73 20 70 72 | 65 73 73 65 64 3f 0d 0a |ey is pr|essed?..|
|000009d0| 36 36 29 20 48 6f 77 20 | 64 6f 20 49 20 67 65 74 |66) How |do I get|
|000009e0| 20 61 20 62 61 73 65 20 | 31 30 20 6c 6f 67 61 72 | a base |10 logar|
|000009f0| 69 74 68 6d 20 69 6e 20 | 54 50 3f 0d 0a 36 37 29 |ithm in |TP?..67)|
|00000a00| 20 49 66 20 44 65 6c 61 | 79 20 70 72 6f 63 65 64 | If Dela|y proced|
|00000a10| 75 72 65 20 64 6f 65 73 | 20 6e 6f 74 20 77 6f 72 |ure does| not wor|
|00000a20| 6b 20 70 72 6f 70 65 72 | 6c 79 2c 20 68 6f 77 20 |k proper|ly, how |
|00000a30| 64 6f 20 49 20 66 69 78 | 20 69 74 3f 0d 0a 36 38 |do I fix| it?..68|
|00000a40| 29 20 48 6f 77 20 6d 75 | 63 68 20 6d 65 6d 6f 72 |) How mu|ch memor|
|00000a50| 79 20 77 69 6c 6c 20 6d | 79 20 54 50 20 70 72 6f |y will m|y TP pro|
|00000a60| 67 72 61 6d 20 72 65 71 | 75 69 72 65 3f 0d 0a 36 |gram req|uire?..6|
|00000a70| 39 29 20 48 6f 77 20 74 | 6f 20 64 65 74 65 63 74 |9) How t|o detect|
|00000a80| 20 69 66 20 61 20 64 72 | 69 76 65 20 69 73 20 61 | if a dr|ive is a|
|00000a90| 20 43 44 2d 52 4f 4d 20 | 64 72 69 76 65 3f 0d 0a | CD-ROM |drive?..|
|00000aa0| 37 30 29 20 48 6f 77 20 | 64 6f 20 49 20 63 6f 6e |70) How |do I con|
|00000ab0| 76 65 72 74 20 61 6e 20 | 61 72 72 61 79 20 6f 66 |vert an |array of|
|00000ac0| 20 63 68 61 72 61 63 74 | 65 72 73 20 69 6e 74 6f | charact|ers into|
|00000ad0| 20 61 20 73 74 72 69 6e | 67 3f 0d 0a 37 31 29 20 | a strin|g?..71) |
|00000ae0| 48 6f 77 20 64 6f 20 49 | 20 67 65 74 20 73 74 61 |How do I| get sta|
|00000af0| 72 74 65 64 20 77 69 74 | 68 20 67 72 61 70 68 69 |rted wit|h graphi|
|00000b00| 63 73 20 70 72 6f 67 72 | 61 6d 6d 69 6e 67 3f 0d |cs progr|amming?.|
|00000b10| 0a 37 32 29 20 57 68 65 | 72 65 20 74 6f 20 49 20 |.72) Whe|re to I |
|00000b20| 66 69 6e 64 20 74 68 65 | 20 64 69 66 66 65 72 65 |find the| differe|
|00000b30| 6e 74 20 73 6f 72 74 69 | 6e 67 20 73 6f 75 72 63 |nt sorti|ng sourc|
|00000b40| 65 20 63 6f 64 65 73 3f | 0d 0a 37 33 29 20 41 20 |e codes?|..73) A |
|00000b50| 62 65 67 69 6e 6e 65 72 | 27 73 20 68 6f 77 20 74 |beginner|'s how t|
|00000b60| 6f 20 77 72 69 74 65 20 | 61 6e 64 20 63 6f 6d 70 |o write |and comp|
|00000b70| 69 6c 65 20 75 6e 69 74 | 73 2e 0d 0a 37 34 29 20 |ile unit|s...74) |
|00000b80| 57 68 61 74 20 61 72 65 | 20 61 6e 64 20 68 6f 77 |What are| and how|
|00000b90| 20 64 6f 20 49 20 75 73 | 65 20 70 6f 69 6e 74 65 | do I us|e pointe|
|00000ba0| 72 73 3f 0d 0a 37 35 29 | 20 48 6f 77 20 63 61 6e |rs?..75)| How can|
|00000bb0| 20 49 20 72 65 61 64 20 | 61 6e 6f 74 68 65 72 20 | I read |another |
|00000bc0| 70 72 6f 67 72 61 6d 27 | 73 20 65 72 72 6f 72 6c |program'|s errorl|
|00000bd0| 65 76 65 6c 20 76 61 6c | 75 65 20 69 6e 20 54 50 |evel val|ue in TP|
|00000be0| 3f 0d 0a 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |?..-----|--------|
|00000bf0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000c00| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000c10| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000c20| 2d 2d 2d 2d 2d 2d 2d 0d | 0a 0d 0a 46 72 6f 6d 20 |-------.|...From |
|00000c30| 74 73 40 75 77 61 73 61 | 2e 66 69 20 53 61 74 20 |ts@uwasa|.fi Sat |
|00000c40| 53 65 70 20 37 20 30 30 | 3a 30 30 3a 35 31 20 31 |Sep 7 00|:00:51 1|
|00000c50| 39 39 36 0d 0a 53 75 62 | 6a 65 63 74 3a 20 4f 75 |996..Sub|ject: Ou|
|00000c60| 74 20 6f 66 20 6d 65 6d | 6f 72 79 20 69 6e 20 63 |t of mem|ory in c|
|00000c70| 6f 6d 70 69 6c 69 6e 67 | 0d 0a 0d 0a 35 31 2e 20 |ompiling|....51. |
|00000c80| 2a 2a 2a 2a 2a 0d 0a 20 | 51 3a 20 49 20 61 6d 20 |*****.. |Q: I am |
|00000c90| 72 75 6e 6e 69 6e 67 20 | 6f 75 74 20 6f 66 20 6d |running |out of m|
|00000ca0| 65 6d 6f 72 79 20 77 68 | 65 6e 20 63 6f 6d 70 69 |emory wh|en compi|
|00000cb0| 6c 69 6e 67 20 6d 79 20 | 6c 61 72 67 65 20 70 72 |ling my |large pr|
|00000cc0| 6f 67 72 61 6d 2e 20 57 | 68 61 74 0d 0a 20 20 20 |ogram. W|hat.. |
|00000cd0| 20 63 61 6e 20 49 20 64 | 6f 3f 0d 0a 0d 0a 20 41 | can I d|o?.... A|
|00000ce0| 3a 20 49 66 20 79 6f 75 | 20 61 72 65 20 63 6f 6d |: If you| are com|
|00000cf0| 70 69 6c 69 6e 67 20 79 | 6f 75 72 20 70 72 6f 67 |piling y|our prog|
|00000d00| 72 61 6d 20 66 72 6f 6d | 20 77 69 74 68 69 6e 20 |ram from| within |
|00000d10| 74 68 65 20 49 44 45 20 | 28 74 68 65 0d 0a 49 6e |the IDE |(the..In|
|00000d20| 74 65 67 72 61 74 65 64 | 20 44 65 76 65 6c 6f 70 |tegrated| Develop|
|00000d30| 6d 65 6e 74 20 45 6e 76 | 69 72 6f 6e 6d 65 6e 74 |ment Env|ironment|
|00000d40| 29 20 74 68 65 6e 20 73 | 65 6c 65 63 74 20 74 68 |) then s|elect th|
|00000d50| 65 20 4f 70 74 69 6f 6e | 20 66 72 6f 6d 20 74 68 |e Option| from th|
|00000d60| 65 0d 0a 6d 61 69 6e 20 | 6d 65 6e 75 2c 20 63 68 |e..main |menu, ch|
|00000d70| 6f 6f 73 65 20 74 68 65 | 20 43 6f 6d 70 69 6c 65 |oose the| Compile|
|00000d80| 72 20 69 74 65 6d 20 61 | 6e 64 20 73 65 74 20 74 |r item a|nd set t|
|00000d90| 68 65 20 4c 69 6e 6b 20 | 62 75 66 66 65 72 20 74 |he Link |buffer t|
|00000da0| 6f 0d 0a 44 69 73 6b 2e | 20 28 41 6c 73 6f 20 6d |o..Disk.| (Also m|
|00000db0| 61 6b 65 20 74 68 65 20 | 43 6f 6d 70 69 6c 65 20 |ake the |Compile |
|00000dc0| 6f 70 74 69 6f 6e 20 44 | 65 73 74 69 6e 61 74 69 |option D|estinati|
|00000dd0| 6f 6e 20 74 6f 20 62 65 | 20 44 69 73 6b 29 2e 0d |on to be| Disk)..|
|00000de0| 0a 20 20 20 49 66 20 74 | 68 69 73 20 69 73 20 6e |. If t|his is n|
|00000df0| 6f 74 20 73 75 66 66 69 | 63 69 65 6e 74 2c 20 6e |ot suffi|cient, n|
|00000e00| 65 78 74 20 72 65 73 6f | 72 74 20 74 6f 20 75 73 |ext reso|rt to us|
|00000e10| 69 6e 67 20 74 68 65 20 | 54 50 43 20 63 6f 6d 6d |ing the |TPC comm|
|00000e20| 61 6e 64 0d 0a 6c 69 6e | 65 20 76 65 72 73 69 6f |and..lin|e versio|
|00000e30| 6e 20 6f 66 20 74 68 65 | 20 54 75 72 62 6f 20 50 |n of the| Turbo P|
|00000e40| 61 73 63 61 6c 20 63 6f | 6d 70 69 6c 65 72 20 69 |ascal co|mpiler i|
|00000e50| 6e 73 74 65 61 64 20 6f | 66 20 74 68 65 20 49 44 |nstead o|f the ID|
|00000e60| 45 2e 20 20 55 73 65 0d | 0a 74 68 65 20 22 4c 69 |E. Use.|.the "Li|
|00000e70| 6e 6b 20 62 75 66 66 65 | 72 20 6f 6e 20 64 69 73 |nk buffe|r on dis|
|00000e80| 6b 22 20 6f 70 74 69 6f | 6e 2e 0d 0a 20 20 20 44 |k" optio|n... D|
|00000e90| 69 76 69 64 65 20 79 6f | 75 72 20 70 72 6f 67 72 |ivide yo|ur progr|
|00000ea0| 61 6d 20 69 6e 74 6f 20 | 75 6e 69 74 73 2e 20 49 |am into |units. I|
|00000eb0| 74 20 69 73 20 61 64 76 | 69 73 61 62 6c 65 20 61 |t is adv|isable a|
|00000ec0| 6e 79 77 61 79 20 66 6f | 72 0d 0a 6d 6f 64 75 6c |nyway fo|r..modul|
|00000ed0| 61 72 69 74 79 20 77 68 | 65 6e 20 79 6f 75 72 20 |arity wh|en your |
|00000ee0| 70 72 6f 67 72 61 6d 20 | 73 69 7a 65 20 67 72 6f |program |size gro|
|00000ef0| 77 73 2e 0d 0a 20 20 20 | 49 66 20 79 6f 75 20 68 |ws... |If you h|
|00000f00| 61 76 65 20 65 78 74 65 | 6e 64 65 64 20 6d 65 6d |ave exte|nded mem|
|00000f10| 6f 72 79 2c 20 69 6e 73 | 74 65 61 64 20 6f 66 20 |ory, ins|tead of |
|00000f20| 54 55 52 42 4f 2e 45 58 | 45 20 75 73 65 20 54 50 |TURBO.EX|E use TP|
|00000f30| 58 2e 45 58 45 2c 20 69 | 66 0d 0a 79 6f 75 20 68 |X.EXE, i|f..you h|
|00000f40| 61 76 65 20 54 50 20 37 | 2e 30 2e 20 49 66 20 79 |ave TP 7|.0. If y|
|00000f50| 6f 75 20 61 72 65 20 69 | 6e 74 6f 20 70 72 6f 74 |ou are i|nto prot|
|00000f60| 65 63 74 65 64 20 6d 6f | 64 65 20 70 72 6f 67 72 |ected mo|de progr|
|00000f70| 61 6d 6d 69 6e 67 20 74 | 68 65 6e 20 75 73 65 0d |amming t|hen use.|
|00000f80| 0a 42 6f 72 6c 61 6e 64 | 20 50 61 73 63 61 6c 20 |.Borland| Pascal |
|00000f90| 42 50 20 37 2e 30 2e 0d | 0a 0d 0a 20 41 32 3a 20 |BP 7.0..|... A2: |
|00000fa0| 49 66 20 79 6f 75 20 77 | 6f 75 6c 64 20 70 72 65 |If you w|ould pre|
|00000fb0| 66 65 72 20 63 6f 6d 70 | 69 6c 69 6e 67 20 79 6f |fer comp|iling yo|
|00000fc0| 75 72 20 70 72 6f 67 72 | 61 6d 20 66 72 6f 6d 20 |ur progr|am from |
|00000fd0| 77 69 74 68 69 6e 20 74 | 68 65 20 49 44 45 0d 0a |within t|he IDE..|
|00000fe0| 62 75 74 20 63 61 6e 6e | 6f 74 20 64 6f 20 69 74 |but cann|ot do it|
|00000ff0| 20 66 6f 72 20 74 68 65 | 20 61 62 6f 76 65 20 72 | for the| above r|
|00001000| 65 61 73 6f 6e 20 28 6f | 72 20 69 66 20 79 6f 75 |eason (o|r if you|
|00001010| 20 77 6f 75 6c 64 20 70 | 72 65 66 65 72 20 74 6f | would p|refer to|
|00001020| 0d 0a 63 6f 6d 70 69 6c | 65 20 79 6f 75 72 20 70 |..compil|e your p|
|00001030| 72 6f 67 72 61 6d 20 66 | 72 6f 6d 20 77 69 74 68 |rogram f|rom with|
|00001040| 69 6e 20 79 6f 75 72 20 | 66 61 76 6f 72 69 74 65 |in your |favorite|
|00001050| 20 65 64 69 74 6f 72 20 | 69 6e 73 74 65 61 64 20 | editor |instead |
|00001060| 6f 66 20 74 68 65 0d 0a | 54 50 20 49 44 45 29 20 |of the..|TP IDE) |
|00001070| 79 6f 75 20 63 61 6e 20 | 75 73 65 20 74 68 65 20 |you can |use the |
|00001080| 66 6f 6c 6c 6f 77 69 6e | 67 20 74 72 69 63 6b 2e |followin|g trick.|
|00001090| 20 49 66 20 79 6f 75 72 | 20 65 64 69 74 6f 72 20 | If your| editor |
|000010a0| 68 61 73 20 61 20 6d 61 | 63 72 6f 0d 0a 6c 61 6e |has a ma|cro..lan|
|000010b0| 67 75 61 67 65 20 6c 69 | 6b 65 20 6d 6f 73 74 20 |guage li|ke most |
|000010c0| 67 6f 6f 64 20 65 64 69 | 74 6f 72 73 20 64 6f 2c |good edi|tors do,|
|000010d0| 20 74 68 65 20 61 73 73 | 69 67 6e 20 61 20 68 6f | the ass|ign a ho|
|000010e0| 74 6b 65 79 20 6d 61 63 | 72 6f 20 74 68 61 74 0d |tkey mac|ro that.|
|000010f0| 0a 63 6f 6d 70 69 6c 65 | 73 20 74 68 65 20 63 75 |.compile|s the cu|
|00001100| 72 72 65 6e 74 20 66 69 | 6c 65 20 77 69 74 68 20 |rrent fi|le with |
|00001110| 74 68 65 20 54 50 43 2e | 20 49 66 20 79 6f 75 20 |the TPC.| If you |
|00001120| 61 72 65 20 75 73 69 6e | 67 20 53 65 6d 57 61 72 |are usin|g SemWar|
|00001130| 65 27 73 0d 0a 51 45 64 | 69 74 20 65 64 69 74 6f |e's..QEd|it edito|
|00001140| 72 20 79 6f 75 27 6c 6c | 20 66 69 6e 64 20 73 75 |r you'll| find su|
|00001150| 63 68 20 6d 61 63 72 6f | 73 20 69 6e 20 28 22 4d |ch macro|s in ("M|
|00001160| 61 63 72 6f 73 20 61 6e | 64 20 63 6f 6e 66 69 67 |acros an|d config|
|00001170| 75 72 61 74 69 6f 6e 73 | 0d 0a 66 6f 72 20 51 45 |urations|..for QE|
|00001180| 64 69 74 20 74 65 78 74 | 2d 65 64 69 74 6f 72 22 |dit text|-editor"|
|00001190| 29 20 66 74 70 3a 2f 2f | 67 61 72 62 6f 2e 75 77 |) ftp://|garbo.uw|
|000011a0| 61 73 61 2e 66 69 2f 70 | 63 2f 74 73 2f 74 73 71 |asa.fi/p|c/ts/tsq|
|000011b0| 65 64 31 38 2e 7a 69 70 | 20 61 6e 64 0d 0a 69 6e |ed18.zip| and..in|
|000011c0| 20 66 74 70 3a 2f 2f 67 | 61 72 62 6f 2e 75 77 61 | ftp://g|arbo.uwa|
|000011d0| 73 61 2e 66 69 2f 74 73 | 2f 74 73 74 73 65 31 38 |sa.fi/ts|/tstse18|
|000011e0| 2e 7a 69 70 20 28 22 53 | 41 4c 20 6d 61 63 72 6f |.zip ("S|AL macro|
|000011f0| 20 73 6f 75 72 63 65 73 | 20 74 6f 20 65 78 74 65 | sources| to exte|
|00001200| 6e 64 0d 0a 54 68 65 20 | 53 65 6d 57 61 72 65 20 |nd..The |SemWare |
|00001210| 45 64 69 74 6f 72 20 76 | 65 72 73 69 6f 6e 20 32 |Editor v|ersion 2|
|00001220| 2e 35 22 29 2e 0d 0a 20 | 20 20 41 6c 73 6f 20 79 |.5")... | Also y|
|00001230| 6f 75 72 20 65 64 69 74 | 6f 72 20 6d 75 73 74 20 |our edit|or must |
|00001240| 62 65 20 73 77 61 70 70 | 65 64 20 74 6f 20 64 69 |be swapp|ed to di|
|00001250| 73 6b 20 64 75 72 69 6e | 67 20 74 68 65 20 63 6f |sk durin|g the co|
|00001260| 6d 70 69 6c 61 74 69 6f | 6e 0d 0a 69 66 20 6d 65 |mpilatio|n..if me|
|00001270| 6d 6f 72 79 20 69 73 20 | 63 72 69 74 69 63 61 6c |mory is |critical|
|00001280| 2e 20 54 68 65 72 65 20 | 69 73 20 61 20 76 65 72 |. There |is a ver|
|00001290| 79 20 67 6f 6f 64 20 70 | 72 6f 67 72 61 6d 20 66 |y good p|rogram f|
|000012a0| 6f 72 20 64 6f 69 6e 67 | 20 74 68 61 74 3a 0d 0a |or doing| that:..|
|000012b0| 66 74 70 3a 2f 2f 67 61 | 72 62 6f 2e 75 77 61 73 |ftp://ga|rbo.uwas|
|000012c0| 61 2e 66 69 2f 70 63 2f | 73 79 73 75 74 69 6c 2f |a.fi/pc/|sysutil/|
|000012d0| 73 68 72 6f 6d 32 34 62 | 2e 7a 69 70 20 28 22 53 |shrom24b|.zip ("S|
|000012e0| 68 65 6c 6c 20 52 6f 6f | 6d 2c 20 53 77 61 70 20 |hell Roo|m, Swap |
|000012f0| 74 6f 0d 0a 64 69 73 6b | 20 77 68 65 6e 20 73 68 |to..disk| when sh|
|00001300| 65 6c 6c 69 6e 67 20 74 | 6f 20 61 70 70 6c 69 63 |elling t|o applic|
|00001310| 61 74 69 6f 6e 22 29 2e | 20 46 6f 72 20 65 78 61 |ation").| For exa|
|00001320| 6d 70 6c 65 20 49 20 69 | 6e 76 6f 6b 65 20 74 68 |mple I i|nvoke th|
|00001330| 65 20 51 45 64 69 74 0d | 0a 65 64 69 74 6f 72 20 |e QEdit.|.editor |
|00001340| 77 69 74 68 20 75 73 69 | 6e 67 20 74 68 65 20 66 |with usi|ng the f|
|00001350| 6f 6c 6c 6f 77 69 6e 67 | 20 62 61 74 63 68 3a 0d |ollowing| batch:.|
|00001360| 0a 20 63 3a 5c 74 6f 6f | 6c 73 5c 73 68 72 6f 6f |. c:\too|ls\shroo|
|00001370| 6d 20 2d 73 20 72 3a 5c | 63 6d 61 6e 64 20 2d 7a |m -s r:\|cmand -z|
|00001380| 20 31 30 32 34 20 63 3a | 5c 71 65 64 69 74 5c 71 | 1024 c:|\qedit\q|
|00001390| 20 25 31 20 25 32 20 25 | 33 20 25 34 20 25 35 20 | %1 %2 %|3 %4 %5 |
|000013a0| 25 36 20 25 37 0d 0a 59 | 6f 75 27 6c 6c 20 66 69 |%6 %7..Y|ou'll fi|
|000013b0| 6e 64 20 6d 6f 72 65 20 | 61 62 6f 75 74 20 74 68 |nd more |about th|
|000013c0| 65 20 73 77 69 74 63 68 | 65 73 20 69 6e 20 74 68 |e switch|es in th|
|000013d0| 65 20 53 68 65 6c 6c 20 | 52 6f 6f 6d 20 64 6f 63 |e Shell |Room doc|
|000013e0| 75 6d 65 6e 74 61 74 69 | 6f 6e 2e 0d 0a 54 68 65 |umentati|on...The|
|000013f0| 20 2d 73 20 73 77 69 74 | 63 68 20 64 65 73 69 67 | -s swit|ch desig|
|00001400| 6e 61 74 65 73 20 74 68 | 65 20 73 77 61 70 20 64 |nates th|e swap d|
|00001410| 65 73 74 69 6e 61 74 69 | 6f 6e 20 28 6d 79 20 72 |estinati|on (my r|
|00001420| 3a 5c 63 6d 61 6e 64 20 | 64 69 72 65 63 74 6f 72 |:\cmand |director|
|00001430| 79 0d 0a 69 73 20 6f 6e | 20 6d 79 20 72 61 6d 64 |y..is on| my ramd|
|00001440| 69 73 6b 29 2e 20 54 68 | 65 20 2d 7a 20 73 77 69 |isk). Th|e -z swi|
|00001450| 74 63 68 20 73 65 74 73 | 20 74 68 65 20 73 68 65 |tch sets| the she|
|00001460| 6c 6c 20 65 6e 76 69 72 | 6f 6e 6d 65 6e 74 20 73 |ll envir|onment s|
|00001470| 69 7a 65 2e 0d 0a 20 20 | 41 6e 20 75 6e 66 6f 72 |ize... |An unfor|
|00001480| 74 75 6e 61 74 65 20 70 | 61 72 74 20 69 73 20 74 |tunate p|art is t|
|00001490| 68 61 74 20 74 68 65 20 | 54 50 20 35 2e 30 20 54 |hat the |TP 5.0 T|
|000014a0| 75 72 62 6f 20 50 61 73 | 63 61 6c 20 49 44 45 20 |urbo Pas|cal IDE |
|000014b0| 69 73 20 61 62 6f 75 74 | 0d 0a 74 68 65 20 6f 6e |is about|..the on|
|000014c0| 6c 79 20 70 72 6f 67 72 | 61 6d 20 49 20 6b 6e 6f |ly progr|am I kno|
|000014d0| 77 20 74 68 61 74 20 69 | 73 20 6e 6f 74 20 61 6d |w that i|s not am|
|000014e0| 65 6e 61 62 6c 65 20 74 | 68 65 20 74 6f 20 53 68 |enable t|he to Sh|
|000014f0| 65 6c 6c 20 52 6f 6f 6d | 0d 0a 75 74 69 6c 69 74 |ell Room|..utilit|
|00001500| 79 2c 20 73 6f 20 79 6f | 75 20 63 61 6e 6e 6f 74 |y, so yo|u cannot|
|00001510| 20 75 74 69 6c 69 7a 65 | 20 53 68 65 6c 6c 20 52 | utilize| Shell R|
|00001520| 6f 6f 6d 20 74 6f 20 73 | 77 61 70 20 74 68 65 20 |oom to s|wap the |
|00001530| 54 50 20 49 44 45 20 74 | 6f 0d 0a 64 69 73 6b 2e |TP IDE t|o..disk.|
|00001540| 20 42 6c 65 73 73 66 75 | 6c 6c 79 2c 20 61 74 20 | Blessfu|lly, at |
|00001550| 6c 65 61 73 74 20 54 50 | 20 37 2e 30 20 6e 6f 20 |least TP| 7.0 no |
|00001560| 6d 6f 72 65 20 68 61 73 | 20 74 68 69 73 20 70 72 |more has| this pr|
|00001570| 6f 62 6c 65 6d 2e 0d 0a | 2d 2d 2d 2d 2d 2d 2d 2d |oblem...|--------|
|00001580| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001590| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000015a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000015b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 0d 0a 0d 0a |--------|----....|
|000015c0| 46 72 6f 6d 20 74 73 40 | 75 77 61 73 61 2e 66 69 |From ts@|uwasa.fi|
|000015d0| 20 53 61 74 20 53 65 70 | 20 37 20 30 30 3a 30 30 | Sat Sep| 7 00:00|
|000015e0| 3a 35 32 20 31 39 39 36 | 0d 0a 53 75 62 6a 65 63 |:52 1996|..Subjec|
|000015f0| 74 3a 20 4c 61 73 74 20 | 70 6f 73 69 74 69 6f 6e |t: Last |position|
|00001600| 20 77 72 69 74 65 20 77 | 6f 65 73 0d 0a 0d 0a 35 | write w|oes....5|
|00001610| 32 2e 20 2a 2a 2a 2a 2a | 0d 0a 20 51 3a 20 48 6f |2. *****|.. Q: Ho|
|00001620| 77 20 64 6f 20 49 20 61 | 76 6f 69 64 20 73 63 72 |w do I a|void scr|
|00001630| 6f 6c 6c 69 6e 67 20 69 | 6e 20 74 68 65 20 6c 61 |olling i|n the la|
|00001640| 73 74 20 63 6f 6c 75 6d | 6e 20 6f 66 20 74 68 65 |st colum|n of the|
|00001650| 20 6c 61 73 74 20 72 6f | 77 3f 0d 0a 0d 0a 20 41 | last ro|w?.... A|
|00001660| 3a 20 49 66 20 79 6f 75 | 20 75 73 65 20 77 72 69 |: If you| use wri|
|00001670| 74 65 20 6f 72 20 77 72 | 69 74 65 6c 6e 20 61 74 |te or wr|iteln at|
|00001680| 20 74 68 65 20 6c 61 73 | 74 20 63 6f 6c 75 6d 6e | the las|t column|
|00001690| 20 6f 66 20 74 68 65 20 | 6c 61 73 74 20 72 6f 77 | of the |last row|
|000016a0| 0d 0a 28 75 73 75 61 6c | 6c 79 20 38 30 2c 32 35 |..(usual|ly 80,25|
|000016b0| 29 20 74 68 65 20 73 63 | 72 65 65 6e 20 77 69 6c |) the sc|reen wil|
|000016c0| 6c 20 73 63 72 6f 6c 6c | 2e 20 49 66 20 79 6f 75 |l scroll|. If you|
|000016d0| 20 77 69 73 68 20 74 6f | 20 61 76 6f 69 64 20 74 | wish to| avoid t|
|000016e0| 68 65 0d 0a 73 63 72 6f | 6c 6c 69 6e 67 20 79 6f |he..scro|lling yo|
|000016f0| 75 27 6c 6c 20 68 61 76 | 65 20 74 6f 20 75 73 65 |u'll hav|e to use|
|00001700| 20 61 6e 20 61 6c 74 65 | 72 6e 61 74 69 76 65 20 | an alte|rnative |
|00001710| 77 72 69 74 65 20 74 68 | 61 74 20 64 6f 65 73 20 |write th|at does |
|00001720| 6e 6f 74 20 6d 6f 76 65 | 0d 0a 74 68 65 20 63 75 |not move|..the cu|
|00001730| 72 73 6f 72 2e 20 48 65 | 72 65 20 69 73 20 61 20 |rsor. He|re is a |
|00001740| 70 72 6f 63 65 64 75 72 | 65 20 74 6f 20 77 72 69 |procedur|e to wri|
|00001750| 74 65 20 77 69 74 68 6f | 75 74 20 6d 6f 76 69 6e |te witho|ut movin|
|00001760| 67 20 74 68 65 20 63 75 | 72 73 6f 72 0d 0a 20 20 |g the cu|rsor.. |
|00001770| 75 73 65 73 20 44 6f 73 | 3b 0d 0a 20 20 70 72 6f |uses Dos|;.. pro|
|00001780| 63 65 64 75 72 65 20 57 | 72 69 74 65 43 68 61 72 |cedure W|riteChar|
|00001790| 20 28 43 68 61 72 61 63 | 74 65 72 20 3a 20 63 68 | (Charac|ter : ch|
|000017a0| 61 72 3b 20 66 67 43 6f | 6c 6f 72 2c 20 62 67 43 |ar; fgCo|lor, bgC|
|000017b0| 6f 6c 6f 72 20 3a 20 62 | 79 74 65 29 3b 0d 0a 20 |olor : b|yte);.. |
|000017c0| 20 76 61 72 20 72 20 3a | 20 72 65 67 69 73 74 65 | var r :| registe|
|000017d0| 72 73 3b 0d 0a 20 20 62 | 65 67 69 6e 0d 0a 20 20 |rs;.. b|egin.. |
|000017e0| 20 20 46 69 6c 6c 43 68 | 61 72 20 28 72 2c 20 53 | FillCh|ar (r, S|
|000017f0| 69 7a 65 4f 66 28 72 29 | 2c 20 30 29 3b 0d 0a 20 |izeOf(r)|, 0);.. |
|00001800| 20 20 20 72 2e 61 68 20 | 3a 3d 20 24 30 39 3b 0d | r.ah |:= $09;.|
|00001810| 0a 20 20 20 20 72 2e 61 | 6c 20 3a 3d 20 6f 72 64 |. r.a|l := ord|
|00001820| 28 43 68 61 72 61 63 74 | 65 72 29 3b 0d 0a 20 20 |(Charact|er);.. |
|00001830| 20 20 72 2e 62 6c 20 3a | 3d 20 28 62 67 43 6f 6c | r.bl :|= (bgCol|
|00001840| 6f 72 20 73 68 6c 20 34 | 29 20 6f 72 20 66 67 43 |or shl 4|) or fgC|
|00001850| 6f 6c 6f 72 3b 0d 0a 20 | 20 20 20 72 2e 63 78 20 |olor;.. | r.cx |
|00001860| 3a 3d 20 31 3b 20 20 20 | 20 7b 20 4e 75 6d 62 65 |:= 1; | { Numbe|
|00001870| 72 20 6f 66 20 72 65 70 | 65 61 74 73 20 7d 0d 0a |r of rep|eats }..|
|00001880| 20 20 20 20 49 6e 74 72 | 20 28 24 31 30 2c 20 72 | Intr| ($10, r|
|00001890| 29 3b 0d 0a 20 20 65 6e | 64 3b 20 20 28 2a 20 77 |);.. en|d; (* w|
|000018a0| 72 69 74 65 63 68 61 72 | 20 2a 29 0d 0a 54 68 75 |ritechar| *)..Thu|
|000018b0| 73 2c 20 69 66 20 79 6f | 75 20 77 69 73 68 20 74 |s, if yo|u wish t|
|000018c0| 6f 20 77 72 69 74 65 20 | 74 6f 20 74 68 65 20 6c |o write |to the l|
|000018d0| 61 73 74 20 63 6f 6c 75 | 6d 6e 20 6f 66 20 74 68 |ast colu|mn of th|
|000018e0| 65 20 6c 61 73 74 20 72 | 6f 77 2c 20 79 6f 75 0d |e last r|ow, you.|
|000018f0| 0a 6d 75 73 74 20 66 69 | 72 73 74 20 6d 6f 76 65 |.must fi|rst move|
|00001900| 20 74 68 65 20 63 75 72 | 73 6f 72 20 74 6f 20 74 | the cur|sor to t|
|00001910| 68 61 74 20 70 6f 73 69 | 74 69 6f 6e 2e 20 54 68 |hat posi|tion. Th|
|00001920| 61 74 20 63 61 6e 20 62 | 65 20 64 6f 6e 65 20 69 |at can b|e done i|
|00001930| 6e 0d 0a 61 6c 74 65 72 | 6e 61 74 69 76 65 20 77 |n..alter|native w|
|00001940| 61 79 73 2e 20 4f 6e 65 | 20 6d 69 67 68 74 20 67 |ays. One| might g|
|00001950| 65 74 20 74 68 65 72 65 | 20 62 79 20 68 61 76 69 |et there| by havi|
|00001960| 6e 67 20 77 72 69 74 74 | 65 6e 20 70 72 65 76 69 |ng writt|en previ|
|00001970| 6f 75 73 6c 79 0d 0a 6f | 6e 20 74 68 65 20 73 63 |ously..o|n the sc|
|00001980| 72 65 65 6e 20 28 77 69 | 74 68 20 77 72 69 74 65 |reen (wi|th write|
|00001990| 6c 6e 20 61 6e 64 20 77 | 72 69 74 65 20 72 6f 75 |ln and w|rite rou|
|000019a0| 74 69 6e 65 73 29 20 75 | 6e 74 69 6c 20 6f 6e 65 |tines) u|ntil one|
|000019b0| 20 69 73 20 69 6e 20 74 | 68 61 74 0d 0a 70 6f 73 | is in t|hat..pos|
|000019c0| 69 74 69 6f 6e 2e 20 41 | 6e 6f 74 68 65 72 20 61 |ition. A|nother a|
|000019d0| 6c 74 65 72 6e 61 74 69 | 76 65 20 69 73 20 75 73 |lternati|ve is us|
|000019e0| 69 6e 67 20 47 6f 54 6f | 58 59 28 38 30 2c 32 30 |ing GoTo|XY(80,20|
|000019f0| 29 2c 20 62 75 74 20 74 | 68 65 6e 20 79 6f 75 0d |), but t|hen you.|
|00001a00| 0a 68 61 76 65 20 74 6f | 20 75 73 65 20 74 68 65 |.have to| use the|
|00001a10| 20 43 72 74 20 75 6e 69 | 74 2e 20 49 66 20 79 6f | Crt uni|t. If yo|
|00001a20| 75 20 64 6f 6e 27 74 20 | 77 61 6e 74 20 74 6f 20 |u don't |want to |
|00001a30| 75 73 65 20 69 74 2c 20 | 74 68 65 6e 20 79 6f 75 |use it, |then you|
|00001a40| 20 63 61 6e 0d 0a 6d 6f | 76 65 20 74 68 65 20 63 | can..mo|ve the c|
|00001a50| 75 72 73 6f 72 20 62 79 | 20 65 6d 70 6c 6f 79 69 |ursor by| employi|
|00001a60| 6e 67 20 22 47 4f 41 54 | 58 59 20 41 73 20 74 68 |ng "GOAT|XY As th|
|00001a70| 65 20 6f 72 64 69 6e 61 | 72 79 20 47 6f 54 6f 58 |e ordina|ry GoToX|
|00001a80| 59 20 62 75 74 20 6e 6f | 0d 0a 43 72 74 20 75 6e |Y but no|..Crt un|
|00001a90| 69 74 20 72 65 71 75 69 | 72 65 64 22 20 66 72 6f |it requi|red" fro|
|00001aa0| 6d 20 66 74 70 3a 2f 2f | 67 61 72 62 6f 2e 75 77 |m ftp://|garbo.uw|
|00001ab0| 61 73 61 2e 66 69 2f 70 | 63 2f 74 73 2f 74 73 70 |asa.fi/p|c/ts/tsp|
|00001ac0| 61 33 35 37 30 2e 7a 69 | 70 2e 0d 0a 20 20 20 54 |a3570.zi|p... T|
|00001ad0| 68 65 72 65 20 69 73 20 | 61 6e 20 61 6c 74 65 72 |here is |an alter|
|00001ae0| 6e 61 74 69 76 65 20 69 | 6e 74 65 72 72 75 70 74 |native i|nterrupt|
|00001af0| 20 73 65 72 76 69 63 65 | 20 28 24 30 41 29 20 77 | service| ($0A) w|
|00001b00| 68 69 63 68 20 64 6f 65 | 73 20 74 68 65 0d 0a 73 |hich doe|s the..s|
|00001b10| 61 6d 65 20 61 73 20 73 | 65 72 76 69 63 65 20 24 |ame as s|ervice $|
|00001b20| 30 39 2c 20 62 75 74 20 | 75 73 65 73 20 74 68 65 |09, but |uses the|
|00001b30| 20 64 65 66 61 75 6c 74 | 20 63 6f 6c 6f 72 73 20 | default| colors |
|00001b40| 69 6e 73 74 65 61 64 2e | 20 4a 75 73 74 0d 0a 73 |instead.| Just..s|
|00001b50| 75 62 73 74 69 74 75 74 | 65 20 24 30 41 20 66 6f |ubstitut|e $0A fo|
|00001b60| 72 20 24 30 39 2c 20 61 | 6e 64 20 6c 65 61 76 65 |r $09, a|nd leave|
|00001b70| 20 74 68 65 20 72 2e 62 | 6c 20 61 73 73 69 67 6e | the r.b|l assign|
|00001b80| 6d 65 6e 74 20 6f 75 74 | 20 6f 66 20 74 68 65 0d |ment out| of the.|
|00001b90| 0a 57 72 69 74 65 43 68 | 61 72 20 72 6f 75 74 69 |.WriteCh|ar routi|
|00001ba0| 6e 65 2e 0d 0a 20 20 20 | 41 6e 6f 74 68 65 72 20 |ne... |Another |
|00001bb0| 6f 70 74 69 6f 6e 20 66 | 6f 72 20 77 72 69 74 69 |option f|or writi|
|00001bc0| 6e 67 20 61 6e 79 68 65 | 72 65 20 6f 6e 20 74 68 |ng anyhe|re on th|
|00001bd0| 65 20 73 63 72 65 65 6e | 20 77 69 74 68 6f 75 74 |e screen| without|
|00001be0| 0d 0a 61 66 66 65 63 74 | 69 6e 67 20 74 68 65 20 |..affect|ing the |
|00001bf0| 63 75 72 73 6f 72 20 69 | 73 20 75 73 69 6e 67 20 |cursor i|s using |
|00001c00| 64 69 72 65 63 74 20 73 | 63 72 65 65 6e 20 77 72 |direct s|creen wr|
|00001c10| 69 74 65 73 3a 0d 0a 20 | 20 75 73 65 73 20 44 6f |ites:.. | uses Do|
|00001c20| 73 3b 0d 0a 20 20 70 72 | 6f 63 65 64 75 72 65 20 |s;.. pr|ocedure |
|00001c30| 57 72 69 74 65 43 68 61 | 72 20 28 63 20 3a 20 63 |WriteCha|r (c : c|
|00001c40| 68 61 72 3b 20 78 2c 20 | 79 20 3a 20 62 79 74 65 |har; x, |y : byte|
|00001c50| 3b 20 66 67 2c 20 62 67 | 20 3a 20 62 79 74 65 29 |; fg, bg| : byte)|
|00001c60| 3b 0d 0a 20 20 76 61 72 | 20 76 69 64 73 74 61 72 |;.. var| vidstar|
|00001c70| 74 20 3a 20 77 6f 72 64 | 3b 0d 0a 20 20 20 20 20 |t : word|;.. |
|00001c80| 20 72 65 67 73 20 20 20 | 20 20 3a 20 72 65 67 69 | regs | : regi|
|00001c90| 73 74 65 72 73 3b 0d 0a | 20 20 62 65 67 69 6e 0d |sters;..| begin.|
|00001ca0| 0a 20 20 20 20 46 69 6c | 6c 43 68 61 72 20 28 72 |. Fil|lChar (r|
|00001cb0| 65 67 73 2c 20 53 69 7a | 65 4f 66 28 72 65 67 73 |egs, Siz|eOf(regs|
|00001cc0| 29 2c 20 30 29 3b 0d 0a | 20 20 20 20 72 65 67 73 |), 0);..| regs|
|00001cd0| 2e 61 68 20 3a 3d 20 24 | 30 46 3b 0d 0a 20 20 20 |.ah := $|0F;.. |
|00001ce0| 20 49 6e 74 72 20 28 24 | 31 30 2c 20 72 65 67 73 | Intr ($|10, regs|
|00001cf0| 29 3b 20 20 7b 20 43 6f | 6c 6f 72 20 6f 72 20 4d |); { Co|lor or M|
|00001d00| 6f 6e 6f 43 68 72 6f 6d | 65 20 76 69 64 65 6f 20 |onoChrom|e video |
|00001d10| 61 64 61 70 74 65 72 20 | 7d 0d 0a 20 20 20 20 69 |adapter |}.. i|
|00001d20| 66 20 72 65 67 73 2e 61 | 6c 20 3d 20 37 20 74 68 |f regs.a|l = 7 th|
|00001d30| 65 6e 20 76 69 64 73 74 | 61 72 74 20 3a 3d 20 24 |en vidst|art := $|
|00001d40| 42 30 30 30 20 65 6c 73 | 65 20 76 69 64 73 74 61 |B000 els|e vidsta|
|00001d50| 72 74 20 3a 3d 20 24 42 | 38 30 30 3b 0d 0a 20 20 |rt := $B|800;.. |
|00001d60| 20 20 6d 65 6d 5b 76 69 | 64 73 74 61 72 74 3a 28 | mem[vi|dstart:(|
|00001d70| 28 79 2d 31 29 2a 38 30 | 2b 78 2d 31 29 2a 32 5d |(y-1)*80|+x-1)*2]|
|00001d80| 20 3a 3d 20 6f 72 64 28 | 63 29 3b 0d 0a 20 20 20 | := ord(|c);.. |
|00001d90| 20 6d 65 6d 5b 76 69 64 | 73 74 61 72 74 3a 28 28 | mem[vid|start:((|
|00001da0| 79 2d 31 29 2a 38 30 2b | 78 2d 31 29 2a 32 2b 31 |y-1)*80+|x-1)*2+1|
|00001db0| 5d 20 3a 3d 20 28 62 67 | 20 73 68 6c 20 34 29 20 |] := (bg| shl 4) |
|00001dc0| 6f 72 20 66 67 3b 0d 0a | 20 20 65 6e 64 3b 0d 0a |or fg;..| end;..|
|00001dd0| 54 6f 20 77 72 69 74 65 | 20 74 6f 20 74 68 65 20 |To write| to the |
|00001de0| 6c 61 73 74 20 70 6f 73 | 69 74 69 6f 6e 20 73 69 |last pos|ition si|
|00001df0| 6d 70 6c 79 20 61 70 70 | 6c 79 20 65 2e 67 2e 0d |mply app|ly e.g..|
|00001e00| 0a 20 20 57 72 69 74 65 | 43 68 61 72 20 28 27 58 |. Write|Char ('X|
|00001e10| 27 2c 20 38 30 2c 20 32 | 35 2c 20 31 34 2c 20 30 |', 80, 2|5, 14, 0|
|00001e20| 29 3b 20 20 7b 20 59 65 | 6c 6c 6f 77 20 6f 6e 20 |); { Ye|llow on |
|00001e30| 62 6c 61 63 6b 20 7d 0d | 0a 54 68 65 20 66 6f 72 |black }.|.The for|
|00001e40| 65 67 72 6f 75 6e 64 20 | 28 66 67 29 20 61 6e 64 |eground |(fg) and|
|00001e50| 20 74 68 65 20 62 61 63 | 6b 67 72 6f 75 6e 64 20 | the bac|kground |
|00001e60| 28 62 67 29 20 63 6f 6c | 6f 72 20 63 6f 64 65 73 |(bg) col|or codes|
|00001e70| 20 61 72 65 0d 0a 20 20 | 42 6c 61 63 6b 20 20 20 | are.. |Black |
|00001e80| 20 20 20 20 20 3d 20 20 | 20 30 0d 0a 20 20 42 6c | = | 0.. Bl|
|00001e90| 75 65 20 20 20 20 20 20 | 20 20 20 3d 20 20 20 31 |ue | = 1|
|00001ea0| 0d 0a 20 20 47 72 65 65 | 6e 20 20 20 20 20 20 20 |.. Gree|n |
|00001eb0| 20 3d 20 20 20 32 0d 0a | 20 20 43 79 61 6e 20 20 | = 2..| Cyan |
|00001ec0| 20 20 20 20 20 20 20 3d | 20 20 20 33 0d 0a 20 20 | =| 3.. |
|00001ed0| 52 65 64 20 20 20 20 20 | 20 20 20 20 20 3d 20 20 |Red | = |
|00001ee0| 20 34 0d 0a 20 20 4d 61 | 67 65 6e 74 61 20 20 20 | 4.. Ma|genta |
|00001ef0| 20 20 20 3d 20 20 20 35 | 0d 0a 20 20 42 72 6f 77 | = 5|.. Brow|
|00001f00| 6e 20 20 20 20 20 20 20 | 20 3d 20 20 20 36 0d 0a |n | = 6..|
|00001f10| 20 20 4c 69 67 68 74 47 | 72 61 79 20 20 20 20 3d | LightG|ray =|
|00001f20| 20 20 20 37 0d 0a 20 20 | 44 61 72 6b 47 72 61 79 | 7.. |DarkGray|
|00001f30| 20 20 20 20 20 3d 20 20 | 20 38 0d 0a 20 20 4c 69 | = | 8.. Li|
|00001f40| 67 68 74 42 6c 75 65 20 | 20 20 20 3d 20 20 20 39 |ghtBlue | = 9|
|00001f50| 0d 0a 20 20 4c 69 67 68 | 74 47 72 65 65 6e 20 20 |.. Ligh|tGreen |
|00001f60| 20 3d 20 20 31 30 0d 0a | 20 20 4c 69 67 68 74 43 | = 10..| LightC|
|00001f70| 79 61 6e 20 20 20 20 3d | 20 20 31 31 0d 0a 20 20 |yan =| 11.. |
|00001f80| 4c 69 67 68 74 52 65 64 | 20 20 20 20 20 3d 20 20 |LightRed| = |
|00001f90| 31 32 0d 0a 20 20 4c 69 | 67 68 74 4d 61 67 65 6e |12.. Li|ghtMagen|
|00001fa0| 74 61 20 3d 20 20 31 33 | 0d 0a 20 20 59 65 6c 6c |ta = 13|.. Yell|
|00001fb0| 6f 77 20 20 20 20 20 20 | 20 3d 20 20 31 34 0d 0a |ow | = 14..|
|00001fc0| 20 20 57 68 69 74 65 20 | 20 20 20 20 20 20 20 3d | White | =|
|00001fd0| 20 20 31 35 0d 0a 20 20 | 42 6c 69 6e 6b 20 20 20 | 15.. |Blink |
|00001fe0| 20 20 20 20 20 3d 20 31 | 32 38 0d 0a 59 65 74 20 | = 1|28..Yet |
|00001ff0| 61 6e 6f 74 68 65 72 20 | 6f 70 74 69 6f 6e 20 69 |another |option i|
|00002000| 73 20 74 68 65 20 66 6f | 6c 6c 6f 77 69 6e 67 2c |s the fo|llowing,|
|00002010| 20 62 75 74 20 69 74 20 | 6e 65 65 64 73 20 74 68 | but it |needs th|
|00002020| 65 20 43 72 74 20 75 6e | 69 74 2e 20 4f 6e 0d 0a |e Crt un|it. On..|
|00002030| 74 68 65 20 6f 74 68 65 | 72 20 68 61 6e 64 2c 20 |the othe|r hand, |
|00002040| 69 74 20 75 73 65 73 20 | 74 68 65 20 64 65 66 61 |it uses |the defa|
|00002050| 75 6c 74 20 63 6f 6c 6f | 72 2e 20 54 68 69 73 20 |ult colo|r. This |
|00002060| 69 73 20 71 75 69 74 65 | 20 61 20 67 6f 6f 64 20 |is quite| a good |
|00002070| 61 6e 64 0d 0a 65 61 73 | 79 20 73 6f 6c 75 74 69 |and..eas|y soluti|
|00002080| 6f 6e 2e 20 49 20 63 61 | 70 74 75 72 65 64 20 74 |on. I ca|ptured t|
|00002090| 68 69 73 20 66 61 69 72 | 6c 79 20 66 72 65 71 75 |his fair|ly frequ|
|000020a0| 65 6e 74 20 69 64 65 61 | 20 66 72 6f 6d 20 61 20 |ent idea| from a |
|000020b0| 70 6f 73 74 69 6e 67 0d | 0a 62 79 20 52 6f 62 65 |posting.|.by Robe|
|000020c0| 72 74 20 42 75 65 72 67 | 69 20 28 6e 62 75 65 72 |rt Buerg|i (nbuer|
|000020d0| 6f 40 68 73 6c 72 73 77 | 69 2e 68 61 73 6c 65 72 |o@hslrsw|i.hasler|
|000020e0| 2e 61 73 63 6f 6d 2e 63 | 68 29 2e 0d 0a 20 20 75 |.ascom.c|h)... u|
|000020f0| 73 65 73 20 43 72 74 3b | 0d 0a 20 20 70 72 6f 63 |ses Crt;|.. proc|
|00002100| 65 64 75 72 65 20 57 72 | 69 74 65 54 6f 43 6f 72 |edure Wr|iteToCor|
|00002110| 6e 65 72 20 28 63 20 3a | 20 63 68 61 72 29 3b 0d |ner (c :| char);.|
|00002120| 0a 20 20 62 65 67 69 6e | 0d 0a 20 20 20 20 49 6e |. begin|.. In|
|00002130| 63 20 28 57 69 6e 64 4d | 61 78 29 3b 0d 0a 20 20 |c (WindM|ax);.. |
|00002140| 20 20 47 6f 74 6f 58 59 | 20 28 38 30 2c 20 32 35 | GotoXY| (80, 25|
|00002150| 29 3b 0d 0a 20 20 20 20 | 77 72 69 74 65 20 28 63 |);.. |write (c|
|00002160| 29 3b 0d 0a 20 20 20 20 | 44 65 63 20 28 57 69 6e |);.. |Dec (Win|
|00002170| 64 4d 61 78 29 3b 0d 0a | 20 20 65 6e 64 3b 20 20 |dMax);..| end; |
|00002180| 28 2a 20 77 72 69 74 65 | 54 6f 43 6f 72 6e 65 72 |(* write|ToCorner|
|00002190| 20 2a 29 0d 0a 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d | *)..---|--------|
|000021a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000021b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000021c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000021d0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 0d 0a 0d 0a 46 72 6f |--------|-....Fro|
|000021e0| 6d 20 74 73 40 75 77 61 | 73 61 2e 66 69 20 53 61 |m ts@uwa|sa.fi Sa|
|000021f0| 74 20 53 65 70 20 37 20 | 30 30 3a 30 30 3a 35 33 |t Sep 7 |00:00:53|
|00002200| 20 31 39 39 36 0d 0a 53 | 75 62 6a 65 63 74 3a 20 | 1996..S|ubject: |
|00002210| 48 69 64 69 6e 67 20 61 | 20 64 69 72 65 63 74 6f |Hiding a| directo|
|00002220| 72 79 0d 0a 0d 0a 35 33 | 2e 20 2a 2a 2a 2a 2a 0d |ry....53|. *****.|
|00002230| 0a 20 51 3a 20 48 6f 77 | 20 63 61 6e 20 6f 6e 65 |. Q: How| can one|
|00002240| 20 68 69 64 65 20 28 6f | 72 20 75 6e 68 69 64 65 | hide (o|r unhide|
|00002250| 29 20 61 20 64 69 72 65 | 63 74 6f 72 79 20 75 73 |) a dire|ctory us|
|00002260| 69 6e 67 20 61 20 54 50 | 20 70 72 6f 67 72 61 6d |ing a TP| program|
|00002270| 3f 0d 0a 0d 0a 20 41 3a | 20 48 65 72 65 20 69 73 |?.... A:| Here is|
|00002280| 20 74 68 65 20 63 6f 64 | 65 20 75 73 69 6e 67 20 | the cod|e using |
|00002290| 69 6e 74 65 72 72 75 70 | 74 20 70 72 6f 67 72 61 |interrup|t progra|
|000022a0| 6d 6d 69 6e 67 2e 20 49 | 6e 63 69 64 65 6e 74 61 |mming. I|ncidenta|
|000022b0| 6c 6c 79 2c 0d 0a 73 69 | 6e 63 65 20 4d 53 2d 44 |lly,..si|nce MS-D|
|000022c0| 4f 53 20 35 2e 30 20 74 | 68 65 20 61 74 74 72 69 |OS 5.0 t|he attri|
|000022d0| 62 20 63 6f 6d 6d 61 6e | 64 20 63 61 6e 20 62 65 |b comman|d can be|
|000022e0| 20 75 73 65 64 20 74 6f | 20 68 69 64 65 20 61 6e | used to| hide an|
|000022f0| 64 20 75 6e 68 69 64 65 | 0d 0a 64 69 72 65 63 74 |d unhide|..direct|
|00002300| 6f 72 69 65 73 2e 0d 0a | 28 2a 20 48 69 64 65 20 |ories...|(* Hide |
|00002310| 61 20 64 69 72 65 63 74 | 6f 72 79 2e 20 42 65 66 |a direct|ory. Bef|
|00002320| 6f 72 65 20 75 73 69 6e | 67 20 69 74 20 77 6f 75 |ore usin|g it wou|
|00002330| 6c 64 20 62 65 20 70 72 | 75 64 65 6e 74 20 74 6f |ld be pr|udent to|
|00002340| 20 63 68 65 63 6b 0d 0a | 20 20 20 74 68 61 74 20 | check..| that |
|00002350| 74 68 65 20 64 69 72 65 | 63 74 6f 72 79 20 65 78 |the dire|ctory ex|
|00002360| 69 73 74 73 2c 20 61 6e | 64 20 74 68 61 74 20 69 |ists, an|d that i|
|00002370| 74 20 69 73 20 61 20 64 | 69 72 65 63 74 6f 72 79 |t is a d|irectory|
|00002380| 2e 0d 0a 20 20 20 57 69 | 74 68 20 61 20 63 6f 6e |... Wi|th a con|
|00002390| 74 72 69 62 75 74 69 6f | 6e 20 66 72 6f 6d 20 4a |tributio|n from J|
|000023a0| 61 6e 20 4e 69 65 6c 73 | 65 6e 20 6a 61 6b 40 68 |an Niels|en jak@h|
|000023b0| 64 63 2e 68 68 61 2e 64 | 6b 0d 0a 20 20 20 42 61 |dc.hha.d|k.. Ba|
|000023c0| 73 65 64 20 6f 6e 20 69 | 6e 66 6f 72 6d 61 74 69 |sed on i|nformati|
|000023d0| 6f 6e 20 66 72 6f 6d 20 | 44 75 6e 63 61 6e 20 28 |on from |Duncan (|
|000023e0| 31 39 38 36 29 2c 20 70 | 2e 20 34 31 30 20 2a 29 |1986), p|. 410 *)|
|000023f0| 0d 0a 70 72 6f 63 65 64 | 75 72 65 20 48 49 44 45 |..proced|ure HIDE|
|00002400| 20 28 64 69 72 6e 61 6d | 65 20 3a 20 73 74 72 69 | (dirnam|e : stri|
|00002410| 6e 67 29 3b 0d 0a 76 61 | 72 20 72 65 67 73 20 3a |ng);..va|r regs :|
|00002420| 20 72 65 67 69 73 74 65 | 72 73 3b 0d 0a 62 65 67 | registe|rs;..beg|
|00002430| 69 6e 0d 0a 20 20 46 69 | 6c 6c 43 68 61 72 20 28 |in.. Fi|llChar (|
|00002440| 72 65 67 73 2c 20 53 69 | 7a 65 4f 66 28 72 65 67 |regs, Si|zeOf(reg|
|00002450| 73 29 2c 20 30 29 3b 20 | 20 7b 20 73 74 61 6e 64 |s), 0); | { stand|
|00002460| 61 72 64 20 70 72 65 63 | 61 75 74 69 6f 6e 20 7d |ard prec|aution }|
|00002470| 0d 0a 20 20 64 69 72 6e | 61 6d 65 20 3a 3d 20 64 |.. dirn|ame := d|
|00002480| 69 72 6e 61 6d 65 20 2b | 20 23 30 3b 20 20 20 20 |irname +| #0; |
|00002490| 20 20 20 20 20 20 20 7b | 20 72 65 71 75 69 72 65 | {| require|
|000024a0| 73 20 41 53 43 49 49 5a | 20 73 74 72 69 6e 67 73 |s ASCIIZ| strings|
|000024b0| 20 7d 0d 0a 20 20 72 65 | 67 73 2e 61 68 20 3a 3d | }.. re|gs.ah :=|
|000024c0| 20 24 34 33 3b 20 20 20 | 20 20 20 20 20 20 20 20 | $43; | |
|000024d0| 20 20 20 20 20 20 20 20 | 20 7b 20 66 75 6e 63 74 | | { funct|
|000024e0| 69 6f 6e 20 7d 0d 0a 20 | 20 72 65 67 73 2e 61 6c |ion }.. | regs.al|
|000024f0| 20 3a 3d 20 24 30 31 3b | 20 20 20 20 20 20 20 20 | := $01;| |
|00002500| 20 20 20 20 20 20 20 20 | 20 20 20 20 7b 20 73 75 | | { su|
|00002510| 62 66 75 6e 63 74 69 6f | 6e 20 7d 0d 0a 20 20 72 |bfunctio|n }.. r|
|00002520| 65 67 73 2e 64 73 20 3a | 3d 20 53 65 67 28 64 69 |egs.ds :|= Seg(di|
|00002530| 72 6e 61 6d 65 5b 31 5d | 29 3b 20 20 20 20 20 20 |rname[1]|); |
|00002540| 20 20 7b 20 70 6f 69 6e | 74 20 74 6f 20 74 68 65 | { poin|t to the|
|00002550| 20 6e 61 6d 65 20 7d 0d | 0a 20 20 72 65 67 73 2e | name }.|. regs.|
|00002560| 64 78 20 3a 3d 20 4f 66 | 73 28 64 69 72 6e 61 6d |dx := Of|s(dirnam|
|00002570| 65 5b 31 5d 29 3b 0d 0a | 20 20 72 65 67 73 2e 63 |e[1]);..| regs.c|
|00002580| 78 20 3a 3d 20 32 3b 20 | 7b 20 73 65 74 20 62 69 |x := 2; |{ set bi|
|00002590| 74 20 31 20 6f 6e 20 7d | 20 20 20 20 20 7b 20 74 |t 1 on }| { t|
|000025a0| 6f 20 75 6e 68 69 64 65 | 20 73 65 74 20 72 65 67 |o unhide| set reg|
|000025b0| 73 2e 63 78 20 3a 3d 20 | 30 20 7d 0d 0a 20 20 49 |s.cx := |0 }.. I|
|000025c0| 6e 74 72 20 28 24 32 31 | 2c 20 72 65 67 73 29 3b |ntr ($21|, regs);|
|000025d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000025e0| 20 20 7b 20 63 61 6c 6c | 20 74 68 65 20 69 6e 74 | { call| the int|
|000025f0| 65 72 72 75 70 74 20 7d | 0d 0a 20 20 69 66 20 72 |errupt }|.. if r|
|00002600| 65 67 73 2e 46 6c 61 67 | 73 20 61 6e 64 20 46 43 |egs.Flag|s and FC|
|00002610| 61 72 72 79 20 3c 3e 20 | 30 20 74 68 65 6e 20 7b |arry <> |0 then {|
|00002620| 20 77 65 72 65 20 77 65 | 20 73 75 63 63 65 73 73 | were we| success|
|00002630| 66 75 6c 20 7d 0d 0a 20 | 20 20 20 77 72 69 74 65 |ful }.. | write|
|00002640| 6c 6e 20 28 27 46 61 69 | 6c 65 64 20 74 6f 20 68 |ln ('Fai|led to h|
|00002650| 69 64 65 27 29 3b 0d 0a | 65 6e 64 3b 20 20 28 2a |ide');..|end; (*|
|00002660| 20 68 69 64 65 20 2a 29 | 0d 0a 0d 0a 20 41 32 3a | hide *)|.... A2:|
|00002670| 20 41 6e 20 61 6c 74 65 | 72 6e 61 74 69 76 65 20 | An alte|rnative |
|00002680| 6d 65 74 68 6f 64 20 62 | 79 20 44 72 2e 20 41 62 |method b|y Dr. Ab|
|00002690| 69 6d 62 6f 6c 61 20 4f | 6c 6f 77 6f 66 6f 79 65 |imbola O|lowofoye|
|000026a0| 6b 75 0d 0a 6c 61 61 31 | 32 40 73 65 71 31 2e 6b |ku..laa1|2@seq1.k|
|000026b0| 65 65 6c 65 2e 61 63 2e | 75 6b 2e 20 4e 6f 20 70 |eele.ac.|uk. No p|
|000026c0| 61 74 68 73 2e 0d 0a 20 | 20 70 72 6f 63 65 64 75 |aths... | procedu|
|000026d0| 72 65 20 48 49 44 45 20 | 28 64 69 72 6e 61 6d 65 |re HIDE |(dirname|
|000026e0| 20 3a 20 73 74 72 69 6e | 67 29 3b 0d 0a 20 20 76 | : strin|g);.. v|
|000026f0| 61 72 20 46 69 6c 65 49 | 6e 66 6f 20 3a 20 73 65 |ar FileI|nfo : se|
|00002700| 61 72 63 68 52 65 63 3b | 0d 0a 20 20 20 20 20 20 |archRec;|.. |
|00002710| 66 20 20 20 20 20 20 20 | 20 3a 20 66 69 6c 65 3b |f | : file;|
|00002720| 0d 0a 20 20 62 65 67 69 | 6e 0d 0a 20 20 20 20 46 |.. begi|n.. F|
|00002730| 69 6e 64 46 69 72 73 74 | 20 28 64 69 72 6e 61 6d |indFirst| (dirnam|
|00002740| 65 2c 20 44 69 72 65 63 | 74 6f 72 79 2c 20 46 69 |e, Direc|tory, Fi|
|00002750| 6c 65 49 6e 66 6f 29 3b | 0d 0a 20 20 20 20 77 68 |leInfo);|.. wh|
|00002760| 69 6c 65 20 44 6f 73 45 | 72 72 6f 72 20 3d 20 30 |ile DosE|rror = 0|
|00002770| 20 64 6f 0d 0a 20 20 20 | 20 20 20 62 65 67 69 6e | do.. | begin|
|00002780| 0d 0a 20 20 20 20 20 20 | 20 20 61 73 73 69 67 6e |.. | assign|
|00002790| 20 28 66 2c 20 46 69 6c | 65 49 6e 66 6f 2e 4e 61 | (f, Fil|eInfo.Na|
|000027a0| 6d 65 29 3b 0d 0a 20 20 | 20 20 20 20 20 20 53 65 |me);.. | Se|
|000027b0| 74 46 41 74 74 72 20 28 | 66 2c 20 48 69 64 64 65 |tFAttr (|f, Hidde|
|000027c0| 6e 29 3b 0d 0a 20 20 20 | 20 20 20 20 20 46 69 6e |n);.. | Fin|
|000027d0| 64 4e 65 78 74 20 28 46 | 69 6c 65 49 6e 66 6f 29 |dNext (F|ileInfo)|
|000027e0| 3b 0d 0a 20 20 20 20 20 | 20 65 6e 64 3b 0d 0a 20 |;.. | end;.. |
|000027f0| 20 65 6e 64 3b 20 20 28 | 2a 20 68 69 64 65 20 2a | end; (|* hide *|
|00002800| 29 0d 0a 20 20 7b 7d 0d | 0a 20 20 70 72 6f 63 65 |).. {}.|. proce|
|00002810| 64 75 72 65 20 55 4e 48 | 49 44 45 20 28 64 69 72 |dure UNH|IDE (dir|
|00002820| 6e 61 6d 65 20 3a 20 73 | 74 72 69 6e 67 29 3b 0d |name : s|tring);.|
|00002830| 0a 20 20 76 61 72 20 46 | 69 6c 65 49 6e 66 6f 20 |. var F|ileInfo |
|00002840| 3a 20 73 65 61 72 63 68 | 52 65 63 3b 0d 0a 20 20 |: search|Rec;.. |
|00002850| 20 20 20 20 66 20 20 20 | 20 20 20 20 20 3a 20 66 | f | : f|
|00002860| 69 6c 65 3b 0d 0a 20 20 | 62 65 67 69 6e 0d 0a 20 |ile;.. |begin.. |
|00002870| 20 20 20 46 69 6e 64 46 | 69 72 73 74 20 28 64 69 | FindF|irst (di|
|00002880| 72 6e 61 6d 65 2c 20 41 | 6e 79 46 69 6c 65 2c 20 |rname, A|nyFile, |
|00002890| 46 69 6c 65 49 6e 66 6f | 29 3b 0d 0a 20 20 20 20 |FileInfo|);.. |
|000028a0| 77 68 69 6c 65 20 44 6f | 73 45 72 72 6f 72 20 3d |while Do|sError =|
|000028b0| 20 30 20 64 6f 0d 0a 20 | 20 20 20 20 20 62 65 67 | 0 do.. | beg|
|000028c0| 69 6e 0d 0a 20 20 20 20 | 20 20 20 20 61 73 73 69 |in.. | assi|
|000028d0| 67 6e 20 28 66 2c 20 46 | 69 6c 65 49 6e 66 6f 2e |gn (f, F|ileInfo.|
|000028e0| 4e 61 6d 65 29 3b 0d 0a | 20 20 20 20 20 20 20 20 |Name);..| |
|000028f0| 53 65 74 46 41 74 74 72 | 20 28 66 2c 20 41 72 63 |SetFAttr| (f, Arc|
|00002900| 68 69 76 65 29 3b 0d 0a | 20 20 20 20 20 20 20 20 |hive);..| |
|00002910| 46 69 6e 64 4e 65 78 74 | 20 28 46 69 6c 65 49 6e |FindNext| (FileIn|
|00002920| 66 6f 29 3b 0d 0a 20 20 | 20 20 20 20 65 6e 64 3b |fo);.. | end;|
|00002930| 0d 0a 20 20 65 6e 64 3b | 20 20 28 2a 20 75 6e 68 |.. end;| (* unh|
|00002940| 69 64 65 20 2a 29 0d 0a | 2d 2d 2d 2d 2d 2d 2d 2d |ide *)..|--------|
|00002950| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00002960| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00002970| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00002980| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 0d 0a 0d 0a |--------|----....|
|00002990| 46 72 6f 6d 20 74 73 40 | 75 77 61 73 61 2e 66 69 |From ts@|uwasa.fi|
|000029a0| 20 53 61 74 20 53 65 70 | 20 37 20 30 30 3a 30 30 | Sat Sep| 7 00:00|
|000029b0| 3a 35 34 20 31 39 39 36 | 0d 0a 53 75 62 6a 65 63 |:54 1996|..Subjec|
|000029c0| 74 3a 20 54 65 73 74 69 | 6e 67 20 66 69 6c 65 20 |t: Testi|ng file |
|000029d0| 6f 70 65 6e 65 64 20 73 | 74 61 74 75 73 0d 0a 0d |opened s|tatus...|
|000029e0| 0a 35 34 2e 20 2a 2a 2a | 2a 2a 0d 0a 20 51 3a 20 |.54. ***|**.. Q: |
|000029f0| 48 6f 77 20 64 6f 20 49 | 20 74 65 73 74 20 77 68 |How do I| test wh|
|00002a00| 65 74 68 65 72 20 61 20 | 66 69 6c 65 20 69 73 20 |ether a |file is |
|00002a10| 61 6c 72 65 61 64 79 20 | 6f 70 65 6e 20 69 6e 20 |already |open in |
|00002a20| 61 20 54 50 20 70 72 6f | 67 72 61 6d 3f 0d 0a 0d |a TP pro|gram?...|
|00002a30| 0a 20 41 3a 20 54 68 69 | 73 20 71 75 65 73 74 69 |. A: Thi|s questi|
|00002a40| 6f 6e 20 69 73 20 62 65 | 73 74 20 61 6e 73 77 65 |on is be|st answe|
|00002a50| 72 65 64 20 62 79 20 70 | 72 6f 76 69 64 69 6e 67 |red by p|roviding|
|00002a60| 20 74 68 65 20 63 6f 64 | 65 3a 0d 0a 20 20 75 73 | the cod|e:.. us|
|00002a70| 65 73 20 44 6f 73 3b 0d | 0a 20 20 7b 2e 2e 2e 20 |es Dos;.|. {... |
|00002a80| 66 6f 72 20 6e 6f 6e 2d | 74 65 78 74 20 66 69 6c |for non-|text fil|
|00002a90| 65 73 20 2e 2e 2e 7d 0d | 0a 20 20 66 75 6e 63 74 |es ...}.|. funct|
|00002aa0| 69 6f 6e 20 49 53 46 4f | 50 45 4e 20 28 76 61 72 |ion ISFO|PEN (var|
|00002ab0| 20 66 69 6c 65 50 6f 69 | 6e 74 65 72 20 3a 20 66 | filePoi|nter : f|
|00002ac0| 69 6c 65 29 20 3a 20 62 | 6f 6f 6c 65 61 6e 3b 0d |ile) : b|oolean;.|
|00002ad0| 0a 20 20 62 65 67 69 6e | 0d 0a 20 20 20 20 69 73 |. begin|.. is|
|00002ae0| 66 6f 70 65 6e 20 3a 3d | 20 46 69 6c 65 52 65 63 |fopen :=| FileRec|
|00002af0| 28 66 69 6c 65 50 6f 69 | 6e 74 65 72 29 2e 6d 6f |(filePoi|nter).mo|
|00002b00| 64 65 20 3c 3e 20 46 6d | 43 6c 6f 73 65 64 3b 0d |de <> Fm|Closed;.|
|00002b10| 0a 20 20 65 6e 64 3b 0d | 0a 20 20 7b 7d 0d 0a 20 |. end;.|. {}.. |
|00002b20| 20 7b 2e 2e 2e 20 66 6f | 72 20 74 65 78 74 20 66 | {... fo|r text f|
|00002b30| 69 6c 65 73 20 2e 2e 2e | 7d 0d 0a 20 20 66 75 6e |iles ...|}.. fun|
|00002b40| 63 74 69 6f 6e 20 49 53 | 54 4f 50 45 4e 20 28 76 |ction IS|TOPEN (v|
|00002b50| 61 72 20 66 69 6c 65 50 | 6f 69 6e 74 65 72 20 3a |ar fileP|ointer :|
|00002b60| 20 74 65 78 74 29 20 3a | 20 62 6f 6f 6c 65 61 6e | text) :| boolean|
|00002b70| 3b 0d 0a 20 20 62 65 67 | 69 6e 0d 0a 20 20 20 20 |;.. beg|in.. |
|00002b80| 69 73 74 6f 70 65 6e 20 | 3a 3d 20 54 65 78 74 52 |istopen |:= TextR|
|00002b90| 65 63 28 66 69 6c 65 50 | 6f 69 6e 74 65 72 29 2e |ec(fileP|ointer).|
|00002ba0| 6d 6f 64 65 20 3c 3e 20 | 46 6d 43 6c 6f 73 65 64 |mode <> |FmClosed|
|00002bb0| 3b 0d 0a 20 20 65 6e 64 | 3b 0d 0a 20 20 7b 7d 0d |;.. end|;.. {}.|
|00002bc0| 0a 20 20 70 72 6f 63 65 | 64 75 72 65 20 54 45 53 |. proce|dure TES|
|00002bd0| 54 3b 20 20 20 20 20 20 | 20 20 20 20 7b 20 54 65 |T; | { Te|
|00002be0| 73 74 69 6e 67 20 61 20 | 6e 6f 6e 2d 74 65 78 74 |sting a |non-text|
|00002bf0| 20 66 69 6c 65 20 7d 0d | 0a 20 20 63 6f 6e 73 74 | file }.|. const|
|00002c00| 20 6e 61 6d 65 20 3d 20 | 27 52 3a 5c 54 4d 50 27 | name = |'R:\TMP'|
|00002c10| 3b 0d 0a 20 20 76 61 72 | 20 66 20 20 3a 20 66 69 |;.. var| f : fi|
|00002c20| 6c 65 3b 0d 0a 20 20 62 | 65 67 69 6e 0d 0a 20 20 |le;.. b|egin.. |
|00002c30| 20 20 41 73 73 69 67 6e | 20 28 66 2c 20 6e 61 6d | Assign| (f, nam|
|00002c40| 65 29 3b 0d 0a 20 20 20 | 20 77 72 69 74 65 6c 6e |e);.. | writeln|
|00002c50| 20 28 27 46 69 6c 65 20 | 27 2c 20 6e 61 6d 65 2c | ('File |', name,|
|00002c60| 20 27 20 69 73 20 6f 70 | 65 6e 20 69 73 20 27 2c | ' is op|en is ',|
|00002c70| 20 49 53 46 4f 50 45 4e | 28 66 29 29 3b 0d 0a 20 | ISFOPEN|(f));.. |
|00002c80| 20 20 20 7b 24 49 2d 7d | 20 72 65 77 72 69 74 65 | {$I-}| rewrite|
|00002c90| 20 28 66 29 3b 20 7b 24 | 49 2b 7d 0d 0a 20 20 20 | (f); {$|I+}.. |
|00002ca0| 20 69 66 20 49 4f 52 65 | 73 75 6c 74 20 3c 3e 20 | if IORe|sult <> |
|00002cb0| 30 20 74 68 65 6e 0d 0a | 20 20 20 20 20 20 62 65 |0 then..| be|
|00002cc0| 67 69 6e 0d 0a 20 20 20 | 20 20 20 20 20 77 72 69 |gin.. | wri|
|00002cd0| 74 65 6c 6e 20 28 27 46 | 61 69 6c 65 64 20 74 6f |teln ('F|ailed to|
|00002ce0| 20 6f 70 65 6e 20 27 2c | 20 6e 61 6d 65 29 3b 0d | open ',| name);.|
|00002cf0| 0a 20 20 20 20 20 20 20 | 20 65 78 69 74 3b 0d 0a |. | exit;..|
|00002d00| 20 20 20 20 20 20 65 6e | 64 3b 0d 0a 20 20 20 20 | en|d;.. |
|00002d10| 77 72 69 74 65 6c 6e 20 | 28 27 46 69 6c 65 20 27 |writeln |('File '|
|00002d20| 2c 20 6e 61 6d 65 2c 20 | 27 20 69 73 20 6f 70 65 |, name, |' is ope|
|00002d30| 6e 20 69 73 20 27 2c 20 | 49 53 46 4f 50 45 4e 28 |n is ', |ISFOPEN(|
|00002d40| 66 29 29 3b 0d 0a 20 20 | 20 20 63 6c 6f 73 65 28 |f));.. | close(|
|00002d50| 66 29 3b 0d 0a 20 20 20 | 20 77 72 69 74 65 6c 6e |f);.. | writeln|
|00002d60| 20 28 27 46 69 6c 65 20 | 27 2c 20 6e 61 6d 65 2c | ('File |', name,|
|00002d70| 20 27 20 69 73 20 6f 70 | 65 6e 20 69 73 20 27 2c | ' is op|en is ',|
|00002d80| 20 49 53 46 4f 50 45 4e | 28 66 29 29 3b 0d 0a 20 | ISFOPEN|(f));.. |
|00002d90| 20 65 6e 64 3b 0d 0a 2d | 2d 2d 2d 2d 2d 2d 2d 2d | end;..-|--------|
|00002da0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00002db0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00002dc0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00002dd0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 0d 0a 0d 0a 46 |--------|---....F|
|00002de0| 72 6f 6d 20 74 73 40 75 | 77 61 73 61 2e 66 69 20 |rom ts@u|wasa.fi |
|00002df0| 53 61 74 20 53 65 70 20 | 37 20 30 30 3a 30 30 3a |Sat Sep |7 00:00:|
|00002e00| 35 35 20 31 39 39 36 0d | 0a 53 75 62 6a 65 63 74 |55 1996.|.Subject|
|00002e10| 3a 20 46 72 6f 6d 20 73 | 74 72 69 6e 67 20 74 6f |: From s|tring to|
|00002e20| 20 72 65 61 6c 0d 0a 0d | 0a 35 35 2e 20 2a 2a 2a | real...|.55. ***|
|00002e30| 2a 2a 0d 0a 20 51 3a 20 | 48 6f 77 20 63 61 6e 20 |**.. Q: |How can |
|00002e40| 49 20 74 65 73 74 20 61 | 6e 64 20 63 6f 6e 76 65 |I test a|nd conve|
|00002e50| 72 74 20 61 20 6e 75 6d | 65 72 69 63 61 6c 20 73 |rt a num|erical s|
|00002e60| 74 72 69 6e 67 20 69 6e | 74 6f 20 61 20 72 65 61 |tring in|to a rea|
|00002e70| 6c 3f 0d 0a 0d 0a 20 41 | 31 3a 20 41 6e 20 65 61 |l?.... A|1: An ea|
|00002e80| 73 79 20 74 61 73 6b 20 | 69 6e 20 54 75 72 62 6f |sy task |in Turbo|
|00002e90| 20 50 61 73 63 61 6c 20 | 62 75 74 20 69 6e 20 73 | Pascal |but in s|
|00002ea0| 74 61 6e 64 61 72 64 20 | 50 61 73 63 61 6c 20 74 |tandard |Pascal t|
|00002eb0| 68 69 73 0d 0a 66 72 65 | 71 75 65 6e 74 20 74 61 |his..fre|quent ta|
|00002ec0| 73 6b 20 69 73 20 6d 75 | 63 68 20 74 72 69 63 6b |sk is mu|ch trick|
|00002ed0| 69 65 72 2e 20 48 65 72 | 65 20 61 72 65 20 62 6f |ier. Her|e are bo|
|00002ee0| 74 68 20 74 68 65 20 54 | 75 72 62 6f 20 50 61 73 |th the T|urbo Pas|
|00002ef0| 63 61 6c 20 61 6e 64 0d | 0a 53 74 61 6e 64 61 72 |cal and.|.Standar|
|00002f00| 64 20 50 61 73 63 61 6c | 20 76 65 72 73 69 6f 6e |d Pascal| version|
|00002f10| 73 20 66 6f 72 20 67 65 | 6e 65 72 61 6c 20 65 64 |s for ge|neral ed|
|00002f20| 69 66 69 63 61 74 69 6f | 6e 20 3a 2d 29 2e 0d 0a |ificatio|n :-)...|
|00002f30| 20 20 28 2a 20 43 6f 6e | 76 65 72 74 20 61 6e 64 | (* Con|vert and|
|00002f40| 20 74 65 73 74 20 61 20 | 6e 75 6d 65 72 69 63 61 | test a |numerica|
|00002f50| 6c 20 73 74 72 69 6e 67 | 20 77 69 74 68 20 54 75 |l string| with Tu|
|00002f60| 72 62 6f 20 50 61 73 63 | 61 6c 20 2a 29 0d 0a 20 |rbo Pasc|al *).. |
|00002f70| 20 66 75 6e 63 74 69 6f | 6e 20 44 49 47 56 41 4c | functio|n DIGVAL|
|00002f80| 46 4e 20 28 6d 6a 20 3a | 20 73 74 72 69 6e 67 3b |FN (mj :| string;|
|00002f90| 20 76 61 72 20 6f 6b 20 | 3a 20 62 6f 6f 6c 65 61 | var ok |: boolea|
|00002fa0| 6e 29 20 3a 20 72 65 61 | 6c 3b 0d 0a 20 20 76 61 |n) : rea|l;.. va|
|00002fb0| 72 20 6b 20 3a 20 69 6e | 74 65 67 65 72 3b 0d 0a |r k : in|teger;..|
|00002fc0| 20 20 20 20 20 20 78 20 | 3a 20 72 65 61 6c 3b 0d | x |: real;.|
|00002fd0| 0a 20 20 62 65 67 69 6e | 0d 0a 20 20 20 20 56 61 |. begin|.. Va|
|00002fe0| 6c 20 28 6d 6a 2c 20 78 | 2c 20 6b 29 3b 0d 0a 20 |l (mj, x|, k);.. |
|00002ff0| 20 20 20 6f 6b 20 3a 3d | 20 6b 20 3d 20 30 3b 0d | ok :=| k = 0;.|
|00003000| 0a 20 20 20 20 69 66 20 | 6f 6b 20 74 68 65 6e 20 |. if |ok then |
|00003010| 64 69 67 76 61 6c 66 6e | 20 3a 3d 20 78 20 65 6c |digvalfn| := x el|
|00003020| 73 65 20 64 69 67 76 61 | 6c 66 6e 20 3a 3d 20 30 |se digva|lfn := 0|
|00003030| 3b 0d 0a 20 20 65 6e 64 | 3b 20 20 28 2a 20 64 69 |;.. end|; (* di|
|00003040| 67 76 61 6c 66 6e 20 2a | 29 0d 0a 20 20 7b 7d 0d |gvalfn *|).. {}.|
|00003050| 0a 20 20 28 2a 20 43 6f | 6e 76 65 72 74 20 61 6e |. (* Co|nvert an|
|00003060| 64 20 74 65 73 74 20 61 | 20 6e 75 6d 65 72 69 63 |d test a| numeric|
|00003070| 61 6c 20 73 74 72 69 6e | 67 20 77 69 74 68 20 73 |al strin|g with s|
|00003080| 74 61 6e 64 61 72 64 20 | 50 61 73 63 61 6c 20 72 |tandard |Pascal r|
|00003090| 6f 75 74 69 6e 65 73 20 | 6f 6e 6c 79 20 2a 29 0d |outines |only *).|
|000030a0| 0a 20 20 70 72 6f 63 65 | 64 75 72 65 20 44 49 47 |. proce|dure DIG|
|000030b0| 56 41 4c 20 28 6d 6a 20 | 3a 20 73 74 72 69 6e 67 |VAL (mj |: string|
|000030c0| 3b 20 76 61 72 20 6e 75 | 6d 62 65 72 20 3a 20 72 |; var nu|mber : r|
|000030d0| 65 61 6c 3b 20 76 61 72 | 20 6f 6b 20 3a 20 62 6f |eal; var| ok : bo|
|000030e0| 6f 6c 65 61 6e 29 3b 0d | 0a 20 20 6c 61 62 65 6c |olean);.|. label|
|000030f0| 20 31 3b 0d 0a 20 20 76 | 61 72 20 69 6c 2c 20 6c | 1;.. v|ar il, l|
|00003100| 65 6e 6c 2c 20 70 6c 2c | 20 6b 6c 31 2c 20 6b 6c |enl, pl,| kl1, kl|
|00003110| 32 20 3a 20 69 6e 74 65 | 67 65 72 3b 0d 0a 20 20 |2 : inte|ger;.. |
|00003120| 20 20 20 20 6e 72 6f 6c | 20 20 20 20 20 20 20 20 | nrol| |
|00003130| 20 20 20 20 20 20 20 20 | 20 20 20 3a 20 62 6f 6f | | : boo|
|00003140| 6c 65 61 6e 3b 0d 0a 20 | 20 20 20 20 20 6e 75 6d |lean;.. | num|
|00003150| 62 65 72 64 6c 20 20 20 | 20 20 20 20 20 20 20 20 |berdl | |
|00003160| 20 20 20 20 3a 20 72 65 | 61 6c 3b 0d 0a 20 20 62 | : re|al;.. b|
|00003170| 65 67 69 6e 0d 0a 20 20 | 20 20 6f 6b 20 3a 3d 20 |egin.. | ok := |
|00003180| 74 72 75 65 3b 20 6c 65 | 6e 6c 20 3a 3d 20 4c 65 |true; le|nl := Le|
|00003190| 6e 67 74 68 20 28 6d 6a | 29 3b 20 6e 72 6f 6c 20 |ngth (mj|); nrol |
|000031a0| 3a 3d 20 66 61 6c 73 65 | 3b 20 70 6c 20 3a 3d 20 |:= false|; pl := |
|000031b0| 30 3b 20 6e 75 6d 62 65 | 72 20 3a 3d 20 30 2e 30 |0; numbe|r := 0.0|
|000031c0| 3b 0d 0a 20 20 20 20 69 | 66 20 6c 65 6e 6c 20 3d |;.. i|f lenl =|
|000031d0| 20 30 20 74 68 65 6e 20 | 6f 6b 20 3a 3d 20 66 61 | 0 then |ok := fa|
|000031e0| 6c 73 65 3b 0d 0a 20 20 | 20 20 66 6f 72 20 69 6c |lse;.. | for il|
|000031f0| 3a 3d 32 20 74 6f 20 6c | 65 6e 6c 20 64 6f 20 69 |:=2 to l|enl do i|
|00003200| 66 20 28 6d 6a 5b 69 6c | 5d 3d 27 2d 27 29 20 6f |f (mj[il|]='-') o|
|00003210| 72 20 28 6d 6a 5b 69 6c | 5d 3d 27 2b 27 29 20 74 |r (mj[il|]='+') t|
|00003220| 68 65 6e 20 6f 6b 20 3a | 3d 20 66 61 6c 73 65 3b |hen ok :|= false;|
|00003230| 0d 0a 20 20 20 20 66 6f | 72 20 69 6c 3a 3d 31 20 |.. fo|r il:=1 |
|00003240| 74 6f 20 6c 65 6e 6c 20 | 64 6f 0d 0a 20 20 20 20 |to lenl |do.. |
|00003250| 20 20 63 61 73 65 20 6d | 6a 5b 69 6c 5d 20 6f 66 | case m|j[il] of|
|00003260| 0d 0a 20 20 20 20 20 20 | 20 20 27 30 27 2e 2e 27 |.. | '0'..'|
|00003270| 39 27 2c 27 2b 27 2c 27 | 2d 27 2c 27 2e 27 20 3a |9','+','|-','.' :|
|00003280| 20 3b 20 65 6c 73 65 20 | 6f 6b 20 3a 3d 20 66 61 | ; else |ok := fa|
|00003290| 6c 73 65 3b 0d 0a 20 20 | 20 20 20 20 65 6e 64 3b |lse;.. | end;|
|000032a0| 0d 0a 20 20 20 20 66 6f | 72 20 69 6c 3a 3d 31 20 |.. fo|r il:=1 |
|000032b0| 74 6f 20 6c 65 6e 6c 20 | 64 6f 0d 0a 20 20 20 20 |to lenl |do.. |
|000032c0| 20 20 63 61 73 65 20 6d | 6a 5b 69 6c 5d 20 6f 66 | case m|j[il] of|
|000032d0| 20 27 30 27 2e 2e 27 39 | 27 20 3a 20 62 65 67 69 | '0'..'9|' : begi|
|000032e0| 6e 20 6e 72 6f 6c 20 3a | 3d 20 74 72 75 65 3b 20 |n nrol :|= true; |
|000032f0| 67 6f 74 6f 20 31 3b 20 | 65 6e 64 3b 20 65 6e 64 |goto 1; |end; end|
|00003300| 3b 0d 0a 20 20 20 20 31 | 3a 20 69 66 20 6e 72 6f |;.. 1|: if nro|
|00003310| 6c 20 3d 20 66 61 6c 73 | 65 20 74 68 65 6e 20 6f |l = fals|e then o|
|00003320| 6b 20 3a 3d 20 66 61 6c | 73 65 3b 0d 0a 20 20 20 |k := fal|se;.. |
|00003330| 20 66 6f 72 20 69 6c 3a | 3d 31 20 74 6f 20 6c 65 | for il:|=1 to le|
|00003340| 6e 6c 20 64 6f 20 69 66 | 20 6d 6a 5b 69 6c 5d 20 |nl do if| mj[il] |
|00003350| 3d 20 27 2e 27 20 74 68 | 65 6e 20 70 6c 20 3a 3d |= '.' th|en pl :=|
|00003360| 20 70 6c 20 2b 20 31 3b | 0d 0a 20 20 20 20 69 66 | pl + 1;|.. if|
|00003370| 20 70 6c 20 3e 20 31 20 | 74 68 65 6e 20 6f 6b 20 | pl > 1 |then ok |
|00003380| 3a 3d 20 66 61 6c 73 65 | 3b 0d 0a 20 20 20 20 6b |:= false|;.. k|
|00003390| 6c 31 3a 3d 31 3b 20 6b | 6c 32 3a 3d 6c 65 6e 6c |l1:=1; k|l2:=lenl|
|000033a0| 2b 31 3b 20 69 66 20 28 | 6d 6a 5b 31 5d 3d 27 2d |+1; if (|mj[1]='-|
|000033b0| 27 29 20 6f 72 20 28 6d | 6a 5b 31 5d 3d 27 2b 27 |') or (m|j[1]='+'|
|000033c0| 29 20 74 68 65 6e 20 6b | 6c 31 20 3a 3d 20 32 3b |) then k|l1 := 2;|
|000033d0| 0d 0a 20 20 20 20 66 6f | 72 20 69 6c 3a 3d 31 20 |.. fo|r il:=1 |
|000033e0| 74 6f 20 6c 65 6e 6c 20 | 64 6f 20 69 66 20 6d 6a |to lenl |do if mj|
|000033f0| 5b 69 6c 5d 20 3d 20 27 | 2e 27 20 74 68 65 6e 20 |[il] = '|.' then |
|00003400| 6b 6c 32 20 3a 3d 20 69 | 6c 3b 0d 0a 20 20 20 20 |kl2 := i|l;.. |
|00003410| 69 66 20 6b 6c 32 2d 6b | 6c 31 20 3e 20 33 38 20 |if kl2-k|l1 > 38 |
|00003420| 74 68 65 6e 20 6f 6b 20 | 3a 3d 20 66 61 6c 73 65 |then ok |:= false|
|00003430| 3b 0d 0a 20 20 20 20 69 | 66 20 6f 6b 20 74 68 65 |;.. i|f ok the|
|00003440| 6e 0d 0a 20 20 20 20 20 | 20 62 65 67 69 6e 0d 0a |n.. | begin..|
|00003450| 20 20 20 20 20 20 20 20 | 6e 75 6d 62 65 72 3a 3d | |number:=|
|00003460| 30 3b 20 6e 75 6d 62 65 | 72 64 6c 3a 3d 30 3b 0d |0; numbe|rdl:=0;.|
|00003470| 0a 20 20 20 20 20 20 20 | 20 66 6f 72 20 69 6c 3a |. | for il:|
|00003480| 3d 6b 6c 31 20 74 6f 20 | 6b 6c 32 2d 31 20 64 6f |=kl1 to |kl2-1 do|
|00003490| 20 6e 75 6d 62 65 72 20 | 3a 3d 20 28 6f 72 64 28 | number |:= (ord(|
|000034a0| 6d 6a 5b 69 6c 5d 29 2d | 34 38 29 2b 31 30 2a 6e |mj[il])-|48)+10*n|
|000034b0| 75 6d 62 65 72 3b 0d 0a | 20 20 20 20 20 20 20 20 |umber;..| |
|000034c0| 69 66 20 6b 6c 32 20 3c | 20 6c 65 6e 6c 2b 31 20 |if kl2 <| lenl+1 |
|000034d0| 74 68 65 6e 0d 0a 20 20 | 20 20 20 20 20 20 20 20 |then.. | |
|000034e0| 66 6f 72 20 69 6c 3a 3d | 6c 65 6e 6c 20 64 6f 77 |for il:=|lenl dow|
|000034f0| 6e 74 6f 20 6b 6c 32 2b | 31 20 64 6f 0d 0a 20 20 |nto kl2+|1 do.. |
|00003500| 20 20 20 20 20 20 20 20 | 20 20 6e 75 6d 62 65 72 | | number|
|00003510| 64 6c 20 3a 3d 20 28 6f | 72 64 28 6d 6a 5b 69 6c |dl := (o|rd(mj[il|
|00003520| 5d 29 2d 34 38 29 2f 31 | 30 2b 6e 75 6d 62 65 72 |])-48)/1|0+number|
|00003530| 64 6c 2f 31 30 3b 0d 0a | 20 20 20 20 20 20 20 20 |dl/10;..| |
|00003540| 6e 75 6d 62 65 72 20 3a | 3d 20 6e 75 6d 62 65 72 |number :|= number|
|00003550| 20 2b 20 6e 75 6d 62 65 | 72 64 6c 3b 0d 0a 20 20 | + numbe|rdl;.. |
|00003560| 20 20 20 20 20 20 69 66 | 20 6d 6a 5b 31 5d 3d 27 | if| mj[1]='|
|00003570| 2d 27 20 74 68 65 6e 20 | 6e 75 6d 62 65 72 20 3a |-' then |number :|
|00003580| 3d 20 2d 6e 75 6d 62 65 | 72 3b 0d 0a 20 20 20 20 |= -numbe|r;.. |
|00003590| 20 20 65 6e 64 3b 20 7b | 69 66 20 6f 6b 7d 0d 0a | end; {|if ok}..|
|000035a0| 20 20 65 6e 64 3b 20 20 | 28 2a 20 64 69 67 76 61 | end; |(* digva|
|000035b0| 6c 20 2a 29 0d 0a 20 20 | 7b 7d 0d 0a 20 20 70 72 |l *).. |{}.. pr|
|000035c0| 6f 63 65 64 75 72 65 20 | 54 45 53 54 3b 0d 0a 20 |ocedure |TEST;.. |
|000035d0| 20 76 61 72 20 73 20 3a | 20 73 74 72 69 6e 67 3b | var s :| string;|
|000035e0| 20 72 20 3a 20 72 65 61 | 6c 3b 20 6f 6b 20 3a 20 | r : rea|l; ok : |
|000035f0| 62 6f 6f 6c 65 61 6e 3b | 0d 0a 20 20 62 65 67 69 |boolean;|.. begi|
|00003600| 6e 0d 0a 20 20 20 20 73 | 20 3a 3d 20 27 31 32 33 |n.. s| := '123|
|00003610| 2e 34 31 27 3b 0d 0a 20 | 20 20 20 72 20 3a 3d 20 |.41';.. | r := |
|00003620| 44 49 47 56 41 4c 46 4e | 20 28 73 2c 20 6f 6b 29 |DIGVALFN| (s, ok)|
|00003630| 3b 0d 0a 20 20 20 20 69 | 66 20 6f 6b 20 74 68 65 |;.. i|f ok the|
|00003640| 6e 20 77 72 69 74 65 6c | 6e 20 28 72 29 20 65 6c |n writel|n (r) el|
|00003650| 73 65 20 77 72 69 74 65 | 6c 6e 20 28 27 45 72 72 |se write|ln ('Err|
|00003660| 6f 72 20 69 6e 20 27 2c | 20 73 29 3b 0d 0a 20 20 |or in ',| s);.. |
|00003670| 20 20 44 49 47 56 41 4c | 20 28 73 2c 20 72 2c 20 | DIGVAL| (s, r, |
|00003680| 6f 6b 29 3b 0d 0a 20 20 | 20 20 69 66 20 6f 6b 20 |ok);.. | if ok |
|00003690| 74 68 65 6e 20 77 72 69 | 74 65 6c 6e 20 28 72 29 |then wri|teln (r)|
|000036a0| 20 65 6c 73 65 20 77 72 | 69 74 65 6c 6e 20 28 27 | else wr|iteln ('|
|000036b0| 45 72 72 6f 72 20 69 6e | 20 27 2c 20 73 29 3b 0d |Error in| ', s);.|
|000036c0| 0a 20 20 65 6e 64 3b 0d | 0a 0d 0a 41 32 3a 20 54 |. end;.|...A2: T|
|000036d0| 68 65 20 63 6f 6e 76 65 | 72 73 69 6f 6e 20 63 61 |he conve|rsion ca|
|000036e0| 6e 20 62 65 20 69 6e 20 | 74 68 65 20 6f 74 68 65 |n be in |the othe|
|000036f0| 72 20 64 69 72 65 63 74 | 6f 72 69 6f 6e 20 61 73 |r direct|orion as|
|00003700| 20 77 65 6c 6c 2e 20 48 | 65 72 65 20 69 73 0d 0a | well. H|ere is..|
|00003710| 68 6f 77 20 74 6f 20 63 | 6f 6e 76 65 72 74 20 61 |how to c|onvert a|
|00003720| 6e 20 69 6e 74 65 67 65 | 72 20 69 6e 74 6f 20 61 |n intege|r into a|
|00003730| 20 73 74 72 69 6e 67 20 | 77 69 74 68 20 73 74 61 | string |with sta|
|00003740| 6e 64 61 72 64 20 50 61 | 73 63 61 6c 0d 0a 72 6f |ndard Pa|scal..ro|
|00003750| 75 74 69 6e 65 73 20 6f | 6e 6c 79 2e 0d 0a 20 20 |utines o|nly... |
|00003760| 66 75 6e 63 74 69 6f 6e | 20 43 48 52 49 56 4c 46 |function| CHRIVLF|
|00003770| 4e 20 28 6e 75 6d 62 65 | 72 20 3a 20 69 6e 74 65 |N (numbe|r : inte|
|00003780| 67 65 72 29 20 3a 20 73 | 74 72 69 6e 67 3b 0d 0a |ger) : s|tring;..|
|00003790| 20 20 76 61 72 20 69 6c | 2c 20 70 6c 2c 20 61 6c | var il|, pl, al|
|000037a0| 20 3a 20 69 6e 74 65 67 | 65 72 3b 0d 0a 20 20 63 | : integ|er;.. c|
|000037b0| 6c 2c 20 6d 6a 20 3a 20 | 73 74 72 69 6e 67 3b 0d |l, mj : |string;.|
|000037c0| 0a 20 20 69 73 4e 65 67 | 20 3a 20 62 6f 6f 6c 65 |. isNeg| : boole|
|000037d0| 61 6e 3b 0d 0a 20 20 62 | 65 67 69 6e 0d 0a 20 20 |an;.. b|egin.. |
|000037e0| 20 20 69 66 20 6e 75 6d | 62 65 72 20 3c 20 30 20 | if num|ber < 0 |
|000037f0| 74 68 65 6e 20 62 65 67 | 69 6e 0d 0a 20 20 20 20 |then beg|in.. |
|00003800| 20 20 69 73 4e 65 67 20 | 3a 3d 20 74 72 75 65 3b | isNeg |:= true;|
|00003810| 20 6e 75 6d 62 65 72 20 | 3a 3d 20 2d 6e 75 6d 62 | number |:= -numb|
|00003820| 65 72 3b 20 65 6e 64 0d | 0a 20 20 20 20 20 20 65 |er; end.|. e|
|00003830| 6c 73 65 20 69 73 4e 65 | 67 20 3a 3d 20 66 61 6c |lse isNe|g := fal|
|00003840| 73 65 3b 0d 0a 20 20 20 | 20 70 6c 20 3a 3d 20 30 |se;.. | pl := 0|
|00003850| 3b 20 6d 6a 20 3a 3d 20 | 27 27 3b 20 63 6c 20 3a |; mj := |''; cl :|
|00003860| 3d 20 27 27 3b 0d 0a 20 | 20 20 20 72 65 70 65 61 |= '';.. | repea|
|00003870| 74 0d 0a 20 20 20 20 20 | 20 70 6c 20 3a 3d 20 70 |t.. | pl := p|
|00003880| 6c 20 2b 20 31 3b 0d 0a | 20 20 20 20 20 20 61 6c |l + 1;..| al|
|00003890| 20 3a 3d 20 6e 75 6d 62 | 65 72 20 6d 6f 64 20 31 | := numb|er mod 1|
|000038a0| 30 3b 0d 0a 20 20 20 20 | 20 20 63 6c 20 3a 3d 20 |0;.. | cl := |
|000038b0| 63 6c 20 2b 20 63 68 72 | 28 61 6c 2b 34 38 29 3b |cl + chr|(al+48);|
|000038c0| 0d 0a 20 20 20 20 20 20 | 6e 75 6d 62 65 72 20 3a |.. |number :|
|000038d0| 3d 20 6e 75 6d 62 65 72 | 20 64 69 76 20 31 30 3b |= number| div 10;|
|000038e0| 0d 0a 20 20 20 20 75 6e | 74 69 6c 20 6e 75 6d 62 |.. un|til numb|
|000038f0| 65 72 20 3d 20 30 3b 0d | 0a 20 20 20 20 69 66 20 |er = 0;.|. if |
|00003900| 69 73 4e 65 67 20 74 68 | 65 6e 20 62 65 67 69 6e |isNeg th|en begin|
|00003910| 20 70 6c 20 3a 3d 20 70 | 6c 20 2b 20 31 3b 20 63 | pl := p|l + 1; c|
|00003920| 6c 5b 70 6c 5d 20 3a 3d | 20 27 2d 27 3b 20 65 6e |l[pl] :=| '-'; en|
|00003930| 64 3b 0d 0a 20 20 20 20 | 66 6f 72 20 69 6c 20 3a |d;.. |for il :|
|00003940| 3d 20 31 20 74 6f 20 70 | 6c 20 64 6f 20 6d 6a 20 |= 1 to p|l do mj |
|00003950| 3a 3d 20 6d 6a 20 2b 20 | 63 6c 5b 70 6c 2b 31 2d |:= mj + |cl[pl+1-|
|00003960| 69 6c 5d 3b 0d 0a 20 20 | 20 20 63 68 72 69 76 6c |il];.. | chrivl|
|00003970| 66 6e 20 3a 3d 20 6d 6a | 3b 0d 0a 20 20 65 6e 64 |fn := mj|;.. end|
|00003980| 3b 20 20 28 2a 20 63 68 | 72 69 76 6c 66 6e 20 2a |; (* ch|rivlfn *|
|00003990| 29 0d 0a 20 20 7b 7d 0d | 0a 20 20 70 72 6f 63 65 |).. {}.|. proce|
|000039a0| 64 75 72 65 20 54 45 53 | 54 3b 0d 0a 20 20 76 61 |dure TES|T;.. va|
|000039b0| 72 20 73 20 3a 20 73 74 | 72 69 6e 67 3b 20 6a 20 |r s : st|ring; j |
|000039c0| 3a 20 69 6e 74 65 67 65 | 72 3b 0d 0a 20 20 62 65 |: intege|r;.. be|
|000039d0| 67 69 6e 0d 0a 20 20 20 | 20 6a 20 3a 3d 20 31 32 |gin.. | j := 12|
|000039e0| 33 34 31 3b 0d 0a 20 20 | 20 20 73 20 3a 3d 20 43 |341;.. | s := C|
|000039f0| 48 52 49 56 4c 46 4e 20 | 28 6a 29 3b 0d 0a 20 20 |HRIVLFN |(j);.. |
|00003a00| 20 20 77 72 69 74 65 6c | 6e 20 28 73 29 3b 0d 0a | writel|n (s);..|
|00003a10| 20 20 65 6e 64 3b 0d 0a | 2d 2d 2d 2d 2d 2d 2d 2d | end;..|--------|
|00003a20| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00003a30| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00003a40| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00003a50| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 0d 0a 0d 0a |--------|----....|
|00003a60| 46 72 6f 6d 20 74 73 40 | 75 77 61 73 61 2e 66 69 |From ts@|uwasa.fi|
|00003a70| 20 53 61 74 20 53 65 70 | 20 37 20 30 30 3a 30 30 | Sat Sep| 7 00:00|
|00003a80| 3a 35 36 20 31 39 39 36 | 0d 0a 53 75 62 6a 65 63 |:56 1996|..Subjec|
|00003a90| 74 3a 20 44 65 63 6f 6d | 70 69 6c 69 6e 67 20 61 |t: Decom|piling a|
|00003aa0| 20 54 50 20 2e 45 58 45 | 0d 0a 0d 0a 35 36 2e 20 | TP .EXE|....56. |
|00003ab0| 2a 2a 2a 2a 2a 0d 0a 20 | 51 3a 20 48 6f 77 20 63 |*****.. |Q: How c|
|00003ac0| 61 6e 20 49 20 72 65 76 | 65 72 73 65 20 61 20 54 |an I rev|erse a T|
|00003ad0| 50 20 2e 45 58 45 20 6f | 72 20 2e 54 50 55 20 62 |P .EXE o|r .TPU b|
|00003ae0| 61 63 6b 20 69 6e 74 6f | 20 73 6f 75 72 63 65 20 |ack into| source |
|00003af0| 63 6f 64 65 3f 0d 0a 0d | 0a 20 41 3a 20 54 68 69 |code?...|. A: Thi|
|00003b00| 73 20 69 73 20 73 69 6d | 70 6c 79 20 61 73 6b 69 |s is sim|ply aski|
|00003b10| 6e 67 20 74 6f 6f 20 6d | 75 63 68 2e 20 59 6f 75 |ng too m|uch. You|
|00003b20| 20 63 61 6e 6e 6f 74 20 | 64 65 63 6f 6d 70 69 6c | cannot |decompil|
|00003b30| 65 20 61 20 54 50 0d 0a | 70 72 6f 67 72 61 6d 20 |e a TP..|program |
|00003b40| 69 6e 20 61 20 6d 61 6e | 6e 65 72 20 74 68 61 74 |in a man|ner that|
|00003b50| 20 77 6f 75 6c 64 20 67 | 69 76 65 20 79 6f 75 20 | would g|ive you |
|00003b60| 62 61 63 6b 20 74 68 65 | 20 6f 72 69 67 69 6e 61 |back the| origina|
|00003b70| 6c 20 73 6f 75 72 63 65 | 2e 0d 0a 54 68 69 73 20 |l source|...This |
|00003b80| 6d 65 74 68 6f 64 20 6f | 66 20 72 65 76 65 72 73 |method o|f revers|
|00003b90| 65 20 65 6e 67 69 6e 65 | 65 72 69 6e 67 20 69 73 |e engine|ering is|
|00003ba0| 20 6e 6f 74 20 6f 6e 20 | 69 6e 20 61 63 74 75 61 | not on |in actua|
|00003bb0| 6c 20 70 72 61 63 74 69 | 63 65 2e 0d 0a 51 75 6f |l practi|ce...Quo|
|00003bc0| 74 69 6e 67 20 4a 65 72 | 6f 65 6e 20 50 6c 75 69 |ting Jer|oen Plui|
|00003bd0| 6d 65 72 73 20 28 6a 65 | 72 6f 65 6e 70 40 64 72 |mers (je|roenp@dr|
|00003be0| 61 67 6f 6e 73 2e 6e 65 | 73 74 2e 6e 6c 29 20 22 |agons.ne|st.nl) "|
|00003bf0| 44 75 72 69 6e 67 20 74 | 68 65 0d 0a 63 6f 6d 70 |During t|he..comp|
|00003c00| 69 6c 61 74 69 6f 6e 2c | 20 69 6d 70 6f 72 74 61 |ilation,| importa|
|00003c10| 6e 74 20 69 6e 66 6f 72 | 6d 61 74 69 6f 6e 20 67 |nt infor|mation g|
|00003c20| 65 74 27 73 20 6c 6f 73 | 74 20 61 62 6f 75 74 20 |et's los|t about |
|00003c30| 76 61 72 69 61 62 6c 65 | 73 2c 0d 0a 74 79 70 65 |variable|s,..type|
|00003c40| 73 2c 20 69 64 65 6e 74 | 69 66 69 65 72 73 20 65 |s, ident|ifiers e|
|00003c50| 74 63 2e 20 57 72 69 74 | 69 6e 67 20 61 20 50 61 |tc. Writ|ing a Pa|
|00003c60| 73 63 61 6c 20 44 65 63 | 6f 6d 70 69 6c 65 72 20 |scal Dec|ompiler |
|00003c70| 69 73 20 69 6d 70 6f 73 | 73 69 62 6c 65 2e 0d 0a |is impos|sible...|
|00003c80| 54 68 65 20 62 65 73 74 | 20 79 6f 75 20 63 61 6e |The best| you can|
|00003c90| 20 61 63 68 69 65 76 65 | 20 69 73 20 61 20 64 69 | achieve| is a di|
|00003ca0| 73 61 73 73 65 6d 62 6c | 65 72 20 74 68 61 74 20 |sassembl|er that |
|00003cb0| 63 61 6e 20 68 65 6c 70 | 20 79 6f 75 0d 0a 72 65 |can help| you..re|
|00003cc0| 63 6f 67 6e 69 7a 65 20 | 73 6f 6d 65 20 50 61 73 |cognize |some Pas|
|00003cd0| 63 61 6c 20 73 74 61 74 | 65 6d 65 6e 74 73 2e 22 |cal stat|ements."|
|00003ce0| 0d 0a 20 20 20 59 6f 75 | 20 6d 69 67 68 74 20 6e |.. You| might n|
|00003cf0| 6f 74 65 20 74 68 61 74 | 20 74 68 69 73 20 71 75 |ote that| this qu|
|00003d00| 65 73 74 69 6f 6e 20 73 | 6f 6d 65 77 68 61 74 20 |estion s|omewhat |
|00003d10| 72 65 73 65 6d 62 6c 65 | 73 20 61 6e 6f 74 68 65 |resemble|s anothe|
|00003d20| 72 0d 0a 66 72 65 71 75 | 65 6e 74 20 71 75 65 73 |r..frequ|ent ques|
|00003d30| 74 69 6f 6e 20 22 48 6f | 77 20 63 61 6e 20 49 20 |tion "Ho|w can I |
|00003d40| 63 6f 6e 76 65 72 74 20 | 61 20 54 50 55 20 75 6e |convert |a TPU un|
|00003d50| 69 74 20 6f 66 20 6f 6e | 65 20 54 50 20 76 65 72 |it of on|e TP ver|
|00003d60| 73 69 6f 6e 20 74 6f 0d | 0a 61 6e 6f 74 68 65 72 |sion to.|.another|
|00003d70| 3f 22 20 77 68 69 63 68 | 20 63 61 6e 6e 6f 74 20 |?" which| cannot |
|00003d80| 62 65 20 73 6f 6c 76 65 | 64 20 77 69 74 68 6f 75 |be solve|d withou|
|00003d90| 74 20 74 68 65 20 6f 72 | 69 67 69 6e 61 6c 20 73 |t the or|iginal s|
|00003da0| 6f 75 72 63 65 20 63 6f | 64 65 2e 0d 0a 2d 2d 2d |ource co|de...---|
|00003db0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00003dc0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00003dd0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00003de0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00003df0| 2d 0d 0a 0d 0a 46 72 6f | 6d 20 74 73 40 75 77 61 |-....Fro|m ts@uwa|
|00003e00| 73 61 2e 66 69 20 53 61 | 74 20 53 65 70 20 37 20 |sa.fi Sa|t Sep 7 |
|00003e10| 30 30 3a 30 30 3a 35 37 | 20 31 39 39 36 0d 0a 53 |00:00:57| 1996..S|
|00003e20| 75 62 6a 65 63 74 3a 20 | 43 61 6c 63 75 6c 61 74 |ubject: |Calculat|
|00003e30| 69 6e 67 20 64 61 74 65 | 2f 74 69 6d 65 20 64 69 |ing date|/time di|
|00003e40| 66 66 65 72 65 6e 63 65 | 73 0d 0a 0d 0a 35 37 2e |fference|s....57.|
|00003e50| 20 2a 2a 2a 2a 2a 0d 0a | 20 51 3a 20 48 6f 77 20 | *****..| Q: How |
|00003e60| 63 61 6e 20 49 20 63 61 | 6c 63 75 6c 61 74 65 20 |can I ca|lculate |
|00003e70| 74 68 65 20 64 69 66 66 | 65 72 65 6e 63 65 20 62 |the diff|erence b|
|00003e80| 65 74 77 65 65 6e 20 74 | 77 6f 20 70 6f 69 6e 74 |etween t|wo point|
|00003e90| 73 20 6f 66 20 74 69 6d | 65 3f 0d 0a 0d 0a 20 41 |s of tim|e?.... A|
|00003ea0| 3a 20 54 68 69 73 20 69 | 73 20 61 6e 20 75 6e 63 |: This i|s an unc|
|00003eb0| 6f 6e 66 69 72 6d 65 64 | 20 61 6e 73 77 65 72 20 |onfirmed| answer |
|00003ec0| 73 6f 20 62 65 20 61 20 | 6c 69 74 74 6c 65 20 63 |so be a |little c|
|00003ed0| 61 72 65 66 75 6c 20 77 | 69 74 68 20 69 74 2e 0d |areful w|ith it..|
|00003ee0| 0a 42 75 74 20 61 74 20 | 74 68 65 20 76 65 72 79 |.But at |the very|
|00003ef0| 20 6c 65 61 73 74 20 69 | 74 20 73 68 6f 77 73 20 | least i|t shows |
|00003f00| 73 6f 6d 65 20 69 6e 74 | 65 72 65 73 74 69 6e 67 |some int|eresting|
|00003f10| 20 69 6e 66 6f 72 6d 61 | 74 69 6f 6e 20 61 62 6f | informa|tion abo|
|00003f20| 75 74 0d 0a 54 75 72 62 | 6f 20 50 61 73 63 61 6c |ut..Turb|o Pascal|
|00003f30| 20 64 61 74 65 2f 74 69 | 6d 65 20 63 6f 6e 76 65 | date/ti|me conve|
|00003f40| 6e 74 69 6f 6e 73 20 61 | 6e 64 20 68 6f 77 20 74 |ntions a|nd how t|
|00003f50| 6f 20 64 65 63 6c 61 72 | 65 20 61 6e 64 20 69 6e |o declar|e and in|
|00003f60| 69 74 69 61 6c 69 7a 65 | 0d 0a 74 79 70 65 64 20 |itialize|..typed |
|00003f70| 63 6f 6e 73 74 61 6e 74 | 73 20 69 66 20 74 68 65 |constant|s if the|
|00003f80| 79 20 61 72 65 20 72 65 | 63 6f 72 64 73 2e 0d 0a |y are re|cords...|
|00003f90| 20 20 70 72 6f 67 72 61 | 6d 20 54 69 6d 44 69 66 | progra|m TimDif|
|00003fa0| 54 65 73 74 3b 0d 0a 20 | 20 75 73 65 73 20 44 6f |Test;.. | uses Do|
|00003fb0| 73 3b 0d 0a 20 20 63 6f | 6e 73 74 20 61 20 3a 20 |s;.. co|nst a : |
|00003fc0| 44 61 74 65 54 69 6d 65 | 0d 0a 20 20 20 20 20 20 |DateTime|.. |
|00003fd0| 20 20 20 20 3d 20 28 79 | 65 61 72 3a 31 39 39 32 | = (y|ear:1992|
|00003fe0| 3b 20 6d 6f 6e 74 68 3a | 31 30 3b 20 64 61 79 3a |; month:|10; day:|
|00003ff0| 32 34 3b 20 68 6f 75 72 | 3a 35 3b 20 6d 69 6e 3a |24; hour|:5; min:|
|00004000| 32 39 3b 20 73 65 63 3a | 33 38 29 3b 0d 0a 20 20 |29; sec:|38);.. |
|00004010| 20 20 20 20 20 20 62 20 | 3a 20 44 61 74 65 54 69 | b |: DateTi|
|00004020| 6d 65 0d 0a 20 20 20 20 | 20 20 20 20 20 20 3d 20 |me.. | = |
|00004030| 28 79 65 61 72 3a 31 39 | 39 33 3b 20 6d 6f 6e 74 |(year:19|93; mont|
|00004040| 68 3a 31 31 3b 20 64 61 | 79 3a 32 33 3b 20 68 6f |h:11; da|y:23; ho|
|00004050| 75 72 3a 36 3b 20 6d 69 | 6e 3a 33 30 3b 20 73 65 |ur:6; mi|n:30; se|
|00004060| 63 3a 35 31 29 3b 0d 0a | 20 20 76 61 72 20 61 4c |c:51);..| var aL|
|00004070| 6f 6e 67 2c 20 62 4c 6f | 6e 67 2c 20 63 4c 6f 6e |ong, bLo|ng, cLon|
|00004080| 67 20 3a 20 6c 6f 6e 67 | 69 6e 74 3b 0d 0a 20 20 |g : long|int;.. |
|00004090| 20 20 20 20 63 20 3a 20 | 44 61 74 65 54 69 6d 65 | c : |DateTime|
|000040a0| 3b 0d 0a 20 20 62 65 67 | 69 6e 0d 0a 20 20 20 20 |;.. beg|in.. |
|000040b0| 50 61 63 6b 54 69 6d 65 | 20 28 61 2c 20 61 4c 6f |PackTime| (a, aLo|
|000040c0| 6e 67 29 3b 0d 0a 20 20 | 20 20 50 61 63 6b 54 69 |ng);.. | PackTi|
|000040d0| 6d 65 20 28 62 2c 20 62 | 4c 6f 6e 67 29 3b 0d 0a |me (b, b|Long);..|
|000040e0| 20 20 20 20 63 4c 6f 6e | 67 20 3a 3d 20 62 4c 6f | cLon|g := bLo|
|000040f0| 6e 67 20 2d 20 61 4c 6f | 6e 67 3b 0d 0a 20 20 20 |ng - aLo|ng;.. |
|00004100| 20 55 6e 70 61 63 6b 54 | 69 6d 65 20 28 63 4c 6f | UnpackT|ime (cLo|
|00004110| 6e 67 2c 20 63 29 3b 0d | 0a 20 20 20 20 77 72 69 |ng, c);.|. wri|
|00004120| 74 65 6c 6e 20 28 63 2e | 79 65 61 72 2d 31 39 38 |teln (c.|year-198|
|00004130| 30 2c 20 27 20 27 2c 20 | 63 2e 6d 6f 6e 74 68 2c |0, ' ', |c.month,|
|00004140| 20 27 20 27 2c 20 63 2e | 64 61 79 2c 20 27 20 27 | ' ', c.|day, ' '|
|00004150| 2c 0d 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |,.. | |
|00004160| 63 2e 68 6f 75 72 2c 20 | 27 20 27 2c 20 63 2e 6d |c.hour, |' ', c.m|
|00004170| 69 6e 2c 20 27 20 27 2c | 20 63 2e 73 65 63 29 3b |in, ' ',| c.sec);|
|00004180| 0d 0a 20 20 65 6e 64 2e | 0d 0a 4d 6f 72 65 20 67 |.. end.|..More g|
|00004190| 65 6e 65 72 61 6c 6c 79 | 20 74 68 61 6e 20 66 6f |enerally| than fo|
|000041a0| 72 20 64 61 74 65 73 20 | 62 65 74 77 65 65 6e 20 |r dates |between |
|000041b0| 31 39 38 30 20 61 6e 64 | 20 32 30 37 39 2c 20 6f |1980 and| 2079, o|
|000041c0| 72 20 66 6f 72 20 6d 6f | 72 65 0d 0a 61 63 63 75 |r for mo|re..accu|
|000041d0| 72 61 74 65 20 72 65 73 | 75 6c 74 73 2c 20 74 68 |rate res|ults, th|
|000041e0| 65 20 64 69 66 66 65 72 | 65 6e 63 65 20 62 65 74 |e differ|ence bet|
|000041f0| 77 65 65 6e 20 74 77 6f | 20 64 61 74 65 2f 74 69 |ween two| date/ti|
|00004200| 6d 65 73 20 63 61 6e 20 | 62 65 0d 0a 63 61 6c 63 |mes can |be..calc|
|00004210| 75 6c 61 74 65 64 20 75 | 73 69 6e 67 20 5a 65 6c |ulated u|sing Zel|
|00004220| 6c 65 72 27 73 20 63 6f | 6e 67 72 75 65 6e 63 65 |ler's co|ngruence|
|00004230| 20 28 73 65 65 20 74 68 | 65 20 69 74 65 6d 20 22 | (see th|e item "|
|00004240| 49 20 77 61 6e 74 20 63 | 6f 64 65 20 74 68 61 74 |I want c|ode that|
|00004250| 0d 0a 67 69 76 65 73 20 | 74 68 65 20 77 65 65 6b |..gives |the week|
|00004260| 64 61 79 20 6f 66 20 74 | 68 65 20 67 69 76 65 6e |day of t|he given|
|00004270| 20 64 61 74 65 22 29 2e | 20 46 69 72 73 74 20 63 | date").| First c|
|00004280| 61 6c 63 75 6c 61 74 65 | 20 5a 65 6c 6c 65 72 27 |alculate| Zeller'|
|00004290| 73 20 66 6f 72 0d 0a 62 | 6f 74 68 20 74 68 65 20 |s for..b|oth the |
|000042a0| 64 61 74 65 73 2c 20 63 | 6f 6e 76 65 72 74 20 74 |dates, c|onvert t|
|000042b0| 68 65 6d 2c 20 61 6e 64 | 20 74 68 65 20 68 6f 75 |hem, and| the hou|
|000042c0| 72 2c 20 6d 69 6e 2c 20 | 61 6e 64 20 73 65 63 20 |r, min, |and sec |
|000042d0| 69 6e 74 6f 0d 0a 73 65 | 63 6f 6e 64 73 2c 20 73 |into..se|conds, s|
|000042e0| 75 62 74 72 61 63 74 2c | 20 61 6e 64 20 63 6f 6e |ubtract,| and con|
|000042f0| 76 65 72 74 20 62 61 63 | 6b 2e 0d 0a 2d 2d 2d 2d |vert bac|k...----|
|00004300| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004310| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004320| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004330| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004340| 0d 0a 0d 0a 46 72 6f 6d | 20 74 73 40 75 77 61 73 |....From| ts@uwas|
|00004350| 61 2e 66 69 20 53 61 74 | 20 53 65 70 20 37 20 30 |a.fi Sat| Sep 7 0|
|00004360| 30 3a 30 30 3a 35 38 20 | 31 39 39 36 0d 0a 53 75 |0:00:58 |1996..Su|
|00004370| 62 6a 65 63 74 3a 20 53 | 74 61 6e 64 2d 61 6c 6f |bject: S|tand-alo|
|00004380| 6e 65 20 6f 72 20 66 72 | 6f 6d 20 49 44 45 0d 0a |ne or fr|om IDE..|
|00004390| 0d 0a 35 38 2e 20 2a 2a | 2a 2a 2a 0d 0a 20 51 3a |..58. **|***.. Q:|
|000043a0| 20 49 73 20 61 20 70 72 | 6f 67 72 61 6d 20 72 75 | Is a pr|ogram ru|
|000043b0| 6e 6e 69 6e 67 20 73 74 | 61 6e 64 2d 61 6c 6f 6e |nning st|and-alon|
|000043c0| 65 20 6f 72 20 66 72 6f | 6d 20 77 69 74 68 69 6e |e or fro|m within|
|000043d0| 20 74 68 65 20 49 44 45 | 3f 0d 0a 0d 0a 20 41 3a | the IDE|?.... A:|
|000043e0| 20 4e 6f 74 20 61 6c 6c | 20 71 75 65 73 74 69 6f | Not all| questio|
|000043f0| 6e 73 20 68 61 76 65 20 | 61 6e 20 61 6e 73 77 65 |ns have |an answe|
|00004400| 72 20 79 65 74 2e 20 49 | 20 70 6f 73 65 64 20 74 |r yet. I| posed t|
|00004410| 68 69 73 20 71 75 65 73 | 74 69 6f 6e 20 74 6f 0d |his ques|tion to.|
|00004420| 0a 74 68 65 20 74 68 65 | 20 6c 61 74 65 20 55 73 |.the the| late Us|
|00004430| 65 4e 65 74 20 6e 65 77 | 73 67 72 6f 75 70 20 63 |eNet new|sgroup c|
|00004440| 6f 6d 70 2e 6c 61 6e 67 | 2e 70 61 73 63 61 6c 2c |omp.lang|.pascal,|
|00004450| 20 62 75 74 20 77 65 20 | 68 61 76 65 20 6e 6f 74 | but we |have not|
|00004460| 0d 0a 66 6f 75 6e 64 20 | 61 6e 20 61 6e 73 77 65 |..found |an answe|
|00004470| 72 20 74 68 61 74 20 77 | 6f 75 6c 64 20 62 65 20 |r that w|ould be |
|00004480| 67 65 6e 65 72 61 6c 20 | 66 6f 72 20 61 6c 6c 20 |general |for all |
|00004490| 4d 53 2d 44 4f 53 20 76 | 65 72 73 69 6f 6e 73 2e |MS-DOS v|ersions.|
|000044a0| 20 54 68 65 0d 0a 63 6c | 6f 73 65 73 74 20 77 65 | The..cl|osest we|
|000044b0| 20 68 61 76 65 20 63 6f | 6d 65 73 20 66 72 6f 6d | have co|mes from|
|000044c0| 20 64 6d 75 72 64 6f 63 | 68 40 6d 61 73 74 2e 71 | dmurdoc|h@mast.q|
|000044d0| 75 65 65 6e 73 75 2e 63 | 61 20 44 75 6e 63 61 6e |ueensu.c|a Duncan|
|000044e0| 20 4d 75 72 64 6f 63 68 | 0d 0a 28 6e 61 74 75 72 | Murdoch|..(natur|
|000044f0| 61 6c 6c 79 20 3a 2d 29 | 2e 20 49 20 68 61 76 65 |ally :-)|. I have|
|00004500| 20 64 6f 6e 65 20 73 6f | 6d 65 20 73 6c 69 67 68 | done so|me sligh|
|00004510| 74 20 65 64 69 74 69 6e | 67 20 6f 66 20 44 75 6e |t editin|g of Dun|
|00004520| 63 61 6e 27 73 0d 0a 73 | 6f 6c 75 74 69 6f 6e 2e |can's..s|olution.|
|00004530| 0d 0a 20 20 75 73 65 73 | 20 44 6f 73 3b 0d 0a 20 |.. uses| Dos;.. |
|00004540| 20 74 79 70 65 20 50 63 | 68 61 72 20 3d 20 5e 43 | type Pc|har = ^C|
|00004550| 68 61 72 3b 0d 0a 20 20 | 66 75 6e 63 74 69 6f 6e |har;.. |function|
|00004560| 20 41 73 63 69 69 7a 32 | 53 74 72 20 28 70 20 3a | Asciiz2|Str (p :|
|00004570| 20 50 63 68 61 72 29 20 | 3a 20 73 74 72 69 6e 67 | Pchar) |: string|
|00004580| 3b 0d 0a 20 20 76 61 72 | 0d 0a 20 20 20 20 72 65 |;.. var|.. re|
|00004590| 73 75 6c 74 20 3a 20 73 | 74 72 69 6e 67 3b 0d 0a |sult : s|tring;..|
|000045a0| 20 20 20 20 6c 65 6e 20 | 3a 20 62 79 74 65 3b 0d | len |: byte;.|
|000045b0| 0a 20 20 62 65 67 69 6e | 0d 0a 20 20 20 20 6c 65 |. begin|.. le|
|000045c0| 6e 20 3a 3d 20 30 3b 0d | 0a 20 20 20 20 77 68 69 |n := 0;.|. whi|
|000045d0| 6c 65 20 28 70 5e 20 3c | 3e 20 23 30 29 20 61 6e |le (p^ <|> #0) an|
|000045e0| 64 20 28 6c 65 6e 20 3c | 20 32 35 35 29 20 64 6f |d (len <| 255) do|
|000045f0| 0d 0a 20 20 20 20 62 65 | 67 69 6e 0d 0a 20 20 20 |.. be|gin.. |
|00004600| 20 20 20 69 6e 63 28 6c | 65 6e 29 3b 0d 0a 20 20 | inc(l|en);.. |
|00004610| 20 20 20 20 72 65 73 75 | 6c 74 5b 6c 65 6e 5d 20 | resu|lt[len] |
|00004620| 3a 3d 20 70 5e 3b 0d 0a | 20 20 20 20 20 20 69 6e |:= p^;..| in|
|00004630| 63 28 6c 6f 6e 67 69 6e | 74 28 70 29 29 3b 0d 0a |c(longin|t(p));..|
|00004640| 20 20 20 20 65 6e 64 3b | 0d 0a 20 20 20 20 72 65 | end;|.. re|
|00004650| 73 75 6c 74 5b 30 5d 20 | 3a 3d 20 63 68 72 28 6c |sult[0] |:= chr(l|
|00004660| 65 6e 29 3b 0d 0a 20 20 | 20 20 41 73 63 69 69 7a |en);.. | Asciiz|
|00004670| 32 53 74 72 20 3a 3d 20 | 72 65 73 75 6c 74 3b 0d |2Str := |result;.|
|00004680| 0a 20 20 65 6e 64 3b 0d | 0a 20 20 7b 7d 0d 0a 20 |. end;.|. {}.. |
|00004690| 20 76 61 72 20 70 61 72 | 65 6e 74 53 65 67 20 3a | var par|entSeg :|
|000046a0| 20 5e 77 6f 72 64 3b 0d | 0a 20 20 20 20 20 20 70 | ^word;.|. p|
|000046b0| 20 20 20 20 20 20 20 20 | 20 3a 20 70 63 68 61 72 | | : pchar|
|000046c0| 3b 0d 0a 20 20 62 65 67 | 69 6e 0d 0a 20 20 20 20 |;.. beg|in.. |
|000046d0| 69 66 20 73 77 61 70 28 | 44 6f 73 56 65 72 73 69 |if swap(|DosVersi|
|000046e0| 6f 6e 29 20 3c 20 24 30 | 34 30 30 20 74 68 65 6e |on) < $0|400 then|
|000046f0| 0d 0a 20 20 20 20 20 20 | 77 72 69 74 65 6c 6e 20 |.. |writeln |
|00004700| 28 27 52 65 71 75 69 72 | 65 73 20 44 6f 73 20 34 |('Requir|es Dos 4|
|00004710| 2e 30 2b 27 29 0d 0a 20 | 20 20 20 65 6c 73 65 20 |.0+').. | else |
|00004720| 62 65 67 69 6e 0d 0a 20 | 20 20 20 20 20 70 61 72 |begin.. | par|
|00004730| 65 6e 74 53 65 67 20 3a | 3d 20 70 74 72 20 28 70 |entSeg :|= ptr (p|
|00004740| 72 65 66 69 78 53 65 67 | 2c 20 24 31 36 29 3b 0d |refixSeg|, $16);.|
|00004750| 0a 20 20 20 20 20 20 70 | 20 3a 3d 20 70 74 72 20 |. p| := ptr |
|00004760| 28 50 61 72 65 6e 74 53 | 65 67 5e 2d 31 2c 20 38 |(ParentS|eg^-1, 8|
|00004770| 29 3b 0d 0a 20 20 20 20 | 20 20 77 72 69 74 65 6c |);.. | writel|
|00004780| 6e 20 28 27 49 20 77 61 | 73 20 6c 61 75 6e 63 68 |n ('I wa|s launch|
|00004790| 65 64 20 62 79 20 27 2c | 20 41 73 63 69 69 7a 32 |ed by ',| Asciiz2|
|000047a0| 53 74 72 28 70 29 29 3b | 0d 0a 20 20 20 20 65 6e |Str(p));|.. en|
|000047b0| 64 3b 0d 0a 20 20 65 6e | 64 2e 0d 0a 41 6e 6f 74 |d;.. en|d...Anot|
|000047c0| 68 65 72 20 73 75 67 67 | 65 73 74 69 6f 6e 20 68 |her sugg|estion h|
|000047d0| 61 73 20 62 65 65 6e 20 | 74 68 61 74 20 74 68 65 |as been |that the|
|000047e0| 20 63 6f 6e 74 65 6e 74 | 73 20 6f 66 20 50 61 72 | content|s of Par|
|000047f0| 61 6d 53 74 72 28 30 29 | 20 77 6f 75 6c 64 0d 0a |amStr(0)| would..|
|00004800| 73 68 6f 77 20 74 68 65 | 20 6c 61 75 6e 63 68 69 |show the| launchi|
|00004810| 6e 67 20 70 72 6f 67 72 | 61 6d 2e 20 49 20 74 65 |ng progr|am. I te|
|00004820| 73 74 65 64 20 74 68 69 | 73 20 6f 6e 20 73 65 76 |sted thi|s on sev|
|00004830| 65 72 61 6c 20 63 6f 6e | 66 69 67 75 72 61 74 69 |eral con|figurati|
|00004840| 6f 6e 73 0d 0a 61 6e 64 | 20 54 50 20 76 65 72 73 |ons..and| TP vers|
|00004850| 69 6f 6e 73 20 61 6e 64 | 20 66 6f 75 6e 64 20 6e |ions and| found n|
|00004860| 6f 20 65 76 69 64 65 6e | 63 65 20 74 68 61 74 20 |o eviden|ce that |
|00004870| 74 68 65 20 63 6f 6e 74 | 65 6e 74 69 6f 6e 20 77 |the cont|ention w|
|00004880| 6f 75 6c 64 0d 0a 68 6f | 6c 64 2e 0d 0a 2d 2d 2d |ould..ho|ld...---|
|00004890| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000048a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000048b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000048c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000048d0| 2d 0d 0a 0d 0a 46 72 6f | 6d 20 74 73 40 75 77 61 |-....Fro|m ts@uwa|
|000048e0| 73 61 2e 66 69 20 53 61 | 74 20 53 65 70 20 37 20 |sa.fi Sa|t Sep 7 |
|000048f0| 30 30 3a 30 30 3a 35 39 | 20 31 39 39 36 0d 0a 53 |00:00:59| 1996..S|
|00004900| 75 62 6a 65 63 74 3a 20 | 4d 65 6d 6f 72 79 20 41 |ubject: |Memory A|
|00004910| 64 64 72 65 73 73 69 6e | 67 0d 0a 0d 0a 35 39 2e |ddressin|g....59.|
|00004920| 20 2a 2a 2a 2a 2a 0d 0a | 20 51 3a 20 50 6c 65 61 | *****..| Q: Plea|
|00004930| 73 65 20 65 78 70 6c 61 | 69 6e 20 54 75 72 62 6f |se expla|in Turbo|
|00004940| 20 50 61 73 63 61 6c 20 | 6d 65 6d 6f 72 79 20 61 | Pascal |memory a|
|00004950| 64 64 72 65 73 73 69 6e | 67 20 74 6f 20 6d 65 2e |ddressin|g to me.|
|00004960| 0d 0a 0d 0a 20 41 3a 20 | 54 68 69 73 20 69 73 20 |.... A: |This is |
|00004970| 66 61 72 20 66 72 6f 6d | 20 61 6e 20 65 61 73 79 |far from| an easy|
|00004980| 20 71 75 65 73 74 69 6f | 6e 2c 20 62 75 74 20 6c | questio|n, but l|
|00004990| 65 74 27 73 20 73 65 65 | 20 77 68 61 74 20 77 65 |et's see| what we|
|000049a0| 20 63 61 6e 20 64 6f 2e | 0d 0a 54 68 65 20 6f 72 | can do.|..The or|
|000049b0| 69 67 69 6e 73 20 6f 66 | 20 74 68 65 20 64 69 66 |igins of| the dif|
|000049c0| 66 69 63 75 6c 74 69 65 | 73 20 61 72 65 20 69 6e |ficultie|s are in|
|000049d0| 20 74 68 65 20 64 65 73 | 69 67 6e 20 6f 66 20 74 | the des|ign of t|
|000049e0| 68 65 20 38 30 38 36 20 | 63 68 69 70 0d 0a 77 68 |he 8086 |chip..wh|
|000049f0| 69 63 68 20 73 74 69 6c | 6c 20 72 65 73 74 72 69 |ich stil|l restri|
|00004a00| 63 74 73 20 61 6c 6c 20 | 54 75 72 62 6f 20 50 61 |cts all |Turbo Pa|
|00004a10| 73 63 61 6c 20 61 70 70 | 6c 69 63 61 74 69 6f 6e |scal app|lication|
|00004a20| 73 20 28 77 68 69 63 68 | 20 63 6f 6e 74 72 61 72 |s (which| contrar|
|00004a30| 79 0d 0a 74 6f 20 42 6f | 72 6c 61 6e 64 20 50 61 |y..to Bo|rland Pa|
|00004a40| 73 63 61 6c 20 75 73 65 | 20 74 68 65 20 6f 72 69 |scal use| the ori|
|00004a50| 67 69 6e 61 6c 20 72 65 | 61 6c 20 6d 6f 64 65 29 |ginal re|al mode)|
|00004a60| 2e 20 54 68 65 20 38 30 | 38 36 20 28 61 6b 61 20 |. The 80|86 (aka |
|00004a70| 72 65 61 6c 0d 0a 6d 6f | 64 65 29 20 61 64 64 72 |real..mo|de) addr|
|00004a80| 65 73 73 69 6e 67 20 69 | 73 20 62 61 73 65 64 20 |essing i|s based |
|00004a90| 6f 6e 20 31 36 2d 62 69 | 74 20 72 65 67 69 73 74 |on 16-bi|t regist|
|00004aa0| 65 72 73 2e 20 41 73 20 | 79 6f 75 20 70 72 6f 62 |ers. As |you prob|
|00004ab0| 61 62 6c 79 20 6b 6e 6f | 77 0d 0a 32 5e 31 36 20 |ably kno|w..2^16 |
|00004ac0| 69 73 20 36 35 35 33 36 | 20 77 68 69 63 68 20 6d |is 65536| which m|
|00004ad0| 65 61 6e 73 20 74 68 61 | 74 20 79 6f 75 20 63 61 |eans tha|t you ca|
|00004ae0| 6e 6e 6f 74 20 64 69 72 | 65 63 74 6c 79 20 70 6f |nnot dir|ectly po|
|00004af0| 69 6e 74 20 74 6f 20 61 | 6c 6c 0d 0a 61 64 64 72 |int to a|ll..addr|
|00004b00| 65 73 73 65 73 20 6f 66 | 20 74 68 65 20 6c 6f 77 |esses of| the low|
|00004b10| 65 72 20 61 6e 64 20 75 | 70 70 65 72 20 6d 65 6d |er and u|pper mem|
|00004b20| 6f 72 79 2c 20 77 68 69 | 63 68 20 72 61 6e 67 65 |ory, whi|ch range|
|00004b30| 73 20 66 72 6f 6d 20 30 | 20 74 6f 0d 0a 31 30 34 |s from 0| to..104|
|00004b40| 38 35 37 35 20 28 32 5e | 32 30 2d 31 29 2e 20 54 |8575 (2^|20-1). T|
|00004b50| 68 75 73 20 61 6c 6c 20 | 74 68 65 20 6d 65 6d 6f |hus all |the memo|
|00004b60| 72 79 20 61 64 64 72 65 | 73 73 65 73 20 61 72 65 |ry addre|sses are|
|00004b70| 20 70 6f 69 6e 74 65 64 | 20 74 6f 20 69 6e 74 6f | pointed| to into|
|00004b80| 0d 0a 74 77 6f 20 70 61 | 72 74 73 20 69 6e 20 54 |..two pa|rts in T|
|00004b90| 50 20 70 72 6f 67 72 61 | 6d 73 2c 20 74 68 65 20 |P progra|ms, the |
|00004ba0| 73 65 67 6d 65 6e 74 20 | 61 6e 64 20 74 68 65 20 |segment |and the |
|00004bb0| 6f 66 66 73 65 74 2e 20 | 54 68 65 20 66 6f 6c 6c |offset. |The foll|
|00004bc0| 6f 77 69 6e 67 0d 0a 65 | 78 61 6d 70 6c 65 20 6f |owing..e|xample o|
|00004bd0| 66 20 74 68 65 20 50 43 | 27 73 20 6d 65 6d 6f 72 |f the PC|'s memor|
|00004be0| 79 20 69 6c 6c 75 73 74 | 72 61 74 65 73 2e 0d 0a |y illust|rates...|
|00004bf0| 0d 0a 20 20 44 65 63 69 | 6d 61 6c 20 20 48 65 78 |.. Deci|mal Hex|
|00004c00| 61 2d 0d 0a 20 20 61 64 | 64 72 65 73 73 20 20 64 |a-.. ad|dress d|
|00004c10| 65 63 69 6d 61 6c 20 20 | 53 65 67 6d 65 6e 74 20 |ecimal |Segment |
|00004c20| 20 4f 66 66 73 65 74 20 | 20 57 68 61 74 0d 0a 20 | Offset | What.. |
|00004c30| 20 20 20 20 20 20 20 30 | 20 20 20 24 30 30 30 30 | 0| $0000|
|00004c40| 30 20 20 20 20 24 30 30 | 30 30 20 20 20 24 30 30 |0 $00|00 $00|
|00004c50| 30 30 20 20 43 6f 6e 76 | 65 6e 74 69 6f 6e 61 6c |00 Conv|entional|
|00004c60| 20 6d 65 6d 6f 72 79 20 | 73 74 61 72 74 73 0d 0a | memory |starts..|
|00004c70| 20 20 20 20 20 31 30 34 | 33 20 20 20 24 30 30 34 | 104|3 $004|
|00004c80| 31 33 20 20 20 20 24 30 | 30 34 30 20 20 20 24 30 |13 $0|040 $0|
|00004c90| 30 31 33 20 20 42 61 73 | 65 20 6d 65 6d 6f 72 79 |013 Bas|e memory|
|00004ca0| 20 69 6e 20 4b 62 2c 20 | 61 20 77 6f 72 64 0d 0a | in Kb, |a word..|
|00004cb0| 20 20 20 36 35 35 33 35 | 39 20 20 20 24 39 46 46 | 65535|9 $9FF|
|00004cc0| 46 46 20 20 20 20 24 39 | 30 30 30 20 20 20 24 46 |FF $9|000 $F|
|00004cd0| 46 46 46 20 20 43 6f 6e | 76 65 6e 74 69 6f 6e 61 |FFF Con|ventiona|
|00004ce0| 6c 20 6d 65 6d 6f 72 79 | 20 65 6e 64 73 0d 0a 20 |l memory| ends.. |
|00004cf0| 20 20 36 35 35 33 36 30 | 20 20 20 24 41 30 30 30 | 655360| $A000|
|00004d00| 30 20 20 20 20 24 41 30 | 30 30 20 20 20 24 30 30 |0 $A0|00 $00|
|00004d10| 30 30 20 20 55 70 70 65 | 72 20 6d 65 6d 6f 72 79 |00 Uppe|r memory|
|00004d20| 20 62 65 67 69 6e 73 0d | 0a 20 20 31 30 34 38 35 | begins.|. 10485|
|00004d30| 37 35 20 20 20 24 46 46 | 46 46 46 20 20 20 20 24 |75 $FF|FFF $|
|00004d40| 46 30 30 30 20 20 20 24 | 46 46 46 46 20 20 55 70 |F000 $|FFFF Up|
|00004d50| 70 65 72 20 6d 65 6d 6f | 72 79 20 65 6e 64 73 0d |per memo|ry ends.|
|00004d60| 0a 0d 0a 54 6f 20 65 78 | 65 6d 70 6c 69 66 79 2c |...To ex|emplify,|
|00004d70| 20 6c 65 74 27 73 20 6c | 6f 6f 6b 20 61 74 20 73 | let's l|ook at s|
|00004d80| 6f 6d 65 20 61 6c 74 65 | 72 6e 61 74 69 76 65 20 |ome alte|rnative |
|00004d90| 77 61 79 73 20 77 65 20 | 63 6f 75 6c 64 20 61 63 |ways we |could ac|
|00004da0| 63 65 73 73 0d 0a 74 68 | 65 20 69 6e 66 6f 72 6d |cess..th|e inform|
|00004db0| 61 74 69 6f 6e 20 61 62 | 6f 75 74 20 74 68 65 20 |ation ab|out the |
|00004dc0| 61 6d 6f 75 6e 74 20 6f | 66 20 74 68 65 20 62 61 |amount o|f the ba|
|00004dd0| 73 65 20 6d 65 6d 6f 72 | 79 2e 20 49 74 20 69 73 |se memor|y. It is|
|00004de0| 20 76 65 72 79 0d 0a 73 | 74 72 61 69 67 68 74 2d | very..s|traight-|
|00004df0| 66 6f 72 77 61 72 64 2c | 20 73 69 6e 63 65 20 69 |forward,| since i|
|00004e00| 6e 20 61 20 50 43 20 74 | 68 61 74 20 69 6e 66 6f |n a PC t|hat info|
|00004e10| 72 6d 61 74 69 6f 6e 20 | 69 73 20 61 74 20 74 68 |rmation |is at th|
|00004e20| 65 20 66 69 78 65 64 0d | 0a 6d 65 6d 6f 72 79 20 |e fixed.|.memory |
|00004e30| 6c 6f 63 61 74 69 6f 6e | 20 73 68 6f 77 20 62 79 |location| show by|
|00004e40| 20 74 68 65 20 61 62 6f | 76 65 20 74 61 62 6c 65 | the abo|ve table|
|00004e50| 2e 20 57 65 20 6b 6e 6f | 77 20 74 68 69 73 20 69 |. We kno|w this i|
|00004e60| 6e 20 61 64 76 61 6e 63 | 65 2e 0d 0a 55 73 69 6e |n advanc|e...Usin|
|00004e70| 67 20 64 69 72 65 63 74 | 20 6d 65 6d 6f 72 79 20 |g direct| memory |
|00004e80| 61 63 63 65 73 73 69 6e | 67 20 77 65 20 63 6f 75 |accessin|g we cou|
|00004e90| 6c 64 20 77 72 69 74 65 | 0d 0a 20 20 76 61 72 20 |ld write|.. var |
|00004ea0| 6d 65 6d 73 69 7a 65 20 | 3a 20 77 6f 72 64 3b 0d |memsize |: word;.|
|00004eb0| 0a 20 20 6d 65 6d 73 69 | 7a 65 20 3a 3d 20 4d 65 |. memsi|ze := Me|
|00004ec0| 6d 57 20 5b 24 30 30 34 | 30 3a 24 30 30 31 33 5d |mW [$004|0:$0013]|
|00004ed0| 3b 0d 0a 20 20 77 72 69 | 74 65 6c 6e 20 28 6d 65 |;.. wri|teln (me|
|00004ee0| 6d 73 69 7a 65 29 3b 0d | 0a 20 20 7b 2e 2e 20 6f |msize);.|. {.. o|
|00004ef0| 72 20 2e 2e 7d 0d 0a 20 | 20 76 61 72 20 6d 65 6d |r ..}.. | var mem|
|00004f00| 73 69 7a 65 20 3a 20 77 | 6f 72 64 20 61 62 73 6f |size : w|ord abso|
|00004f10| 6c 75 74 65 20 24 30 30 | 34 30 3a 24 30 30 31 33 |lute $00|40:$0013|
|00004f20| 3b 0d 0a 20 20 77 72 69 | 74 65 6c 6e 20 28 6d 65 |;.. wri|teln (me|
|00004f30| 6d 73 69 7a 65 29 3b 0d | 0a 49 66 20 79 6f 75 20 |msize);.|.If you |
|00004f40| 61 72 65 20 6e 6f 74 20 | 66 61 6d 69 6c 69 61 72 |are not |familiar|
|00004f50| 20 77 69 74 68 20 74 68 | 65 20 74 72 75 65 20 6d | with th|e true m|
|00004f60| 65 61 6e 69 6e 67 20 6f | 66 20 70 6f 69 6e 74 65 |eaning o|f pointe|
|00004f70| 72 73 2c 20 74 68 65 79 | 20 6d 61 79 0d 0a 66 65 |rs, they| may..fe|
|00004f80| 65 6c 20 63 6f 6e 66 75 | 73 69 6e 67 2c 20 62 75 |el confu|sing, bu|
|00004f90| 74 20 77 68 61 74 20 74 | 68 65 79 20 62 61 73 69 |t what t|hey basi|
|00004fa0| 63 61 6c 6c 79 20 61 72 | 65 20 69 73 20 6a 75 73 |cally ar|e is jus|
|00004fb0| 74 20 77 68 61 74 20 74 | 68 65 20 6e 61 6d 65 0d |t what t|he name.|
|00004fc0| 0a 69 6e 64 69 63 61 74 | 65 73 2c 20 70 6f 69 6e |.indicat|es, poin|
|00004fd0| 74 65 72 73 20 74 6f 20 | 6d 65 6d 6f 72 79 20 6c |ters to |memory l|
|00004fe0| 6f 63 61 74 69 6f 6e 73 | 2e 20 53 74 75 64 79 20 |ocations|. Study |
|00004ff0| 74 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 0d 0a 65 |the foll|owing..e|
|00005000| 78 61 6d 70 6c 65 2e 0d | 0a 20 20 76 61 72 20 6d |xample..|. var m|
|00005010| 65 6d 73 69 7a 65 50 74 | 72 20 3a 20 5e 77 6f 72 |emsizePt|r : ^wor|
|00005020| 64 3b 20 20 20 20 20 20 | 20 20 20 20 20 7b 20 41 |d; | { A|
|00005030| 20 70 6f 69 6e 74 65 72 | 20 74 6f 20 61 20 77 6f | pointer| to a wo|
|00005040| 72 64 20 7d 0d 0a 20 20 | 62 65 67 69 6e 0d 0a 20 |rd }.. |begin.. |
|00005050| 20 20 20 6d 65 6d 73 69 | 7a 65 50 74 72 20 3a 3d | memsi|zePtr :=|
|00005060| 20 70 74 72 20 28 24 34 | 30 2c 20 24 31 33 29 3b | ptr ($4|0, $13);|
|00005070| 20 20 20 7b 20 41 73 73 | 69 67 6e 20 74 68 65 20 | { Ass|ign the |
|00005080| 70 6f 69 6e 74 65 72 20 | 61 20 76 61 6c 75 65 20 |pointer |a value |
|00005090| 7d 0d 0a 20 20 20 20 77 | 72 69 74 65 6c 6e 20 28 |}.. w|riteln (|
|000050a0| 6d 65 6d 73 69 7a 65 50 | 74 72 5e 29 3b 20 20 20 |memsizeP|tr^); |
|000050b0| 20 20 20 20 20 20 20 7b | 20 57 72 69 74 65 20 77 | {| Write w|
|000050c0| 68 61 74 20 69 73 20 69 | 6e 20 74 68 65 20 61 64 |hat is i|n the ad|
|000050d0| 64 72 65 73 73 20 7d 0d | 0a 20 20 65 6e 64 2e 20 |dress }.|. end. |
|000050e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000050f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 7b 20 74 | | { t|
|00005100| 68 61 74 20 77 61 73 20 | 70 6f 69 6e 74 65 64 20 |hat was |pointed |
|00005110| 74 6f 20 7d 0d 0a 54 68 | 69 73 20 77 61 73 20 72 |to }..Th|is was r|
|00005120| 65 6c 61 74 69 76 65 6c | 79 20 73 69 6d 70 6c 65 |elativel|y simple|
|00005130| 2c 20 73 69 6e 63 65 20 | 77 65 20 6b 6e 65 77 20 |, since |we knew |
|00005140| 69 6e 20 61 64 76 61 6e | 63 65 20 74 68 65 20 6c |in advan|ce the l|
|00005150| 6f 63 61 74 69 6f 6e 20 | 6f 66 0d 0a 74 68 65 20 |ocation |of..the |
|00005160| 69 6e 66 6f 72 6d 61 74 | 69 6f 6e 2e 20 4c 65 74 |informat|ion. Let|
|00005170| 73 20 6c 6f 6f 6b 20 61 | 74 20 61 20 63 61 73 65 |s look a|t a case|
|00005180| 20 77 68 65 72 65 20 77 | 65 20 64 6f 20 6e 6f 74 | where w|e do not|
|00005190| 20 6b 6e 6f 77 20 74 68 | 61 74 2e 0d 0a 43 6f 6e | know th|at...Con|
|000051a0| 73 69 64 65 72 0d 0a 20 | 20 76 61 72 20 78 20 3a |sider.. | var x :|
|000051b0| 20 77 6f 72 64 3b 0d 0a | 20 20 62 65 67 69 6e 0d | word;..| begin.|
|000051c0| 0a 20 20 20 20 78 20 3a | 3d 20 31 32 32 33 3b 0d |. x :|= 1223;.|
|000051d0| 0a 20 20 20 20 77 72 69 | 74 65 6c 6e 20 28 78 29 |. wri|teln (x)|
|000051e0| 3b 0d 0a 20 20 65 6e 64 | 2e 0d 0a 57 65 20 68 61 |;.. end|...We ha|
|000051f0| 76 65 20 61 20 76 61 72 | 69 61 62 6c 65 20 78 20 |ve a var|iable x |
|00005200| 73 6f 6d 65 77 68 65 72 | 65 20 69 6e 20 74 68 65 |somewher|e in the|
|00005210| 20 6d 65 6d 6f 72 79 2c | 20 61 6e 64 20 77 65 20 | memory,| and we |
|00005220| 63 61 6e 20 72 65 66 65 | 72 20 74 6f 20 69 74 0d |can refe|r to it.|
|00005230| 0a 77 69 74 68 6f 75 74 | 20 65 76 65 72 20 6e 65 |.without| ever ne|
|00005240| 65 64 69 6e 67 20 74 6f | 20 6b 6e 6f 77 20 77 68 |eding to| know wh|
|00005250| 65 72 65 20 74 68 65 20 | 76 61 72 69 61 62 6c 65 |ere the |variable|
|00005260| 20 61 63 74 75 61 6c 6c | 79 20 69 73 20 69 6e 20 | actuall|y is in |
|00005270| 74 68 65 0d 0a 6d 65 6d | 6f 72 79 2e 20 42 75 74 |the..mem|ory. But|
|00005280| 20 68 6f 77 20 64 6f 65 | 73 20 6f 6e 65 20 66 69 | how doe|s one fi|
|00005290| 6e 64 20 6f 75 74 20 69 | 66 20 6f 6e 65 20 66 6f |nd out i|f one fo|
|000052a0| 72 20 73 6f 6d 65 20 72 | 65 61 73 6f 6e 20 77 61 |r some r|eason wa|
|000052b0| 6e 74 73 20 6f 72 0d 0a | 6e 65 65 64 73 20 74 6f |nts or..|needs to|
|000052c0| 20 6b 6e 6f 77 3f 0d 0a | 20 20 76 61 72 20 78 20 | know?..| var x |
|000052d0| 20 20 20 20 20 20 3a 20 | 77 6f 72 64 3b 0d 0a 20 | : |word;.. |
|000052e0| 20 20 20 20 20 53 65 67 | 6d 65 6e 74 20 3a 20 77 | Seg|ment : w|
|000052f0| 6f 72 64 3b 0d 0a 20 20 | 20 20 20 20 4f 66 66 73 |ord;.. | Offs|
|00005300| 65 74 20 20 3a 20 77 6f | 72 64 3b 0d 0a 20 20 20 |et : wo|rd;.. |
|00005310| 20 20 20 79 20 20 20 20 | 20 20 20 3a 20 5e 77 6f | y | : ^wo|
|00005320| 72 64 3b 0d 0a 20 20 62 | 65 67 69 6e 0d 0a 20 20 |rd;.. b|egin.. |
|00005330| 20 20 78 20 3a 3d 20 31 | 32 32 33 3b 0d 0a 20 20 | x := 1|223;.. |
|00005340| 20 20 77 72 69 74 65 6c | 6e 20 28 78 29 3b 0d 0a | writel|n (x);..|
|00005350| 20 20 20 20 53 65 67 6d | 65 6e 74 20 3a 3d 20 53 | Segm|ent := S|
|00005360| 65 67 28 78 29 3b 0d 0a | 20 20 20 20 4f 66 66 73 |eg(x);..| Offs|
|00005370| 65 74 20 20 3a 3d 20 4f | 66 73 28 78 29 3b 0d 0a |et := O|fs(x);..|
|00005380| 20 20 20 20 77 72 69 74 | 65 6c 6e 20 28 27 56 61 | writ|eln ('Va|
|00005390| 72 69 61 62 6c 65 20 78 | 20 69 73 20 61 74 20 24 |riable x| is at $|
|000053a0| 27 2c 20 48 45 58 46 4e | 28 53 65 67 6d 65 6e 74 |', HEXFN|(Segment|
|000053b0| 29 2c 20 27 3a 24 27 2c | 20 48 45 58 46 4e 28 4f |), ':$',| HEXFN(O|
|000053c0| 66 66 73 65 74 29 29 3b | 0d 0a 20 20 20 20 7b 2e |ffset));|.. {.|
|000053d0| 2e 2e 20 6f 6e 65 20 74 | 65 73 74 20 74 6f 20 65 |.. one t|est to e|
|000053e0| 6e 73 75 72 65 20 74 68 | 61 74 20 74 68 65 20 76 |nsure th|at the v|
|000053f0| 61 6c 75 65 20 72 65 61 | 6c 6c 79 20 69 73 20 69 |alue rea|lly is i|
|00005400| 6e 20 74 68 65 72 65 20 | 2e 2e 2e 7d 0d 0a 20 20 |n there |...}.. |
|00005410| 20 20 77 72 69 74 65 6c | 6e 20 28 4d 65 6d 57 20 | writel|n (MemW |
|00005420| 5b 53 65 67 6d 65 6e 74 | 3a 4f 66 66 73 65 74 5d |[Segment|:Offset]|
|00005430| 29 3b 0d 0a 20 20 20 20 | 7b 2e 2e 2e 20 61 6e 6f |);.. |{... ano|
|00005440| 74 68 65 72 20 74 65 73 | 74 20 74 6f 20 64 65 6d |ther tes|t to dem|
|00005450| 6f 6e 73 74 72 61 74 65 | 20 74 68 61 74 20 74 68 |onstrate| that th|
|00005460| 65 20 76 61 6c 75 65 20 | 72 65 61 6c 6c 79 20 69 |e value |really i|
|00005470| 73 20 69 6e 20 74 68 65 | 72 65 20 2e 2e 2e 7d 0d |s in the|re ...}.|
|00005480| 0a 20 20 20 20 79 20 3a | 3d 20 41 64 64 72 28 78 |. y :|= Addr(x|
|00005490| 29 3b 0d 0a 20 20 20 20 | 77 72 69 74 65 6c 6e 20 |);.. |writeln |
|000054a0| 28 79 5e 29 3b 0d 0a 20 | 20 65 6e 64 2e 0d 0a 4e |(y^);.. | end...N|
|000054b0| 65 78 74 20 63 6f 6e 73 | 69 64 65 72 0d 0a 20 20 |ext cons|ider.. |
|000054c0| 76 61 72 20 78 50 74 72 | 20 20 20 20 3a 20 5e 77 |var xPtr| : ^w|
|000054d0| 6f 72 64 3b 0d 0a 20 20 | 20 20 20 20 53 65 67 6d |ord;.. | Segm|
|000054e0| 65 6e 74 20 3a 20 77 6f | 72 64 3b 0d 0a 20 20 20 |ent : wo|rd;.. |
|000054f0| 20 20 20 4f 66 66 73 65 | 74 20 20 3a 20 77 6f 72 | Offse|t : wor|
|00005500| 64 3b 0d 0a 20 20 20 20 | 20 20 79 50 74 72 20 20 |d;.. | yPtr |
|00005510| 20 20 3a 20 5e 77 6f 72 | 64 3b 0d 0a 20 20 62 65 | : ^wor|d;.. be|
|00005520| 67 69 6e 0d 0a 20 20 20 | 20 78 50 74 72 5e 20 3a |gin.. | xPtr^ :|
|00005530| 3d 20 31 32 32 33 3b 0d | 0a 20 20 20 20 77 72 69 |= 1223;.|. wri|
|00005540| 74 65 6c 6e 20 28 78 50 | 74 72 5e 29 3b 0d 0a 20 |teln (xP|tr^);.. |
|00005550| 20 20 20 53 65 67 6d 65 | 6e 74 20 3a 3d 20 53 65 | Segme|nt := Se|
|00005560| 67 28 78 50 74 72 5e 29 | 3b 0d 0a 20 20 20 20 4f |g(xPtr^)|;.. O|
|00005570| 66 66 73 65 74 20 20 3a | 3d 20 4f 66 73 28 78 50 |ffset :|= Ofs(xP|
|00005580| 74 72 5e 29 3b 0d 0a 20 | 20 20 20 77 72 69 74 65 |tr^);.. | write|
|00005590| 6c 6e 20 28 27 24 27 2c | 20 48 45 58 46 4e 28 53 |ln ('$',| HEXFN(S|
|000055a0| 65 67 6d 65 6e 74 29 2c | 20 27 3a 24 27 2c 20 48 |egment),| ':$', H|
|000055b0| 45 58 46 4e 28 4f 66 66 | 73 65 74 29 29 3b 0d 0a |EXFN(Off|set));..|
|000055c0| 20 20 20 20 7b 2e 2e 2e | 20 61 20 74 65 73 74 20 | {...| a test |
|000055d0| 74 6f 20 65 6e 73 75 72 | 65 20 74 68 61 74 20 74 |to ensur|e that t|
|000055e0| 68 65 20 76 61 6c 75 65 | 20 72 65 61 6c 6c 79 20 |he value| really |
|000055f0| 69 73 20 69 6e 20 74 68 | 65 72 65 20 2e 2e 2e 7d |is in th|ere ...}|
|00005600| 0d 0a 20 20 20 20 79 50 | 74 72 20 3a 3d 20 50 74 |.. yP|tr := Pt|
|00005610| 72 20 28 53 65 67 6d 65 | 6e 74 2c 20 4f 66 66 73 |r (Segme|nt, Offs|
|00005620| 65 74 29 3b 0d 0a 20 20 | 20 20 77 72 69 74 65 6c |et);.. | writel|
|00005630| 6e 20 28 79 50 74 72 5e | 29 3b 0d 0a 20 20 65 6e |n (yPtr^|);.. en|
|00005640| 64 2e 0d 0a 41 20 66 75 | 72 74 68 65 72 20 61 73 |d...A fu|rther as|
|00005650| 70 65 63 74 20 6f 66 20 | 70 6f 69 6e 74 65 72 73 |pect of |pointers|
|00005660| 20 69 73 20 74 68 61 74 | 20 79 6f 75 20 63 61 6e | is that| you can|
|00005670| 20 75 74 69 6c 69 7a 65 | 20 74 68 65 6d 20 74 6f | utilize| them to|
|00005680| 20 70 75 74 20 61 0d 0a | 76 61 72 69 61 62 6c 65 | put a..|variable|
|00005690| 73 20 6f 6e 74 6f 20 74 | 68 65 20 68 65 61 70 20 |s onto t|he heap |
|000056a0| 69 6e 73 74 65 61 64 20 | 6f 66 20 74 68 65 20 64 |instead |of the d|
|000056b0| 61 74 61 20 73 65 67 6d | 65 6e 74 20 73 6f 20 74 |ata segm|ent so t|
|000056c0| 68 61 74 20 79 6f 75 0d | 0a 77 6f 6e 27 74 20 72 |hat you.|.won't r|
|000056d0| 75 6e 20 73 6f 20 65 61 | 73 69 6c 79 20 6f 75 74 |un so ea|sily out|
|000056e0| 20 6f 66 20 73 70 61 63 | 65 2e 0d 0a 20 20 76 61 | of spac|e... va|
|000056f0| 72 20 78 50 74 72 20 3a | 20 5e 77 6f 72 64 3b 0d |r xPtr :| ^word;.|
|00005700| 0a 20 20 62 65 67 69 6e | 0d 0a 20 20 20 20 7b 20 |. begin|.. { |
|00005710| 50 75 74 20 69 74 20 6f | 6e 74 6f 20 74 68 65 20 |Put it o|nto the |
|00005720| 68 65 61 70 20 7d 0d 0a | 20 20 20 20 4e 65 77 20 |heap }..| New |
|00005730| 28 78 50 74 72 29 3b 0d | 0a 20 20 20 20 78 50 74 |(xPtr);.|. xPt|
|00005740| 72 5e 20 3a 3d 20 31 32 | 32 33 3b 0d 0a 20 20 20 |r^ := 12|23;.. |
|00005750| 20 77 72 69 74 65 6c 6e | 20 28 78 50 74 72 5e 29 | writeln| (xPtr^)|
|00005760| 3b 0d 0a 20 20 20 20 7b | 20 47 65 74 20 72 69 64 |;.. {| Get rid|
|00005770| 20 6f 66 20 69 74 20 7d | 0d 0a 20 20 20 20 44 69 | of it }|.. Di|
|00005780| 73 70 6f 73 65 20 28 78 | 50 74 72 29 3b 20 78 50 |spose (x|Ptr); xP|
|00005790| 74 72 20 3a 3d 20 6e 69 | 6c 3b 0d 0a 20 20 20 20 |tr := ni|l;.. |
|000057a0| 72 65 61 64 6c 6e 3b 0d | 0a 20 20 65 6e 64 2e 0d |readln;.|. end..|
|000057b0| 0a 4c 65 74 20 75 73 20 | 72 65 74 75 72 6e 20 74 |.Let us |return t|
|000057c0| 6f 20 74 68 65 20 61 64 | 64 72 65 73 73 69 6e 67 |o the ad|dressing|
|000057d0| 2e 20 54 68 65 20 66 6f | 72 6d 75 6c 61 73 20 66 |. The fo|rmulas f|
|000057e0| 6f 72 20 63 6f 6e 76 65 | 72 74 69 6e 67 20 62 65 |or conve|rting be|
|000057f0| 74 77 65 65 6e 0d 0a 74 | 68 65 20 61 64 64 72 65 |tween..t|he addre|
|00005800| 73 73 65 73 20 28 73 65 | 6e 74 20 69 6e 20 62 79 |sses (se|nt in by|
|00005810| 20 44 75 6e 63 61 6e 20 | 4d 75 72 64 6f 63 68 29 | Duncan |Murdoch)|
|00005820| 20 61 72 65 0d 0a 20 20 | 50 68 79 73 69 63 61 6c | are.. |Physical|
|00005830| 20 3a 3d 20 6c 6f 6e 67 | 69 6e 74 28 73 65 67 6d | := long|int(segm|
|00005840| 65 6e 74 29 2a 31 36 20 | 2b 20 6f 66 66 73 65 74 |ent)*16 |+ offset|
|00005850| 3b 0d 0a 20 20 7b 7d 0d | 0a 20 20 53 65 67 6d 65 |;.. {}.|. Segme|
|00005860| 6e 74 20 20 3a 3d 20 50 | 68 79 73 69 63 61 6c 20 |nt := P|hysical |
|00005870| 64 69 76 20 31 36 3b 0d | 0a 20 20 4f 66 66 73 65 |div 16;.|. Offse|
|00005880| 74 20 20 20 3a 3d 20 50 | 68 79 73 69 63 61 6c 20 |t := P|hysical |
|00005890| 6d 6f 64 20 31 36 3b 20 | 7b 20 54 68 69 73 20 67 |mod 16; |{ This g|
|000058a0| 69 76 65 73 20 74 68 65 | 20 6e 6f 72 6d 61 6c 69 |ives the| normali|
|000058b0| 7a 65 64 20 66 6f 72 6d | 20 7d 0d 0a 54 68 65 72 |zed form| }..Ther|
|000058c0| 65 20 61 72 65 20 6d 75 | 6c 74 69 70 6c 65 20 53 |e are mu|ltiple S|
|000058d0| 65 67 6d 65 6e 74 3a 4f | 66 66 73 65 74 20 70 61 |egment:O|ffset pa|
|000058e0| 69 72 73 20 74 68 61 74 | 20 72 65 66 65 72 20 74 |irs that| refer t|
|000058f0| 6f 20 74 68 65 20 73 61 | 6d 65 0d 0a 61 64 64 72 |o the sa|me..addr|
|00005900| 65 73 73 2c 20 65 2e 67 | 2e 20 24 30 30 30 30 3a |ess, e.g|. $0000:|
|00005910| 24 30 34 31 33 20 61 6e | 64 20 24 30 30 34 30 3a |$0413 an|d $0040:|
|00005920| 24 30 30 31 33 2e 20 54 | 68 65 20 6e 6f 72 6d 61 |$0013. T|he norma|
|00005930| 6c 69 7a 65 64 20 61 64 | 64 72 65 73 73 65 73 2c |lized ad|dresses,|
|00005940| 0d 0a 77 69 74 68 20 74 | 68 65 20 6f 66 66 73 65 |..with t|he offse|
|00005950| 74 20 69 6e 20 74 68 65 | 20 72 61 6e 67 65 20 6f |t in the| range o|
|00005960| 66 20 30 20 74 6f 20 24 | 46 2c 20 61 72 65 2c 20 |f 0 to $|F, are, |
|00005970| 68 6f 77 65 76 65 72 2c | 20 75 6e 69 71 75 65 2e |however,| unique.|
|00005980| 20 41 6e 0d 0a 65 78 61 | 6d 70 6c 65 20 24 30 30 | An..exa|mple $00|
|00005990| 34 31 3a 24 30 30 30 33 | 2e 0d 0a 2d 2d 2d 2d 2d |41:$0003|...-----|
|000059a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000059b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000059c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000059d0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 0d |--------|-------.|
|000059e0| 0a 0d 0a 46 72 6f 6d 20 | 74 73 40 75 77 61 73 61 |...From |ts@uwasa|
|000059f0| 2e 66 69 20 53 61 74 20 | 53 65 70 20 37 20 30 30 |.fi Sat |Sep 7 00|
|00005a00| 3a 30 30 3a 36 30 20 31 | 39 39 36 0d 0a 53 75 62 |:00:60 1|996..Sub|
|00005a10| 6a 65 63 74 3a 20 47 65 | 74 74 69 6e 67 20 61 20 |ject: Ge|tting a |
|00005a20| 62 69 74 20 66 72 6f 6d | 20 61 20 62 79 74 65 0d |bit from| a byte.|
|00005a30| 0a 0d 0a 36 30 2e 20 2a | 2a 2a 2a 2a 0d 0a 20 51 |...60. *|****.. Q|
|00005a40| 3a 20 48 6f 77 20 64 6f | 20 49 20 6f 62 74 61 69 |: How do| I obtai|
|00005a50| 6e 20 61 20 62 69 74 20 | 6f 72 20 62 69 74 73 20 |n a bit |or bits |
|00005a60| 66 72 6f 6d 20 61 20 62 | 79 74 65 2c 20 61 20 77 |from a b|yte, a w|
|00005a70| 6f 72 64 20 6f 72 20 61 | 20 6c 6f 6e 67 69 6e 74 |ord or a| longint|
|00005a80| 3f 0d 0a 0d 0a 20 41 3a | 20 46 6f 72 20 62 69 74 |?.... A:| For bit|
|00005a90| 20 6f 70 65 72 61 74 69 | 6f 6e 73 20 74 68 69 6e | operati|ons thin|
|00005aa0| 6b 20 6f 66 20 74 68 65 | 20 76 61 72 69 61 62 6c |k of the| variabl|
|00005ab0| 65 20 61 73 20 61 20 62 | 69 6e 61 72 79 20 6e 75 |e as a b|inary nu|
|00005ac0| 6d 62 65 72 0d 0a 69 6e | 73 74 65 61 64 20 6f 66 |mber..in|stead of|
|00005ad0| 20 61 20 64 65 63 69 6d | 61 6c 2e 20 43 6f 6e 73 | a decim|al. Cons|
|00005ae0| 69 64 65 72 20 66 6f 72 | 20 65 78 61 6d 70 6c 65 |ider for| example|
|00005af0| 0d 0a 20 20 76 61 72 20 | 78 20 3a 20 77 6f 72 64 |.. var |x : word|
|00005b00| 3b 0d 0a 20 20 78 20 3a | 3d 20 32 31 39 3b 0d 0a |;.. x :|= 219;..|
|00005b10| 49 6e 20 62 69 6e 61 72 | 79 20 70 72 65 73 65 6e |In binar|y presen|
|00005b20| 74 61 74 69 6f 6e 20 69 | 74 20 69 73 0d 0a 20 20 |tation i|t is.. |
|00005b30| 54 68 65 20 77 6f 72 64 | 20 20 20 20 20 20 20 20 |The word| |
|00005b40| 20 20 20 20 20 20 20 20 | 20 20 30 30 30 30 20 30 | | 0000 0|
|00005b50| 30 30 30 20 31 31 30 31 | 20 31 30 31 31 0d 0a 20 |000 1101| 1011.. |
|00005b60| 20 50 6f 73 69 74 69 6f | 6e 20 69 6e 20 74 68 65 | Positio|n in the|
|00005b70| 20 77 6f 72 64 20 20 20 | 20 20 20 46 45 44 43 20 | word | FEDC |
|00005b80| 42 41 39 38 20 37 36 35 | 34 20 33 32 31 30 0d 0a |BA98 765|4 3210..|
|00005b90| 0d 0a 53 61 79 20 79 6f | 75 20 6e 65 65 64 20 74 |..Say yo|u need t|
|00005ba0| 68 65 20 76 61 6c 75 65 | 20 6f 66 20 62 69 74 20 |he value| of bit |
|00005bb0| 36 20 28 74 68 65 20 73 | 65 76 65 6e 74 68 20 62 |6 (the s|eventh b|
|00005bc0| 69 74 29 20 69 6e 20 74 | 68 65 20 77 6f 72 64 2e |it) in t|he word.|
|00005bd0| 20 59 6f 75 0d 0a 63 61 | 6e 20 22 61 6e 64 22 20 | You..ca|n "and" |
|00005be0| 74 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 20 77 6f |the foll|owing wo|
|00005bf0| 72 64 73 0d 0a 20 20 30 | 30 30 30 20 30 30 30 30 |rds.. 0|000 0000|
|00005c00| 20 31 31 30 31 20 31 30 | 31 31 20 20 20 20 28 32 | 1101 10|11 (2|
|00005c10| 31 39 29 0d 0a 20 20 30 | 30 30 30 20 30 30 30 30 |19).. 0|000 0000|
|00005c20| 20 30 31 30 30 20 30 30 | 30 30 20 20 20 20 28 20 | 0100 00|00 ( |
|00005c30| 36 34 29 0d 0a 49 6e 20 | 64 65 63 69 6d 61 6c 20 |64)..In |decimal |
|00005c40| 54 50 20 6e 6f 74 61 74 | 69 6f 6e 20 74 68 69 73 |TP notat|ion this|
|00005c50| 20 61 6d 6f 75 6e 74 73 | 20 74 6f 0d 0a 20 20 76 | amounts| to.. v|
|00005c60| 61 72 20 62 20 3a 20 77 | 6f 72 64 3b 0d 0a 20 20 |ar b : w|ord;.. |
|00005c70| 62 20 3a 3d 20 78 20 61 | 6e 64 20 36 34 3b 0d 0a |b := x a|nd 64;..|
|00005c80| 54 68 65 20 76 61 6c 75 | 65 20 6f 66 20 62 20 69 |The valu|e of b i|
|00005c90| 73 20 6e 6f 77 0d 0a 20 | 20 30 30 30 30 20 30 30 |s now.. | 0000 00|
|00005ca0| 30 30 20 30 31 30 30 20 | 30 30 30 30 20 20 20 20 |00 0100 |0000 |
|00005cb0| 28 20 36 34 29 0d 0a 54 | 6f 20 67 65 74 20 74 68 |( 64)..T|o get th|
|00005cc0| 65 20 62 69 74 20 76 61 | 6c 75 65 20 28 30 20 6f |e bit va|lue (0 o|
|00005cd0| 72 20 31 29 20 79 6f 75 | 20 6e 65 65 64 20 74 6f |r 1) you| need to|
|00005ce0| 20 73 68 69 66 74 20 74 | 68 65 20 72 65 73 75 6c | shift t|he resul|
|00005cf0| 74 20 72 69 67 68 74 20 | 62 79 0d 0a 73 69 78 20 |t right |by..six |
|00005d00| 73 74 65 70 73 2c 20 74 | 68 61 74 20 74 68 69 73 |steps, t|hat this|
|00005d10| 20 74 68 65 20 65 78 70 | 72 65 73 73 69 6f 6e 20 | the exp|ression |
|00005d20| 62 65 63 6f 6d 65 73 20 | 74 68 65 20 6f 66 74 65 |becomes |the ofte|
|00005d30| 6e 20 73 65 65 6e 20 62 | 75 74 0d 0a 63 72 79 70 |n seen b|ut..cryp|
|00005d40| 74 69 63 0d 0a 20 20 62 | 20 3a 3d 20 28 78 20 61 |tic.. b| := (x a|
|00005d50| 6e 64 20 36 34 29 20 73 | 68 72 20 36 3b 0d 0a 77 |nd 64) s|hr 6;..w|
|00005d60| 68 69 63 68 20 6d 65 61 | 6e 73 20 74 68 61 74 20 |hich mea|ns that |
|00005d70| 74 68 65 20 76 61 6c 75 | 65 20 6f 66 20 62 20 69 |the valu|e of b i|
|00005d80| 73 20 66 69 6e 61 6c 6c | 79 20 31 20 69 6e 20 74 |s finall|y 1 in t|
|00005d90| 68 69 73 20 65 78 61 6d | 70 6c 65 2e 0d 0a 0d 0a |his exam|ple.....|
|00005da0| 4f 6b 2c 20 62 75 74 20 | 77 68 61 74 20 74 68 65 |Ok, but |what the|
|00005db0| 6e 20 69 66 20 79 6f 75 | 20 6e 65 65 64 20 74 68 |n if you| need th|
|00005dc0| 65 20 63 6f 6d 62 69 6e | 65 64 20 76 61 6c 75 65 |e combin|ed value|
|00005dd0| 20 6f 66 20 62 69 74 73 | 20 73 69 78 20 61 6e 64 | of bits| six and|
|00005de0| 0d 0a 73 65 76 65 6e 2e | 20 54 68 65 20 61 6e 73 |..seven.| The ans|
|00005df0| 77 65 72 20 69 73 20 65 | 76 69 64 65 6e 74 20 69 |wer is e|vident i|
|00005e00| 66 20 79 6f 75 20 63 6f | 6e 73 69 64 65 72 20 74 |f you co|nsider t|
|00005e10| 68 65 20 62 69 6e 61 72 | 79 20 70 72 65 73 65 6e |he binar|y presen|
|00005e20| 74 61 74 69 6f 6e 0d 0a | 20 20 30 30 30 30 20 30 |tation..| 0000 0|
|00005e30| 30 30 30 20 31 31 30 31 | 20 31 30 31 31 20 20 20 |000 1101| 1011 |
|00005e40| 20 28 32 31 39 29 0d 0a | 20 20 30 30 30 30 20 30 | (219)..| 0000 0|
|00005e50| 30 30 30 20 31 31 30 30 | 20 30 30 30 30 20 20 20 |000 1100| 0000 |
|00005e60| 20 28 31 39 32 29 0d 0a | 68 65 6e 63 65 0d 0a 20 | (192)..|hence.. |
|00005e70| 20 62 20 3a 3d 20 28 78 | 20 61 6e 64 20 31 39 32 | b := (x| and 192|
|00005e80| 29 20 73 68 72 20 36 3b | 0d 0a 77 68 69 63 68 20 |) shr 6;|..which |
|00005e90| 77 69 6c 6c 20 67 69 76 | 65 20 33 20 61 73 20 69 |will giv|e 3 as i|
|00005ea0| 74 20 73 68 6f 75 6c 64 | 2e 0d 0a 0d 0a 53 6f 20 |t should|.....So |
|00005eb0| 66 61 72 2c 20 73 6f 20 | 67 6f 6f 64 2e 20 57 68 |far, so |good. Wh|
|00005ec0| 61 74 20 69 66 20 79 6f | 75 20 6e 65 65 64 20 74 |at if yo|u need t|
|00005ed0| 6f 20 74 75 72 6e 20 6f | 6e 20 62 69 74 20 6e 69 |o turn o|n bit ni|
|00005ee0| 6e 65 20 69 6e 20 61 20 | 77 6f 72 64 0d 0a 77 69 |ne in a |word..wi|
|00005ef0| 74 68 6f 75 74 20 69 6e | 74 65 72 66 65 72 69 6e |thout in|terferin|
|00005f00| 67 20 77 69 74 68 20 74 | 68 65 20 6f 74 68 65 72 |g with t|he other|
|00005f10| 20 62 69 74 73 2e 20 54 | 68 65 20 62 69 6e 61 72 | bits. T|he binar|
|00005f20| 79 20 70 72 65 73 65 6e | 74 61 74 69 6f 6e 2c 0d |y presen|tation,.|
|00005f30| 0a 61 67 61 69 6e 2c 20 | 69 73 20 74 68 65 20 6b |.again, |is the k|
|00005f40| 65 79 2e 20 59 6f 75 27 | 6c 6c 20 68 61 76 65 20 |ey. You'|ll have |
|00005f50| 74 6f 20 22 6f 72 22 20 | 74 68 65 20 66 6f 6c 6c |to "or" |the foll|
|00005f60| 6f 77 69 6e 67 0d 0a 20 | 20 30 30 30 30 20 30 30 |owing.. | 0000 00|
|00005f70| 30 30 20 31 31 30 31 20 | 31 30 31 31 20 20 20 20 |00 1101 |1011 |
|00005f80| 28 32 31 39 29 0d 0a 20 | 20 30 30 30 30 20 30 30 |(219).. | 0000 00|
|00005f90| 31 30 20 30 30 30 30 20 | 30 30 30 30 20 20 20 20 |10 0000 |0000 |
|00005fa0| 28 35 31 32 29 0d 0a 74 | 68 61 74 20 69 73 0d 0a |(512)..t|hat is..|
|00005fb0| 20 20 78 20 3a 3d 20 78 | 20 6f 72 20 35 31 32 3b | x := x| or 512;|
|00005fc0| 0d 0a 54 68 69 73 20 72 | 65 73 75 6c 74 73 20 74 |..This r|esults t|
|00005fd0| 6f 0d 0a 20 20 30 30 30 | 30 20 30 30 31 30 20 31 |o.. 000|0 0010 1|
|00005fe0| 31 30 31 20 31 30 31 31 | 20 20 20 20 28 37 33 31 |101 1011| (731|
|00005ff0| 29 0d 0a 0d 0a 57 68 61 | 74 20 69 66 20 79 6f 75 |)....Wha|t if you|
|00006000| 20 77 69 73 68 20 74 6f | 20 74 75 72 6e 20 6f 66 | wish to| turn of|
|00006010| 66 2c 20 73 61 79 20 62 | 69 74 20 36 2c 20 69 6e |f, say b|it 6, in|
|00006020| 0d 0a 20 20 30 30 30 30 | 20 30 30 30 30 20 31 31 |.. 0000| 0000 11|
|00006030| 30 31 20 31 30 31 31 20 | 20 20 20 28 32 31 39 29 |01 1011 | (219)|
|00006040| 0d 0a 20 20 31 31 31 31 | 20 31 31 31 31 20 31 30 |.. 1111| 1111 10|
|00006050| 31 31 20 31 31 31 31 20 | 20 28 36 35 34 37 31 29 |11 1111 | (65471)|
|00006060| 0d 0a 54 68 69 73 20 69 | 73 20 61 63 68 69 65 76 |..This i|s achiev|
|00006070| 65 64 20 62 79 0d 0a 20 | 20 78 20 3a 3d 20 32 31 |ed by.. | x := 21|
|00006080| 39 3b 0d 0a 20 20 78 20 | 3a 3d 20 78 20 61 6e 64 |9;.. x |:= x and|
|00006090| 20 36 35 34 37 31 3b 0d | 0a 54 68 69 73 20 72 65 | 65471;.|.This re|
|000060a0| 73 75 6c 74 73 20 74 6f | 0d 0a 20 20 30 30 30 30 |sults to|.. 0000|
|000060b0| 20 30 30 30 30 20 31 30 | 30 31 20 31 30 31 31 20 | 0000 10|01 1011 |
|000060c0| 20 20 20 28 31 35 35 29 | 0d 0a 0d 0a 43 6f 6e 73 | (155)|....Cons|
|000060d0| 69 64 65 72 20 74 68 65 | 20 66 6f 6c 6c 6f 77 69 |ider the| followi|
|000060e0| 6e 67 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 20 61 |ng appli|cation a|
|000060f0| 73 20 61 6e 20 65 78 61 | 6d 70 6c 65 2e 20 54 68 |s an exa|mple. Th|
|00006100| 65 20 6e 75 6d 62 65 72 | 20 6f 66 20 61 0d 0a 50 |e number| of a..P|
|00006110| 43 27 73 20 66 6c 6f 70 | 70 79 20 64 69 73 6b 20 |C's flop|py disk |
|00006120| 64 72 69 76 65 73 20 28 | 6d 69 6e 75 73 20 6f 6e |drives (|minus on|
|00006130| 65 29 20 69 73 20 73 74 | 6f 72 65 64 20 69 6e 20 |e) is st|ored in |
|00006140| 62 69 74 73 20 36 20 61 | 6e 64 20 37 20 69 6e 20 |bits 6 a|nd 7 in |
|00006150| 61 0d 0a 77 6f 72 64 20 | 72 65 74 75 72 6e 65 64 |a..word |returned|
|00006160| 20 62 79 20 69 6e 74 65 | 72 72 75 70 74 20 24 31 | by inte|rrupt $1|
|00006170| 31 2e 20 54 68 69 73 20 | 69 73 20 74 68 65 20 63 |1. This |is the c|
|00006180| 6f 64 65 20 74 6f 20 66 | 69 6e 64 20 6f 75 74 20 |ode to f|ind out |
|00006190| 68 6f 77 0d 0a 6d 61 6e | 79 20 64 69 73 6b 20 64 |how..man|y disk d|
|000061a0| 72 69 76 65 73 20 61 20 | 50 43 20 68 61 73 2e 0d |rives a |PC has..|
|000061b0| 0a 20 20 75 73 65 73 20 | 44 6f 73 3b 0d 0a 20 20 |. uses |Dos;.. |
|000061c0| 66 75 6e 63 74 69 6f 6e | 20 4e 72 4f 66 46 44 69 |function| NrOfFDi|
|000061d0| 73 6b 44 72 69 76 65 73 | 20 3a 20 62 79 74 65 3b |skDrives| : byte;|
|000061e0| 0d 0a 20 20 76 61 72 20 | 72 65 67 73 20 3a 20 72 |.. var |regs : r|
|000061f0| 65 67 69 73 74 65 72 73 | 3b 0d 0a 20 20 62 65 67 |egisters|;.. beg|
|00006200| 69 6e 0d 0a 20 20 20 20 | 49 6e 74 72 20 28 24 31 |in.. |Intr ($1|
|00006210| 31 2c 20 72 65 67 73 29 | 3b 0d 0a 20 20 20 20 4e |1, regs)|;.. N|
|00006220| 72 4f 66 46 44 69 73 6b | 44 72 69 76 65 73 20 3a |rOfFDisk|Drives :|
|00006230| 3d 20 28 28 72 65 67 73 | 2e 61 78 20 61 6e 64 20 |= ((regs|.ax and |
|00006240| 31 39 32 29 20 73 68 72 | 20 36 29 20 2b 20 31 3b |192) shr| 6) + 1;|
|00006250| 0d 0a 20 20 65 6e 64 3b | 0d 0a 0d 0a 41 20 74 69 |.. end;|....A ti|
|00006260| 70 20 66 72 6f 6d 20 44 | 75 6e 63 61 6e 20 4d 75 |p from D|uncan Mu|
|00006270| 72 64 6f 63 68 2e 20 20 | 59 6f 75 20 6d 69 67 68 |rdoch. |You migh|
|00006280| 74 20 77 69 73 68 20 74 | 6f 20 70 72 65 64 65 66 |t wish t|o predef|
|00006290| 69 6e 65 20 74 68 65 0d | 0a 66 6f 6c 6c 6f 77 69 |ine the.|.followi|
|000062a0| 6e 67 20 63 6f 6e 73 74 | 61 6e 74 73 20 66 6f 72 |ng const|ants for|
|000062b0| 20 65 61 73 69 65 72 20 | 68 61 6e 64 6c 69 6e 67 | easier |handling|
|000062c0| 0d 0a 20 20 63 6f 6e 73 | 74 20 62 69 74 30 20 20 |.. cons|t bit0 |
|000062d0| 3d 20 31 3b 0d 0a 20 20 | 20 20 20 20 20 20 62 69 |= 1;.. | bi|
|000062e0| 74 31 20 20 3d 20 32 3b | 0d 0a 20 20 20 20 20 20 |t1 = 2;|.. |
|000062f0| 20 20 62 69 74 32 20 20 | 3d 20 34 3b 0d 0a 20 20 | bit2 |= 4;.. |
|00006300| 20 20 20 20 20 20 3a 0d | 0a 20 20 20 20 20 20 20 | :.|. |
|00006310| 20 62 69 74 31 35 20 3d | 20 33 32 37 36 38 3b 0d | bit15 =| 32768;.|
|00006320| 0a 20 20 20 20 20 20 20 | 20 3a 0d 0a 20 20 20 20 |. | :.. |
|00006330| 20 20 20 20 62 69 74 33 | 31 20 3d 20 32 31 34 37 | bit3|1 = 2147|
|00006340| 34 38 33 36 34 38 3b 0d | 0a 4f 72 20 74 6f 20 70 |483648;.|.Or to p|
|00006350| 75 74 20 69 74 20 73 6c | 69 67 68 74 6c 79 20 64 |ut it sl|ightly d|
|00006360| 69 66 66 65 72 65 6e 74 | 6c 79 20 61 73 20 44 72 |ifferent|ly as Dr|
|00006370| 20 4a 6f 68 6e 20 53 74 | 6f 63 6b 74 6f 6e 0d 0a | John St|ockton..|
|00006380| 6a 72 73 40 64 63 6c 66 | 2e 6e 70 6c 2e 63 6f 2e |jrs@dclf|.npl.co.|
|00006390| 75 6b 20 73 75 67 67 65 | 73 74 73 0d 0a 20 20 63 |uk sugge|sts.. c|
|000063a0| 6f 6e 73 74 0d 0a 20 20 | 62 69 74 30 30 3d 24 30 |onst.. |bit00=$0|
|000063b0| 30 30 30 30 30 30 31 3b | 20 62 69 74 30 31 3d 24 |0000001;| bit01=$|
|000063c0| 30 30 30 30 30 30 30 32 | 3b 20 62 69 74 30 32 3d |00000002|; bit02=|
|000063d0| 24 30 30 30 30 30 30 30 | 34 3b 20 62 69 74 30 33 |$0000000|4; bit03|
|000063e0| 3d 24 30 30 30 30 30 30 | 30 38 3b 0d 0a 20 20 62 |=$000000|08;.. b|
|000063f0| 69 74 30 34 3d 24 30 30 | 30 30 30 30 31 30 3b 20 |it04=$00|000010; |
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.