[Copyright 1999,2002 Frank Durda IV, All Rights Reserved. Mirroring of any material on this page in any form is expressly prohibited. The official web site for this material is: http://nemesis.lonestar.org Contact this address for use clearances: clearance at nemesis.lonestar.org Comments and queries to this address: web_software_2011 at nemesis.lonestar.org]
MISOSYS EDAS-4.3 04/19/99 00:03:40 BUILD - LS-DOS 6.2 Page 00001
00001 ;LBBUILD/ASM - BUILD Command
00003 ;
00004 ;
0050 00005 CPL EQU 80 ;Characters per line
00006 ;
0000 00007 *GET BUILDVER/ASM:3
00008 ;
00009 ; Buildver/asm is a bit of a kludge since not all utilities can load
00010 ; equates from LDOS60 and still compile. LOWCORE and everybody else
00011 ; relies on this setting, and it eventually ends up in LDOS60/EQU
00012 ; for programs that can use that.
00013 ;
FFFF 00014 @BLD631 EQU -1 ;<631>Build 631 distribution (LEVEL 1B)
00015 ; These switches activate patches made since the 1B release.
00016 ; It is important that all earlier patches be enabled when a higher
00017 ; patch is enabled.
00018 ; Patches C thru F were published in TMQ IV.iv, page 32 (NOTE: the
00019 ; patch addresses listed for SPOOL in SPOOL1/FIX are 19H high.)
FFFF 00020 @BLD631C EQU -1 ;<631>Apply 1C patches (SETKI)
FFFF 00021 @BLD631D EQU -1 ;<631>Apply 1D patches (DIR)
FFFF 00022 @BLD631E EQU -1 ;<631>Apply 1E patches (DIR & MEMDISK/DCT)
FFFF 00023 @BLD631F EQU -1 ;<631>Apply 1F patches (SPOOL)
00024 ; Patches G and H were published in TMQ V.i, pages 10 and 18/19.
FFFF 00025 @BLD631G EQU -1 ;<631>Apply 1G patches (//KEYIN,DIR,DO *)
FFFF 00026 @BLD631H EQU -1 ;<631>Apply 1H patches (MEMORY)
00027 ;
00028 ;End of BUILDVER/ASM
0000 00029 *GET SVCMAC:3 ;SVC Macro equivalents
00030 ;SVCMAC/ASM - LS-DOS Version VI
00031 *LIST OFF
00423 *LIST ON
0000 00425 *GET VALUES:3 ;Misc. equates
00426 ;VALUES/ASM - Version 6
00427 *LIST OFF
00454 *LIST ON
00455 ;
2400 00456 ORG 2400H
00457 ;
00458 ; Was the key hit ?
00459 ;
00460 START
00461 IF @BLD631
2400 ED731024 00462 LD (SAVESP+1),SP ;<631>Save SP address
2404 00463 @@CKBRKC ;<631>Break key down?
2404+3E6A 00464 LD A,106
2406+EF 00465 RST 40
2407 202A 00466 JR NZ,ABORT ;<631>
00467 ELSE
00468 @@CKBRKC ;Break key down?
00469 JR Z,$+6 ;Go if not
00470 LD HL,-1 ; else abort
00471 RET
00472 ;
00473 ; not hit - execute module
00474 ;
00475 LD (SAVESP+1),SP ;Save SP address
00476 ENDIF
2409 CD3824 00477 CALL BUILD ;Build a file
240C 210000 00478 LD HL,0 ;Set no error
240F 310000 00479 SAVESP LD SP,$-$ ;P/u original SP addr.
2412 00480 @@CKBRKC
2412+3E6A 00481 LD A,106
2414+EF 00482 RST 40
2415 C9 00483 RET ;Exit with retcode
00484 ;
00485 ; I/O Error Handler
00486 ;
2416 2600 00487 IOERR LD H,0 ;Set HL = Error #
2418 6F 00488 LD L,A ;
2419 F6C0 00489 OR 0C0H ;Short error mess & RET
241B 4F 00490 LD C,A ;Stuff in C
241C 00491 @@ERROR ;Display error
241C+3E1A 00492 LD A,26
241E+EF 00493 RST 40
241F 18EE 00494 JR SAVESP ;ABORT
00495 ;
00496 ; Internal Error Message Handling
00497 ;
2421 219425 00498 BADIGS LD HL,BADIGS$ ;"Bad Hex digit"
2424 DD 00499 DB 0DDH
2425 218025 00500 ODDIGS LD HL,ODDIGS$ ;"Odd # of hex digits"
2428 DD 00501 DB 0DDH
2429 21AE25 00502 SPCREQ LD HL,SPCREQ$ ;"Filespec Required"
242C DD 00503 DB 0DDH
242D 21C125 00504 EXISTS LD HL,EXISTS$ ;"File already exists"
2430 00505 @@LOGOT ;Log error message
00506 IFEQ 00H,1
00507 LD HL,
00508 ENDIF
2430+3E0C 00509 LD A,12
2432+EF 00510 RST 40
2433 21FFFF 00511 ABORT LD HL,-1 ;Set abort code
2436 18D7 00512 JR SAVESP ;Exit
00513 ;
00514 ; BUILD - Build A file
00515 ;
2438 111D26 00516 BUILD LD DE,FCB1 ;DE => FCB
243B 00517 @@FSPEC ;Legal Filespec ?
243B+3E4E 00518 LD A,78
243D+EF 00519 RST 40
243E 20E9 00520 JR NZ,SPCREQ ;No - "Filespec req"
00521 ;
00522 ; Legal Filespec - Stuff default /ext of JCL
00523 ;
2440 E5 00524 PUSH HL ;Save cmd buf ptr
2441 210226 00525 LD HL,JCLEXT ;HL => "JCL"
2444 00526 @@FEXT ;Fetch extension
2444+3E4F 00527 LD A,79
2446+EF 00528 RST 40
2447 E1 00529 POP HL ;Rcvr command ptr
00530 ;
00531 ; Pick up parameters if any
00532 ;
2448 110A26 00533 LD DE,PRMTBL$ ;DE => Parameter table
244B 00534 @@PARAM ;Get any parameters
244B+3E11 00535 LD A,17
244D+EF 00536 RST 40
244E 20C6 00537 JR NZ,IOERR ;Quit on parm error
00538 ;
00539 ; Position to Extension
00540 ;
2450 211D26 00541 LD HL,FCB1 ;Point to start of FCB
2453 7E 00542 SLASH? LD A,(HL) ;P/u a char
2454 23 00543 INC HL ; & bump pointer
2455 FE0D 00544 CP CR ;End of line?
2457 281B 00545 JR Z,NOTKSM ;Yes - not a KSM file
2459 FE2F 00546 CP '/' ;Start of EXT?
245B 20F6 00547 JR NZ,SLASH? ;Loop if not
00548 ;
00549 ; Is the extension KSM ?
00550 ;
245D E5 00551 PUSH HL ;HL => Extension
245E 7E 00552 LD A,(HL) ;P/u character
245F 23 00553 INC HL ;Bump ptr
2460 FE4B 00554 CP 'K' ;Match K?
2462 2010 00555 JR NZ,NOTKSM
2464 7E 00556 LD A,(HL)
2465 23 00557 INC HL
2466 FE53 00558 CP 'S' ;Match S?
2468 200A 00559 JR NZ,NOTKSM
246A 7E 00560 LD A,(HL)
246B FE4D 00561 CP 'M' ;Match M?
246D 2005 00562 JR NZ,NOTKSM
00563 ;
00564 ; Extension is /KSM - stuff 0FFH in indicator
00565 ;
246F 3EFF 00566 LD A,0FFH
2471 32DA24 00567 LD (KSM?+1),A ;Stuff KSM indicator
00568 ;
00569 ; Is the extension /JCL ?
00570 ;
2474 E1 00571 NOTKSM POP HL ;HL => Extension field
2475 7E 00572 LD A,(HL) ;Ck if EXT is JCL
2476 23 00573 INC HL
2477 FE4A 00574 CP 'J' ;Match J?
2479 2010 00575 JR NZ,INIT
247B 7E 00576 LD A,(HL)
247C 23 00577 INC HL
247D FE43 00578 CP 'C' ;Match C?
247F 200A 00579 JR NZ,INIT
2481 7E 00580 LD A,(HL)
2482 FE4C 00581 CP 'L' ;Match L?
2484 2005 00582 JR NZ,INIT
2486 3E4F 00583 LD A,CPL-1 ;Max 79 cpl on JCL
2488 32F124 00584 LD (LINLEN+2),A
00585 ;
00586 ; Init the file with LRL of 256
00587 ;
248B 210027 00588 INIT LD HL,IOBUF ;HL => I/O buffer
248E 111D26 00589 LD DE,FCB1 ;DE => FCB
2491 0600 00590 LD B,0 ;B = LRL = 256
2493 00591 @@INIT ;Init the file
2493+3E3A 00592 LD A,58
2495+EF 00593 RST 40
2496 2025 00594 JR NZ,IOERRA ;Jump on error
00595 ;
00596 ; Stuff Filespec into Buffer
00597 ;
2498 F5 00598 PUSH AF ;Save Carry
2499 11D525 00599 LD DE,FILEBUF ;DE => Filespec
249C ED4B2326 00600 LD BC,(FCB1+6) ;B = DEC, C = Drive #
24A0 3A1D26 00601 LD A,(FCB1) ;P/u to test device/file
24A3 CD6A25 00602 CALL $FNAME
24A6 2015 00603 JR NZ,IOERRA
24A8 F1 00604 POP AF ;F = Status from @INIT
00605 ;
24A9 21E425 00606 LD HL,BMESS1 ;Default "Building :"
24AC 3818 00607 JR C,SETBUF ;Jump if New file
00608 ;
00609 ; File already exists - Was APPEND specified ?
00610 ;
24AE 010000 00611 APPEND LD BC,$-$ ;P/u APPEND parameter
24B1 111D26 00612 LD DE,FCB1 ;DE => FCB
24B4 0C 00613 INC C ;Specified ?
24B5 2809 00614 JR Z,APP1 ;Go if so
24B7 00615 @@CLOSE ;Close to reset open bit
24B7+3E3C 00616 LD A,60
24B9+EF 00617 RST 40
24BA CA2D24 00618 JP Z,EXISTS ;Quit with "file exists...
24BD C31624 00619 IOERRA JP IOERR ; or if error on close
00620 ;
00621 ; Position to end of file for append
00622 ;
24C0 00623 APP1 @@PEOF ;Position to EOF
24C0+3E41 00624 LD A,65
24C2+EF 00625 RST 40
24C3 21EF25 00626 LD HL,BMESS2 ;"Appending *KI to "
00627 ;
00628 ; Display Building/Appending Message
00629 ;
24C6 CD5025 00630 SETBUF CALL DSPLY ;Display message
24C9 21D525 00631 LD HL,FILEBUF ;Filename buffer
24CC CD5025 00632 CALL DSPLY
24CF 0E0D 00633 LD C,CR ;End line
24D1 00634 @@DSP
24D1+3E02 00635 LD A,2
24D3+EF 00636 RST 40
24D4 20E7 00637 JR NZ,IOERRA
24D6 210028 00638 LD HL,BUFFER ;HL => Input buffer
00639 ;
00640 ; Is this a KSM File ?
00641 ;
24D9 3E00 00642 KSM? LD A,$-$ ;Not zero if KSM
24DB B7 00643 OR A
24DC 2811 00644 JR Z,LINLEN ;Z - not a KSM
00645 ;
00646 ; KSM loop - p/u current letter & increment
00647 ;
24DE E5 00648 KSM1 PUSH HL ;Save text pointer
24DF 210526 00649 LD HL,LETBUF ;"A=> "
24E2 34 00650 INC (HL) ;Increment letter
24E3 7E 00651 LD A,(HL) ;P/u letter
00652 ;
00653 ; Finished with all the KSM keys ?
00654 ;
24E4 FE5B 00655 CP 'Z'+1 ;Go past Z?
24E6 2003 00656 JR NZ,DISSTR ;No - display string
24E8 E1 00657 POP HL ;Recover text ptr
24E9 183C 00658 JR GOTEND ;Finished
00659 ;
00660 ; Display letter & "=> "
00661 ;
24EB CD5025 00662 DISSTR CALL DSPLY ;Display string
24EE E1 00663 POP HL ;Recover text ptr
00664 ;
00665 ; Input line with either 255 or 79 characters
00666 ;
24EF 0100FF 00667 LINLEN LD BC,255<8 ;255 or 79 (JCL)
24F2 00668 @@KEYIN ;Input line
24F2+3E09 00669 LD A,9
24F4+EF 00670 RST 40
24F5 382C 00671 JR C,GOTBRK ;Exit on
24F7 2025 00672 JR NZ,TSTEOF ;Ck if EOF key used
00673 ;
00674 ; Got a line of input, check if HEX parameter
00675 ;
24F9 110000 00676 HPARM LD DE,$-$ ;P/u HEX parameter
24FC 1C 00677 INC E ;Specified ?
24FD 2018 00678 JR NZ,NOTHEX ;No - ASCII input
00679 ;
00680 ; HEX parm was entered - convert input to hex
00681 ;
24FF 54 00682 LD D,H ;Point DE => Input
2500 5D 00683 LD E,L
00684 ;
2501 CD5725 00685 HP1 CALL CVRTHEX ;Convert char @ DE
2504 05 00686 DEC B ;Decrement count
2505 CA2524 00687 JP Z,ODDIGS ;Done ? - odd # of digits
00688 ;
00689 ; Stuff first digit into high order nibble
00690 ;
2508 07 00691 RLCA ;Shift to hi-order nybble
2509 07 00692 RLCA
250A 07 00693 RLCA
250B 07 00694 RLCA
250C 4F 00695 LD C,A ;Save in C
00696 ;
00697 ; P/u low-order digit & OR with high order
00698 ;
250D CD5725 00699 CALL CVRTHEX ;Convert char @ DE
2510 B1 00700 OR C ;OR with hi-order nibble
2511 77 00701 LD (HL),A ;Stuff in buffer
00702 ;
00703 ; Increment converted input ptr & count down
00704 ;
2512 23 00705 INC HL ;Bump conv input ptr
2513 10EC 00706 DJNZ HP1 ;B hex digits
2515 18C2 00707 JR KSM? ;Done conv, back to loop
00708 ;
00709 ; ASCII input, point HL to next free location
00710 ;
2517 48 00711 NOTHEX LD C,B ;Advance memory buffer
2518 0600 00712 LD B,0 ;To end of this line
251A 09 00713 ADD HL,BC ;HL => End of line
251B 23 00714 INC HL ;Bump to 1st free posn
251C 18BB 00715 JR KSM? ;Loop for input
00716 ;
00717 ; EOF or BREAK hit - Test Number of chars entered
00718 ; If not at line start, convert to CR and continue
00719 ;
251E FE1C 00720 TSTEOF CP 1CH ;EOF?
2520 C21624 00721 JP NZ,IOERR ;Real error if not
2523 78 00722 GOTBRK LD A,B ;Any characters ?
2524 B7 00723 OR A
2525 20D2 00724 JR NZ,HPARM ;Yes - continue Build
00725 ;
00726 ; Save input pointer address
00727 ;
2527 222E25 00728 GOTEND LD (ENDTXT+1),HL ;Save buffer posn
252A 210028 00729 LD HL,BUFFER ;HL => Start of input
252D 110000 00730 ENDTXT LD DE,$-$ ;DE => Last used address
00731 ;
00732 ; Is there any more text to write out ?
00733 ;
2530 EB 00734 EX DE,HL ;Swap for math
2531 AF 00735 XOR A ;Clear carry
2532 ED52 00736 SBC HL,DE ;Any more text to write ?
2534 280B 00737 JR Z,ATEND ;No - don't write any
00738 ;
00739 ; Write a byte to the file
00740 ;
2536 EB 00741 EX DE,HL ;HL => Byte to output
2537 111D26 00742 LD DE,FCB1 ;DE => FCB
253A 4E 00743 LD C,(HL) ;P/u a char
253B 23 00744 INC HL ;Bump ptr
253C 00745 @@PUT ;Output char
253C+3E04 00746 LD A,4
253E+EF 00747 RST 40
253F 28EC 00748 JR Z,ENDTXT ;Loop for more if i/o OK
00749 ;
00750 ; Done writing - either end of text or error
00751 ;
2541 F5 00752 ATEND PUSH AF ;Save error code if any
00753 ;
00754 ; Close the file
00755 ;
2542 111D26 00756 LD DE,FCB1 ;DE => FCB
2545 00757 @@CLOSE ;Close the file
2545+3E3C 00758 LD A,60
2547+EF 00759 RST 40
2548 C21624 00760 JP NZ,IOERR ;Can't - I/O error
00761 ;
00762 ; Make sure @PUT didn't RETurn any I/O error
00763 ;
254B F1 00764 POP AF ;Recover error code
254C C8 00765 RET Z ;Ok - Return
254D C31624 00766 JP IOERR ;NZ - I/O Error
00767 ;
00768 ; DSPLY - Display Line & HL
00769 ;
00770 ;
2550 00771 DSPLY @@DSPLY ;Display line
00772 IFEQ 00H,1
00773 LD HL,
00774 ENDIF
2550+3E0A 00775 LD A,10
2552+EF 00776 RST 40
2553 C8 00777 RET Z ;Back if good
2554 C31624 00778 JP IOERR ; else abort
00779 ;
00780 ; CVRTHEX - Convert character at DE to hex
00781 ;
2557 1A 00782 CVRTHEX LD A,(DE) ;Get a char
2558 13 00783 INC DE ;Bump ptr
2559 D630 00784 SUB '0' ;Convert to binary
255B 380A 00785 JR C,BADIGSA ;Can't be < '0'
255D FE0A 00786 CP 10 ;Numeric character ?
255F D8 00787 RET C ;Yes - return
2560 CBAF 00788 RES 5,A ;No - convert to U/C
2562 D607 00789 SUB 7 ;Adjust A-F to be 10-15
2564 FE10 00790 CP 16 ;Legal hex digit ?
2566 D8 00791 RET C ;Yes - return
2567 C32124 00792 BADIGSA JP BADIGS ;No - Bad Hex Digit
00793 ;
00794 ; Routine to pick up device/file name
00795 ;
256A CB7F 00796 $FNAME BIT 7,A ;Test device/file
256C 2804 00797 JR Z,FNAME1 ;Go if device
256E 00798 @@FNAME
256E+3E50 00799 LD A,80
2570+EF 00800 RST 40
2571 C9 00801 RET
2572 3E2A 00802 FNAME1 LD A,'*' ;Stuff device indicator
2574 12 00803 LD (DE),A
2575 13 00804 INC DE
2576 79 00805 LD A,C ;Stuff 1st character
2577 12 00806 LD (DE),A
2578 13 00807 INC DE
2579 78 00808 LD A,B ;Stuff 2nd character
257A 12 00809 LD (DE),A
257B 13 00810 INC DE
257C 3E03 00811 LD A,3 ;Stuff ETX
257E 12 00812 LD (DE),A
257F C9 00813 RET
00814 ;
00815 ; ERROR Messages
00816 ;
2580 4F 00817 ODDIGS$ DB 'Odd # of hex digits',CR
64 64 20 23 20 6F 66 20
68 65 78 20 64 69 67 69
74 73 0D
2594 42 00818 BADIGS$ DB 'Bad hex digit encountered',CR
61 64 20 68 65 78 20 64
69 67 69 74 20 65 6E 63
6F 75 6E 74 65 72 65 64
0D
25AE 46 00819 SPCREQ$ DB 'File spec required',CR
69 6C 65 20 73 70 65 63
20 72 65 71 75 69 72 65
64 0D
25C1 46 00820 EXISTS$ DB 'File already exists',CR
69 6C 65 20 61 6C 72 65
61 64 79 20 65 78 69 73
74 73 0D
00821 ;
25D5 00822 FILEBUF DS 15
25E4 42 00823 BMESS1 DB 'Building: ',ETX
75 69 6C 64 69 6E 67 3A
20 03
25EF 41 00824 BMESS2 DB 'Appending: *KI to ',ETX
70 70 65 6E 64 69 6E 67
3A 20 2A 4B 49 20 74 6F
20 03
00825 ;
2602 4A 00826 JCLEXT DB 'JCL'
43 4C
00827 ;
2605 40 00828 LETBUF DB 'A'-1,'=> ',ETX
3D 3E 20 03
00829 ;
00830 ; PARAMETER TABLE
00831 ;
260A 80 00832 PRMTBL$ DB 80H ;6.x Parameter table
00833 ;
00834 ; HEX (H) parameter - Flag input only
00835 ;
260B 53 00836 DB FLAG!ABB!3
260C 48 00837 DB 'HEX'
45 58
260F 00 00838 DB 0
2610 FA24 00839 DW HPARM+1
00840 ;
00841 ; APPEND (A) parameter - Flag input only
00842 ;
2612 56 00843 DB FLAG!ABB!6
2613 41 00844 DB 'APPEND'
50 50 45 4E 44
2619 00 00845 DB 0
261A AF24 00846 DW APPEND+1
00847 ;
261C 00 00848 DB 0
00849 ;
00850 ; Buffer Area
00851 ;
261D 00 00852 FCB1 DB 0
261E 00853 DS 31
2700 00854 ORG $<-8+1<8
2700 00855 IOBUF DS 256
2800 00856 BUFFER DS 256
00857 ;
2400 00858 END START
2400 is the transfer address
00000 Total errors
[Copyright 1999,2002 Frank Durda IV, All Rights Reserved. Mirroring of any material on this page in any form is expressly prohibited. The official web site for this material is: http://nemesis.lonestar.org Contact this address for use clearances: clearance at nemesis.lonestar.org Comments and queries to this address: web_software_2011 at nemesis.lonestar.org]