home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols000 / vol030 / sigmlog.019 < prev    next >
Text File  |  1985-02-09  |  29KB  |  1,200 lines

  1. Sig/M volume 19        miscellaneous Pascal Z programs
  2.  
  3.     (original materials from Pascal Z User Group volume 1)
  4.  
  5.     -CATALOG.019        contents of Sig/M volume 19
  6.     -CATALOG.ACK        acknowledgement file
  7.     ABSTRACT.019        comments file
  8.     CRCKFILE.019        CRC of volume 19
  9.  
  10. 19.1    AUTOBOOT.ASM     5K    autoboot on CP/M cold start
  11. 19.2    AUTOBOOT.COM     1K    /
  12. 19.3    LINEARP.PAS    11K    simplex algorithm to minimize
  13. 19.4    LINEARP.COM    21K        a cost function to constraints
  14. 19.5    VARIANT.PAS     1K    demo for variant records
  15. 19.6    VARIANT.COM     5K    /
  16. 19.7    REVERSE.PAS     2K    demo for linked lists
  17. 19.8    REVERSE.COM     6K    /
  18. 19.9    EDITFILE.PAS     9K    adapted from S-100 Microsystems
  19. 19.10    EDITFILE.COM    13K    /
  20. 19.11    RT.PAS         4K    demo program for non-text files
  21. 19.12    RT.COM         8K    /
  22. 19.13    STARS.PAS     6K    game
  23. 19.14    STARS.COM     7K    /
  24. 19.15    ADDN.PAS     1K    simple demo to add two numbers
  25. 19.16    ADDN.COM     6K    /
  26. 19.17    ZMNEMONS.DOC    13K    programming aid
  27. 19.18    TRIAN.PAS     1K    demo on FOR loops
  28. 19.19    TRIAN.COM     4K    /
  29. 19.20    CONCHAR.PAS     6K    utility for command line input
  30. 19.21    SCAN2X.PAS     5K    file READ evaluation
  31. 19.22    SCAN2X.COM     8K    /
  32. 19.23    STRDEMO.PAS    14K    demo on string functions
  33. 19.24    STRLIB.DOC     4K    part of STRDEMO.PAS
  34. 19.25    LONG.PAS     3K    demo to string words together
  35. 19.26    LONG.COM     7K    /
  36. 19.27    MAKEREL.DOC     8K    convert REL. files from function blks
  37. 19.28    LIOS.ASM     7K    novice utility
  38. 19.29    CONVERT.PAS     1K    convert gas in liters
  39. 19.30    CONVERT.COM     6K    /
  40. 19.31    COMPARE.!!!    11K    compare source code files from UCSD
  41. 19.32    DUMP.ASM    23K    expanded CP/M DUMP program
  42. 19.33    LSTR.PAS     2K    generates a line of various length 
  43.  
  44.  
  45. Thσ Sig/═ Use≥ Grou≡ receiveΣ thσ Pasca∞ ┌ Use≥ Grou≡ volume≤ fo≥ ì
  46. inclusioε int∩ thσ library«á Wσ thanδ Charliσ Foste≥ wh∩ haΣ donσ ì
  47. thσá origina∞ compilatioε fo≥ hi≤ contributioε anΣá efforts«á Thσ ì
  48. Pasca∞á ┌á Use≥ Grou≡ librarie≤ arσ no≈ par⌠ oµ Sig/═ volume≤á 1╣ ì
  49. througΦ 25.
  50.  
  51.     
  52.  
  53.  
  54.                          Z-user≤ group
  55.                           Volumσ #1
  56.  
  57.      Sincσ thi≤ i≤ thσ ver∙ firs⌠ disδ distributeΣ b∙ thσ Z-user≤ 
  58. group¼  i⌠  seem≤ appropriatσ tha⌠ ╔ givσ yo⌡ ß littlσ histor∙ oµ 
  59. jus⌠ ho≈ thi≤ al∞ started«  
  60.  
  61.      Wheε ╔ starteΣ iε thσ Microcompute≥ arena¼ tw∩ year≤ ago«  ╔ 
  62. didn'⌠  kno≈  anythinτ abou⌠ anything«   Bu⌠ ╔  aφ  ß  compulsivσ 
  63. reade≥ anΣ spen⌠ much¼  mucΦ timσ readinτ wha⌠ thσ expert≤ haΣ t∩ 
  64. say«   ╔  theε tooδ thei≥ advice¼  pocketbooδ  permitting«   Tha⌠ 
  65. mean⌠  tha⌠  ╔  wa≤ goinτ t∩ havσ ß  S-10░  bus¼  Z-80¼  dua∞  8ó 
  66. floppies¼á  64δá  oµ  memory¼á al∞  runninτ  unde≥á  CPM«á   Theε  ì
  67. camσá languages«áá   A⌠á  first¼áá  ╔á wen⌠á alonτá witΦá  Basic«   ì
  68. However¼á  i⌠á didn'⌠á reall∙ turε mσ oε s∩ ╔ jus⌠ collecteΣá anΣ ì
  69. drifteΣá froφá onσ languagσ t∩ another«á   Thσ expert≤á saiΣá thσ ì
  70. greates⌠ thinτ arounΣ wa≤  Pascal«á   S∩  wheε  UCS─  Pasca∞á wa≤ ì
  71. offereΣá  t∩á  ou≥á  loca∞ Compute≥ cluΓ ╔ chippeΣ iε anΣá go⌠á ß ì
  72. copy«á   Ou⌠ oµ fort∙ member≤ wh∩  go⌠  tha⌠ Pascal¼á  onl∙ threσ ì
  73. oµ u≤ go⌠ i⌠ u≡  anΣ  running«  Nonσ  oµ  u≤ useΣ i⌠ AFTE╥ wσ go⌠ ì
  74. i⌠á  u≡á  anΣá  running«á   Mostly¼á becausσ  wσá  werσá al∞á CP═ ì
  75. orientated«   S∩ wσ gavσ u≡ oε  Pascal«  Meanwhile¼ ╔ wa≤ stayinτ ì
  76. iε toucΦ witΦ variou≤ friend≤ arounΣ thσ countr∙ anΣ onσ oµá theφ ì
  77. tolΣá mσ abou⌠ Ithaca'≤ PASCAL/Z«á   I⌠ wa≤ onl∙ versioε #▒ bu⌠ ╔ ì
  78. loveΣ i⌠ froφ thσ ver∙ first«   ╔ likeΣ thσ  ideß anΣ iε spitσ oµ ì
  79. thσ earl∙ bugs¼á  ╔ haΣ ß bal∞ witΦ  it«  S∩ ╔ bough⌠ versioε 2.░ ì
  80. anΣ likeΣ tha⌠ eveε better.
  81.  
  82.      Man∙ program≤ late≥ ╔ wa≤ ß confirmeΣ Pasca∞ freak«  S∩ mucΦ 
  83. s∩  tha⌠  wheε  thσ  S╞ Fai≥ rolleΣ around¼  ╔  lookeΣ  u≡  Stevσ 
  84. Edleman«  Hσ wa≤ thσ guidinτ ligh⌠ fo≥ Ithacß Intersystem≤ anΣ wσ 
  85. seemeΣ  t∩ havσ somσ commoε interests«   T∩ makσ ß  shor⌠  story¼ 
  86. shorter¼  Stevσ  tooδ ß couplσ oµ m∙ suggestion≤ t∩ hear⌠ anΣ  iε 
  87. Ma∙ oµ 198░ announceΣ t∩ thσ worlΣ tha⌠ Ithacß Intersystem≤ woulΣ 
  88. activel∙  suppor⌠ ß Pascal/┌ use≥ group«   ╔ offereΣ t∩ direc⌠ i⌠ 
  89. anΣ kee≡ i⌠ running¼ s∩ wσ madσ ß deal.
  90.  
  91.      Thσ  inten⌠  oµ thi≤ grou≡ i≤ t∩ assis⌠  Pascal/Z¼  Z8░  anΣ 
  92. Z800░  softwarσ  dissemination«   Tha⌠ way¼  we'l∞ al∞  ge⌠  morσ 
  93. program≤ t∩ pla∙ arounΣ witΦ anΣ havσ fuε too.
  94.  
  95.      Fo≥ thσ stranger¼ wh∩ happen≤ t∩ picδ u≡ thi≤ disk¼ Pascal/┌ 
  96. require≤  ß  Z8░  cpu¼  CP═ anΣ  56δ  oµ  useablσ  memory«   Mos⌠ 
  97. everythinτ  elsσ i≤ u≡ t∩ thσ owne≥ oµ thσ system«   ╔ intenΣ  t∩ 
  98. publisΦ  ß  flye≥  bimonthl∙ s∩ thσ bugs¼  fixe≤  anΣ  an∙  othe≥ 
  99. interestinτ  item≤  caε bσ passeΣ on«   Donation≤  arσ  certainl∙ 
  100. needed«   ╔ wil∞ tr∙ t∩ edi⌠ anΣ tes⌠ al∞ program≤ sent¼ givσ thσ 
  101. autho≥  plent∙  oµ  credi⌠ anΣ spreaΣ hi≤ prograφ  al∞  ove≥  thσ 
  102. world«   It≤  likσ  ß chaiε letter¼  yo⌡ senΣ iε one¼  anΣ ge⌠  ß 
  103. hundreΣ back«   S∩ don'⌠ bσ lazy¼ senΣ i⌠ in«  Someone¼ somewherσ 
  104. wil∞ bσ glaΣ yo⌡ did«  AnΣ yo⌡ wil∞ too.
  105. .paèCHARLI┼ FOSTER
  106. Director
  107. Z-Users Group
  108. 7962 Center Pkwy
  109. Sacramento, Ca 95823
  110.  
  111.  
  112. ---------------------------------------------------------
  113. -                            -
  114. -   Steps to make your Pascal procedure/function into a    -
  115. -   .REL file so it may be included into a library of    -
  116. -   commonly used routines.                -
  117. ---------------------------------------------------------
  118.  
  119.  
  120. 1.    Write your function/procedure and test it in a complete
  121.     program.  When you are happy with your function then
  122.     write up a dummy Pascal program. It will look something
  123.     like this:
  124.  
  125.     Program dummy;
  126.     type    new : (xxx,yyy);
  127.     var    str8 : STRING 8;
  128.  
  129.     (*$I+    [include Pascal prgm stmts]    *)
  130.     FUNCTION DOESITALL;
  131.     begin
  132.     ...main body of function
  133.     end(*---of does it all---*);
  134.  
  135.     (*---dummy program---*)
  136.     begin end.
  137.  
  138.  
  139. 2.    -Notice the compiler option -   $I+
  140.      This is a must so you can see where the assembly source
  141.      program starts and ends.
  142.     -You may include types and variables in the program heading
  143.      to get your function/procedure to compile but notice that
  144.      there is NO main program.
  145.  
  146. 3    Compile the program with the Pascal compiler producing
  147.     DOESITALL.SRC.
  148.  
  149. 4.    Edit DOESITALL.SRC to include the following:
  150.  
  151.     a. The name of the routine:
  152.         NAME DOESITALL
  153.  
  154.     b. The entry name for the linker:
  155.         ENTRY DOESITALL
  156.  
  157.     c. The entry name as a label for the assembler:
  158.         DOESITALL:
  159.  
  160.  
  161. 5.    All together it will look somwthing like this:
  162.  
  163.  
  164.     ;FUNCTION DOESITALL;        <---all Pascal source statements
  165.     ;                    will be included as comments
  166.     ;                    in your source program.
  167.         NAME DOESITALL        <---These are the 3 statements
  168.         ENTRY DOESITALL            that you added
  169.     DOESITALL:
  170.         ENTR    D,2,0        <---this is the first line of the
  171.                         source program
  172.         ---the rest of the source program
  173.            continues here---
  174.  
  175.     ;end(*---of does it all---*);    <---this is the last line of
  176.         EXIT    D,0            your function and this is
  177.                         the last line of the assembly
  178.                         source.
  179.     --------------------------------
  180.     Anything after the EXIT statement is to be deleted.
  181.  
  182.  
  183. 6.    You are now ready to assemble the source program and make
  184.     a .REL file.
  185.     <first rename EMAIN.SRC to MACRO.SRC and in addition
  186.      edit EMAIN.SRC and remove the NAME statement from it.
  187.      We only want the names that we give to our routines
  188.      in the source code>
  189.  
  190.     ASMBL MACRO,DOESITALL/REL
  191.  
  192.     -This will produce DOESITALL.REL
  193.  
  194. 7.    DOESITALL.REL is now ready to be included in your library:
  195.  
  196.     LINK /L:B:ALLOFIT B:DOESITALL /E
  197.  
  198.     -This will create a library named ALLOFIT.REL
  199.  
  200. 8.    We now write a program that calls DOESITALL.
  201.     It is not until link time that there is any need for the
  202.     routine at all.
  203.  
  204.     LINK /N:B:SUPERWRITER B:SUPERWRITER A:ALLOFIT/S /E
  205.  
  206.     -Did you get all of that?
  207.     a. We opened a .COM file on drive B: named SUPERWRITER.COM
  208.     b. We opened a .REL file on drive B: named SUPERWRITER.REL
  209.     c. We will search a library file named ALLOFIT.REL on drive A:
  210.     d. And then exit to the CP/M operating system, searching
  211.        a file named LIB.REL to resolve any unresolved symbols.
  212.     <<CP/M limits file names to 8 characters so please forgive
  213.       me when I get carried away>>
  214.  
  215. 9.    Following is a Pascal program called RANDOM.PAS. that has
  216.     been compiled and converted into a .REL file.  Look it over
  217.     and see if you can do it also.
  218.  
  219. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  220.  
  221.  
  222.  
  223. (*$I+    [include Pascal prgm stmts]    *)
  224. PROGRAM RANDOM;
  225. VAR
  226.   SEED1, SEED2 : INTEGER;
  227. (*
  228. ==============================================
  229.  PROGRAM TITLE:    RANDOM_NUMB_GENERATOR
  230.  
  231.  WRITTEN BY:    Raymond E. Penley
  232.  DATE WRITTEN:    SEP 1979
  233.  
  234.  WRITTEN FOR:    Use with PASCAL/Z
  235.  
  236.  SUMMARY:
  237.     Implement a Fibonacci series Random number generator.
  238.     RANDOM will return numbers from 0 to 32767
  239.     Call RANDOM with the following convention:
  240.      Range         Use
  241.       0 - 32    RANDOM DIV 1000
  242.       0 - 327    RANDOM DIV 100
  243.           0 - 32767    RANDOM
  244. **
  245.   Add these lines to your PASCAL source program:
  246.  
  247.     VAR  SEED1, SEED2 : INTEGER;
  248.  
  249.     PROCEDURE SEEDRAND; EXTERNAL;
  250.     FUNCTION RANDOM: INTEGER; EXTERNAL;
  251.  
  252.  
  253.   Also within the body of the main program
  254.   but BEFORE calling RANDOM:
  255.  
  256.       SEEDRAND;
  257.  
  258. ==============================================
  259. *)
  260.  
  261. PROCEDURE SEEDRAND;
  262. (* INITIAL VALUES FOR SEED1 AND SEED2 ARE HERE  *)
  263. (*
  264.     NAME RANDOM            <<< these statements were included
  265.     ENTRY SEEDRAND,RANDOM        <<< by me to make it easy to edit
  266.                     <<< the source code.
  267. SEEDRAND:                <<< the LABEL goes directly in front
  268. *)                    <<< of the first BEGIN stmt
  269. Begin
  270.    SEED1 := 10946;
  271.    SEED2 := 17711
  272. END;
  273.  
  274.  
  275. FUNCTION RANDOM : INTEGER;
  276. (*
  277. GLOBAL
  278.   SEED1, SEED2 : INTEGER        *)
  279. CONST
  280.   HALFINT = 16383; (* 1/2 OF MAXINT *)
  281. VAR
  282.   temp1, temp2, HALF_ADDER : INTEGER;
  283. (*
  284. RANDOM:                    <<< the LABEL goes directly in
  285. *)                    <<< front of the first BEGIN stmt
  286. Begin
  287. (* Take 1/2 of the seeds for the comparison test *)
  288.   temp1 := SEED1 DIV 2;
  289.   temp2 := SEED2 DIV 2;
  290.   IF (temp1+temp2) >= HALFINT THEN
  291.     (* the number is too big - scale it down *)
  292.     HALF_ADDER := temp1 + temp2 - HALFINT
  293.   ELSE
  294.     HALF_ADDER := temp1 + temp2;
  295.   SEED1 := SEED2;
  296.   (* Restore from previous DIVision *)
  297.   SEED2 := HALF_ADDER * 2;
  298.   RANDOM := SEED2
  299. END(*---RANDOM---*);
  300.  
  301. (*-----------DUMMY PROGRAM--------------*)
  302. (* THIS MUST BE REMOVED VIA YOUR EDITOR *)
  303. BEGIN END.
  304.  
  305.  
  306.  
  307.  
  308. +++++++++++++++++++++++++++++++++++++++++++++++++++++++
  309.  
  310.  
  311.     The assembler source code follows
  312.     There has been some editing of the code
  313.     to remove unwanted labels and program
  314.     statements.
  315.  
  316. +++++++++++++++++++++++++++++++++++++++++++++++++++++++
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323. ; ==============================================
  324. ;  PROGRAM TITLE:    RANDOM_NUMB_GENERATOR
  325. ;  WRITTEN BY:          Raymond E. Penley
  326. ;  DATE WRITTEN:    SEP 1979
  327. ;  WRITTEN FOR:    Use with PASCAL/Z
  328. ;  SUMMARY:
  329. ;     Implement a Fibonacci series Random number generator.
  330. ;     RANDOM will return numbers from 0 to 32767
  331. ;     Call RANDOM with the following convention:
  332. ;      Range         Use
  333. ;       0 - 32    RANDOM DIV 1000
  334. ;       0 - 327    RANDOM DIV 100
  335. ;         0 - 32767    RANDOM
  336. ;
  337. ; Add these lines to your PASCAL source program:
  338. ;     VAR  SEED1, SEED2 : INTEGER;
  339. ;
  340. ;     PROCEDURE SEEDRAND; EXTERNAL;
  341. ;     FUNCTION RANDOM: INTEGER; EXTERNAL;
  342. ;
  343. ;     Also within the body of the main program
  344. ;     but BEFORE calling RANDOM:
  345. ;
  346. ;      SEEDRAND;
  347. ;
  348. ;==============================================
  349. ;
  350.     NAME    RANDOM
  351. ;
  352.      ENTRY SEEDRAND,RANDOM
  353. ;
  354. ;PROCEDURE SEEDRAND;
  355. ; INITIAL VALUES OF SEED1 AND SEED2 ARE HERE
  356. SEEDRAND:
  357.     ENTR    D,2,0
  358. ;    SEED1 := 10946;
  359.     MVI    0(IY),42
  360.     MVI    -1(IY),194
  361. ;    SEED2 := 17711
  362.     MVI    -2(IY),69
  363.     MVI    -3(IY),47
  364. ; END;
  365.     EXIT    D,0
  366. ;
  367. ;
  368. ; FUNCTION RANDOM : INTEGER;
  369. ; GLOBAL
  370. ;   SEED1, SEED2 : INTEGER
  371. ; CONST
  372. ;   HALFINT = 16383; (* 1/2 OF MAXINT *)
  373. ; VAR
  374. ;   temp1, temp2, HALF_ADDER : INTEGER;
  375. ;
  376. RANDOM:
  377.     ENTR    D,2,6
  378. ; (* Take 1/2 of the seeds for the comparison test *)
  379. ;   temp1 := SEED1 DIV 2;
  380.     MOV    L,-1(IY)
  381.     MOV    H,0(IY)
  382.     LXI    D,2
  383.     DIVD    D,0
  384.     MOV    -2(IX),H
  385.     MOV    -3(IX),L
  386. ;   temp2 := SEED2 DIV 2;
  387.     MOV    L,-3(IY)
  388.     MOV    H,-2(IY)
  389.     LXI    D,2
  390.     DIVD    D,0
  391.     MOV    -4(IX),H
  392.     MOV    -5(IX),L
  393. ;   IF (temp1+temp2) >= HALFINT THEN
  394.     MOV    L,-3(IX)
  395.     MOV    H,-2(IX)
  396.     MOV    E,-5(IX)
  397.     MOV    D,-4(IX)
  398.     DADD    D,0
  399.     LXI    D,16383
  400.     GE    D,0
  401. ;     (* the number is too big - scale it down *)
  402. ;     HALF_ADDER := temp1 + temp2 - HALFINT
  403.     JNC    L171
  404.     MOV    L,-3(IX)
  405.     MOV    H,-2(IX)
  406.     MOV    E,-5(IX)
  407.     MOV    D,-4(IX)
  408.     DADD    D,0
  409. ;   ELSE
  410.     LXI    D,-16383
  411.     DADD    D,0
  412.     MOV    0(IX),H
  413.     MOV    -1(IX),L
  414. ;     HALF_ADDER := temp1 + temp2;
  415.     JMP    L191
  416. L171
  417.     MOV    L,-3(IX)
  418.     MOV    H,-2(IX)
  419.     MOV    E,-5(IX)
  420.     MOV    D,-4(IX)
  421.     DADD    D,0
  422.     MOV    0(IX),H
  423.     MOV    -1(IX),L
  424. L191
  425. ;   SEED1 := SEED2;
  426.     MOV    L,-3(IY)
  427.     MOV    H,-2(IY)
  428.     MOV    0(IY),H
  429.     MOV    -1(IY),L
  430. ;   (* Restore from previous DIVision *)
  431. ;   SEED2 := HALF_ADDER * 2;
  432.     MOV    L,-1(IX)
  433.     MOV    H,0(IX)
  434.     DADD    C
  435.     MOV    -2(IY),H
  436.     MOV    -3(IY),L
  437. ;   RANDOM := SEED2
  438.     MOV    L,-3(IY)
  439.     MOV    H,-2(IY)
  440.     MOV    3(IX),H
  441.     MOV    2(IX),L
  442. ; END(*---RANDOM---*);
  443.     EXIT    D,0
  444.  
  445.  
  446.  
  447. +++++++++++++++++++++++++++++++++++++++++++++++++++++
  448.  
  449.  
  450. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  451. :
  452. :          Cross Reference listing of Z-80 Mnemonics      
  453. :
  454. :Courtesy of Tim Eliseo
  455. :        %PCE, 4778 Dewey Dr, Fair Oaks, Ca 95628
  456. :June 1980
  457. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  458.  
  459.      This  document is a cross-reference listing of the  standard 
  460. Zilog Z-80 mnemonics to the bastardized TDL Z-80 mnemonics.   The 
  461. TDL  mnemonics  are upward compatible to the standard Intel  8080 
  462. mnemonics,  making  it  easy  to  upgrade  existing  8080  source 
  463. programs to the Z-80 CPU.  The only problem is that they are just 
  464. as illogical as the original 8080 mnemonics, and there is no real 
  465. standard for them.   These are the mnemonics which are used  with 
  466. PASCAL/Z  and the assembler that comes with the  package.   These 
  467. tables   will  make  it  easy  for  the  Z-80  assembly  language 
  468. programmer to cross reference the non-standard mnemonics.
  469.      If an asterisk appears in the left-hand column of a line, it 
  470. means that all of the instructions specified in that line, except 
  471. those that refer to the Z-80 index registers, are compatible with 
  472. the 8080.
  473.      There   are   a  few  instructions  that   require   further 
  474. clarification.  The TDL assembler mnemonics JV, JNV, CV, CNV, RV, 
  475. and RNV are synonymous to the 8080 mnemonics JPE,  JPO, CPE, CPO, 
  476. RPE,  and  RPO  respectively.   These instructions refer  to  the 
  477. parity/overflow  flag in the Z-80 when it is used as an  overflow 
  478. flag  and  are not included in 8080 assemblers,  even though  the 
  479. instructions  will execute on the 8080 but will always  refer  to 
  480. the  flag as a parity flag (this flag is always a parity flag  in 
  481. the 8080).
  482.      Another  instruction which requires clarification is the RST 
  483. instruction.   In the TDL assembler the operand is a number which 
  484. is actually the restart address divided by 8,  while in the Zilog 
  485. assembler the operand is the actual restart address.
  486.      Following  is a list of the abbreviations that are  used  to 
  487. reference a group of similar operands.   Notice that although the 
  488. same  symbol may be used as an operand for both a Zilog  mnemonic 
  489. and a TDL mnemonic that they may refer to different things.  When 
  490. two  lists  are given in the following table,  one for the  Zilog 
  491. assembler and one for the  Z  assembler,  you may assume that the 
  492. items in each list parallel each other.
  493.  
  494.  
  495. Symbol    Standard (Zilog) Z-80        Bastardized (TDL) Z-80
  496.  
  497. r    Register A,B,C,D,E,H, or L    Register A,B,C,D,E,H, or L
  498. n    One byte value            One byte value
  499. ii    Index register IX, IY        Index register X or IX, Y or IY
  500. jj    rr or ii            rr or ii
  501. d    8-bit index displacement    8-bit index displacement
  502. zz    Register pair BC or DE        Register pair B or D
  503. nn    Two byte (address) value    Two byte (address) value
  504. rr    Register pair BC,DE,HL, or SP    Register pair B,D,H, or SP
  505. qq    Register pair BC,DE,HL, or AF    Register pair B,D,H, or PSW
  506. s    r, (HL), or (ii+d)        r, M, or d(ii)
  507. tt    Register BC,DE,SP, or IX    Register B,D,SP, or X
  508. uu    Register BC,DE,SP, or IY    Register B,D,SP, or Y
  509. b    Bit number 0-7            Bit number 0-7
  510. .PA
  511.  
  512.             Z-80 instructions arranged by group
  513.  
  514.  
  515. 8080?    Standard (Zilog) Z-80        Bastardized (TDL) Z-80
  516.  
  517.  
  518.                       8 Bit load group
  519.  
  520. *    LD    r,s            MOV    r,s
  521. *    LD    r,n            MVI    r,n
  522. *    LD    s,r            MOV    s,r
  523. *    LD    A,(nn)            LDA    nn
  524. *    LD    (nn),A            STA    nn
  525. *    LD    A,(zz)            LDAX    zz
  526. *    LD    (zz),A            STAX    zz
  527.     LD    A,I            LDAI
  528.     LD    A,R            LDAR
  529.     LD    I,A            STAI
  530.     LD    R,A            STAR
  531.  
  532.  
  533.  
  534.                      16 Bit load group
  535.  
  536. *    LD    jj,nn            LXI    jj,nn
  537.     LD    BC,(nn)            LBCD    nn
  538.     LD    DE,(nn)            LDED    nn
  539. *    LD    HL,(nn)            LHLD    nn
  540.     LD    IX,(nn)            LIXD    nn
  541.     LD    IY,(nn)            LIYD    nn
  542.     LD    SP,(nn)            LSPD    nn
  543.     LD    (nn),BC            SBCD    nn
  544.     LD    (nn),DE            SDED    nn
  545. *    LD    (nn),HL            SHLD    nn
  546.     LD    (nn),IX            SIXD    nn
  547.     LD    (nn),IY            SIYD    nn
  548.     LD    (nn),SP            SSPD    nn
  549. *    LD    SP,HL            SPHL
  550.     LD    SP,IX            SPIX
  551.     LD    SP,IY            SPIY
  552. *    PUSH    qq            PUSH    qq
  553.     PUSH    ii            PUSH    ii
  554. *    POP    qq            POP    qq
  555.     POP    ii            POP    ii
  556.  
  557.  
  558.  
  559.          Exchange, block transfer, and search group
  560.  
  561. *    EX    DE,HL            XCHG
  562.     EX    AF,AF'            EXAF
  563.     EXX                EXX
  564. *    EX    (SP),HL            XTHL
  565.     EX    (SP),IX            XTIX
  566.     EX    (SP),IY            XTIY
  567.     LDI                LDI
  568.     LDIR                LDIR
  569.     LDD                LDD
  570.     LDDR                LDDR
  571.     CPI                CCI
  572.     CPIR                CCIR
  573.     CPD                CCD
  574.     CPDR                CCDR
  575.  
  576.  
  577.  
  578.              8 bit arithmetic and logical group
  579.  
  580. *    ADD    A,s            ADD    s
  581. *    ADD    A,n            ADI    n
  582. *    ADC    A,s            ADC    s
  583. *    ADC    A,n            ACI    n
  584. *    SUB    A,s            SUB    s
  585. *    SUB    A,n            SUI    n
  586. *    SBC    A,s            SBB    s
  587. *    SBC    A,n            SBI    n
  588. *    AND    A,s            ANA    s
  589. *    AND    A,n            ANI    n
  590. *    OR    A,s            ORA    s
  591. *    OR    A,n            ORI    n
  592. *    XOR    A,s            XRA    s
  593. *    XOR    A,n            XRI    n
  594. *    CP    A,s            CMP    s
  595. *    CP    A,n            CPI    n
  596. *    INC    s            INR    s
  597. *    DEC    s            DCR    s
  598.  
  599.  
  600.  
  601.       General purpose arithmetic and CPU control group
  602.  
  603. *    DAA                DAA
  604. *    CPL                CMA
  605.     NEG                NEG
  606. *    CCF                CMC
  607. *    SCF                STC
  608. *    NOP                NOP
  609. *    HALT                HLT
  610. *    DI                DI
  611. *    EI                EI
  612.     IM    0            IM0
  613.     IM    1            IM1
  614.     IM    2            IM2
  615.  
  616.  
  617.  
  618.                   16 bit arithmetic group
  619.  
  620. *    ADD    HL,rr            DAD    rr
  621.     ADC    HL,rr            DADC    rr
  622.     SBC    HL,rr            DSBC    rr
  623.     ADD    IX,tt            DADX    tt
  624.     ADD    IY,uu            DADY    uu
  625. *    INC    jj            INX    jj
  626. *    DEC    jj            DCX    jj
  627.  
  628.  
  629.  
  630.                    Rotate and shift group
  631.  
  632. *    RLCA                RLC
  633. *    RLA                RAL
  634. *    RRCA                RRC
  635. *    RRA                RAR
  636.     RLC    s            RLCR    s
  637.     RL    s            RALR    s
  638.     RRC    s            RRCR    s
  639.     RR    s            RARR    s
  640.     SLA    s            SLAR    s
  641.     SRA    s            SRAR    s
  642.     SRL    s            SRLR    s
  643.     RLD                RLD
  644.     RRD                RRD
  645.  
  646.  
  647.  
  648.                Bit set, reset, and test group
  649.  
  650.     BIT    b,s            BIT    b,s
  651.     SET    b,s            BSET    b,s
  652.     RES    b,s            RES    b,s
  653.  
  654.  
  655.  
  656.                          Jump group
  657.  
  658. *    JP    nn            JMP    nn
  659. *    JP    Z,nn            JZ    nn
  660. *    JP    NZ,nn            JNZ    nn
  661. *    JP    C,nn            JC    nn
  662. *    JP    NC,nn            JNC    nn
  663. *    JP    PO,nn            JPO    nn
  664. *    JP    PE,nn            JPE    nn
  665. *    JP    P,nn            JP    nn
  666. *    JP    M,nn            JM    nn
  667. *    JP    PE,nn            JV    nn
  668. *    JP    PO,nn            JNV    nn
  669.     JR    nn            JMPR    nn
  670.     JR    Z,nn            JRZ    nn
  671.     JR    NZ,nn            JRNZ    nn
  672.     JR    C,nn            JRC    nn
  673.     JR    NC,nn            JRNC    nn
  674.     DJNZ    nn            DJNZ    nn
  675. *    JP    (HL)            PCHL
  676.     JP    (IX)            PCIX
  677.     JP    (IY)            PCIY
  678.  
  679.  
  680.  
  681.                    Call and return group
  682.  
  683. *    CALL    nn            CALL    nn
  684. *    CALL    Z,nn            CZ    nn
  685. *    CALL    NZ,nn            CNZ    nn
  686. *    CALL    C,nn            CC    nn
  687. *    CALL    NC,nn            CNC    nn
  688. *    CALL    PO,nn            CPO    nn
  689. *    CALL    PE,nn            CPE    nn
  690. *    CALL    P,nn            CP    nn
  691. *    CALL    M,nn            CM    nn
  692. *    CALL    PE,nn            CV    nn
  693. *    CALL    PO,nn            CNV    nn
  694. *    RET                RET
  695. *    RET    Z            RZ
  696. *    RET    NZ            RNZ
  697. *    RET    C            RC
  698. *    RET    NC            RNC
  699. *    RET    PO            RPO
  700. *    RET    PE            RPE
  701. *    RET    P            RP
  702. *    RET    M            RM
  703. *    RET    PE            RV
  704. *    RET    PO            RNV
  705.     RETI                RETI
  706.     RETN                RETN
  707. *    RST    n            RST    n/8
  708.  
  709.  
  710.  
  711.                    Input and output group
  712.  
  713. *    IN    A,(n)            IN    n
  714.     IN    r,(C)            INP    r
  715.     INI                INI
  716.     INIR                INIR
  717.     IND                IND
  718.     INDR                INDR
  719. *    OUT    (n),A            OUT    n
  720.     OUT    (C),r            OUTP    r
  721.     OUTI                OUTI
  722.     OUTD                OUTD
  723.     OTDR                OUTDR
  724.  
  725.  
  726.  
  727.     Z-80 instructions sorted by standard Zilog mnemonics
  728.  
  729.  
  730. 8080?    Standard (Zilog) Z-80        Bastardized (TDL) Z-80
  731.  
  732.  
  733. *    ADC    A,n            ACI    n
  734. *    ADC    A,s            ADC    s
  735.     ADC    HL,rr            DADC    rr
  736. *    ADD    A,n            ADI    n
  737. *    ADD    A,s            ADD    s
  738. *    ADD    HL,rr            DAD    rr
  739.     ADD    IX,tt            DADX    tt
  740.     ADD    IY,uu            DADY    uu
  741. *    AND    A,n            ANI    n
  742. *    AND    A,s            ANA    s
  743.     BIT    b,s            BIT    b,s
  744. *    CALL    C,nn            CC    nn
  745. *    CALL    M,nn            CM    nn
  746. *    CALL    NC,nn            CNC    nn
  747. *    CALL    nn            CALL    nn
  748. *    CALL    NZ,nn            CNZ    nn
  749. *    CALL    P,nn            CP    nn
  750. *    CALL    PE,nn            CPE    nn
  751. *    CALL    PE,nn            CV    nn
  752. *    CALL    PO,nn            CNV    nn
  753. *    CALL    PO,nn            CPO    nn
  754. *    CALL    Z,nn            CZ    nn
  755. *    CCF                CMC
  756. *    CP    A,n            CPI    n
  757. *    CP    A,s            CMP    s
  758.     CPD                CCD
  759.     CPDR                CCDR
  760.     CPI                CCI
  761.     CPIR                CCIR
  762. *    CPL                CMA
  763. *    DAA                DAA
  764. *    DEC    jj            DCX    jj
  765. *    DEC    s            DCR    s
  766. *    DI                DI
  767.     DJNZ    nn            DJNZ    nn
  768. *    EI                EI
  769. *    EX    (SP),HL            XTHL
  770.     EX    (SP),IX            XTIX
  771.     EX    (SP),IY            XTIY
  772.     EX    AF,AF'            EXAF
  773. *    EX    DE,HL            XCHG
  774.     EXX                EXX
  775. *    HALT                HLT
  776.     IM    0            IM0
  777.     IM    1            IM1
  778.     IM    2            IM2
  779. *    IN    A,(n)            IN    n
  780.     IN    r,(C)            INP    r
  781. *    INC    jj            INX    jj
  782. *    INC    s            INR    s
  783.     IND                IND
  784.     INDR                INDR
  785.     INI                INI
  786.     INIR                INIR
  787. *    JP    (HL)            PCHL
  788.     JP    (IX)            PCIX
  789.     JP    (IY)            PCIY
  790. *    JP    C,nn            JC    nn
  791. *    JP    M,nn            JM    nn
  792. *    JP    NC,nn            JNC    nn
  793. *    JP    nn            JMP    nn
  794. *    JP    NZ,nn            JNZ    nn
  795. *    JP    P,nn            JP    nn
  796. *    JP    PE,nn            JPE    nn
  797. *    JP    PE,nn            JV    nn
  798. *    JP    PO,nn            JNV    nn
  799. *    JP    PO,nn            JPO    nn
  800. *    JP    Z,nn            JZ    nn
  801.     JR    C,nn            JRC    nn
  802.     JR    NC,nn            JRNC    nn
  803.     JR    nn            JMPR    nn
  804.     JR    NZ,nn            JRNZ    nn
  805.     JR    Z,nn            JRZ    nn
  806. *    LD    (nn),A            STA    nn
  807.     LD    (nn),BC            SBCD    nn
  808.     LD    (nn),DE            SDED    nn
  809. *    LD    (nn),HL            SHLD    nn
  810.     LD    (nn),IX            SIXD    nn
  811.     LD    (nn),IY            SIYD    nn
  812.     LD    (nn),SP            SSPD    nn
  813. *    LD    (zz),A            STAX    zz
  814. *    LD    A,(nn)            LDA    nn
  815. *    LD    A,(zz)            LDAX    zz
  816.     LD    A,I            LDAI
  817.     LD    A,R            LDAR
  818.     LD    BC,(nn)            LBCD    nn
  819.     LD    DE,(nn)            LDED    nn
  820. *    LD    HL,(nn)            LHLD    nn
  821.     LD    I,A            STAI
  822.     LD    IX,(nn)            LIXD    nn
  823.     LD    IY,(nn)            LIYD    nn
  824. *    LD    jj,nn            LXI    jj,nn
  825.     LD    R,A            STAR
  826. *    LD    r,n            MVI    r,n
  827. *    LD    r,s            MOV    r,s
  828. *    LD    s,r            MOV    s,r
  829.     LD    SP,(nn)            LSPD    nn
  830. *    LD    SP,HL            SPHL
  831.     LD    SP,IX            SPIX
  832.     LD    SP,IY            SPIY
  833.     LDD                LDD
  834.     LDDR                LDDR
  835.     LDI                LDI
  836.     LDIR                LDIR
  837.     NEG                NEG
  838. *    NOP                NOP
  839. *    OR    A,n            ORI    n
  840. *    OR    A,s            ORA    s
  841.     OTDR                OUTDR
  842.     OTIR                OUTIR
  843.     OUT    (C),r            OUTP    r
  844. *    OUT    (n),A            OUT    n
  845.     OUTD                OUTD
  846.     OUTI                OUTI
  847.     POP    ii            POP    ii
  848. *    POP    qq            POP    qq
  849.     PUSH    ii            PUSH    ii
  850. *    PUSH    qq            PUSH    qq
  851.     RES    b,s            RES    b,s
  852. *    RET                RET
  853. *    RET    C            RC
  854. *    RET    M            RM
  855. *    RET    NC            RNC
  856. *    RET    NZ            RNZ
  857. *    RET    P            RP
  858. *    RET    PE            RPE
  859. *    RET    PE            RV
  860. *    RET    PO            RNV
  861. *    RET    PO            RPO
  862. *    RET    Z            RZ
  863.     RETI                RETI
  864.     RETN                RETN
  865.     RL    s            RALR    s
  866. *    RLA                RAL
  867.     RLC    s            RLCR    s
  868. *    RLCA                RLC
  869.     RLD                RLD
  870.     RR    s            RARR    s
  871. *    RRA                RAR
  872.     RRC    s            RRCR    s
  873. *    RRCA                RRC
  874.     RRD                RRD
  875. *    RST    n            RST    n/8
  876. *    SBC    A,n            SBI    n
  877. *    SBC    A,s            SBB    s
  878.     SBC    HL,rr            DSBC    rr
  879. *    SCF                STC
  880.     SET    b,s            BSET    b,s
  881.     SLA    s            SLAR    s
  882.     SRA    s            SRAR    s
  883.     SRL    s            SRLR    s
  884. *    SUB    A,n            SUI    n
  885. *    SUB    A,s            SUB    s
  886. *    XOR    A,n            XRI    n
  887. *    XOR    A,s            XRA    s
  888.  
  889.  
  890.  
  891.    Z-80 instructions sorted by bastardized TDL mnemonics
  892.  
  893.  
  894. 8080?    Standard (Zilog) Z-80        Bastardized (TDL) Z-80
  895.  
  896.  
  897. *    ADC    A,n            ACI    n
  898. *    ADC    A,s            ADC    s
  899. *    ADD    A,s            ADD    s
  900. *    ADD    A,n            ADI    n
  901. *    AND    A,s            ANA    s
  902. *    AND    A,n            ANI    n
  903.     BIT    b,s            BIT    b,s
  904.     SET    b,s            BSET    b,s
  905. *    CALL    nn            CALL    nn
  906. *    CALL    C,nn            CC    nn
  907.     CPD                CCD
  908.     CPDR                CCDR
  909.     CPI                CCI
  910.     CPIR                CCIR
  911. *    CALL    M,nn            CM    nn
  912. *    CPL                CMA
  913. *    CCF                CMC
  914. *    CP    A,s            CMP    s
  915. *    CALL    NC,nn            CNC    nn
  916. *    CALL    PO,nn            CNV    nn
  917. *    CALL    NZ,nn            CNZ    nn
  918. *    CALL    P,nn            CP    nn
  919. *    CALL    PE,nn            CPE    nn
  920. *    CP    A,n            CPI    n
  921. *    CALL    PO,nn            CPO    nn
  922. *    CALL    PE,nn            CV    nn
  923. *    CALL    Z,nn            CZ    nn
  924. *    DAA                DAA
  925. *    ADD    HL,rr            DAD    rr
  926.     ADC    HL,rr            DADC    rr
  927.     ADD    IX,tt            DADX    tt
  928.     ADD    IY,uu            DADY    uu
  929. *    DEC    s            DCR    s
  930. *    DEC    jj            DCX    jj
  931. *    DI                DI
  932.     DJNZ    nn            DJNZ    nn
  933.     SBC    HL,rr            DSBC    rr
  934. *    EI                EI
  935.     EX    AF,AF'            EXAF
  936.     EXX                EXX
  937. *    HALT                HLT
  938.     IM    0            IM0
  939.     IM    1            IM1
  940.     IM    2            IM2
  941. *    IN    A,(n)            IN    n
  942.     IND                IND
  943.     INDR                INDR
  944.     INI                INI
  945.     INIR                INIR
  946.     IN    r,(C)            INP    r
  947. *    INC    s            INR    s
  948. *    INC    jj            INX    jj
  949. *    JP    C,nn            JC    nn
  950. *    JP    M,nn            JM    nn
  951. *    JP    nn            JMP    nn
  952.     JR    nn            JMPR    nn
  953. *    JP    NC,nn            JNC    nn
  954. *    JP    PO,nn            JNV    nn
  955. *    JP    NZ,nn            JNZ    nn
  956. *    JP    P,nn            JP    nn
  957. *    JP    PE,nn            JPE    nn
  958. *    JP    PO,nn            JPO    nn
  959.     JR    C,nn            JRC    nn
  960.     JR    NC,nn            JRNC    nn
  961.     JR    NZ,nn            JRNZ    nn
  962.     JR    Z,nn            JRZ    nn
  963. *    JP    PE,nn            JV    nn
  964. *    JP    Z,nn            JZ    nn
  965.     LD    BC,(nn)            LBCD    nn
  966. *    LD    A,(nn)            LDA    nn
  967.     LD    A,I            LDAI
  968.     LD    A,R            LDAR
  969. *    LD    A,(zz)            LDAX    zz
  970.     LDD                LDD
  971.     LDDR                LDDR
  972.     LD    DE,(nn)            LDED    nn
  973.     LDI                LDI
  974.     LDIR                LDIR
  975. *    LD    HL,(nn)            LHLD    nn
  976.     LD    IX,(nn)            LIXD    nn
  977.     LD    IY,(nn)            LIYD    nn
  978.     LD    SP,(nn)            LSPD    nn
  979. *    LD    jj,nn            LXI    jj,nn
  980. *    LD    r,s            MOV    r,s
  981. *    LD    s,r            MOV    s,r
  982. *    LD    r,n            MVI    r,n
  983.     NEG                NEG
  984. *    NOP                NOP
  985. *    OR    A,s            ORA    s
  986. *    OR    A,n            ORI    n
  987. *    OUT    (n),A            OUT    n
  988.     OUTD                OUTD
  989.     OTDR                OUTDR
  990.     OUTI                OUTI
  991.     OTIR                OUTIR
  992.     OUT    (C),r            OUTP    r
  993. *    JP    (HL)            PCHL
  994.     JP    (IX)            PCIX
  995.     JP    (IY)            PCIY
  996.     POP    ii            POP    ii
  997. *    POP    qq            POP    qq
  998.     PUSH    ii            PUSH    ii
  999. *    PUSH    qq            PUSH    qq
  1000. *    RLA                RAL
  1001.     RL    s            RALR    s
  1002. *    RRA                RAR
  1003.     RR    s            RARR    s
  1004. *    RET    C            RC
  1005.     RES    b,s            RES    b,s
  1006. *    RET                RET
  1007.     RETI                RETI
  1008.     RETN                RETN
  1009. *    RLCA                RLC
  1010.     RLC    s            RLCR    s
  1011.     RLD                RLD
  1012. *    RET    M            RM
  1013. *    RET    NC            RNC
  1014. *    RET    PO            RNV
  1015. *    RET    NZ            RNZ
  1016. *    RET    P            RP
  1017. *    RET    PE            RPE
  1018. *    RET    PO            RPO
  1019. *    RRCA                RRC
  1020.     RRC    s            RRCR    s
  1021.     RRD                RRD
  1022. *    RST    n            RST    n/8
  1023. *    RET    PE            RV
  1024. *    RET    Z            RZ
  1025. *    SBC    A,s            SBB    s
  1026.     LD    (nn),BC            SBCD    nn
  1027. *    SBC    A,n            SBI    n
  1028.     LD    (nn),DE            SDED    nn
  1029. *    LD    (nn),HL            SHLD    nn
  1030.     LD    (nn),IX            SIXD    nn
  1031.     LD    (nn),IY            SIYD    nn
  1032.     SLA    s            SLAR    s
  1033. *    LD    SP,HL            SPHL
  1034.     LD    SP,IX            SPIX
  1035.     LD    SP,IY            SPIY
  1036.     SRA    s            SRAR    s
  1037.     SRL    s            SRLR    s
  1038.     LD    (nn),SP            SSPD    nn
  1039. *    LD    (nn),A            STA    nn
  1040.     LD    I,A            STAI
  1041.     LD    R,A            STAR
  1042. *    LD    (zz),A            STAX    zz
  1043. *    SCF                STC
  1044. *    SUB    A,s            SUB    s
  1045. *    SUB    A,n            SUI    n
  1046. *    EX    DE,HL            XCHG
  1047. *    XOR    A,s            XRA    s
  1048. *    XOR    A,n            XRI    n
  1049. *    EX    (SP),HL            XTHL
  1050.     EX    (SP),IX            XTIX
  1051.     EX    (SP),IY            XTIY
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.     (************************************************)
  1058.     (*                        *)
  1059.     (*        STRING LIBRARY            *)
  1060.     (*                        *)
  1061.     (************************************************)
  1062.  
  1063.  
  1064.  
  1065.  
  1066. (*    Version 3.0  31 May 1980/Raymond E. Penley *)
  1067.  
  1068.     (************************************************)
  1069.  
  1070.  
  1071.  
  1072. FUNCTION INDEX(SOURCE,Pattern) : INTEGER ; EXTERNAL;
  1073.     (*---this is a Pascal/Z extension---*)
  1074.  
  1075.     Returns the position of the first occurrence of the
  1076. Pattern in SOURCE to be scanned. The integer value of the
  1077. position of the first character in the matched pattern will
  1078. be returned. If no match occurred then zero will be returned.
  1079.  
  1080.   If for example the string THIS contained:
  1081.     'Today is the first day.'
  1082.     PATTERN := 'is';
  1083.     N := INDEX(THIS,pattern);
  1084.     writeln(N);
  1085.  
  1086.     would write:    7
  1087.  
  1088.     (****************************************)
  1089.     (*    UCSD PASCAL            *)
  1090.     (*                    *)
  1091.     (*     K := POS(Pattern,SOURCE);    *)
  1092.     (*                    *)
  1093.     (* NOTE that Pascal/Z is 180 degrees    *)
  1094.     (* out of wack!                *)
  1095.     (****************************************)
  1096.  
  1097.     (************************************************)
  1098.  
  1099.  
  1100.  
  1101. PROCEDURE PRINT(STRING);
  1102.  
  1103.   Prints to the console the string passed; does NOT issue a
  1104.   carriage-return/line-feed. 
  1105.  
  1106.     PRINT(This);          {no CR/LF    }
  1107.     PRINT(This);writeln;    {with CR/LF    }
  1108.     PRINT(A[5]);write('    ');PRINT(Newstr);writeln;
  1109.  
  1110.     (************************************************)
  1111.  
  1112.  
  1113.  
  1114. PROCEDURE COPY(New_string,Source,POS,COUNT);
  1115.  
  1116.     COPY(<NEW> := <SOURCE>,<starting at>,<# of chars>);
  1117.     COPY(Newstr,Title,1,9);
  1118.  
  1119.     Returns a string containing count <chars> starting at
  1120.     <POS> position in SOURCE.
  1121.  
  1122.     (*****************************************)
  1123.     (*    UCSD PASCAL             *)
  1124.     (*                     *)
  1125.     (* New_string := COPY(Source,POS,COUNT); *)
  1126.     (*                     *)
  1127.     (*****************************************)
  1128.  
  1129.     (************************************************)
  1130.  
  1131.  
  1132.  
  1133. PROCEDURE CONCAT(New_string,arg1_string,arg2_string);
  1134.  
  1135.     CONCAT(Newstr,ThisString, ThatString);
  1136.  
  1137.     This CONCAT works in the same fashion as CPM's PIP does.
  1138.   That is:
  1139.         CONCAT( New String := Arg1, Arg2 );
  1140.  
  1141.   There may be only two arguments. A string is returned which is
  1142.   the concatenation of both strings passed provided that the 
  1143.   combined length of all strings does not exceed the max length
  1144.   allowed for strings.
  1145.  
  1146.     (********************************************)
  1147.     (*    UCSD PASCAL                *)
  1148.     (*                        *)
  1149.     (* New_string := CONCAT(arg1,arg2,...argn); *)
  1150.     (*                        *)
  1151.     (********************************************)
  1152.  
  1153.     (************************************************)
  1154.  
  1155.  
  1156.  
  1157. PROCEDURE REPLACE(Source, Destination, INDEX);
  1158.  
  1159.     REPLACE(Main,Next,N);
  1160.     PRINT(Next);
  1161.  
  1162.     Replaces the characters in Destination with those
  1163.   from the substring Source starting at position INDEX.
  1164.  
  1165.  
  1166.     (*****************************************)
  1167.     (*    UCSD PASCAL             *)
  1168.     (*                     *)
  1169.     (* INSERT(SOURCE,DESTINATION,INDEX);     *)
  1170.     (*                     *)
  1171.     (*****************************************)
  1172.  
  1173.     (************************************************)
  1174.  
  1175.  
  1176.  
  1177. PROCEDURE GetLine(STRING,count);
  1178.  
  1179.     Returns a string and the strings length input
  1180.  from the console. The string must be a valid ASCII
  1181.  character. Returns a length of zero if an error is
  1182.  made.
  1183.  
  1184.   For example:
  1185.  
  1186.     GetLine(BUFFER,12);
  1187.  
  1188.     Gets characters from the console into the String 'BUFFER'
  1189.   but up to a max of 12 characters.
  1190.  
  1191.     (***********************************************)
  1192.  
  1193.