[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:04:47 CREATE - LS-DOS 6.2 Page 00001 00001 ;LBCREATE/ASM - CREATE Command 00003 ; 0000 00004 *GET BUILDVER/ASM:3 00005 ; 00006 ; Buildver/asm is a bit of a kludge since not all utilities can load 00007 ; equates from LDOS60 and still compile. LOWCORE and everybody else 00008 ; relies on this setting, and it eventually ends up in LDOS60/EQU 00009 ; for programs that can use that. 00010 ; FFFF 00011 @BLD631 EQU -1 ;<631>Build 631 distribution (LEVEL 1B) 00012 ; These switches activate patches made since the 1B release. 00013 ; It is important that all earlier patches be enabled when a higher 00014 ; patch is enabled. 00015 ; Patches C thru F were published in TMQ IV.iv, page 32 (NOTE: the 00016 ; patch addresses listed for SPOOL in SPOOL1/FIX are 19H high.) FFFF 00017 @BLD631C EQU -1 ;<631>Apply 1C patches (SETKI) FFFF 00018 @BLD631D EQU -1 ;<631>Apply 1D patches (DIR) FFFF 00019 @BLD631E EQU -1 ;<631>Apply 1E patches (DIR & MEMDISK/DCT) FFFF 00020 @BLD631F EQU -1 ;<631>Apply 1F patches (SPOOL) 00021 ; Patches G and H were published in TMQ V.i, pages 10 and 18/19. FFFF 00022 @BLD631G EQU -1 ;<631>Apply 1G patches (//KEYIN,DIR,DO *) FFFF 00023 @BLD631H EQU -1 ;<631>Apply 1H patches (MEMORY) 00024 ; 00025 ;End of BUILDVER/ASM 0000 00026 *GET SVCMAC:3 ;SVC Macro equivalents 00027 ;SVCMAC/ASM - LS-DOS Version VI 00028 *LIST OFF 00420 *LIST ON 0000 00422 *GET VALUES:3 ;Misc. equates 00423 ;VALUES/ASM - Version 6 00424 *LIST OFF 00451 *LIST ON 00452 ; 2400 00453 ORG 2400H 00454 ; 2400 00455 CREATE EQU $ 00456 IF @BLD631 2400 ED731E25 00457 LD (SAVESP+1),SP ;<631>Save SP address 2404 00458 @@CKBRKC ;<631>Break key down? 2404+3E6A 00459 LD A,106 2406+EF 00460 RST 40 2407 C25425 00461 JP NZ,ABORT ;<631>Abort 00462 ELSE 00463 @@CKBRKC ;Break key down? 00464 JR Z,BEGINA ;Ok if not 00465 LD HL,-1 ; else abort 00466 RET 00467 ; 00468 BEGINA LD (SAVESP+1),SP ;Save SP address 00469 ENDIF 240A CD3224 00470 CALL CREATCD ;Do the CREATE code 00471 ; 00472 ; Set ERN & offset in FCB = value at @INIT 00473 ; 240D 210000 00474 ERN LD HL,$-$ ;P/u ERN (probably 0) 2410 22CE25 00475 LD (FCB+12),HL ;Stuff into FCB 2413 3E00 00476 OFFSET LD A,$-$ ;P/u offset byte 2415 32CA25 00477 LD (FCB+8),A ;Stuff into FCB 00478 ; 00479 ; CLOSE the file if possible 00480 ; 2418 11C225 00481 LD DE,FCB ;DE => FCB 00482 IF @BLD631 241B ED4BC825 00483 LD BC,(FCB+6) ;<631> 00484 ENDIF 241F 00485 @@CLOSE ;Close file 241F+3E3C 00486 LD A,60 2421+EF 00487 RST 40 2422 C21425 00488 JP NZ,IOERR ;NZ - I/O Error 00489 ; 00490 ; Exit Routine 00491 ; 00492 IF @BLD631 2425 110000 00493 SHRINK: LD DE,0 ;<631> 2428 7A 00494 LD A,D ;<631> 2429 A3 00495 AND E ;<631> 242A 3C 00496 INC A ;<631> 242B CC2125 00497 CALL Z,CLRCRE ;<631>Clear Create flag 242E 210000 00498 LD HL,0 ;<631> 00499 ELSE 00500 LD HL,0 ;Successful - HL = 0 00501 ENDIF 2431 C9 00502 RET ;Return 00503 ; 00504 ; Parse the Filespec given 00505 ; 2432 11C225 00506 CREATCD LD DE,FCB ;Fetch filespec 2435 00507 @@FSPEC 2435+3E4E 00508 LD A,78 2437+EF 00509 RST 40 2438 C24A25 00510 JP NZ,SPCREQ ;Quit on bad name 00511 ; 00512 ; Check out parameter input 00513 ; 243B 119825 00514 LD DE,PRMTBL$ ;Get parms 243E 00515 @@PARAM 243E+3E11 00516 LD A,17 2440+EF 00517 RST 40 2441 C21425 00518 JP NZ,IOERR ;Jump on parm error 00519 ; 00520 ; Check If Rec or LRL were specified 00521 ; 2444 3AAC25 00522 LD A,(LRESP) ;P/u LRL response 2447 47 00523 LD B,A ;Save in B 2448 3AA525 00524 LD A,(RRESP) ;P/u REC response 244B B0 00525 OR B ;Either specified ? 244C 2807 00526 JR Z,RPARM ;No - check # records 00527 ; 00528 ; If Size parm also was specified - Parameter Error 00529 ; 244E 3A9E25 00530 LD A,(SRESP) ;Size can't be used 2451 B7 00531 OR A ; with REC or LRL 2452 C21225 00532 JP NZ,PRMERR ;Specified ? - Error 00533 ; 00534 ; Check Record count 00535 ; 2455 010000 00536 RPARM LD BC,$-$ ;P/u # of records 2458 78 00537 LD A,B 2459 B1 00538 OR C 245A 200D 00539 JR NZ,LPARM 00540 ; 00541 ; Zero Records - Use Size instead 00542 ; 245C 210000 00543 SPARM LD HL,$-$ ;P/u size parm 245F 7C 00544 LD A,H 2460 B5 00545 OR L 2461 CA1225 00546 JP Z,PRMERR ;Err if size not entered 00547 ; 00548 ; Multiply HL x 4 to get # of sectors 00549 ; 2464 29 00550 ADD HL,HL ;X 2 2465 29 00551 ADD HL,HL ;X 4 2466 225624 00552 LD (RPARM+1),HL ;Pretend it's rec input 00553 ; 00554 ; Make sure LRL input is valid 00555 ; 2469 010000 00556 LPARM LD BC,$-$ ;P/u LRL 246C 78 00557 LD A,B ;Test for > 256 246D B7 00558 OR A ;If hi-order = 0, 246E 2808 00559 JR Z,LP1 ;Just use lo-order 2470 3D 00560 DEC A ;Test hi-order = 1 2471 C21225 00561 JP NZ,PRMERR ;Quit if any other 2474 B1 00562 OR C ;P/u lo-order 2475 C21225 00563 JP NZ,PRMERR ;Lo-order must be 0 2478 B1 00564 LP1 OR C ;Merge lo-order 00565 ; 00566 ; Open the File with the LRL specified 00567 ; 2479 11C225 00568 LD DE,FCB ;Open the file 247C 210026 00569 LD HL,BUFFER 247F 47 00570 LD B,A ;LRL = 256, or user entry 2480 00571 @@INIT 2480+3E3A 00572 LD A,58 2482+EF 00573 RST 40 2483 C21425 00574 JP NZ,IOERR ;Jump on init error 00575 ; 00576 ; Display "Creating : Filespec" String 00577 ; 2486 118925 00578 LD DE,FILESP ;DE => Filespec 2489 ED4BC825 00579 LD BC,(FCB+6) ;P/u drive #, DEC 248D 3AC225 00580 LD A,(FCB) ;P/u to test device/file 2490 CD3425 00581 CALL $FNAME 2493 C21425 00582 JP NZ,IOERR ;Leave on error 2496 217F25 00583 LD HL,CREATE$ ;"Creating : " 2499 00584 @@DSPLY ;Display it 00585 IFEQ 00H,1 00586 LD HL, 00587 ENDIF 2499+3E0A 00588 LD A,10 249B+EF 00589 RST 40 249C C21425 00590 JP NZ,IOERR ;Quit on dsply error 249F 0E0D 00591 LD C,CR ;End line 24A1 00592 @@DSP 24A1+3E02 00593 LD A,2 24A3+EF 00594 RST 40 24A4 C21425 00595 JP NZ,IOERR 00596 ; 00597 ; Save ERN & offset from FCB for later 00598 ; 24A7 2ACE25 00599 LD HL,(FCB+12) ;P/u ERN 24AA 220E24 00600 LD (ERN+1),HL 24AD 3ACA25 00601 LD A,(FCB+8) ;P/u offset byte 24B0 321424 00602 LD (OFFSET+1),A 00603 ; 00604 ; Check if the New Size > Old Size ? 00605 ; 24B3 11C225 00606 BIGGER LD DE,FCB ;DE => FCB+0 24B6 00607 @@LOF ;Get length of file 24B6+3E40 00608 LD A,64 24B8+EF 00609 RST 40 24B9 60 00610 LD H,B ;Move len to HL 24BA 69 00611 LD L,C 24BB ED4B5624 00612 LD BC,(RPARM+1) ;P/u # of records 24BF AF 00613 XOR A ;Clear carry 24C0 E5 00614 PUSH HL ;Save ERN 24C1 ED42 00615 SBC HL,BC ;Is new ERN > old ERN? 24C3 E1 00616 POP HL ;HL = ERN 24C4 D24E25 00617 JP NC,BADSIZ ;Go if not 00618 ; 00619 ; Position FCB to Ending Record Number 00620 ; 24C7 0B 00621 DEC BC ;Reduce to offset from 0 24C8 00622 @@POSN ;Position to new ERN 24C8+3E42 00623 LD A,66 24CA+EF 00624 RST 40 00625 ; 00626 ; Fill a 256 byte buffer with X'E5' bytes 00627 ; 24CB 210026 00628 LD HL,BUFFER ;Buffer area 24CE 110126 00629 LD DE,BUFFER+1 ;"format" a sector 24D1 01FF00 00630 LD BC,255 24D4 36E5 00631 LD (HL),0E5H 24D6 EDB0 00632 LDIR 00633 ; 00634 ; Write the last Record of the file 00635 ; 24D8 11C225 00636 LD DE,FCB ;Write the new ERN sector 24DB 25 00637 DEC H ;Set HL = buffer start 24DC 23 00638 INC HL 24DD CD0D25 00639 CALL WRITE ;Write the last record 24E0 00640 @@REW ;Rewind File 24E0+3E44 00641 LD A,68 24E2+EF 00642 RST 40 00643 ; 00644 ; Read in the directory entry 00645 ; 24E3 ED4BC825 00646 LD BC,(FCB+6) ;Get drive # & DEC 00647 IF @BLD631 24E7 CD2625 00648 CALL SETCRE ;<631>Set Create flag in directory 00649 ELSE 00650 @@DIRRD ;Read in record 00651 JR NZ,IOERR ;Jump on read error 00652 ; 00653 ; Set the CREATE bit, and write it back out 00654 ; 00655 INC HL ;Point to FCB+1 & 00656 SET 7,(HL) ; set the CREATE bit 00657 @@DIRWR ;Write entry back 00658 JR NZ,IOERR ;Jump on write error 00659 ENDIF 00660 ; 00661 ; Do we have to Fill the file ? 00662 ; 24EA 010001 00663 FILL LD BC,0100H ;P/u FILL parm 24ED 05 00664 DEC B 24EE C8 00665 RET Z ;RETurn if no Fill 00666 ; 00667 ; Create a Buffer with the FILL bytes 00668 ; 24EF D5 00669 PUSH DE ;Save FCB pointer 24F0 210026 00670 LD HL,BUFFER ;I/O buffer 24F3 71 00671 LD (HL),C ;Byte to xfer 24F4 110126 00672 LD DE,BUFFER+1 24F7 01FF01 00673 LD BC,255+256 ;Hit both buffers 24FA EDB0 00674 LDIR ;Xfer into buffer 00675 ; 00676 ; Pt HL => User Buff, DE => FCB, BC = last Rec 00677 ; 24FC D1 00678 POP DE ;Restore FCB pointer 24FD ED4B5624 00679 LD BC,(RPARM+1) ;P/u last record 2501 210027 00680 LD HL,UBUFF ;User Buffer 00681 ; 00682 ; Loop to write logical records 00683 ; 2504 78 00684 WRLOOP LD A,B ;Is rec cnt = 0 ? 2505 B1 00685 OR C 2506 C8 00686 RET Z ;Yes - done 2507 CD0D25 00687 CALL WRITE ;Write Record 250A 0B 00688 DEC BC ;Dec one 250B 18F7 00689 JR WRLOOP ;Do til BC = 0 00690 ; 00691 ; Write the buffer contents 00692 ; 250D 00693 WRITE @@WRITE ;Write buffer 250D+3E4B 00694 LD A,75 250F+EF 00695 RST 40 2510 C8 00696 RET Z ;Good - RETurn 2511 21 00697 DB 21H ;Skip LD A,## instruction 2512 3E2C 00698 PRMERR LD A,PAR_ERR ;Parameter Error 00699 ; 00700 ; I/O error display & abort routine 00701 ; 2514 6F 00702 IOERR LD L,A ;Save error # in HL 2515 2600 00703 LD H,0 2517 F6C0 00704 OR 0C0H ;Short error message 2519 4F 00705 LD C,A ;Stuff in C for @ERROR 251A 00706 @@ERROR ;Display error message 251A+3E1A 00707 LD A,26 251C+EF 00708 RST 40 251D 310000 00709 SAVESP LD SP,$-$ ;P/u original SP 2520 C9 00710 RET ;Done, RETurn 00711 IF @BLD631 2521 3EBE 00712 CLRCRE LD A,0BEH ;<631> 2523 322D25 00713 LD (CREFLG),A ;<631> 2526 00714 SETCRE: @@DIRRD ;<631> 2526+3E57 00715 LD A,87 2528+EF 00716 RST 40 2529 20E9 00717 JR NZ,IOERR ;<631> 252B 23 00718 INC HL ;<631> 252D 00719 CREFLG: EQU $+1 ;<631> 252C CBFE 00720 SET 7,(HL) ;<631> 252E 00721 @@DIRWR ;<631> 252E+3E58 00722 LD A,88 2530+EF 00723 RST 40 2531 20E1 00724 JR NZ,IOERR ;<631> 2533 C9 00725 RET ;<631> 00726 ENDIF 00727 ; 00728 ; Routine to pick up device/file name 00729 ; 2534 CB7F 00730 $FNAME BIT 7,A ;Test device/file 2536 2804 00731 JR Z,FNAME1 ;Go if device 2538 00732 @@FNAME 2538+3E50 00733 LD A,80 253A+EF 00734 RST 40 253B C9 00735 RET 253C 3E2A 00736 FNAME1 LD A,'*' ;Stuff device indicator 253E 12 00737 LD (DE),A 253F 13 00738 INC DE 2540 79 00739 LD A,C ;Stuff 1st character 2541 12 00740 LD (DE),A 2542 13 00741 INC DE 2543 78 00742 LD A,B ;Stuff 2nd character 2544 12 00743 LD (DE),A 2545 13 00744 INC DE 2546 3E03 00745 LD A,3 ;Stuff ETX 2548 12 00746 LD (DE),A 2549 C9 00747 RET 00748 ; 00749 ; Error Message Display routine 00750 ; 254A 215925 00751 SPCREQ LD HL,SPCREQ$ 254D DD 00752 DB 0DDH 254E 216C25 00753 BADSIZ LD HL,BADSIZ$ 00754 ; 00755 ; Log Error Message & Abort 00756 ; 2551 00757 @@LOGOT ;Log error message 00758 IFEQ 00H,1 00759 LD HL, 00760 ENDIF 2551+3E0C 00761 LD A,12 2553+EF 00762 RST 40 00763 IF @BLD631 00764 ABORT: ;<631> 00765 ENDIF 2554 21FFFF 00766 LD HL,-1 ;Set abort code 2557 18C4 00767 JR SAVESP ;Exit 00768 ; 00769 ; Messages 00770 ; 2559 46 00771 SPCREQ$ DB 'File spec required',CR 69 6C 65 20 73 70 65 63 20 72 65 71 75 69 72 65 64 0D 256C 46 00772 BADSIZ$ DB 'File exists larger',CR 69 6C 65 20 65 78 69 73 74 73 20 6C 61 72 67 65 72 0D 257F 43 00773 CREATE$ DB 'Creating: ' 72 65 61 74 69 6E 67 3A 20 2589 00774 FILESP DS 15 00775 ; 00776 ;PARAMETER TABLE 00777 ; 2598 80 00778 PRMTBL$ DB 80H ;6.x Parameter Table 00779 ; 00780 ; SIZE (S) - Accept Numeric Input only 00781 ; 2599 94 00782 DB NUM!ABB!4 259A 53 00783 DB 'SIZE' 49 5A 45 259E 00 00784 SRESP DB 0 259F 5D24 00785 DW SPARM+1 00786 ; 00787 ; REC (R) - Accept Numeric input only 00788 ; 25A1 93 00789 DB NUM!ABB!3 25A2 52 00790 DB 'REC' 45 43 25A5 00 00791 RRESP DB 0 25A6 5624 00792 DW RPARM+1 00793 ; 00794 ; LRL (L) - Accept Numeric input only 00795 ; 25A8 93 00796 DB NUM!ABB!3 25A9 4C 00797 DB 'LRL' 52 4C 25AC 00 00798 LRESP DB 0 25AD 6A24 00799 DW LPARM+1 00800 ; 00801 ; FILL (F) - Accept Numeric or Flag input 00802 ; 25AF D4 00803 DB FLAG!NUM!ABB!4 25B0 46 00804 DB 'FILL' 49 4C 4C 25B4 00 00805 FRESP DB 0 25B5 EB24 00806 DW FILL+1 00807 IF @BLD631 00808 ; 00809 ; SHRINK (S) 00810 ; 25B7 46 00811 DB FLAG!6 ;<631> 25B8 53 00812 DB 'SHRINK' ;<631> 48 52 49 4E 4B 25BE 00 00813 DB 0 ;<631> 25BF 2624 00814 DW SHRINK+1 ;<631> 00815 ENDIF 25C1 00 00816 DB 0 00817 ; 00818 ; I/O buffer 00819 ; 25C2 00 00820 FCB DB 0 25C3 00821 DS 31 2600 00822 ORG $<-8+1<8 2600 00823 BUFFER DS 256 2700 00824 UBUFF DS 256 00825 ; 2400 00826 END CREATE 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]