/src/obsolete/user/commands/attribute/attribute.s

http://github.com/jockepockee/ogrp-os · Assembly · 135 lines · 112 code · 15 blank · 8 comment · 0 complexity · 55f7ede35ef99dc63f50519cf01f5a15 MD5 · raw file

  1. ; * This file is a part of the ogrp-os project
  2. ; * Version: 0.1 19 Aug 2010
  3. ;
  4. ; * Authors: jockepockee, mr3d (jockepockee.com, h4xxel.ath.cx)
  5. ; * Email: jocke@h4xx.org h4xxel@h4xx.org
  6. ;
  7. ; * Copyright 2010 ogrp
  8. ; * License: see COPYING file
  9. s
  10. mov bx, si
  11. ParameterCheckLoop:
  12. cmp [es:si], byte ':'
  13. je Parameter
  14. cmp [es:si], byte 0
  15. je NoAttrib
  16. inc si
  17. jmp ParameterCheckLoop
  18. Parameter:
  19. mov [es:si], byte 0
  20. inc si
  21. xor al, al
  22. AddAttribs:
  23. mov dh, [es:si]
  24. cmp dh, 0
  25. je AddAttribFinished
  26. AddAttribX:
  27. cmp dh, 'x'
  28. jne AddAttribR
  29. mov dl, al
  30. and dl, 0000_0001b
  31. cmp dl, 0000_0001b
  32. je NoAttrib
  33. add al, 0000_0001b
  34. inc si
  35. jmp AddAttribs
  36. AddAttribR:
  37. cmp dh, 'r'
  38. jne AddAttribW
  39. mov dl, al
  40. and dl, 0000_0010b
  41. cmp dl, 0000_0010b
  42. je NoAttrib
  43. add al, 0000_0010b
  44. inc si
  45. jmp AddAttribs
  46. AddAttribW:
  47. cmp dh, 'w'
  48. jne AddAttribV
  49. mov dl, al
  50. and dl, 0000_0100b
  51. cmp dl, 0000_0100b
  52. je NoAttrib
  53. add al, 0000_0100b
  54. inc si
  55. jmp AddAttribs
  56. AddAttribV:
  57. cmp dh, 'v'
  58. jne NoAttrib
  59. mov dl, al
  60. and dl, 0000_1000b
  61. cmp dl, 0000_1000b
  62. je NoAttrib
  63. add al, 0000_1000b
  64. inc si
  65. jmp AddAttribs
  66. AddAttribFinished:
  67. xor dx, dx
  68. xor cx, cx
  69. mov ah, 4
  70. cmp [es:bx], byte 0
  71. je AttribEnd
  72. int 25h
  73. cmp ah, 1
  74. je ErrorOccured
  75. push cs
  76. pop es
  77. xor dx, dx
  78. xor cx, cx
  79. mov ah, 0
  80. mov bx, AttribChangedMSG
  81. int 26h
  82. jmp AttribEnd
  83. NoAttrib:
  84. push cs
  85. pop es
  86. mov ah, 0
  87. mov bx, NoAttribMSG
  88. int 26h
  89. jmp AttribEnd
  90. DriveNotReady:
  91. push cs
  92. pop es
  93. mov ah, 0
  94. mov bx, DriveNotReadyMSG
  95. int 26h
  96. jmp AttribEnd
  97. NoFile:
  98. push cs
  99. pop es
  100. mov ah, 0
  101. mov bx, NoFileMSG
  102. int 26h
  103. jmp AttribEnd
  104. ErrorOccured:
  105. cmp al, 1
  106. je DriveNotReady
  107. cmp al, 2
  108. je NoFile
  109. push cs
  110. pop es
  111. mov ah, 0
  112. mov bx, UnknownErrorMSG
  113. int 26h
  114. AttribEnd:
  115. retf
  116. AttribChangedMSG db "Attributes changed!",13d,10d,0
  117. DriveNotReadyMSG db "Error: Drive not ready!",13d,10d,0
  118. NoFileMSG db "Error: No such file!",13d,10d,0
  119. NoAttribMSG db "Error: Invalid attribute string!",13d,10d,0
  120. UnknownErrorMSG db "Error: Unknown error!",13d,10d,0