home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / lan / newnode / newnode.asm < prev    next >
Assembly Source File  |  1988-02-06  |  4KB  |  191 lines

  1. ;
  2. ;NewNode.ASM -- Node finder for NetWare
  3. ;
  4. ;     December 6, 1987
  5. ;
  6. ;
  7. ;
  8. CSEG          Segment
  9.               Assume  CS:CSEG,DS:CSEG
  10.               Org     100h
  11. Entry:                JMP     Begin
  12.       DB      " NewNode (c) 1987 Jeffrey Diehl "
  13.       DB      "Released to the Public Domain"
  14.       DB      "Syntax: NewNode  "
  15.       DB      "Output: Prints the 12-digit Hexidecimal"
  16.       DB      " address of the workstation, then"
  17.       DB      " converts the last two digits to"
  18.       DB      " decimal."
  19.       DB      "   The DOS IF ERRORLEVEL batch command"
  20.       DB      " can use the return to branch."
  21. CX4   DW      ?
  22. BX4   DW      ?
  23. AX4   DW      ?
  24. PNODE DB      "The Node Address of this workstation"
  25.       DB      " is",0Dh,0Ah,"$"
  26. HEXI  DB      " Hexidecimal, or $"
  27. DECI  DB      " Decimal.  $"
  28. OOPS  DB      "OOPS! The NetWare shell returned a 0,"
  29.       DB      " so you either don't have the shell loaded"
  30.       DB      " or you are at a non-dedicated server,"
  31.       DB      " or you don't have a network card!"
  32. CRLF  DB      0Dh,0Ah,"$"
  33. GETSTN        EQU     0DCh
  34. GETNWAD       EQU     0EEh
  35. PRTCHR        EQU     02h
  36. PRTSTR        EQU     09h
  37. DOS   EQU     21h
  38. ;
  39. ;
  40. Begin:
  41. ;Set up a CRLF to the CRT
  42. ;
  43.       MOV     DX,OFFSET CRLF
  44.       MOV     AH,PRTSTR
  45.       INT     DOS
  46. ;
  47. ;Send the first line to the CRT
  48. ;
  49.       MOV     DX,OFFSET PNODE
  50.       MOV     AH,PRTSTR
  51.       INT     DOS
  52. ;
  53. ;See if the NetWare shell is active
  54. ;
  55.       MOV     AH,GETSTN
  56.       INT     DOS
  57. ;
  58.       CMP     AL,0
  59.       JA      GET_ADDR
  60. No_NET:       MOV     DX,Offset OOPS
  61.       MOV     AX4,1
  62.       MOV     AH,PRTSTR
  63.       INT     DOS
  64.       JMP     OUT
  65. ;
  66. GET_ADDR:
  67. ;Get the Address from the NetWare Shell
  68. ;
  69.       MOV     AH,GETNWAD
  70.       INT     DOS
  71. ;
  72. ;Now store off the address before messing with it
  73. ;
  74.       MOV     AX4,AX
  75.       MOV     BX4,BX
  76.       MOV     CX4,CX
  77. ;
  78. ;But First check if NetWare returned ok address.
  79. ;If last two chars are 0, then check if last 8
  80. ; chars are 0, just to be certain.
  81. ;
  82.       CMP     AX,0
  83.       JA      NET_OK
  84.       MOV     AX,BX
  85.       CMP     AX,0
  86.       JA      NET_OK
  87. No_ADDR:
  88.       MOV     DX,Offset OOPS
  89.       MOV     AX4,1
  90.       MOV     AH,PRTSTR
  91.       INT     DOS
  92.       JMP     OUT
  93. ;
  94. NET_OK:
  95. ;Send the hex chars to the CRT four at a time.
  96. ;
  97.       MOV     AX,CX4
  98.       CALL    HEX4PRN
  99. ;
  100.       MOV     AX,BX4
  101.       CALL    HEX4PRN
  102. ;
  103.       MOV     AX,AX4
  104.       CALL    HEX4PRN
  105. ;
  106. ;
  107. ;Send the Hexi message to the CRT
  108. ;
  109.       MOV     DX,OFFSET HEXI
  110.       MOV     AH,PRTSTR
  111.       INT     DOS
  112. ;
  113. ;
  114. ;Convert the last two digits to decimal for message
  115. ;
  116.       SUB     AX,AX   ;Clear the accumulator
  117.       MOV     AX,AX4  ;Put the last four hex into AL
  118.       AND     AX,0FFh ; but only keep last two
  119.       MOV     BL,100  ;Byte divisor
  120.       DIV     BL      ;
  121.       MOV     CH,AH   ;Keep remainder from AH
  122.       ADD     AL,'0'  ; convert to ascii
  123.       CALL    PRINTIT ;quotient in AL
  124. ;
  125.       MOV     AL,CH   ;Get remainder back
  126.       AND     AX,0FFh ;
  127.       MOV     BL,10   ;
  128.       DIV     BL      ;
  129.       MOV     CH,AH   ;Keep remainder from AH
  130.       ADD     AL,'0'  ;
  131.       CALL    PRINTIT ;
  132. ;
  133.       MOV     AL,CH   ;Get remainder back
  134.       ADD     AL,'0'  ;
  135.       CALL    PRINTIT ; and print it
  136. ;
  137. ;Send the Decimal message to the CRT
  138. ;
  139.       MOV     DX,OFFSET DECI
  140.       MOV     AH,PRTSTR
  141.       INT     DOS
  142. ;
  143. ;Set up a CRLF to the CRT
  144. ;
  145.       MOV     DX,OFFSET CRLF
  146.       MOV     AH,PRTSTR
  147.       INT     DOS
  148. ;
  149. ;Now get out!
  150. ;
  151. OUT:  MOV     AX,AX4
  152. ;leave the DOS IF ERRORLEVEL
  153. ; value intact
  154.       MOV     AH,4Ch
  155.       INT     DOS
  156. ;
  157. ;
  158. ;Sub-Routines follow
  159. ;
  160. HEX4PRN:
  161. ;Convert Hexi character in AX to ASCII
  162. ;
  163.       MOV     BX,AX
  164.       MOV     CL,04
  165.       MOV     CH,04
  166. ;
  167. LOOP: ROL     BX,CL
  168.       MOV     AL,BL
  169.       AND     AL,0Fh
  170.       ADD     AL,90h
  171.       DAA
  172.       ADC     AL,40h
  173.       DAA
  174.       CALL PRINTIT
  175. ;
  176.       DEC     CH
  177.       JNZ     LOOP
  178. ;
  179.       RET
  180. ;
  181. PRINTIT:
  182. ;Single Character print AL=Char
  183. ;
  184.       MOV     DL,AL
  185.       MOV     AH,PRTCHR
  186.       INT     DOS
  187.       RET
  188. ;
  189. CSEG  ENDS
  190.       END     Entry
  191.