2474
|
1 .s="",ss=0,p="",n="",sn=80, * normal (pica) characters, 80 per 8 inch line
|
|
2 .lm=5, rm=75, tm=5, bm=60
|
|
3 .lh=5,rh=75,p=""
|
|
4 .he0="Assembler Library Documentation", he1="Page ##"
|
|
5 .he2="String Handlers"
|
|
6 .hf0=r,hf1=l,hf2=r
|
|
7 .hl0=2,hl1=2,hl2=3
|
|
8 .lf=c
|
|
9 .tf=_
|
|
10 =====================
|
|
11 == String Handlers ==
|
|
12 =====================
|
|
13 .lf=l
|
|
14
|
|
15
|
|
16 .nl=7
|
|
17 \t66\
|
|
18
|
|
19 STIMESTR: Get current system time as an ascii string.
|
|
20
|
|
21 OTHER MODULES NEEDED: DATESTR
|
|
22
|
|
23 ENTRY: X=buffer for ascii
|
|
24
|
|
25 EXIT: all registers preserved (except cc)
|
|
26
|
|
27
|
|
28 .nl=7
|
|
29 \t66\
|
|
30
|
|
31 DATESTR: Convert a date to a string. This can be used
|
|
32 for converting the system time as well as
|
|
33 modify/create dates from files. The date must
|
|
34 be 6 bytes -- null pad file dates.
|
|
35
|
|
36 OTHER MODULES NEEDED: BIN_ASC
|
|
37
|
|
38 ENTRY: X=binary date
|
|
39 Y=buffer for ascii
|
|
40
|
|
41 EXIT: all registers preserved (except cc)
|
|
42
|
|
43
|
|
44 .nl=7
|
|
45 \t66\
|
|
46
|
|
47 TO_NON_SP: Advance X to 1st non-space character
|
|
48
|
|
49 OTHER MODULES NEEDED: none
|
|
50
|
|
51 ENTRY: X=somewhere in a string
|
|
52
|
|
53 EXIT: X=1st non-space character in string
|
|
54 B=char at X
|
|
55
|
|
56
|
|
57 .nl=7
|
|
58 \t66\
|
|
59
|
|
60 PRINT_DEC: Print decimal number to standard out.
|
|
61
|
|
62 ENTRY: D=value to print
|
|
63
|
|
64 EXIT: CC carry set if error (from I$WritLn)
|
|
65 B error code, if any
|
|
66
|
|
67
|
|
68 .nl=7
|
|
69 \t66\
|
|
70
|
|
71 PRINT_HEX: Print hex number to standard out.
|
|
72
|
|
73 ENTRY: D=value to print
|
|
74
|
|
75 EXIT: CC carry set if error (from I$WritLn)
|
|
76 B error code, if any
|
|
77
|
|
78
|
|
79 .nl=7
|
|
80 \t66\
|
|
81
|
|
82 PRINT_ASC: Print binary number to standard out.
|
|
83
|
|
84 ENTRY: D=value to print
|
|
85
|
|
86 EXIT: CC carry set if error (from I$WritLn)
|
|
87 B error code, if any
|
|
88
|
|
89
|
|
90 .nl=7
|
|
91 \t66\
|
|
92
|
|
93 STRCMP: compare two null terminated strings.
|
|
94
|
|
95 NOTE: This routine first finds the length of both
|
|
96 strings and passes the length of the longer
|
|
97 one to strncmp.
|
|
98
|
|
99 OTHER MODULES NEEDED: STRNCMP, STRLEN
|
|
100
|
|
101 ENTRY: X=start of 1st string
|
|
102 Y=start of 2nd string
|
|
103
|
|
104 EXIT: CC zero set if equal (beq)
|
|
105 carry + zero clear if 1>2 (bhi)
|
|
106 carry set if 1<2 (blo)
|
|
107
|
|
108
|
|
109 .nl=7
|
|
110 \t66\
|
|
111
|
|
112 STRNCMP: compare 2 null terminated strings
|
|
113 maximum number of bytes to compare in D
|
|
114
|
|
115 OTHER MODULES NEEDED: COMPARE
|
|
116
|
|
117 ENTRY: X=start of 1st string
|
|
118 Y=start of 2nd string
|
|
119 D=number of bytes to compare
|
|
120 CASEMTCH:(a global variable in COMPARE)
|
|
121 0=match for case
|
|
122 -1=ignore case differences
|
|
123
|
|
124 EXIT: CC zero set if equal (beq)
|
|
125 carry + zero clear if 1>2 (bhi)
|
|
126 carry set if 1<2 (blo)
|
|
127
|
|
128
|
|
129 .nl=7
|
|
130 \t66\
|
|
131
|
|
132 STRLEN: String Length: find length of null terminated string.
|
|
133 note:null NOT included in count.
|
|
134
|
|
135 ENTRY: X=start of string
|
|
136
|
|
137 EXIT: D=length
|
|
138 all other regs (except cc) preserved
|
|
139
|
|
140
|
|
141 .nl=7
|
|
142 \t66\
|
|
143
|
|
144 STRHLEN: find length of sign-bit terminated string.
|
|
145 note: sign-bit set byte IS included in count.
|
|
146
|
|
147 OTHER MODULES NEEDED: none
|
|
148
|
|
149 ENTRY: X=start of string
|
|
150
|
|
151 EXIT: D=length
|
|
152 all other regs (except cc) preserved
|
|
153
|
|
154
|
|
155 .nl=7
|
|
156 \t66\
|
|
157
|
|
158 B09STRLEN: Find the length of a BASIC09 string.
|
|
159
|
|
160 OTHER MODULES NEEDED: none
|
|
161
|
|
162 ENTRY: X=start of string
|
|
163 D=max possible length (size passed to subroutine)
|
|
164
|
|
165 EXIT: D=actual length (either at $FF or max size)
|
|
166 all other regs (except cc) preserved
|
|
167
|
|
168 .nl=7
|
|
169 \t66\
|
|
170
|
|
171 STRCAT: append 2 null terminated strings
|
|
172 User must ensure there is room in buffer!!!
|
|
173
|
|
174 OTHER MODULES NEEDED: STRCPY, STRLEN
|
|
175
|
|
176 ENTRY: X=start of string to move
|
|
177 Y=start of string to append to
|
|
178
|
|
179 EXIT: all regs preserved (except cc)
|
|
180
|
|
181
|
|
182 .nl=7
|
|
183 \t66\
|
|
184
|
|
185 STRNCPY: copy N bytes of a null terminated string
|
|
186 User must ensure there is room in buffer!!!
|
|
187 If N>string length only N bytes will be moved
|
|
188
|
|
189 OTHER MODULES NEEDED: STRLEN, MEMMOVE
|
|
190
|
|
191 ENTRY: X=start of string to move
|
|
192 Y=buffer for copy of string
|
|
193
|
|
194 EXIT: D = actual number of bytes moved
|
|
195 all other regs preserved (except cc)
|
|
196
|
|
197
|
|
198 .nl=7
|
|
199 \t66\
|
|
200
|
|
201 STRCPY: copy a null terminated string
|
|
202 User must ensure there is room in buffer!!!
|
|
203
|
|
204 OTHER MODULES NEEDED: STRNCPY
|
|
205
|
|
206 ENTRY: X=start of string to move
|
|
207 Y=buffer for copy of string
|
|
208
|
|
209 EXIT: all regs preserved (except cc)
|
|
210
|
|
211 .nl=7
|
|
212 \t66\
|
|
213
|
|
214 STRNCPY: copy N bytes of a null terminated string
|
|
215 User must ensure there is room in buffer!!!
|
|
216 If N>string length only N bytes will be moved
|
|
217
|
|
218 OTHER MODULES NEEDED: STRLEN, MEMMOVE
|
|
219
|
|
220 ENTRY: X=start of string to move
|
|
221 Y=buffer for copy of string
|
|
222
|
|
223 EXIT: D = actual number of bytes moved
|
|
224 all other regs preserved (except cc)
|
|
225
|
|
226
|
|
227 .nl=7
|
|
228 \t66\
|
|
229
|
|
230 STRHCPY: copy sign-bit terminated string
|
|
231 User must ensure there is room in buffer!!!
|
|
232 See also PARSNSTR, this routine does not change
|
|
233 sign-bit termination.
|
|
234
|
|
235 OTHER MODULES NEEDED: strhlen,memmove
|
|
236
|
|
237 ENTRY: X=start of string to move
|
|
238 Y=buffer for copy of string
|
|
239
|
|
240
|
|
241 .nl=7
|
|
242 \t66\
|
|
243
|
|
244 TO_UPPRS: convert a null terminated string to all uppercase
|
|
245
|
|
246 OTHER MODULES NEEDED: TO_UPPER
|
|
247
|
|
248 ENTRY: X=start of string
|
|
249
|
|
250 EXIT: all registers (except CC) preserved
|
|
251
|
|
252
|
|
253 .nl=7
|
|
254 \t66\
|
|
255
|
|
256 TO_UPPER: Convert character in "B" to uppercase
|
|
257
|
|
258 OTHER MODULES NEEDED: IS_LOWER
|
|
259
|
|
260 ENTRY: B=ascii value of character to convert
|
|
261
|
|
262 EXIT: B=ascii value of character in uppercase
|
|
263
|
|
264 Note: control codes, etc. are not effected.
|
|
265
|
|
266
|
|
267 .nl=7
|
|
268 \t66\
|
|
269
|
|
270 TO_LOWRS: convert a null terminated string to all lowercase
|
|
271
|
|
272 OTHER MODULES NEEDED: TO_LOWER
|
|
273
|
|
274 ENTRY: X=start of string
|
|
275
|
|
276 EXIT: all registers (except CC) preserved
|
|
277
|
|
278
|
|
279 .nl=7
|
|
280 \t66\
|
|
281
|
|
282 TO_LOWER: Convert character in "B" to lowercase
|
|
283
|
|
284 OTHER MODULES NEEDED: IS_UPPER
|
|
285
|
|
286 ENTRY: B=ascii value of character to convert
|
|
287
|
|
288 EXIT: B=ascii value of character in lowercase
|
|
289
|
|
290 Note: control codes, etc. are not effected.
|
|
291
|
|
292
|
|
293 .nl=7
|
|
294 \t66\
|
|
295
|
|
296 PARSNSTR: Parse sign bit terminated string to convert it to a
|
|
297 null terminated string. Note: if X and Y are the same
|
|
298 the existing string will be overwritten -- don't do this
|
|
299 with psects...
|
|
300
|
|
301 OTHER MODULES NEEDED: none
|
|
302
|
|
303 ENTRY: X=start of sign bit terminated string
|
|
304 Y=buffer for null terminated string
|
|
305
|
|
306 EXIT: D=string size (not including null)
|
|
307 All other regs (except cc) preserved
|
|
308
|
|
309
|
|
310 .lf=c, he2="I/O Routines",pg
|
|
311 ==================
|
|
312 == I/O Routines ==
|
|
313 ==================
|
|
314 .lf=l
|
|
315
|
|
316 .nl=7
|
|
317 \t66\
|
|
318
|
|
319 PRINTS: Print a program embedded, null terminated string to std out.
|
|
320
|
|
321 OTHER MODULES NEEDED: puts
|
|
322
|
|
323 ENTRY: Null terminated string must follow PRINTS call
|
|
324 eg: LBSR PRINTS
|
|
325 fcc /this is a string to print/
|
|
326 fcb $0d
|
|
327 fcc /a second string/
|
|
328 fcb $0d,0
|
|
329 lbsr morestuff...
|
|
330
|
|
331 EXIT: CC carry set if error
|
|
332 B error code (if any)
|
|
333
|
|
334 .nl=7
|
|
335 \t66\
|
|
336
|
|
337 PUTS: Print a null terminated string to standard out.
|
|
338
|
|
339 OTHER MODULES NEEDED: fputs
|
|
340
|
|
341 ENTRY: X=string to print
|
|
342
|
|
343 EXIT: CC carry set if error
|
|
344 B error code (if any)
|
|
345
|
|
346
|
|
347 .nl=7
|
|
348 \t66\
|
|
349
|
|
350 FPUTS: print null terminated string to "A".
|
|
351
|
|
352 OTHER MODULES REQUIRED: none
|
|
353
|
|
354 ENTRY: X=start of string
|
|
355 A=path
|
|
356
|
|
357 EXIT: CC carry set if error
|
|
358 B = OS9 error if any (from I$WritLn)
|
|
359
|
|
360 NOTE: string is feed through I$WritLn for editing (adding LF, etc.)
|
|
361
|
|
362
|
|
363 .nl=7
|
|
364 \t66\
|
|
365
|
|
366 PUTCR: Subroutine to print a carriage return to std. out.
|
|
367
|
|
368 OTHER MODULES REQUIRED: FPUTCR
|
|
369
|
|
370 ENTRY: none
|
|
371
|
|
372 EXIT: CC carry set if error (from I$WritLn)
|
|
373 B error code if any.
|
|
374
|
|
375
|
|
376 .nl=7
|
|
377 \t66\
|
|
378
|
|
379 FPUTCR: Subroutine to print a carriage return
|
|
380
|
|
381 OTHER MODULES REQUIRED: FPUTC
|
|
382
|
|
383 ENTRY: A=path
|
|
384
|
|
385 EXIT: CC carry set if error (from I$WritLn)
|
|
386 B error code if any.
|
|
387
|
|
388
|
|
389 .nl=7
|
|
390 \t66\
|
|
391
|
|
392 PUTSPACE: Subroutine to print a space to std. out
|
|
393
|
|
394 OTHER MODULES REQUIRED: FPUTSPACE
|
|
395
|
|
396 ENTRY: none
|
|
397
|
|
398 EXIT: CC carry set if error (from I$WritLn)
|
|
399 B error code if any.
|
|
400
|
|
401
|
|
402 .nl=7
|
|
403 \t66\
|
|
404
|
|
405 FPUTSPACE: Subroutine to print a space
|
|
406
|
|
407 OTHER MODULES REQUIRED: FPUTC
|
|
408
|
|
409 ENTRY: A=path
|
|
410
|
|
411 EXIT: CC carry set if error (from I$WritLn)
|
|
412 B error code if any.
|
|
413
|
|
414
|
|
415 .nl=7
|
|
416 \t66\
|
|
417
|
|
418 PUTC: Put single character to standard out.
|
|
419
|
|
420 OTHER MODULES NEEDED: FPUTC
|
|
421
|
|
422 ENTRY: B=character to print
|
|
423
|
|
424 EXIT: CC carry set if error
|
|
425 B=error code if any
|
|
426
|
|
427
|
|
428 .nl=7
|
|
429 \t66\
|
|
430
|
|
431 FPUTC: Subroutine to print one character.
|
|
432
|
|
433 OTHER MODULES NEEDED: none
|
|
434
|
|
435 ENTRY: A=path
|
|
436 B=char to print
|
|
437
|
|
438 EXIT: CC carry set if error (from I$WritLn)
|
|
439 B error code if any
|
|
440
|
|
441
|
|
442 .nl=7
|
|
443 \t66\
|
|
444
|
|
445 GETC: Subroutine to input one character from std in.
|
|
446
|
|
447 OTHER MODULES NEEDED: FGETC
|
|
448
|
|
449 ENTRY: none
|
|
450
|
|
451 EXIT: A character
|
|
452 CC carry set if error (from I$Read)
|
|
453 B error code if any
|
|
454
|
|
455
|
|
456 .nl=7
|
|
457 \t66\
|
|
458
|
|
459 FGETC: Subroutine to input one character.
|
|
460
|
|
461 OTHER MODULES NEEDED: none
|
|
462
|
|
463 ENTRY: A=path
|
|
464
|
|
465 EXIT: A character
|
|
466 CC carry set if error (from I$Read)
|
|
467 B error code if any
|
|
468
|
|
469
|
|
470 .nl=7
|
|
471 \t66\
|
|
472
|
|
473 GETS: Subroutine to input a null terminated string from Std. In
|
|
474
|
|
475 OTHER MODULES NEEDED: FGETS
|
|
476
|
|
477 ENTRY: X=buffer for string
|
|
478 Y=max buffer size (leave room for null!!)
|
|
479
|
|
480 EXIT: CC carry set if error (from I$ReadLn)
|
|
481 B error code if any
|
|
482
|
|
483 NOTE: The string entered must end with an end-of-record char
|
|
484 (usually a $0D), the null is appended for ease in string
|
|
485 handling.
|
|
486
|
|
487
|
|
488 .nl=7
|
|
489 \t66\
|
|
490
|
|
491 FGETS: Subroutine to input a null terminated string.
|
|
492
|
|
493 OTHER MODULES NEEDED: none
|
|
494
|
|
495 ENTRY: A=path
|
|
496 X=buffer for string
|
|
497 Y=max buffer size (leave room for null!!)
|
|
498
|
|
499 EXIT: CC carry set if error (from I$ReadLn)
|
|
500 B error code if any
|
|
501
|
|
502
|
|
503 NOTE: The string entered must end with an end-of-record char
|
|
504 (usually a $0D), the null is appended for ease in string
|
|
505 handling.
|
|
506
|
|
507 .nl=7
|
|
508 \t66\
|
|
509
|
|
510 INKEY: Checks STDIN for a keypress and returns it if avail.
|
|
511
|
|
512 ENTRY: none
|
|
513
|
|
514 EXIT: A=character, 0=no character
|
|
515 B=error code (if any)
|
|
516 CC=carry set if error (from I$Read)
|
|
517
|
|
518 NOTE: NULLs entered from the keyboard are returned as "no keypress".
|
|
519
|
|
520
|
|
521 .he2="Integer Math",pg,lf=c
|
|
522 ==================
|
|
523 == Integer Math ==
|
|
524 ==================
|
|
525 .lf=l
|
|
526
|
|
527
|
|
528 .nl=7
|
|
529 \t66\
|
|
530
|
|
531 MULT168: 16 x 8 Multiply (24 bit result)
|
|
532
|
|
533 OTHER MODULES NEEDED: none
|
|
534
|
|
535 ENTRY: A = multiplier
|
|
536 X = multiplicand
|
|
537
|
|
538 EXIT: A = product byte 1
|
|
539 X = product bytes 2 & 3
|
|
540 B modified
|
|
541
|
|
542
|
|
543 .nl=7
|
|
544 \t66\
|
|
545
|
|
546 MULT16: 16 x 16 Multiply
|
|
547
|
|
548 ENTRY: D = multiplier
|
|
549 X = multiplicand
|
|
550
|
|
551 EXIT: Y = product 2 msbs
|
|
552 U = " 2 lsbs
|
|
553 D & X preserved
|
|
554
|
|
555
|
|
556 .nl=7
|
|
557 \t66\
|
|
558
|
|
559 DIV168: 16 x 8 bit integer divide
|
|
560
|
|
561 Result must be an 8 bit value
|
|
562
|
|
563 ENTRY: A = divisor
|
|
564 X = dividend
|
|
565
|
|
566 EXIT: A = remainder
|
|
567 B = quotient
|
|
568 all other registers (except CC) preserved
|
|
569
|
|
570
|
|
571 .nl=7
|
|
572 \t66\
|
|
573
|
|
574 DIV16: 16 x 16 bit integer divide
|
|
575
|
|
576 OTHER MODULES NEEDED: none
|
|
577
|
|
578 ENTRY: D = divisor
|
|
579 X = dividend
|
|
580
|
|
581 EXIT: X = quotient
|
|
582 D = remainder
|
|
583
|
|
584
|
|
585 .nl=7
|
|
586 \t66\
|
|
587
|
|
588 DIV88: 8 x 8 Divide
|
|
589
|
|
590 OTHER MODULES NEEDED: none
|
|
591
|
|
592 ENTRY: A = divisor
|
|
593 B = dividend
|
|
594
|
|
595 EXIT: A = remainder
|
|
596 B = quotient
|
|
597
|
|
598
|
|
599 .he2="Number Conversions",pg,lf=c
|
|
600 ========================
|
|
601 == Number Conversions ==
|
|
602 ========================
|
|
603 .lf=l
|
|
604
|
|
605
|
|
606 .nl=7
|
|
607 \t66\
|
|
608
|
|
609 DEC_BIN: DECIMAL to BINARY conversion routine
|
|
610
|
|
611 OTHER MODULES NEEDED: DECTAB$, IS_TERMIN
|
|
612
|
|
613 ENTRY: X = start of asci decimal string terminated by
|
|
614 a space, comma, CR or null.
|
|
615
|
|
616 EXIT: D = binary value
|
|
617 CC carry set if error (too large, not numeric)
|
|
618 Y = terminator or error char.
|
|
619
|
|
620
|
|
621 .nl=7
|
|
622 \t66\
|
|
623
|
|
624 BIN_DEC: Binary to decimal conversion
|
|
625
|
|
626 OTHER MODULES NEEDED: DECTAB$
|
|
627
|
|
628 ENTRY: X=buffer for ascii string
|
|
629 D=binary value to convert
|
|
630
|
|
631 EXIT: all registers (except cc) preserved
|
|
632
|
|
633
|
|
634 .nl=7
|
|
635 \t66\
|
|
636
|
|
637 ASC_BIN: ASCII String to binary byte conversion
|
|
638
|
|
639 OTHER MODULES NEEDED: IS_TERMIN
|
|
640
|
|
641 ENTRY: X = start of string of binary digits (001101)
|
|
642 terminated by space, comma, CR or null.
|
|
643
|
|
644 EXIT: D = value
|
|
645 CC carry set if error (string too long, not binary digits)
|
|
646 Y = terminator or error pos.
|
|
647
|
|
648
|
|
649 .nl=7
|
|
650 \t66\
|
|
651
|
|
652 BIN_ASC: Binary word to ASCII string conversion
|
|
653
|
|
654 OTHER MODULES NEEDED: none
|
|
655
|
|
656 ENTRY: D = binary value
|
|
657 X = buffer for 16 bit number
|
|
658
|
|
659 EXIT: all registers (except cc) preserved
|
|
660
|
|
661
|
|
662 .nl=7
|
|
663 \t66\
|
|
664
|
|
665 HEX_BIN: Hexadecimal string to BINARY conversion
|
|
666
|
|
667 OTHER MODULES REQUIRED: TO_UPPER, IS_TERMIN, IS_XDIGIT
|
|
668
|
|
669 ENTRY: X=start of a hex string terminated by a space,
|
|
670 comma, CR, or NULL.
|
|
671
|
|
672 EXIT: D=binary number
|
|
673 CC carry set iferror (too large, non-numeric)
|
|
674 Y=terminator position or error char.
|
|
675
|
|
676
|
|
677 .nl=7
|
|
678 \t66\
|
|
679
|
|
680 BIN_HEX: Binary to hexadecimal convertor
|
|
681
|
|
682 This subroutine will convert the binary value in
|
|
683 'D' to a 4 digit hexadecimal ascii string.
|
|
684
|
|
685 OTHER MODULES NEEDED: BIN2HEX
|
|
686
|
|
687 ENTRY: D=value to convert
|
|
688 X=buffer for hex string-null terminated
|
|
689
|
|
690 EXIT all registers (except CC) preserved.
|
|
691
|
|
692
|
|
693 .nl=7
|
|
694 \t66\
|
|
695
|
|
696 HEX2BIN: Convert hex byte to 2 hex digits
|
|
697
|
|
698 OTHER MODULES REQUIRED: none
|
|
699
|
|
700 ENTRY: B= value to convert
|
|
701
|
|
702 EXIT: D=2 byte hex digits
|
|
703
|
|
704
|
|
705 .nl=7
|
|
706 \t66\
|
|
707
|
|
708 DECTAB: table of decimal numbers for use by binary/decimal conversion
|
|
709 routines.
|
|
710
|
|
711
|
|
712 .he2="What's IT??",pg,lf=c
|
|
713 =================
|
|
714 == What's IT?? ==
|
|
715 =================
|
|
716 .lf=l
|
|
717
|
|
718
|
|
719 .nl=7
|
|
720 \t66\
|
|
721
|
|
722 IS_PUNCT: See if character in "B" is a punctuation character
|
|
723
|
|
724 OTHER MODULES NEEDED: IS_ALNUM, IS_CNTRL
|
|
725
|
|
726 ENTRY: B=character to test
|
|
727
|
|
728 EXIT: CC zero=1 if punct., 0 if not
|
|
729
|
|
730
|
|
731 .nl=7
|
|
732 \t66\
|
|
733
|
|
734 IS_PRINT: See if character in "B" is a printable character
|
|
735 controls are defined as $00..$1F and $7F+ -- all others are printable
|
|
736
|
|
737 OTHER MODULES NEEDED: IS_CNTRL
|
|
738
|
|
739 ENTRY: B=character to test
|
|
740
|
|
741 EXIT: CC zero=1 if printable, 0 if not
|
|
742
|
|
743
|
|
744 .nl=7
|
|
745 \t66\
|
|
746
|
|
747 IS_CNTRL: See if character in "B" is a control character
|
|
748 controls are defined as $00..$1F and $7F+
|
|
749
|
|
750 OTHER MODULES NEEDED: none
|
|
751
|
|
752 ENTRY: B=character to test
|
|
753
|
|
754 EXIT: CC zero=1 if control, 0 if not
|
|
755
|
|
756
|
|
757 .nl=7
|
|
758 \t66\
|
|
759
|
|
760 IS_SPACE: See if character in "B" is a space ($20)
|
|
761
|
|
762 NOTE: This module is included for completeness only,
|
|
763 it is much more efficient to do an inline test.
|
|
764
|
|
765 OTHER MODULES NEEDED: none
|
|
766
|
|
767 ENTRY: B=character to test
|
|
768
|
|
769 EXIT: CC zero=1 if space, 0 if not
|
|
770
|
|
771
|
|
772 .nl=7
|
|
773 \t66\
|
|
774
|
|
775 IS_XDIGIT: See if character in "B" is a hexdigit 0..9, A..F or a..f
|
|
776
|
|
777 OTHER MODULES NEEDED: IS_DIGIT
|
|
778
|
|
779 ENTRY: B=character to test
|
|
780
|
|
781 EXIT: CC zero=1 if hex digit, 0 if not
|
|
782
|
|
783
|
|
784 .nl=7
|
|
785 \t66\
|
|
786
|
|
787 IS_ALNUM: See if character in "B" is a
|
|
788 alpha letter a..z or A..Z or digit 0..9
|
|
789
|
|
790 OTHER MODULES NEEDED: IS_ALPHA, IS_DIGIT
|
|
791
|
|
792 ENTRY: B=character to test
|
|
793
|
|
794 EXIT: CC zero=1 if alphanumeric, 0 if not
|
|
795
|
|
796
|
|
797 .nl=7
|
|
798 \t66\
|
|
799
|
|
800 IS_ALPHA: See if character in "B" is a alpha letter a..z or A..Z
|
|
801
|
|
802 OTHER MODULES NEEDED: IS_LOWER, IS_UPPER
|
|
803
|
|
804 ENTRY: B=character to test
|
|
805
|
|
806 EXIT: CC zero=1 if alpha, 0 if not
|
|
807
|
|
808
|
|
809 .nl=7
|
|
810 \t66\
|
|
811
|
|
812 IS_DIGIT: See if character in "B" is a digit 0..9
|
|
813
|
|
814 OTHER MODULES NEEDED: none
|
|
815
|
|
816 ENTRY: B=character to test
|
|
817
|
|
818 EXIT: CC zero=1 if digit, 0 if not
|
|
819
|
|
820
|
|
821 .nl=7
|
|
822 \t66\
|
|
823
|
|
824 IS_LOWER: See if character in "B" is a lowercase letter
|
|
825
|
|
826 OTHER MODULES NEEDED: none
|
|
827
|
|
828 ENTRY: B=character to test
|
|
829
|
|
830 EXIT: CC zero=1 if lowercase, 0 if not
|
|
831
|
|
832
|
|
833 .nl=7
|
|
834 \t66\
|
|
835
|
|
836 IS_UPPER: See if character in "B" is a uppercase letter
|
|
837
|
|
838 OTHER MODULES NEEDED: none
|
|
839
|
|
840 ENTRY: B=character to test
|
|
841
|
|
842 EXIT: CC zero=1 if uppercase, 0 if not
|
|
843
|
|
844
|
|
845 .nl=7
|
|
846 \t66\
|
|
847
|
|
848 IS_TERMIN: See if character in "B" is a valid string terminator.
|
|
849
|
|
850 NOTE: This module is used by HEX_BIN, DEC_BIN, etc. It permits
|
|
851 SPACE, CR, COMMA and NULL to be used as a delimiter -- useful
|
|
852 for paramater and list processing....
|
|
853
|
|
854 OTHER MODULES NEEDED: none
|
|
855
|
|
856 ENTRY: B=character to test
|
|
857
|
|
858 EXIT: CC zero=1 if space, 0 if not
|
|
859
|
|
860
|
|
861 .he2="OS9 File Specific",lf=c
|
|
862 =======================
|
|
863 == OS9 File Specific ==
|
|
864 =======================
|
|
865 .lf=l
|
|
866
|
|
867
|
|
868 .nl=7
|
|
869 \t66\
|
|
870
|
|
871 GETFMD: Get the "last modified" date of an open file
|
|
872
|
|
873 NOTE: Even though OS9 does not save seconds in its
|
|
874 files this routine stores a zero in this position.
|
|
875 This is done to make the routine compatible with
|
|
876 DATESTR.
|
|
877
|
|
878 OTHER MODULES NEEDED: none
|
|
879
|
|
880 ENTRY: X=buffer for 6 byte date
|
|
881 A=path of open file
|
|
882
|
|
883 EXIT: CC carry set if error
|
|
884 B error code (if any) from SS.FD
|
|
885
|
|
886
|
|
887 .nl=7
|
|
888 \t66\
|
|
889
|
|
890 MKTEMP: This subroutine creates a temorary filename
|
|
891 by adding a "." and a 2digit hex value based
|
|
892 on the process id.
|
|
893 IMPORTANT: there must be room after the filename
|
|
894 for at least 6 bytes!! Filename must be variable
|
|
895 area, not parameter or program sections!!!
|
|
896
|
|
897 OTHER MODULES NEEDED: BIN_HEX
|
|
898
|
|
899 ENTRY: X= filename
|
|
900
|
|
901 EXIT: no registers (expect cc) modified
|
|
902 filename ends in ".processid",$0d
|
|
903
|
|
904
|
|
905 .he2="Miscellaneous Routines",pg,lf=c
|
|
906 ============================
|
|
907 == Miscellaneous Routines ==
|
|
908 ============================
|
|
909 .lf=l
|
|
910
|
|
911
|
|
912 .nl=7
|
|
913 \t66\
|
|
914
|
|
915 LINEDIT: Edit/input line.
|
|
916
|
|
917 This routine does not use cursor positioning,
|
|
918 instead it uses backspacing, etc. This means it
|
|
919 can be used without a GOTOXY module, however it
|
|
920 is a bit slow, especially when lines get longer than
|
|
921 one line. If the buffer contains data, you will be
|
|
922 able to edit; to enter new data pass a buffer of
|
|
923 blanks.
|
|
924
|
|
925 OTHER MODULES NEEDED: STRLEN,IS_PRINT, FPUTS, FPUTC, FGETC, MEMMOVE
|
|
926
|
|
927 ENTRY: X=null terminated string to edit
|
|
928 A=input path (normally 0)
|
|
929 B=output path (normally 1)
|
|
930
|
|
931 EXIT: CC carry set if error (GetStt, Setstt, Write, Read, etc.)
|
|
932 B=error code, if any
|
|
933
|
|
934
|
|
935 .nl=7
|
|
936 \t66\
|
|
937
|
|
938 SHO_REGS: Display the 6809 registers to standard error.
|
|
939
|
|
940 OTHER MODULES NEEDED: BIN2HEX, BIN_HEX, PUTS
|
|
941
|
|
942 ENTRY: none
|
|
943
|
|
944 EXIT: none
|
|
945
|
|
946
|
|
947 NOTE: The value used for PC is that of the calling routine
|
|
948 S is assumed to be 2 greater than actual to comp for
|
|
949 the subroutine call...
|
|
950
|
|
951
|
|
952 .nl=7
|
|
953 \t66\
|
|
954
|
|
955 MEMMOVE: Memory move
|
|
956
|
|
957 NOTE: This routine properly moves overlapping areas of memory.
|
|
958 Uses fast move algorithm
|
|
959
|
|
960 ENTRY: X=source data
|
|
961 Y=destination
|
|
962 D=count
|
|
963
|
|
964 EXIT: all registers (except CC) preserved
|
|
965
|
|
966
|
|
967 .nl=7
|
|
968 \t66\
|
|
969
|
|
970 PTSEARCH: Pattern Search
|
|
971
|
|
972 OTHER MODULES REQUIRED: COMPARE
|
|
973
|
|
974 ENTRY: X=start of memory to search
|
|
975 U=end of memory
|
|
976 Y=start of pattern
|
|
977 D=size of pattern
|
|
978 CASEMTCH (a global variable in COMPARE) =0 if A<>a, -1 if A=a
|
|
979
|
|
980 EXIT: X=address of match if found, unchanged if no match
|
|
981 CC zero set if match, clear for no-match
|
|
982 A,B,U,Y preserved
|
|
983
|
|
984
|
|
985 .nl=7
|
|
986 \t66\
|
|
987
|
|
988 MEMSET: Set bytes in memory to specified value
|
|
989
|
|
990 OTHER MODULES NEEDED: none
|
|
991
|
|
992 ENTRY: X=start of memory
|
|
993 Y=number of bytes to set
|
|
994 B=character to set
|
|
995
|
|
996 EXIT: all registers (except cc) preserved
|
|
997
|
|
998
|
|
999 .nl=7
|
|
1000 \t66\
|
|
1001
|
|
1002 COMPARE: Subroutine for string comparsion routines.
|
|
1003 Compares chars in A/B, will convert both to
|
|
1004 uppercase first if CASEMTCH is set (negative)
|
|
1005
|
|
1006 OTHER MODULES NEEDED: TO_UPPER
|
|
1007
|
|
1008 ENTRY: A/B=characters to compare
|
|
1009 CASEMTCH=0 (or positive value) if A<>a
|
|
1010 -1 (or neg value) if A=a
|
|
1011
|
|
1012 EXIT: CC zero set if characters match.
|
|
1013 All other registers preserved.
|