graphic.asm
上传用户:xiaoan1112
上传日期:2013-04-11
资源大小:19621k
文件大小:3k
源码类别:

操作系统开发

开发平台:

Visual C++

  1. ;*
  2. ;* CW : Character Windows
  3. ;*
  4. ;* graphic.asm : GPD/GSD interface layer
  5. include user.inc
  6. include indrv.inc
  7. include ingxd.inc
  8. ;*****************************************************************************
  9. externFP <RerrLoadDrv,FreeIndv>
  10. ;*****************************************************************************
  11. sBegin BSS
  12.     assumes DS,DGROUP
  13. Assert <cpfnGsdMin EQ cpfnGpdMin>
  14. ;* * INDJ structure
  15. labelB <PUBLIC, indjGsd>
  16. DD cpfnGsdMin DUP (0)
  17. labelB <PUBLIC, indjGpd>
  18. DD cpfnGpdMin DUP (0)
  19. sEnd BSS
  20. sBegin DATA
  21.     assumes DS,DGROUP
  22. globalW fPrinting, 0
  23. globalW pindjCur, <dataOffset indjGsd>
  24. labelB <PUBLIC, indvGsd> ;* Graphic Screen
  25. DB indtGraphicScreen,0
  26. DW dataOffset indjGsd
  27. DW cpfnGsdMin
  28. DW cpfnGsdMin
  29. DW 0
  30. DW 0
  31. labelB <PUBLIC, indvGpd> ;* Graphic Printer
  32. DB indtGraphicPrinter,0
  33. DW dataOffset indjGpd
  34. DW cpfnGpdMin
  35. DW cpfnGpdMin
  36. DW 0
  37. DW 0
  38. sEnd DATA
  39. ;*****************************************************************************
  40. ;* Load GSD file
  41. sBegin INIT
  42.     assumes CS,INIT
  43.     assumes DS,DGROUP
  44.     assumes SS,DGROUP
  45. ;********** FreeGsd/Gpd **********
  46. ;* entry: bx = pindv for which driver
  47. ;* * Free a GSD/GPD driver
  48. ;* exit: n/a
  49. ;* GPD free
  50. LabelFP <PUBLIC, FreeGpd>
  51. mov bx,dataOffset indvGpd
  52. jmp short FreeGsdGpd
  53. ;* GSD free
  54. LabelFP <PUBLIC, FreeGsd>
  55. mov bx,dataOffset indvGsd
  56. cPublic FreeGsdGpd
  57. cBegin FreeGsdGpd
  58. ;* enter with BX => indv
  59. cCall FreeIndv, <bx>
  60. cEnd FreeGsdGpd
  61. ;********** FLoadGsd/Gpd **********
  62. ;* entry: szFile = file name
  63. ;* bx = pindv for which driver
  64. ;* * Try and load a GSD/GPD driver
  65. ;* exit: AX != 0 if loaded successfully
  66. ;* GPD load
  67. LabelFP <PUBLIC, FLoadGpd>
  68. mov bx,dataOffset indvGpd
  69. jmp short FLoadGsdGpd
  70. ;* GSD load
  71. LabelFP <PUBLIC, FLoadGsd>
  72. mov bx,dataOffset indvGsd
  73. cPublic FLoadGsdGpd
  74.     parmDP szFile
  75. cBegin FLoadGsdGpd
  76. ;* enter with BX => indv
  77. mov cx,1
  78. Save <bx>
  79. cCall RerrLoadDrv, <szFile, bx, cx>
  80. or ax,ax
  81. mov ax,0
  82. jnz end_fload ;* load error
  83. mov cx,[bx].psLoadedIndv
  84. jcxz end_fload ;* not loaded
  85. inc ax ;* success
  86. end_fload:
  87. cEnd FLoadGsdGpd
  88. sEnd INIT
  89. ;*****************************************************************************
  90. sBegin SCREEN
  91.     assumes CS,SCREEN
  92.     assumes DS,DGROUP
  93.     assumes SS,DGROUP
  94. ;********** SetPrinting **********
  95. ;* entry: fEnablePrinting => whether we want printing or not
  96. ;* * set up globals for subsequent graphic driver calls
  97. cPublic SetPrinting
  98.     parmW  fEnablePrinting
  99. cBegin SetPrinting
  100. mov cx,fEnablePrinting
  101. mov ax,dataOffset indjGsd
  102. jcxz @F ;* back to screen
  103. mov ax,dataOffset indjGpd
  104. @@:
  105. mov pindjCur,ax
  106. mov fPrinting,cx
  107. cEnd SetPrinting
  108. ;*****************************************************************************
  109. ;* Driver Stubs (see Documentation for interface details)
  110. GD_ENTRY MACRO label
  111. labelFP <PUBLIC, label>
  112. mov bx,pindjCur
  113. AssertNE <word ptr [bx].pfn&label&Indj>,0 ;* trap empty vector
  114. jmp [bx].pfn&label&Indj
  115. ENDM
  116. GD_ENTRY FInitGraphics
  117. GD_ENTRY TermGraphics
  118. GD_ENTRY Move
  119. GD_ENTRY Draw
  120. GD_ENTRY SetAreaPat
  121. GD_ENTRY SetLinePat
  122. GD_ENTRY SetLineWeight
  123. GD_ENTRY SetColor
  124. GD_ENTRY Text
  125. GD_ENTRY Rectangle
  126. GD_ENTRY Arc
  127. GD_ENTRY Polygon
  128. GD_ENTRY BitBlt
  129. ;*****************************************************************************
  130. sEnd SCREEN
  131. END