home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 2: PC / frozenfish_august_1995.bin / bbs / d03xx / d0366.lha / DosError / DosError.s < prev    next >
Text File  |  1990-08-12  |  11KB  |  347 lines

  1.  
  2. ;
  3. ;   DOSError V2.0
  4. ;
  5. ;   Assembly Language by Robert Lang. 23/5/90.
  6. ;   (C) Edgeware (Robert Lang)
  7. ;
  8. ;   This program simply outputs a little message
  9. ;   explaining the input dos error number!
  10. ;
  11. ;   If you use ANY part of this source, contact me, and
  12. ;   put my name in your own source unless you persuade me
  13. ;   otherwise !
  14. ;
  15. ;   If you reassemble this program with different messages,
  16. ;   you MUST leave my name in the usage text.
  17. ;
  18. ;   REMEMBER : This source is still 100% my own property.
  19. ;   I am simply lending it to the public.
  20. ;
  21. ;   Contact me at the address in the listing with any questions or
  22. ;   problems.
  23. ;
  24. ; V2.0 Updates :
  25. ;
  26. ; Added an extra line description to make things a little more useful,
  27. ; and added a heading to the ALL option.
  28. ; Added the workbench routine, including the question for the argument.
  29. ; Added an icon !
  30.  
  31. ; Label definitions
  32.  
  33. execbase=4
  34. getmsg=-372
  35. findtask=-294
  36. waitport=-384
  37.  
  38. ; Exec Functions
  39.  
  40. openlib=-408
  41. closelib=-414
  42.  
  43. ; Dos Functions
  44.  
  45. mode_oldfile=1005
  46. write=-48
  47. read=-42 
  48. output=-60
  49. open=-30
  50. close=-36
  51.  
  52. ; Setting up Program
  53.  
  54.     section begin,code_c 
  55.  
  56. begin:    move.b    d0,d5        ;Save the argument pointer
  57.     move.l    execbase,a6    ;This checks if it was run from
  58.     suba.l    a1,a1        ;the workbench or the CLI....
  59.     jsr    findtask(a6)
  60.     move.l    d0,a4
  61.     tst.l    $ac(a4)
  62.     bne    cli        ; Its from the CL, so read argument
  63. wbench:    lea    $5c(a4),a0    ; Its from the Workbench,
  64.     jsr    waitport(a6)    ; so handle messages....
  65.     lea    $5c(a4),a0    ; (Otherwise visit from guru....)
  66.     jsr    getmsg(a6)
  67.     bra    workbench    ; and open console etc...
  68. cli:    move.b    #0,wbflag
  69.     move.b    d5,d0        ; Retrieve the argument pointer
  70.     subq    #1,d0        ; All of this is to read the
  71.     beq    ok        ; arguments off the CLI line
  72. search:    cmp.b    #$20,(a0)+
  73.     bne    oky
  74.     dbra    d0,search
  75.     bra    ok
  76. oky:    sub.l    #1,a0
  77. ok:    move.b    d0,paramno    ; And store pointers for my use !
  78.     move.l    a0,paramaddr
  79.  
  80. none:    move.l    execbase,a6    ; This opens the dos.library
  81.     lea    dosname(pc),a1
  82.     moveq    #0,d0
  83.     jsr    openlib(a6)
  84.     move.l    d0,dosbase
  85.     beq     error        ; Can't open library...exit!
  86.     
  87. ; Main Program
  88.  
  89.     move.l    dosbase,a6    ; Find the handle of the
  90.     jsr    output(a6)    ; output channel for text !
  91.     move.l    d0,conhandle
  92.         
  93.     move.b    paramno,d0    ; Check that a parameter was entered
  94.     cmp.b    #0,d0
  95.     beq    question    ; NO! Ask for one.....
  96.  
  97.     move.l    #useend-1,d2    ; YES! Output a linefeed
  98.     move.l    #1,d3
  99.     bsr    text
  100.     
  101. join:    move.l    paramaddr,a1    ; Check for common ? argument
  102.     cmp.b    #'?',(a1)    ; to find usage of CLI command
  103.     beq    usage        ; YES! show usage....
  104.  
  105.     move.l    paramaddr,a1    ; YES! Setup for finding a match
  106.     move.l    #errorlist,a2    ; points to my errorlist
  107.     move.l    #err103,d2    ; the first error in the list
  108.     move.l    #31,d3        ; there are 31 errors in the list
  109.  
  110.     move.l    (a1),d0        ; read the 4 bytes from input
  111. loop:    move.l    (a2),d1        ; and the 4 from the error list
  112.     cmp.l    d0,d1        ; the same ?
  113.     beq    found        ; YES ! Display the message
  114.     add.l    #4,a2        ; No, so move to next error in list
  115.     add.l    #41*2,d2    ; and next error message
  116.     sub.b    #1,d3        ; Is this our last error check ?
  117.     bne    loop        ; NO! Do some more
  118.  
  119.     move.b    (a1)+,d0    ; Check for all case variations of ALL
  120.     cmp.b    #'A',d0        ; Check A
  121.     beq    Aok
  122.     cmp.b    #'a',d0        ; or a
  123.     bne    unk
  124. Aok:    move.b    (a1)+,d0
  125.     cmp.b    #'L',d0        ; Check L
  126.     beq    Lok
  127.     cmp.b    #'l',d0        ; or l
  128.     bne    unk
  129. Lok:    move.b    (a1)+,d0    
  130.     cmp.b    #'L',d0        ; Check L
  131.     beq    L2ok
  132.     cmp.b    #'l',d0        ; or l
  133.     bne    unk
  134. L2ok:    move.b    (a1)+,d0    ; Check Return
  135.     cmp.b    #$0a,d0
  136.     bne    unk        
  137. all:    move.l    #fulllist,d2    ; OK! display whole error list
  138.     move.l    #unknown-fulllist,d3
  139.     bsr    text
  140.     bra    end            ; and exit....
  141.  
  142. unk:    move.l    #unknown,d2    ; Argument unknown
  143.     move.l    #41*2,d3    ; So output message !
  144.     bsr    text        
  145.     bra    usage        ; And the usage text....
  146.  
  147. found:    move.l    #41*2,d3    ; Length of all messages
  148.     bsr    text        ; Show the message
  149.     bra    end
  150.  
  151. usage:    move.l    #use,d2        ; Show the usage text
  152.     move.l    #useend-use,d3
  153.     bsr    text
  154.  
  155. end:    move.b    wbflag,d0    ; Was it from Workbench?
  156.     cmp.b    #1,d0
  157.     beq    closecon    ; Yes! Close our console....
  158.  
  159.     move.l    #useend-1,d2    ; Output a linefeed
  160.     move.l    #1,d3
  161.     bsr    text
  162.     
  163.     move.l    execbase,a6    ; Close dos.library
  164.     move.l    dosbase,a1
  165.     jsr    closelib(a6)
  166.     clr.l    d0        ; No probs.
  167. error:    rts            ; Exit Program
  168.  
  169. workbench:
  170.     move.b    #1,wbflag
  171.  
  172.     move.l    execbase,a6    ; This opens the dos.library
  173.     lea    dosname(pc),a1
  174.     moveq    #0,d0
  175.     jsr    openlib(a6)
  176.     move.l    d0,dosbase
  177.     beq     error        ; Can't open library...exit!
  178.  
  179.     move.l    #conname,d1        ; Open Console Window
  180.     move.l    #mode_oldfile,d2
  181.     bsr    openfile
  182.     beq    error            ; Oops....error !
  183.     move.l    d0,conhandle
  184.  
  185. question:                ; Ask for an argument
  186.     move.l    #welcome,d2
  187.     move.l    #return-welcome,d3
  188.     bsr    text
  189.     
  190.     bsr    readin            ; Read in argument
  191.     
  192.     move.l    #useend-1,d2        ; Print Carriage Return
  193.     move.l    #1,d3
  194.     bsr    text
  195.  
  196.     move.l    #buff,paramaddr        ; Point to buffer,
  197.     bra    join            ; and handle data....
  198.     
  199.  
  200. closecon:                ; This closes my con:
  201.     move.l    #return,d2    
  202.     move.l    #use-return,d3        ; First asks to press Return....
  203.     bsr    text
  204.     bsr    readin            ; Wait for return....
  205.     move.l    conhandle,d1
  206.     move.l    dosbase,a6
  207.     jsr    close(a6)        ; Close console....
  208.     clr.l    d0
  209.     rts
  210.  
  211. ; Subroutines
  212.  
  213. text:    move.l    conhandle,d1    ; This routine displays text in
  214.     move.l    dosbase,a6
  215.     jsr    write(a6)    ; the output found earlier
  216.     rts
  217.     
  218. openfile:
  219.     move.l    dosbase,a6    ; This opens a file,
  220.     jsr    open(a6)    ; is used here to open a 
  221.     tst.l    d0        ; CON: screen for input/ouput.
  222.     rts            
  223.  
  224. readin:    move    #4,d3        ; Reads in text
  225.     move.l    #buff,d2    ; 4 long, into 'buff'
  226.     move.l    dosbase,a6    
  227.     move.l    conhandle,d1
  228.     jsr    read(a6)
  229.     rts
  230.  
  231. ; Program Data
  232.  
  233. dosname:    dc.b    'dos.library',0
  234.         even
  235. conname:    dc.b    'CON:100/5/440/195/DOSError V2.0 by Robert Lang 23/5/90',0
  236. wbflag:        dc.b    0
  237.         even
  238. buff:        dc.b    '?   ',0
  239.         even
  240. dosbase:    dc.l    0
  241. conhandle:    dc.l    0
  242. welcome:    dc.b    $0a,'Welcome to DOSError V2.0 !'
  243.         dc.b    $0a,'Please enter the DOS error number : '
  244. return:        dc.b    $0a,'Press RETURN to return to WorkBench....'
  245. use:        dc.b    $0a,'DOSError V2.0 by Robert Lang (c) Edgeware 23/5/90'
  246.         dc.b    $0a,'~~~~~~~~ ~~~~    ~~~~~~~~~~~     ~~~~~~~~',$0a
  247.         dc.b    ' This program gives a two-line description',$0a
  248.         dc.b    ' of what a DOS error number means.',$0a
  249.         dc.b    $0a,' Example Usage : DOSError 205',$0a
  250.         dc.b    $0a,' (Use DOSError ALL to get a list of',$0a
  251.         dc.b    '  all the DOS messages known.)',$0a
  252.         dc.b    $0a,' Write to me : Robert Lang',$0a
  253.             dc.b    '               (EDGEWARE)',$0a
  254.             dc.b    '               P.O. Box 127',$0a
  255.         dc.b    '               CARDIFF NSW 2285',$0a
  256.         dc.b    '               AUSTRALIA',$0a,$0a
  257.         dc.b    '   DOSError is dedicated to Suzanne Day !',$0a,$0a
  258. useend:
  259.  
  260.         even
  261.  
  262. paramno:    dc.l    0
  263. paramaddr:    dc.l    0
  264.  
  265. errorlist:    dc.b    '103',$0a,'105',$0a,'120',$0a,'121',$0a,'122',$0a
  266.         dc.b    '201',$0a,'202',$0a,'203',$0a,'204',$0a,'205',$0a
  267.         dc.b    '206',$0a,'207',$0a,'209',$0a,'210',$0a,'211',$0a
  268.         dc.b    '212',$0a,'213',$0a,'214',$0a,'215',$0a,'216',$0a 
  269.         dc.b    '217',$0a,'218',$0a,'219',$0a,'220',$0a,'221',$0a
  270.         dc.b    '222',$0a,'223',$0a,'224',$0a,'225',$0a,'226',$0a 
  271.         dc.b    '232',$0a
  272.         even
  273.  
  274. fulllist:    dc.b    '----------------------------------------',$0a
  275.         dc.b    '  DOSError V2.0 by Robert Lang 23/5/90  ',$0a
  276.         dc.b    '----------------------------------------',$0a
  277. err103:        dc.b    'DOS Error 103 : INSUFFICIENT FREE STORE ',$0a
  278.         dc.b    'Not Enough Memory is available.         ',$0a
  279. err105:        dc.b    'DOS Error 105 : TASK TABLE FULL         ',$0a
  280.         dc.b    'There are already 20 processes runnning.',$0a
  281. err120:        dc.b    'DOS Error 120 : LINE TOO LONG OR INVALID',$0a
  282.         dc.b    'Too many or invalid arguments used.     ',$0a
  283. err121:        dc.b    'DOS Error 121 : FILE NOT OBJECT         ',$0a
  284.         dc.b    'The called file cannot be executed.     ',$0a
  285. err122:        dc.b    'DOS Error 122 : INVALID RESIDENT LIBRARY',$0a
  286.         dc.b    'The resident library called was invalid.',$0a
  287. err201:        dc.b    'DOS Error 201 : NO DEFAULT DIRECTORY    ',$0a
  288.         dc.b    'A default directory could not be found! ',$0a
  289. err202:        dc.b    'DOS Error 202 : OBJECT IN USE           ',$0a
  290.         dc.b    'The file or directory is being used.    ',$0a
  291. err203:        dc.b    'DOS Error 203 : OBJECT EXISTS           ',$0a
  292.         dc.b    'The specified file already exists.      ',$0a
  293. err204:        dc.b    'DOS Error 204 : DIRECTORY NOT FOUND     ',$0a
  294.         dc.b    'The specified directory does not exist. ',$0a
  295. err205:        dc.b    'DOS Error 205 : OBJECT NOT FOUND        ',$0a
  296.         dc.b    'The channel specified does not exist.   ',$0a
  297. err206:        dc.b    'DOS Error 206 : INVALID WINDOW          ',$0a
  298.         dc.b    'Incorrect parameters for the window.    ',$0a
  299. err207:        dc.b    'DOS Error 207 : OBJECT TOO LARGE        ',$0a
  300.         dc.b    'The specified file is too big.          ',$0a
  301. err209:        dc.b    'DOS Error 209 : ACTION NOT KNOWN        ',$0a
  302.         dc.b    'The device cannot do the desired action.',$0a
  303. err210:        dc.b    'DOS Error 210 : INVALID COMPONENT NAME  ',$0a
  304.         dc.b    'The filename is too long or invalid.    ',$0a
  305. err211:        dc.b    'DOS Error 211 : INVALID LOCK            ',$0a
  306.         dc.b    'The specified lock structure is invalid.',$0a
  307. err212:        dc.b    'DOS Error 212 : OBJECT WRONG TYPE       ',$0a
  308.         dc.b    'Directory and filename interchanged.    ',$0a
  309. err213:        dc.b    'DOS Error 213 : DISK NOT VALIDATED      ',$0a
  310.         dc.b    'The disk is not recognised by the system',$0a
  311. err214:        dc.b    'DOS Error 214 : DISK WRITE PROTECTED    ',$0a
  312.         dc.b    'Writing is not possible to that device. ',$0a
  313. err215:        dc.b    'DOS Error 215 : RENAME ACROSS DEVICES   ',$0a
  314.         dc.b    'Devices in rename must be same.         ',$0a
  315. err216:        dc.b    'DOS Error 216 : DIRECTORY NOT EMPTY     ',$0a
  316.         dc.b    'Non-Empty directories cannot be deleted.',$0a
  317. err217:        dc.b    'DOS Error 217 : TOO MANY LEVELS         ',$0a
  318.         dc.b    'Too many directory names used.          ',$0a
  319. err218:        dc.b    'DOS Error 218 : DEVICE NOT MOUNTED      ',$0a
  320.         dc.b    'That device is not currently available. ',$0a
  321. err219:        dc.b    'DOS Error 219 : SEEK ERROR              ',$0a
  322.         dc.b    'Error in the Seek() function parameters.',$0a
  323. err220:        dc.b    'DOS Error 220 : COMMENT TOO BIG         ',$0a
  324.         dc.b    'The File Comment was too large.         ',$0a
  325. err221:        dc.b    'DOS Error 221 : DISK FULL               ',$0a
  326.         dc.b    'Not enough space on the specified disk. ',$0a
  327. err222:        dc.b    'DOS Error 222 : DELETE PROTECTED        ',$0a
  328.         dc.b    'The file cannot be deleted.             ',$0a
  329. err223:        dc.b    'DOS Error 223 : WRITE PROTECTED         ',$0a
  330.         dc.b    'The file cannot be overwritten.         ',$0a
  331. err224:        dc.b    'DOS Error 224 : READ PROTECTED          ',$0a
  332.         dc.b    'The file cannot be read.                ',$0a
  333. err225:        dc.b    'DOS Error 225 : NOT A DOS DISK          ',$0a
  334.         dc.b    'AmigaDOS does not recognise this disk.  ',$0a
  335. err226:        dc.b    'DOS Error 226 : NO DISK                 ',$0a
  336.         dc.b    'There is no disk in the specified drive.',$0a
  337. err232:        dc.b    'DOS Error 232 : NO MORE ENTRIES         ',$0a
  338.         dc.b    'Last valid file found in the directory. ',$0a
  339.         dc.b    '----------------------------------------',$0a
  340.         dc.b    '  (c) Edgeware 1990 -- Australian Made  ',$0a
  341.         dc.b    '----------------------------------------',$0a
  342. unknown:    dc.b    'Unknown Argument !                      ',$0a
  343.         dc.b    'Usage of DOSError V2.0 is as follows :  ',$0a
  344.  
  345. Programend:
  346.  
  347.