Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.5 KiB

  1. .286p
  2. include cmacros.inc
  3. ?WIN=1 ; Use Windows prolog/epilog
  4. ?PLM=1 ; Use PASCAL calling convention
  5. externW __ahincr
  6. sBegin CODE ;INIT_TEXT
  7. assumes cs,CODE ;INIT_TEXT
  8. assumes ds,DATA
  9. cProc HugeOffset,<NEAR, PUBLIC>
  10. parmD pSrc
  11. parmD cb
  12. cBegin
  13. mov ax, SEG_cb
  14. mov dx, ax
  15. mov ax, OFF_pSrc
  16. add ax, OFF_cb ;add src offset and bytecount
  17. adc dx, 0 ;dx = # segments to increment
  18. mov cx, ax ;save new offset
  19. mov ax, dx ;#segs into ax
  20. lea bx, __ahincr
  21. mul bx ;__ahincr ;mul by windows magic #
  22. mov dx, ax ;restore to dx for output
  23. mov ax, cx ;restore for output
  24. add dx, SEG_pSrc
  25. cEnd
  26. ifdef DEBUG
  27. cProc StkTrace,<NEAR, PUBLIC>
  28. parmW cFrames
  29. parmD lpBuf
  30. cBegin
  31. push es
  32. mov cx, cFrames
  33. mov bx, bp
  34. les di, lpBuf
  35. cld
  36. x:
  37. mov bx, ss:[bx]
  38. and bx, 0FFFEh
  39. mov ax, ss:[bx+2]
  40. stosw
  41. loopnz x
  42. pop es
  43. cEnd
  44. endif
  45. ?WIN=0 ; turn off windows prolog/epilog stuff
  46. ;
  47. ; SwitchDS
  48. ;
  49. ; Routine to switch the DS to word argument
  50. ; Called from C but without C DS glue.
  51. ;
  52. cProc SwitchDS,<NEAR, PUBLIC>
  53. parmW newDS
  54. cBegin
  55. mov ax,ds ; old DS is return value
  56. mov ds,newDS
  57. cEnd
  58. sEnd CODE ;INIT_TEXT
  59. end
  60.