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

[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/11/99 02:17:24 ROUTE - LS-DOS 6.2           Page 00001 

              00001 ;LBROUTE/ASM - ROUTE Command
              00003 ;
000D          00004 CR      EQU     13
002C          00005 PAR_ERR EQU     44              ;Parameter Error
              00006 ;
0000          00007 *GET    SVCMAC:3                ;SVC Macro equivalents
              00008 ;SVCMAC/ASM - LS-DOS Version VI
              00009 *LIST   OFF
              00401 *LIST   ON
              00403 ;
2400          00404         ORG     2400H
              00405 ;
              00406 ;       Save stack & call Route routine
              00407 ;
2400 ED732724 00408 ROUTE   LD      (SAVESP+1),SP   ;Save Stack
2404 CD2D24   00409         CALL    ROUTE1          ;Call route routine
2407 210000   00410 EXIT    LD      HL,0            ;Clean Exit
240A 181A     00411         JR      SAVESP
              00412 ;
              00413 ;       I/O Error Handling
              00414 ;
240C 3E2C     00415 PRMERR  LD      A,PAR_ERR       ;Parameter Error
240E 6F       00416 IOERR   LD      L,A
240F 2600     00417         LD      H,0
2411 F6C0     00418         OR      0C0H            ;Set abbrev & return
2413 4F       00419         LD      C,A
2414          00420         @@ERROR
2414+3E1A     00421         LD      A,26
2416+EF       00422         RST     40
2417 180D     00423         JR      SAVESP          ;P/u stack & return
              00424 ;
              00425 ;       Internal Error Message Handling
              00426 ;
2419 215525   00427 CANT    LD      HL,CANT$        ;"No mem space...
241C DD       00428         DB      0DDH
241D 216F25   00429 SPCERR  LD      HL,SPCERR$      ;"Devspec req...
2420          00430         @@LOGOT
              00431         IFEQ    00H,1
              00432         LD      HL,
              00433         ENDIF
2420+3E0C     00434         LD      A,12
2422+EF       00435         RST     40
2423 21FFFF   00436 ERREXIT LD      HL,-1           ;Set abort code
              00437 ;
              00438 ;       P/u stack & Clear any pending 
              00439 ;
2426 310000   00440 SAVESP  LD      SP,$-$          ;P/u stack
2429          00441         @@CKBRKC                ;Clear any Break
2429+3E6A     00442         LD      A,106
242B+EF       00443         RST     40
242C C9       00444         RET
              00445 ;
              00446 ;       ROUTE1 - Route spec to spec
              00447 ;
242D 11E525   00448 ROUTE1  LD      DE,FCBSRC       ;Fetch source spec
2430          00449         @@FSPEC
2430+3E4E     00450         LD      A,78
2432+EF       00451         RST     40
2433 2026     00452         JR      NZ,SPCER        ;Jump on error
2435 1A       00453         LD      A,(DE)
2436 FE2A     00454         CP      '*'             ;Must be a device
2438 2021     00455         JR      NZ,SPCER        ;Jump if not
243A 118425   00456         LD      DE,PRMTBL$      ;Get parameters
243D          00457         @@PARAM
243D+3E11     00458         LD      A,17
243F+EF       00459         RST     40
2440 20CA     00460         JR      NZ,PRMERR       ;Jump on parm error
2442 ED5BE625 00461         LD      DE,(FCBSRC+1)   ;Stuff source name
2446 ED539F25 00462         LD      (RTENAM+3),DE
244A          00463         @@FLAGS                 ;Get flag table pointer
244A+3E65     00464         LD      A,101
244C+EF       00465         RST     40
              00466 ;
              00467 ;       Test NIL parameter
              00468 ;
244D 010000   00469 NPARM   LD      BC,0            ;P/u NIL parm
2450 78       00470         LD      A,B
2451 B1       00471         OR      C
2452 C22825   00472         JP      NZ,NILDCB       ;Jump if NIL entered
              00473 ;
              00474 ;       Route to device/file - check which
              00475 ;
2455 11A525   00476         LD      DE,FCBDST       ;Fetch destination spec
2458          00477         @@FSPEC
2458+3E4E     00478         LD      A,78
245A+EF       00479         RST     40
245B C21D24   00480 SPCER   JP      NZ,SPCERR       ;Jump on error
245E D5       00481         PUSH    DE
245F 118425   00482         LD      DE,PRMTBL$
2462          00483         @@PARAM                 ;Need in case REWIND
2462+3E11     00484         LD      A,17
2464+EF       00485         RST     40
2465 D1       00486         POP     DE
2466 20A4     00487         JR      NZ,PRMERR       ;Exit on parm error
2468 1A       00488         LD      A,(DE)
2469 FE2A     00489         CP      '*'             ;Test device/file
246B 2040     00490         JR      NZ,INITFCB      ;Jump on file
              00491 ;
              00492 ;       Destination spec is a device
              00493 ;
246D ED5BA625 00494         LD      DE,(FCBDST+1)   ;P/u device name
2471 2AE625   00495         LD      HL,(FCBSRC+1)   ;Make sure SRC<>DST
2474 ED52     00496         SBC     HL,DE           ;  CF is reset
2476 CA1D24   00497         JP      Z,SPCERR
2479          00498         @@GTDCB                 ;Find in tables
2479+3E52     00499         LD      A,82
247B+EF       00500         RST     40
247C C20E24   00501         JP      NZ,IOERR        ;Jump if not found
247F E5       00502 CKDCBS  PUSH    HL              ;Save DCB address of dest
2480 CD0D25   00503         CALL    CKSRC           ;Locate source DCB
2483 C20E24   00504         JP      NZ,IOERR
2486          00505 CKDCB1  EQU     $
2486 F3       00506         DI
2487 C1       00507         POP     BC              ;Rcvr dest route vector
2488 E5       00508         PUSH    HL              ;Save DCB+0
              00509 ;
              00510 ;       Save the old device vector while stuffing new
              00511 ;
2489 2C       00512         INC     L               ;Bump to vector
248A 7E       00513         LD      A,(HL)          ;Save what's there
248B 71       00514         LD      (HL),C          ;Stuff dest route
248C 4F       00515         LD      C,A             ;  into DCB of source
248D 2C       00516         INC     L               ;  while saving old
248E 7E       00517         LD      A,(HL)          ;  vector for storage
248F 70       00518         LD      (HL),B          ;  (could be a FCB)
2490 47       00519         LD      B,A
              00520 ;
              00521 ;       Now set ROUTE bit and rest of DCB block
              00522 ;
2491 E1       00523         POP     HL              ;Rcvr ptr to DCB+0
2492 7E       00524         LD      A,(HL)          ;Init the ROUTE bit
2493 F5       00525         PUSH    AF              ;Save old TYPE byte
2494 E607     00526         AND     7               ;Strip any flag bits
2496 F610     00527         OR      10H
2498 77       00528         LD      (HL),A          ;Show source is routed
2499 7D       00529         LD      A,L
249A C607     00530         ADD     A,7             ;Point to name field
249C 6F       00531         LD      L,A
249D 72       00532         LD      (HL),D          ;And stuff in the name
249E 2D       00533         DEC     L               ;  in case this is a
249F 73       00534         LD      (HL),E          ;  new DCB block
24A0 F1       00535         POP     AF              ;P/u old TYPE byte &
24A1 CB67     00536         BIT     4,A             ;  save old data if
24A3 2006     00537         JR      NZ,CKDCB2       ;  not already routed
24A5 2D       00538         DEC     L
24A6 70       00539         LD      (HL),B          ;Stuff old vector
24A7 2D       00540         DEC     L               ;  for reclamation
24A8 71       00541         LD      (HL),C
24A9 2D       00542         DEC     L
24AA 77       00543         LD      (HL),A          ;Stuff old TYPE
24AB          00544 CKDCB2  EQU     $
24AB FB       00545         EI
24AC C9       00546         RET                     ;Successful
              00547 ;
              00548 ;       Destination is file - init it & posn to end
              00549 ;
24AD D5       00550 INITFCB PUSH    DE
24AE 119C25   00551         LD      DE,RTENAM       ;See if space already
24B1          00552         @@GTMOD                 ;  allocated for this
24B1+3E53     00553         LD      A,83
24B3+EF       00554         RST     40
24B4 D1       00555         POP     DE
24B5 200C     00556         JR      NZ,NOTRES       ;  device name
              00557 ;
              00558 ;       Space in memory, re-use it
              00559 ;
24B7 23       00560         INC     HL              ;Get last byte used
24B8 23       00561         INC     HL              ;  into HL
24B9 7E       00562         LD      A,(HL)
24BA 23       00563         INC     HL
24BB 66       00564         LD      H,(HL)
24BC 6F       00565         LD      L,A
24BD AF       00566         XOR     A               ;Set a 0 to show
24BE 32F724   00567         LD      (CKIFRES+1),A   ;  already resident
24C1 180E     00568         JR      SETBUF
              00569 ;
              00570 ;       Not yet resident, get space
              00571 ;
24C3 FDCB0246 00572 NOTRES  BIT     0,(IY+'C'-'A')  ;Can we alter HIGH$?
24C7 C21924   00573         JP      NZ,CANT         ;Can't if frozen
24CA 210000   00574         LD      HL,0            ;Get high
24CD 45       00575         LD      B,L
24CE          00576         @@HIGH$
24CE+3E64     00577         LD      A,100
24D0+EF       00578         RST     40
24D1 229925   00579 SETBUF  LD      (RTEDVR+2),HL   ;Stuff highest used
24D4 23       00580         INC     HL              ;Reserve a page for
24D5 25       00581         DEC     H               ;  the I/O buffer
24D6 E5       00582         PUSH    HL              ;Don't lose it
24D7 0600     00583         LD      B,0             ;LRL = 0
24D9          00584         @@INIT                  ;Init the file
24D9+3E3A     00585         LD      A,58
24DB+EF       00586         RST     40
24DC 200D     00587         JR      NZ,INITF1       ;What? an error?
24DE 010000   00588 RPARM   LD      BC,0            ;Ck on rewind (no peof)
24E1 04       00589         INC     B               ;Keep file at start
24E2 2807     00590         JR      Z,INITF1        ;  if REWIND specified
24E4          00591         @@PEOF                  ;  else posn file
24E4+3E41     00592         LD      A,65
24E6+EF       00593         RST     40
24E7 2802     00594         JR      Z,INITF1        ;  to the end
24E9 FE1C     00595         CP      1CH             ;At End Of File?
24EB E1       00596 INITF1  POP     HL              ;Get back buffer pointer
24EC C20E24   00597         JP      NZ,IOERR        ;Any other error, JuMp
24EF 012E00   00598         LD      BC,32+14        ;Back up another 32
24F2 AF       00599         XOR     A               ;  for the FCB storage
24F3 ED42     00600         SBC     HL,BC           ;  + 14 for linkage
24F5 E5       00601         PUSH    HL              ;Save module start
              00602 ;
              00603 ;       Bypass HIGH$ stuff if "ISRES"
              00604 ;
24F6 F6FF     00605 CKIFRES OR      -1              ;"OR 0" if "ISRES"
24F8 2804     00606         JR      Z,ISRES1
24FA 2B       00607         DEC     HL              ;Reset HIGH$ (B=0)
24FB          00608         @@HIGH$                 ;Stuff new high$
24FB+3E64     00609         LD      A,100
24FD+EF       00610         RST     40
24FE D1       00611 ISRES1  POP     DE              ;Rcvr module pointer
24FF D5       00612         PUSH    DE
2500 219725   00613         LD      HL,RTEDVR       ;Move module to memory
2503 EDB0     00614         LDIR
2505 D1       00615         POP     DE              ;Now adjust to true
2506 210E00   00616         LD      HL,14           ;  FCB loc'n
2509 19       00617         ADD     HL,DE
250A C37F24   00618         JP      CKDCBS          ;Go check dcbs
              00619 ;
              00620 ;       Scan device tables for source device
              00621 ;
250D ED5BE625 00622 CKSRC   LD      DE,(FCBSRC+1)   ;P/u source device name
2511 D5       00623         PUSH    DE              ;  & save it for later
2512          00624         @@GTDCB                 ;Find device in table
2512+3E52     00625         LD      A,82
2514+EF       00626         RST     40
2515 280A     00627         JR      Z,CKSRC1        ;Use it if found
2517 110000   00628         LD      DE,0            ;  else find a spare
251A          00629         @@GTDCB                 ;  DCB block
251A+3E52     00630         LD      A,82
251C+EF       00631         RST     40
251D 3E21     00632         LD      A,33            ;Init "No device space...
251F 2005     00633         JR      NZ,CKSRC2       ;Abort if no space
2521 E5       00634 CKSRC1  PUSH    HL
2522 CD3925   00635         CALL    CLSFILS         ;Close any existing
2525 E1       00636         POP     HL              ;  file routes
2526 D1       00637 CKSRC2  POP     DE              ;Recover source name
2527 C9       00638         RET
              00639 ;
              00640 ;       NIL entered, close up any open file
              00641 ;
2528 CD0D25   00642 NILDCB  CALL    CKSRC           ;Check on devqice
252B 7E       00643         LD      A,(HL)          ;Get type byte
252C F608     00644         OR      8
252E 77       00645         LD      (HL),A          ;Show is NIL device
252F 7D       00646         LD      A,L             ;Pt to name field
2530 C606     00647         ADD     A,6
2532 6F       00648         LD      L,A
2533 F3       00649         DI
2534 73       00650         LD      (HL),E          ;Stuff in our name
2535 2C       00651         INC     L               ;  in case it's a new
2536 72       00652         LD      (HL),D          ;  DCB block
2537 FB       00653         EI
2538 C9       00654         RET                     ;Successful
              00655 ;
              00656 ;       Find the last device route & close any open file
              00657 ;
2539 CB66     00658 CLSFILS BIT     4,(HL)          ;Jump if no route
253B 2807     00659         JR      Z,CLSFIL1
253D 23       00660         INC     HL              ;Else p/u link address
253E 7E       00661         LD      A,(HL)          ;  and test that one
253F 23       00662         INC     HL              ;  for a chain
2540 66       00663         LD      H,(HL)
2541 6F       00664         LD      L,A
2542 18F5     00665         JR      CLSFILS
2544 CB7E     00666 CLSFIL1 BIT     7,(HL)          ;A file?
2546 C8       00667         RET     Z               ;Ret if not
2547 11C525   00668         LD      DE,FCBFIL       ;Pt to fcb area
254A D5       00669         PUSH    DE
254B 012000   00670         LD      BC,32
254E EDB0     00671         LDIR                    ;Fill from device vector
2550 D1       00672         POP     DE              ;Recover start
2551          00673         @@CLOSE                 ;Close the file
2551+3E3C     00674         LD      A,60
2553+EF       00675         RST     40
2554 C9       00676         RET                     ;Ret with Z, NZ status
              00677 ;
              00678 ;       Messages
              00679 ;
2555 4E       00680 CANT$   DB      'No memory space available',CR
     6F 20 6D 65 6D 6F 72 79
     20 73 70 61 63 65 20 61
     76 61 69 6C 61 62 6C 65
     0D 
256F 44       00681 SPCERR$ DB      'Device spec required',CR
     65 76 69 63 65 20 73 70
     65 63 20 72 65 71 75 69
     72 65 64 0D 
              00682 ;
2584 80       00683 PRMTBL$ DB      80H,53H,'NIL',0
     53 4E 49 4C 00 
258A 4E24     00684         DW      NPARM+1
258C 56       00685         DB      56H,'REWIND',0
     52 45 57 49 4E 44 00 
2594 DF24     00686         DW      RPARM+1
2596 00       00687         NOP
              00688 ;
2597 18FE     00689 RTEDVR  JR      $               ;No real jump
2599 0000     00690         DW      $-$             ;Stuff of high
259B 05       00691         DB      5
259C 52       00692 RTENAM  DB      'RTExx'
     54 45 78 78 
25A1 0000     00693         DW      0,0
     0000 
              00694 ;
25A5 00       00695 FCBDST  DB      0
25A6          00696         DS      31
25C5 00       00697 FCBFIL  DB      0
25C6          00698         DS      31
25E5 00       00699 FCBSRC  DB      0
25E6          00700         DS      31
              00701 ;
2400          00702         END     ROUTE
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]

Valid HTML 4.01!