LS-DOS 6.3.1 - LBLIST Assembly Listing (HTML format version)

[Copyright 1999,2002,2014 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_2014 at nemesis.lonestar.org
Comments and queries to this address: web_software_2014 at nemesis.lonestar.org]
MISOSYS EDAS-4.3 04/11/99 01:04:16 LIST - LS-DOS 6.2            Page 00001 

              00001 ;LBLIST/ASM - List 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 ;
0006          00453 @PRT    EQU     6
0002          00454 @DSP    EQU     2
              00455 ;
2400          00456         ORG     2400H
              00457 ;
              00458 START
2400          00459         @@CKBRKC                ;Check break
2400+3E6A     00460         LD      A,106
2402+EF       00461         RST     40
2403 2804     00462         JR      Z,LISTA         ;Continue if not
2405 21FFFF   00463         LD      HL,-1           ;  else abort
2408 C9       00464         RET
              00465 ;
              00466 ;        not hit, Execute Module
              00467 ;
              00468 LISTA
2409 ED731124 00469         LD      (SAVESP+1),SP   ;Save SP
240D CD2D24   00470         CALL    LIST            ;List a file
2410 310000   00471 SAVESP  LD      SP,$-$          ;P/u SP address
2413          00472         @@CKBRKC                ;Reset if user pressed break
2413+3E6A     00473         LD      A,106
2415+EF       00474         RST     40
2416 C9       00475         RET                     ;Abort
              00476 ;
              00477 ;       I/O Error Processing - Display & Abort
              00478 ;
2417 2600     00479 IOERR   LD      H,0             ;Set HL = Error #
2419 6F       00480         LD      L,A             ;
241A F6C0     00481         OR      0C0H            ;Short error message
241C 4F       00482         LD      C,A             ;Stuff error # in C
241D          00483         @@ERROR                 ;Display error
241D+3E1A     00484         LD      A,26
241F+EF       00485         RST     40
2420 18EE     00486         JR      SAVESP          ;Abort
              00487 ;
              00488 ;       Internal Error Message Display Routine
              00489 ;
2422 214827   00490 SPCREQ  LD      HL,SPCREQ$      ;File spec Required
2425          00491         @@LOGOT                 ;Log error message
              00492         IFEQ    00H,1
              00493         LD      HL,
              00494         ENDIF
2425+3E0C     00495         LD      A,12
2427+EF       00496         RST     40
2428 21FFFF   00497 ABORT   LD      HL,-1           ;Internal error = -1
242B 18E3     00498         JR      SAVESP          ;P/u stack & return
              00499 ;
              00500 ;       LIST - List a file in hex or ASCII
              00501 ;
242D CDDF26   00502 LIST    CALL    RESKFL          ;Reset pause, & enter
              00503 ;
              00504 ;       Find parameter entries if existent
              00505 ;
2430 E5       00506         PUSH    HL              ;Save command ptr
2431 7E       00507 FPLP    LD      A,(HL)          ;P/u character
2432 FE28     00508         CP      '('             ;Parameter(s) ?
2434 2807     00509         JR      Z,GETPRM        ;Yes - go get 'em
2436 FE0E     00510         CP      CR+1            ;End of line ?
2438 380C     00511         JR      C,RESTPTR       ;Yes - restore ptr
243A 23       00512         INC     HL              ;No - bump til end
243B 18F4     00513         JR      FPLP            ;Do til eol or "("
              00514 ;
              00515 ;       Process any parameters entered
              00516 ;
243D 117327   00517 GETPRM  LD      DE,PRMTBL$      ;DE => Parameter table
2440          00518         @@PARAM                 ;@PARAM
2440+3E11     00519         LD      A,17
2442+EF       00520         RST     40
2443 C21724   00521         JP      NZ,IOERR        ;NZ - "Parameter Error"
2446 E1       00522 RESTPTR POP     HL              ;Recover ptr
              00523 ;
              00524 ;       Skip command line blanks
              00525 ;
2447 7E       00526 IGSPC   LD      A,(HL)          ;P/u character
2448 23       00527         INC     HL              ;Bump ptr
2449 FE20     00528         CP      ' '             ;Space ?
244B 28FA     00529         JR      Z,IGSPC         ;Yes - ignore them
244D 2B       00530         DEC     HL              ;HL => First non-space
              00531 ;
              00532 ;       Check if the filespec is legal in format
              00533 ;
244E 11CC27   00534         LD      DE,FCB1         ;Fetch file spec
2451          00535         @@FSPEC                 ;Filespec legal ?
2451+3E4E     00536         LD      A,78
2453+EF       00537         RST     40
2454 C22224   00538         JP      NZ,SPCREQ       ;No - filespec required
              00539 ;
              00540 ;       If this is a device - don't LIST
              00541 ;
2457 1A       00542         LD      A,(DE)          ;Is this a device ?
2458 FE2A     00543         CP      '*'             ;
245A CA2224   00544         JP      Z,SPCREQ        ;Yes - Filespec req
              00545 ;
              00546 ;       Save the original filespec
              00547 ;
245D EB       00548         EX      DE,HL           ;HL => Source FCB
245E 11EC27   00549         LD      DE,FCB2         ;DE => Duplicate FCB
2461 012000   00550         LD      BC,32           ;32 bytes tm xfer
2464 E5       00551         PUSH    HL              ;Save source ptr
2465 EDB0     00552         LDIR                    ;Xfer
2467 D1       00553         POP     DE              ;DE => Source FCB
              00554 ;
              00555 ;       Stuff default extension of /TXT to source
              00556 ;
2468 217027   00557         LD      HL,TXTEXT       ;HL => TXT
246B          00558         @@FEXT                  ;Stuff TXT if no ext
246B+3E4F     00559         LD      A,79
246D+EF       00560         RST     40
              00561 ;
              00562 ;       Open the file with LRL of 256
              00563 ;
246E 0600     00564         LD      B,0             ;Set LRL (B) = 256
2470 CD3A27   00565         CALL    OPEN            ;Open file with LRL=256
2473 2816     00566         JR      Z,INITLRL       ;Good - LIST it
              00567 ;
              00568 ;       Error - Was it a "File not Found" Error ?
              00569 ;
2475 FE18     00570         CP      24              ;"File not Found" ?
2477 C21724   00571         JP      NZ,IOERR        ;No - I/O Error
              00572 ;
              00573 ;       OPEN original filespec instead of TXT
              00574 ;
247A 0E20     00575         LD      C,32            ;BC = 32 bytes to xfer
247C D5       00576         PUSH    DE              ;DE => FCB1
247D E5       00577         PUSH    HL              ;Save I/O buff ptr
247E 21EC27   00578         LD      HL,FCB2         ;HL => Filespec
2481 EDB0     00579         LDIR                    ;Xfer original filespec
2483 E1       00580         POP     HL              ;HL => I/O buffer
2484 D1       00581         POP     DE              ;DE => unopen FCB
              00582 ;
              00583 ;       Open Original Filespec without extension
              00584 ;
2485 CD3A27   00585         CALL    OPEN            ;Open the file
2488 C21724   00586         JP      NZ,IOERR        ;I/O error - abort
              00587 ;
              00588 ;       Pick up the DEC from the FCB
              00589 ;
248B D5       00590 INITLRL PUSH    DE              ;Xfer fcb to IX
248C DDE1     00591         POP     IX
248E DD4607   00592         LD      B,(IX+7)        ;P/u DEC
2491 DD4E06   00593         LD      C,(IX+6)        ;  & drive #
2494          00594         @@DIRRD                 ;Read in directory record
2494+3E57     00595         LD      A,87
2496+EF       00596         RST     40
              00597 ;
              00598 ;       Was the LRL parm specified ?
              00599 ;
2497 3AAB27   00600         LD      A,(LRESP)       ;P/u response
249A B7       00601         OR      A
249B 2008     00602         JR      NZ,SKIPLRL      ;Go if entered
              00603 ;
              00604 ;       No LRL parm, get from directory record
              00605 ;
249D 7D       00606         LD      A,L             ;Position to DIR+4
249E C604     00607         ADD     A,4
24A0 6F       00608         LD      L,A             ;HL => LRL byte (DIR+4)
              00609 ;
              00610 ;       Pick up LRL & stuff into LRL parameter
              00611 ;
24A1 7E       00612         LD      A,(HL)          ;P/u LRL
24A2 32AD25   00613         LD      (LPARM+1),A     ;Set dir LRL into parm
              00614 ;
              00615 ;       Pick up LRL & stuff into FCB
              00616 ;
24A5 3AAD25   00617 SKIPLRL LD      A,(LPARM+1)     ;P/u possible new LRL
24A8 DD7709   00618         LD      (IX+9),A        ;Put into FCB
24AB DDCB01FE 00619         SET     7,(IX+1)        ;Mark for byte I/O
              00620 ;
              00621 ;       Check if TAB (T) parm is flag or numeric
              00622 ;
24AF 3AB727   00623         LD      A,(TRESP)       ;P/u response byte
24B2 E640     00624         AND     40H             ;Flag response ?
24B4 3A4325   00625         LD      A,(TPARM+1)     ;P/u value
24B7 2805     00626         JR      Z,NOTFLG        ;No - numeric
              00627 ;
              00628 ;       Flag Response - Is it ON (T=8) or OFF (T=1)
              00629 ;
24B9 3C       00630         INC     A               ;Tab=OFF (NZ) or ON (Z) ?
24BA 2002     00631         JR      NZ,NOTFLG       ;Tab = OFF ---> TABEXP=1
24BC 3E08     00632         LD      A,8             ;Tab = ON ---> TABEXP=8
              00633 ;
              00634 ;       P/u TAB (T) parm value & stuff into routine
              00635 ;
24BE 324D25   00636 NOTFLG  LD      (TABEXP+1),A    ;Stuff away
24C1 3D       00637         DEC     A               ;Range can
24C2 FE20     00638         CP      32              ;Only be between 1-32.
24C4 3E2C     00639         LD      A,PAR_ERR       ;Greater - Parm Error
24C6 D21724   00640         JP      NC,IOERR
              00641 ;
              00642 ;       Was the P (print) parameter entered ?
              00643 ;
24C9 010000   00644 PPARM   LD      BC,$-$          ;P/u P parameter
24CC 78       00645         LD      A,B             ;Was it specified ?
24CD B1       00646         OR      C
24CE 2809     00647         JR      Z,HPARM         ;No - use @DSP
              00648         IF      @BLD631
24D0 ED438A26 00649         LD      (SPARM+1),BC    ;<631>
              00650         ENDIF
              00651 ;
              00652 ;       Stuff @PRT SVC # in output routine
              00653 ;
24D4 3E06     00654         LD      A,@PRT          ;@PRT SVC Number
24D6 326A26   00655         LD      (PUTOUT1+1),A   ;Overwrite @DSP
              00656 ;
              00657 ;       Hex Parameter Entered ?
              00658 ;
24D9 010000   00659 HPARM   LD      BC,$-$          ;P/u Hex parm
24DC 78       00660         LD      A,B             ;Entered ?
24DD B1       00661         OR      C
24DE C28D25   00662         JP      NZ,RPARM        ;Yes - check out Records
              00663 ;
              00664 ;       Routine to LIST a file in ASCII
              00665 ;
24E1 32BB27   00666         LD      (BYTCTR),A      ;Init counter to 0
              00667         IF      @BLD631
24E4 32AC26   00668         LD      (L26AC),A       ;<631>
24E7 3E17     00669         LD      A,17H           ;<631>
24E9 329026   00670         LD      (L2690),A       ;<631>
24EC 32AE26   00671         LD      (L26AE),A       ;<631>
              00672         ENDIF
              00673 ;
24EF 010100   00674 LINPRM  LD      BC,1            ;P/u start line parm
24F2 0B       00675         DEC     BC              ;Count down for start
24F3 78       00676         LD      A,B             ;Ready to list ?
24F4 B1       00677         OR      C
24F5 2812     00678         JR      Z,BGNLIN        ;Go list/print if ready
24F7 11CC27   00679         LD      DE,FCB1         ;DE => FCB
              00680 ;
              00681 ;       Ignore all lines until specified start posn
              00682 ;
24FA          00683 FND1ST  @@GET                   ;Get a character
24FA+3E03     00684         LD      A,3
24FC+EF       00685         RST     40
24FD C21724   00686         JP      NZ,IOERR        ;Error - abort
2500 FE0D     00687         CP      CR              ;End of line?
2502 20F6     00688         JR      NZ,FND1ST       ;Keep reading
              00689 ;
              00690 ;       Finished with line - decrement LINE count
              00691 ;
2504 0B       00692         DEC     BC              ;Dec line counter
2505 78       00693         LD      A,B             ;Finished
2506 B1       00694         OR      C               ;Ignoring lines ?
2507 20F1     00695         JR      NZ,FND1ST       ;No - loop until LINES=0
              00696 ;
              00697 ;       Start LISTing File
              00698 ;
2509 2AF024   00699 BGNLIN  LD      HL,(LINPRM+1)   ;P/u original line #
250C 015B27   00700         LD      BC,VARDOT       ;Convert to Decimal ASCII
250F CDF326   00701         CALL    CVTDEC          ;  and stuff into string
              00702 ;
              00703 ;       Read in a character from the file
              00704 ;
2512 11CC27   00705 GETCHR  LD      DE,FCB1         ;DE => FCB
2515          00706         @@GET                   ;Get a byte
2515+3E03     00707         LD      A,3
2517+EF       00708         RST     40
2518 205D     00709         JR      NZ,GOTERR       ;Go if read error
251A 323025   00710         LD      (PUCHAR+1),A    ;Hang on to char
              00711 ;
              00712 ;       Test if NUM parameter was entered
              00713 ;
251D 010000   00714 NPARM   LD      BC,$-$          ;P/u N parameter
2520 78       00715         LD      A,B             ;Was it entered ?
2521 B1       00716         OR      C
2522 280B     00717         JR      Z,PUCHAR        ;No - don't print line #
              00718 ;
              00719 ;       N parm entered - print line # & Increment it
              00720 ;
2524 215B27   00721         LD      HL,VARDOT       ;HL => Buffer with line #
2527 E5       00722         PUSH    HL              ;Save ptr
2528 CDBD26   00723         CALL    PUTLINE         ;Output line @ HL
252B E1       00724         POP     HL              ;Restore line # ptr
252C CD2927   00725         CALL    INCNUM          ;Increment line #
              00726 ;
              00727 ;       Pick up character and Check if high bit set
              00728 ;
252F 3E00     00729 PUCHAR  LD      A,$-$           ;P/u character
2531 07       00730 DLOOP   RLCA                    ;Get HB into Carry flag
              00731 ;
              00732 ;       Reset High bit unless A8 parameter entered
              00733 ;
2532 110000   00734 A8PARM  LD      DE,$-$          ;P/u A8 parm
2535 14       00735         INC     D               ;Was it entered ?
2536 15       00736         DEC     D
2537 2003     00737         JR      NZ,A8BIT        ;Yes - don't change byte
2539 CB3F     00738         SRL     A               ;Reset Bit 7
253B 1E       00739         DB      1EH             ;LD E,nn instruction
253C 0F       00740 A8BIT   RRCA                    ;Use all 8 bits
              00741 ;
              00742 ;       Is the character a Tab ?
              00743 ;
253D F5       00744         PUSH    AF              ;Save C flag
253E FE09     00745         CP      TAB             ;Was it a tab ?
2540 201B     00746         JR      NZ,NOTTAB       ;No - don't check TAB
              00747 ;
              00748 ;       Character is a Tab - Was T=N specified ?
              00749 ;
2542 110800   00750 TPARM   LD      DE,0008H        ;P/u TAB parm (Default=8)
2545 1C       00751         INC     E               ;TAB = N ?
2546 1D       00752         DEC     E
2547 2814     00753         JR      Z,NOTTAB        ;Yes - don't expand
              00754 ;
              00755 ;       P/u column # & calculate # of spaces to pad
              00756 ;
2549 3ABB27   00757         LD      A,(BYTCTR)      ;P/u column number
254C 0E08     00758 TABEXP  LD      C,8             ;P/u TAB expansion #
254E 91       00759 CLOOP   SUB     C
254F 30FD     00760         JR      NC,CLOOP
2551 ED44     00761         NEG                     ;Subtract A from Col #
              00762 ;
              00763 ;       Output A blank spaces for tab expansion
              00764 ;
2553 47       00765         LD      B,A             ;Put # spaces in B
2554 3E20     00766 TP1     LD      A,' '           ;Pad with a space
2556 CD6726   00767         CALL    PUTOUT          ;Output character
2559 10F9     00768         DJNZ    TP1             ;B spaces to output
255B 1803     00769         JR      WASTAB          ;Check byte counter
              00770 ;
              00771 ;       Character was not a tab, display it
              00772 ;
255D CD6726   00773 NOTTAB  CALL    PUTOUT          ;Print the character
2560 3ABB27   00774 WASTAB  LD      A,(BYTCTR)      ;P/u byte counter
2563 B7       00775         OR      A               ;If C/R printed
2564 CCC726   00776         CALL    Z,CKPAWS        ;Then check for 
              00777 ;
              00778 ;       Check for  if hi bit set on character
              00779 ;
2567 F1       00780         POP     AF              ;Get back char
2568 DCC726   00781         CALL    C,CKPAWS        ;If high bit was set
              00782 ;
              00783 ;       If character = C/R then read in another line
              00784 ;
256B FE0D     00785         CP      CR              ;Was it C/R ?
256D 28A3     00786         JR      Z,GETCHR        ;Yes - get new line
              00787 ;
              00788 ;       Get another byte from file
              00789 ;
256F 11CC27   00790         LD      DE,FCB1         ;DE => FCB
2572          00791         @@GET                   ;Get a byte
2572+3E03     00792         LD      A,3
2574+EF       00793         RST     40
2575 28BA     00794         JR      Z,DLOOP         ;Good - check character
              00795 ;
              00796 ;       I/O Error on @GET - Output a Carriage Return
              00797 ;
2577 F5       00798 GOTERR  PUSH    AF              ;Save error code
2578 3E0D     00799         LD      A,CR            ;Write end of line
257A CD6726   00800         CALL    PUTOUT
257D F1       00801         POP     AF              ;Rcvr error code
              00802 ;
              00803 ;       If End of File Error - Exit normally
              00804 ;
257E 210000   00805         LD      HL,0            ;Set HL = 0 (normal exit)
2581 FE1C     00806         CP      1CH             ;EOF?
2583 CA1024   00807 GTBK    JP      Z,SAVESP        ;Exit if so
2586 FE1D     00808         CP      1DH             ;NRN > ERN?
2588 28F9     00809         JR      Z,GTBK          ;Yes - leave
258A C31724   00810         JP      IOERR           ;Other - Abort
              00811 ;
              00812 ;       LIST a file in HEX format
              00813 ;
258D 010000   00814 RPARM   LD      BC,$-$          ;P/u starting Record #
2590 11CC27   00815         LD      DE,FCB1         ;DE => FCB
2593          00816         @@POSN                  ;Position to Record BC
2593+3E42     00817         LD      A,66
2595+EF       00818         RST     40
2596 C21724   00819         JP      NZ,IOERR        ;Abort on position error
              00820 ;
              00821 ;       Reset byte counter to Zero
              00822 ;
2599 AF       00823 DOHEX   XOR     A               ;Init byte counter to 0
259A 32B125   00824         LD      (DOHEX1+1),A
              00825 ;
              00826 ;       Stuff Record Number in Line Number buffer
              00827 ;
259D ED5B8E25 00828         LD      DE,(RPARM+1)    ;P/u Record Number
25A1 216427   00829         LD      HL,VARCLN+1     ;HL => Hex ASCII dest
25A4          00830         @@HEX16                 ;Convert DE to ASCII
25A4+3E63     00831         LD      A,99
25A6+EF       00832         RST     40
              00833 ;
              00834 ;       Bump Record Number & stuff into RPARM
              00835 ;
25A7 13       00836         INC     DE              ;Bump by one
25A8 ED538E25 00837         LD      (RPARM+1),DE    ;  & store for next time
              00838 ;
25AC 010000   00839 LPARM   LD      BC,$-$          ;P/u LRL
              00840 ;
              00841 ;       Convert Byte counter to Hex & stuff in buff
              00842 ;
25AF C5       00843 DISBYTE PUSH    BC              ;Save bytes left in Rec
25B0 0E00     00844 DOHEX1  LD      C,$-$           ;P/u byte counter
25B2 216927   00845         LD      HL,VAREQU       ;HL => Hex ASCII dest
25B5          00846         @@HEX8                  ;Cvrt C to ASCII @ HL
25B5+3E62     00847         LD      A,98
25B7+EF       00848         RST     40
25B8 C1       00849         POP     BC              ;BC = Bytes left in Rec
              00850 ;
              00851 ;       Display Record Number/Starting byte string
              00852 ;
25B9 216327   00853         LD      HL,VARCLN       ;HL => Display buffer
25BC CDBD26   00854         CALL    PUTLINE         ;Display Rec # byte
              00855 ;
              00856 ;       P/u byte counter & add 16 (BPL) & stuff away
              00857 ;
25BF 3AB125   00858         LD      A,(DOHEX1+1)    ;P/u byte counter
25C2 0610     00859         LD      B,16            ;Set B = 16 bytes
25C4 80       00860         ADD     A,B             ;Add 16 to byte count
25C5 32B125   00861         LD      (DOHEX1+1),A    ;  & stuff into LD C inst
              00862 ;
25C8 21BC27   00863         LD      HL,LINBUF       ;HL => Line buffer
              00864 ;
              00865 ;       Get a byte from the File
              00866 ;
25CB 11CC27   00867 DOHEX2  LD      DE,FCB1         ;DE => FCB
25CE          00868         @@GET                   ;Get a byte
25CE+3E03     00869         LD      A,3
25D0+EF       00870         RST     40
25D1 280B     00871         JR      Z,DOHEX4        ;Good - stuff byte
              00872 ;
              00873 ;       End of File Error ?
              00874 ;
25D3 F5       00875         PUSH    AF              ;Save error code
25D4 FE1C     00876         CP      1CH             ;EOF?
25D6 2805     00877         JR      Z,DOHEX3        ;Yes - Okay
              00878 ;
              00879 ;       Past End of File Error ?
              00880 ;
25D8 FE1D     00881         CP      1DH             ;NRN>ERN?
25DA C21724   00882         JP      NZ,IOERR        ;Another error
              00883 ;
              00884 ;       Recover Flags & check type of Error
              00885 ;
25DD F1       00886 DOHEX3  POP     AF              ;Recover error code
25DE 2018     00887 DOHEX4  JR      NZ,DOHEX5       ;Bypass if at end of file
              00888 ;
              00889 ;       Stuff Character in buffer & bump
              00890 ;
25E0 77       00891         LD      (HL),A          ;Stuff byte in buffer
25E1 23       00892         INC     HL              ;Bump ptr
              00893 ;
              00894 ;       Output byte in Hex & follow with a space
              00895 ;
25E2 CD5626   00896         CALL    CVTHEX          ;Output the byte in hex
25E5 3E20     00897         LD      A,' '           ;  followed by a space
25E7 CD6726   00898         CALL    PUTOUT
              00899 ;
              00900 ;       Output an extra space if halfway in line
              00901 ;
25EA 78       00902         LD      A,B             ;P/u byte counter
25EB FE09     00903         CP      9               ;Halfway yet?
25ED CCB926   00904         CALL    Z,WR1SPA        ;Yes - display space
              00905 ;
              00906 ;       Dec Chars/Line & # of chars left in Rec
              00907 ;
25F0 05       00908         DEC     B               ;Count down
25F1 0D       00909         DEC     C               ;Count down the LRL
25F2 2804     00910         JR      Z,DOHEX5        ;Done - get next record
              00911 ;
              00912 ;       Finished with Line ?
              00913 ;
25F4 78       00914         LD      A,B             ;Done with line ?
25F5 B7       00915         OR      A
25F6 20D3     00916         JR      NZ,DOHEX2       ;No - do til 16 chars
              00917 ;
              00918 ;       Finished with Line or Logical Record
              00919 ;
25F8 F5       00920 DOHEX5  PUSH    AF              ;End the line
25F9 78       00921         LD      A,B             ;P/u byte counter
25FA FE10     00922         CP      16              ;Done with this line ?
25FC 2826     00923         JR      Z,PRTLIN2       ;Yes - get another record
              00924 ;
              00925 ;       Display ASCII equivalent of line
              00926 ;
25FE C5       00927 PRTLIN  PUSH    BC              ;Save counters
              00928 ;
              00929 ;       Multiply # of chars not printed by three
              00930 ;
25FF 78       00931         LD      A,B             ;P/u # chars not printed
2600 87       00932         ADD     A,A             ;X 2
2601 80       00933         ADD     A,B             ;X 3
2602 47       00934         LD      B,A             ;Stuff in B
              00935 ;
              00936 ;       Add two extra spaces if more than halfway
              00937 ;
2603 FE1B     00938         CP      27              ;Need extra space if
2605 3F       00939         CCF                     ;Not halfway
2606 3E01     00940         LD      A,1             ;Plus 1 more space
2608 88       00941         ADC     A,B             ;Carry set for 3 spaces
              00942 ;
              00943 ;       Position to ASCII portion of line
              00944 ;
2609 47       00945         LD      B,A             ;Set loop counter
260A CDB326   00946         CALL    WRSPA           ;Output B spaces
260D C1       00947         POP     BC              ;Recover the counters
              00948 ;
              00949 ;       Calculate # of characters to print
              00950 ;
260E 3E10     00951         LD      A,16            ;Get # to print
2610 90       00952         SUB     B
2611 47       00953         LD      B,A             ;Xfer to B for DJNZ
2612 21BC27   00954         LD      HL,LINBUF       ;HL => Line buffer
2615 C5       00955         PUSH    BC              ;Save C
2616 0E08     00956         LD      C,8             ;Space after 8
              00957 ;
              00958 ;       Display ASCII part of line
              00959 ;
2618 7E       00960 PRTLIN1 LD      A,(HL)          ;P/u character
2619 23       00961         INC     HL              ;Bump ptr
261A CD4A26   00962         CALL    CVTDOT          ;Output each char
261D 0D       00963         DEC     C               ;Space yet ?
261E CCB926   00964         CALL    Z,WR1SPA        ;Yes - display space
2621 10F5     00965         DJNZ    PRTLIN1         ;Output line
2623 C1       00966         POP     BC              ;Recover C
              00967 ;
              00968 ;       End of Line - Output C/R & check for EOF
              00969 ;
2624 3E0D     00970 PRTLIN2 LD      A,CR            ;Output C/R
2626 CD6726   00971         CALL    PUTOUT
2629 F1       00972         POP     AF              ;Recover @GET ret code
262A 3E1C     00973         LD      A,1CH           ;Init to EOF
262C C27725   00974         JP      NZ,GOTERR       ;End of file - Abort
              00975 ;
262F CDC726   00976         CALL    CKPAWS          ; or  ?
              00977 ;
              00978 ;       Are we done with the Record ?
              00979 ;
2632 79       00980         LD      A,C             ;P/u # of bytes left
2633 B7       00981         OR      A               ;Finished ?
2634 C2AF25   00982         JP      NZ,DISBYTE      ;No - get next line
              00983 ;
              00984 ;       Finished with record - Output space & C/R
              00985 ;
2637 3E20     00986         LD      A,' '           ;Space
2639 CD6726   00987         CALL    PUTOUT
263C 3E0D     00988         LD      A,CR            ;Carriage Return
263E CD6726   00989         CALL    PUTOUT
              00990 ;
              00991 ;       Increment Line Number
              00992 ;
2641 216327   00993         LD      HL,VARCLN       ;HL => Line Number
2644 CD2927   00994         CALL    INCNUM          ;Increment
2647 C39925   00995         JP      DOHEX           ;Loop for more
              00996 ;
              00997 ;       CVTDOT - Output chars & convert non-printables
              00998 ;
264A FE20     00999 CVTDOT  CP      ' '             ;Don't print controls
264C 3804     01000         JR      C,CVTDOT1
264E FE7F     01001         CP      7FH             ;Print X'20' thru X'7E'
2650 3815     01002         JR      C,PUTOUT
2652 3E2E     01003 CVTDOT1 LD      A,'.'           ;Otherwise change to "."
2654 1811     01004         JR      PUTOUT
              01005 ;
              01006 ;       CVTHEX - Convert A to Hex ASCII & Output it
              01007 ;
2656 F5       01008 CVTHEX  PUSH    AF              ;Save Lower digit
2657 0F       01009         RRCA                    ;Get most sig nibble
2658 0F       01010         RRCA
2659 0F       01011         RRCA
265A 0F       01012         RRCA
265B CD5F26   01013         CALL    CVTH1           ;Output upper nibble
265E F1       01014         POP     AF              ;Recover #
              01015 ;
265F E60F     01016 CVTH1   AND     0FH             ;Mask off upper nibble
2661 C690     01017         ADD     A,90H           ;Convert to Hex digit
2663 27       01018         DAA
2664 CE40     01019         ADC     A,40H
2666 27       01020         DAA                     ;Fall into Output byte
              01021 ;
              01022 ;       PUTOUT - Put out a byte to *DO/*PR
              01023 ;
2667 C5       01024 PUTOUT  PUSH    BC              ;Save BC
2668 4F       01025         LD      C,A             ;Xfer char to C
              01026 ;
              01027 ;       Output byte to *DO or *PR
              01028 ;
2669 3E02     01029 PUTOUT1 LD      A,@DSP          ;@DSP or @PRT SVC #
266B EF       01030         RST     28H
266C C21724   01031         JP      NZ,IOERR        ;NZ - I/O Error
              01032 ;
              01033 ;       Increment byte counter
              01034 ;
266F E5       01035         PUSH    HL              ;Save HL
2670 21BB27   01036         LD      HL,BYTCTR       ;HL => Byte counter
2673 34       01037         INC     (HL)            ;Bump counter
              01038         IF      @BLD631
2674 7E       01039         LD      A,(HL)          ;<631>
2675 D650     01040         SUB     50H             ;<631>
2677 3801     01041         JR      C,L267A         ;<631>
2679 77       01042         LD      (HL),A          ;<631>
267A 79       01043 L267A:  LD      A,C             ;<631>
267B D60A     01044         SUB     0AH             ;<631>
267D 2804     01045         JR      Z,L2683         ;<631>
267F D603     01046         SUB     03H             ;<631>
2681 2001     01047         JR      NZ,L2684        ;<631>
2683 77       01048 L2683:  LD      (HL),A          ;<631>
2684 34       01049 L2684:  INC     (HL)            ;<631>
2685 35       01050         DEC     (HL)            ;<631>
2686 E1       01051         POP     HL              ;<631>
2687 C1       01052         POP     BC              ;<631>
2688 C0       01053         RET     NZ              ;<631>
2689          01054 SPARM:  EQU     $
2689 110000   01055         LD      DE,0            ;<631>
268C 7A       01056         LD      A,D             ;<631>
268D B3       01057         OR      E               ;<631>
268E C0       01058         RET     NZ              ;<631>
2690          01059 L2690:  EQU     $+1
268F 3E11     01060         LD      A,11H           ;<631>
2691 3D       01061         DEC     A               ;<631>
2692 329026   01062         LD      (L2690),A       ;<631>
2695 C0       01063         RET     NZ              ;<631>
2696          01064         @@KEY                   ;<631>
2696+3E01     01065         LD      A,1
2698+EF       01066         RST     40
2699 FE80     01067         CP      80H             ;<631>
269B CAEB26   01068         JP      Z,GOTBRK        ;<631>
269E D643     01069         SUB     43H             ;<631>
26A0 2804     01070         JR      Z,L26A6         ;<631>
26A2 D620     01071         SUB     ' '             ;<631>
26A4 2004     01072         JR      NZ,L26AA        ;<631>
26A6 ED538A26 01073 L26A6:  LD      (SPARM+1),DE    ;<631>
26AA 3E69     01074 L26AA:  LD      A,69H           ;<631>
26AC EF       01075 L26AC:  RST     28H             ;<631>
26AE          01076 L26AE:  EQU     $+1
26AD 3E11     01077         LD      A,11H           ;<631>
26AF 329026   01078         LD      (L2690),A       ;<631>
26B2 C9       01079         RET                     ;<631>
              01080         ELSE
              01081         LD      A,C             ;P/u byte
              01082         CP      CR              ;End of line ?
              01083         JR      NZ,NOTCR        ;No - rest regs & RETurn
              01084 ;
              01085         LD      (HL),0          ;Reset byte counter
              01086 NOTCR   POP     HL              ;Restore registers
              01087         POP     BC
              01088         RET                     ;  & RETurn
              01089         ENDIF
              01090 ;
              01091 ;
              01092 ;       Output B spaces to Display or Printer
              01093 ;
26B3 CDB926   01094 WRSPA   CALL    WR1SPA          ;Write a space
26B6 10FB     01095         DJNZ    WRSPA           ;Do it B times
26B8 C9       01096         RET                     ;RETurn
              01097 ;
              01098 ;       Output a space to Display or Printer
              01099 ;
26B9 3E20     01100 WR1SPA  LD      A,' '           ;Space Character
26BB 18AA     01101         JR      PUTOUT          ;Output byte
              01102 ;
              01103 ;       PUTLINE - Output a line to the video or printer
              01104 ;       HL => Line of data to output
              01105 ;
26BD 7E       01106 PUTLINE LD      A,(HL)          ;P/u byte
26BE 23       01107         INC     HL              ;Prepare for next
26BF FE03     01108         CP      ETX             ;Check if done none
26C1 C8       01109         RET     Z               ;  return if so
26C2 CD6726   01110         CALL    PUTOUT          ;Char OK output it
              01111         IF      @BLD631
              01112         ELSE
              01113         CP      CR              ;Check for CR
              01114         RET     Z               ;  return if so
              01115         ENDIF
26C5 18F6     01116         JR      PUTLINE
              01117 ;
              01118 ;       CKPAWS - Check for Pause (SHIFT @)
              01119 ;
26C7          01120 CKPAWS  @@FLAGS                 ;IY => System flags
26C7+3E65     01121         LD      A,101
26C9+EF       01122         RST     40
              01123 ;
              01124 ;       Was the  key pressed ?
              01125 ;
26CA          01126         @@CKBRKC                ; hit ?
26CA+3E6A     01127         LD      A,106
26CC+EF       01128         RST     40
26CD 201C     01129         JR      NZ,GOTBRK       ;Quit if so
              01130 ;
              01131 ;       Was the <@> pressed ?
              01132 ;
26CF FDCB0A4E 01133         BIT     1,(IY+KFLAG$)   ;Is the  bit set ?
26D3 C8       01134         RET     Z               ;Return if not <@>
              01135 ;
              01136 ;       Pause - Wait for key to continue
              01137 ;
26D4          01138 CKWAIT  @@KEY                   ;Wait for key press
26D4+3E01     01139         LD      A,1
26D6+EF       01140         RST     40
26D7 FE60     01141 CKWAIT1 CP      60H             ;Was key a ?
26D9 28F9     01142         JR      Z,CKWAIT        ;Ignore if it was
26DB FE80     01143         CP      80H             ;Was key a Break?
26DD 280C     01144         JR      Z,GOTBRK        ;Quit if so
              01145 ;
              01146 ;       Reset  &  bits & RETurn
              01147 ;
26DF          01148 RESKFL  @@FLAGS                 ;IY => Flag Table
26DF+3E65     01149         LD      A,101
26E1+EF       01150         RST     40
26E2 FD7E0A   01151         LD      A,(IY+KFLAG$)   ;P/u KFLAG$
26E5 E6F9     01152         AND     0F9H            ;Reset Pause and Enter
26E7 FD770A   01153         LD      (IY+KFLAG$),A   ;Stuff into KFLAG$
26EA C9       01154         RET
              01155 ;
              01156 ;        hit - Display C/R & Abort
              01157 ;
26EB 3E0D     01158 GOTBRK  LD      A,CR            ;Send end of line
26ED CD6726   01159         CALL    PUTOUT          ;Output byte
26F0 C32824   01160         JP      ABORT           ;  and abort due to BREAK
              01161 ;
              01162 ;       CVTDEC - Convert HL to Decimal & stuff in BC
              01163 ;
26F3 111027   01164 CVTDEC  LD      DE,10000        ;Divide by 10000
26F6 CD0E27   01165         CALL    CVD1
26F9 11E803   01166         LD      DE,1000         ;Divide by 1000
26FC CD0E27   01167         CALL    CVD1
26FF 116400   01168         LD      DE,100          ;Divide by 100
2702 CD0E27   01169         CALL    CVD1
2705 110A00   01170         LD      DE,10           ;Divide by 10
2708 CD0E27   01171         CALL    CVD1
270B 110100   01172         LD      DE,1            ;Divide by 1
              01173 ;
              01174 ;       Divide Quotient in HL by value in DE
              01175 ;
270E AF       01176 CVD1    XOR     A               ;Clear carry set A=0
270F ED52     01177 CVD2    SBC     HL,DE           ;Subtract Divisor
2711 3803     01178         JR      C,CVD3          ;Done - add back divisor
2713 3C       01179         INC     A               ;Bump counter
2714 18F9     01180         JR      CVD2            ;Subtract until a Carry
              01181 ;
              01182 ;       Add divisor to neg rem & cvrt A to ASCII
              01183 ;
2716 19       01184 CVD3    ADD     HL,DE           ;HL = New quotient
2717 C630     01185         ADD     A,'0'           ;A = ASCII numeric digit
2719 FE30     01186         CP      '0'             ;Zero ?
271B 2009     01187         JR      NZ,CVD4         ;No - stuff in buff (BC)
              01188 ;
              01189 ;       Char is a Zero - use space if leading zero
              01190 ;
271D 0B       01191         DEC     BC              ;Backspace buff ptr
271E 0A       01192         LD      A,(BC)          ;P/u last char
271F 03       01193         INC     BC              ;Bump to currentt
2720 FE20     01194         CP      ' '             ;Last char a space ?
2722 2802     01195         JR      Z,CVD4          ;Yes - don't use lead 0
2724 3E30     01196         LD      A,'0'           ;No - use zero
              01197 ;
              01198 ;       Stuff Numeric ASCII character into buffer
              01199 ;
2726 02       01200 CVD4    LD      (BC),A          ;Stuff char in buff
2727 03       01201         INC     BC              ;Bump ptr
2728 C9       01202         RET                     ;RETurn
              01203 ;
              01204 ;       INCNUM - Increment Line number in buffer (HL)
              01205 ;
2729 23       01206 INCNUM  INC     HL              ;Point to lo-order digit
272A 23       01207         INC     HL
272B 23       01208         INC     HL
272C 23       01209         INC     HL
              01210 ;
              01211 ;       Loop to Increment digit and return if done
              01212 ;
272D 7E       01213 INCNUM1 LD      A,(HL)          ;P/u digit
272E F630     01214         OR      '0'             ;Start with possible 0
2730 3C       01215         INC     A               ;Add 1
2731 77       01216         LD      (HL),A          ;Restuff
2732 D63A     01217         SUB     '9'+1           ;See if went to 10
2734 D8       01218         RET     C               ;Ret if not
2735 3630     01219         LD      (HL),'0'        ;Make it 0
2737 2B       01220         DEC     HL              ;B/u one
2738 18F3     01221         JR      INCNUM1         ;  & loop
              01222 ;
              01223 ;       OPEN - Open a file
              01224 ;
273A          01225 OPEN    @@FLAGS                 ;IY => System Flags
273A+3E65     01226         LD      A,101
273C+EF       01227         RST     40
273D FDCB12C6 01228         SET     0,(IY+SFLAG$)   ;P/u SFLAG$
2741 210029   01229         LD      HL,IOBUFF       ;HL => I/O buffer
2744          01230         @@OPEN                  ;Open the file
2744+3E3B     01231         LD      A,59
2746+EF       01232         RST     40
2747 C9       01233         RET                     ;  & RETurn with condition
              01234 ;
2748 46       01235 SPCREQ$ DB      'File spec required',CR
     69 6C 65 20 73 70 65 63
     20 72 65 71 75 69 72 65
     64 0D 
              01236 ;
              01237 ;
275B 20       01238 VARDOT  DB      '     . ',ETX
     20 20 20 20 2E 20 03 
2763 20       01239 VARCLN  DB      '     :'
     20 20 20 20 3A 
2769 58       01240 VAREQU  DB      'XX =  ',ETX
     58 20 3D 20 20 03 
2770 54       01241 TXTEXT  DB      'TXT'
     58 54 
              01242 ;
              01243 ;
              01244 ;       PARAMETER TABLE
              01245 ;
2773 80       01246 PRMTBL$ DB      80H
              01247 ;
              01248 ;        ASCII8 (A8) - Flag input only 
              01249 ;
2774 46       01250         DB      FLAG!6
2775 41       01251         DB      'ASCII8'
     53 43 49 49 38 
277B 00       01252         DB      0
277C 3325     01253         DW      A8PARM+1
              01254 ;
277E 42       01255         DB      FLAG!2
277F 41       01256         DB      'A8'
     38 
2781 00       01257         DB      0
2782 3325     01258         DW      A8PARM+1
              01259 ;
              01260 ;        LINE - Numeric input only 
              01261 ;
2784 84       01262         DB      NUM!4
2785 4C       01263         DB      'LINE'
     49 4E 45 
2789 00       01264         DB      0
278A F024     01265         DW      LINPRM+1
              01266 ;
              01267         IF      @BLD631
              01268 ;        NUM (N) - Flag input only 
              01269 ;
278C 43       01270         DB      FLAG!3                  ;<631>
              01271         ELSE
              01272 ;       NUM (N) - Flag input only
              01273 ;
              01274         DB      FLAG!ABB!3
              01275         ENDIF
278D 4E       01276         DB      'NUM'
     55 4D 
2790 00       01277         DB      0
2791 1E25     01278         DW      NPARM+1
              01279         IF      @BLD631
              01280 ;
              01281 ;       NS (N) - Flag input only
              01282 ;
2793 52       01283         DB      FLAG!ABB!2
2794 4E       01284         DB      'NS'
     53 
2796 00       01285         DB      0
2797 8A26     01286         DW      SPARM+1
              01287         ENDIF
              01288 ;
              01289 ;        HEX (H) - Flag input only 
              01290 ;
2799 53       01291         DB      FLAG!ABB!3
279A 48       01292         DB      'HEX'
     45 58 
279D 00       01293         DB      0
279E DA24     01294         DW      HPARM+1
              01295 ;
              01296 ;        REC (R) - Numeric input only 
              01297 ;
27A0 93       01298         DB      NUM!ABB!3
27A1 52       01299         DB      'REC'
     45 43 
27A4 00       01300         DB      0
27A5 8E25     01301         DW      RPARM+1
              01302 ;
              01303 ;        LRL (L) - Numeric input only 
              01304 ;
27A7 93       01305         DB      NUM!ABB!3
27A8 4C       01306         DB      'LRL'
     52 4C 
27AB 00       01307 LRESP   DB      0
27AC AD25     01308         DW      LPARM+1
              01309 ;
              01310 ;        P - Flag input only 
              01311 ;
27AE 41       01312         DB      FLAG!1
27AF 50       01313         DB      'P'
27B0 00       01314         DB      0
27B1 CA24     01315         DW      PPARM+1
              01316 ;
              01317 ;        TAB (T) - Flag input only 
              01318 ;
27B3 53       01319         DB      FLAG!ABB!3
27B4 54       01320         DB      'TAB'
     41 42 
27B7 00       01321 TRESP   DB      0
27B8 4325     01322         DW      TPARM+1
              01323 ;
27BA 00       01324         DB      0
              01325 ;
              01326 ;Buffer Area
              01327 ;
27BB          01328 BYTCTR  DS      1
27BC          01329 LINBUF  DS      16
27CC          01330 FCB1    DS      32
27EC          01331 FCB2    DS      32
              01332 ;
2900          01333         ORG     $<-8+1<+8
2900          01334 IOBUFF  DS      256
              01335 ;
2400          01336         END     START
2400 is the transfer address
00000 Total errors


[Copyright 1999,2002,2014 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_2014 at nemesis.lonestar.org
Comments and queries to this address: web_software_2014 at nemesis.lonestar.org]

Valid HTML 4.01!