TESTDA.ASM 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. ;
  2. ; $Source: f:/miner/source/div/rcs/div0.asm $
  3. ; $Revision: 1.1 $
  4. ; $Author: john $
  5. ; $Date: 1993/09/17 12:37:51 $
  6. ;
  7. ; Divide by zero error handler functions
  8. ;
  9. ; $Log: div0.asm $
  10. ; Revision 1.1 1993/09/17 12:37:51 john
  11. ; Initial revision
  12. ;
  13. ;
  14. ;
  15. .386
  16. _DATA SEGMENT BYTE PUBLIC USE32 'DATA'
  17. _DATA ENDS
  18. DGROUP GROUP _DATA
  19. _TEXT SEGMENT BYTE PUBLIC USE32 'CODE'
  20. ASSUME DS:_DATA
  21. ASSUME CS:_TEXT
  22. extern div0_set_handler_:PROC
  23. PUBLIC correct_
  24. correct_:
  25. mov eax, 15
  26. jmp Corrected
  27. PUBLIC testdivide_
  28. testdivide_:
  29. push ecx
  30. push edx
  31. PUBLIC div0_my_add1_
  32. div0_my_add1_:
  33. mov edx, 1
  34. mov eax, 1
  35. mov ecx, 0
  36. PUBLIC div0_my_add_
  37. div0_my_add_:
  38. idiv ecx ; should cause error
  39. Corrected:
  40. pop edx
  41. pop ecx
  42. ret
  43. PUBLIC setup_correct_
  44. setup_correct_:
  45. push eax
  46. push edx
  47. mov eax, offset div0_my_add1_
  48. mov edx, offset correct_
  49. call div0_set_handler_
  50. mov eax, offset div0_my_add_
  51. mov edx, offset correct_
  52. call div0_set_handler_
  53. pop edx
  54. pop eax
  55. ret
  56. _TEXT ENDS
  57. END