Subversion Repositories Kolibri OS

Rev

Rev 314 | Rev 381 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;                                                        ;;
  3. ;;  VESA12.INC                                            ;;
  4. ;;                                                        ;;
  5. ;;  Vesa 1.2 functions for MenuetOS                       ;;
  6. ;;                                                        ;;
  7. ;;  Copyright 2002 Ville Turjanmaa                        ;;
  8. ;;                                                        ;;
  9. ;;  quickcode@mail.ru - bankswitch for S3 cards           ;;
  10. ;;                                                        ;;
  11. ;;  See file COPYING for details                          ;;
  12. ;;                                                        ;;
  13. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  14.  
  15.  
  16. ; A complete video driver should include the following types of function
  17. ;
  18. ; Putpixel
  19. ; Getpixel
  20. ;
  21. ; Drawimage
  22. ; Drawbar
  23. ;
  24. ; Drawbackground
  25. ;
  26. ;
  27. ; Modifying the set_bank -function is mostly enough
  28. ; for different Vesa 1.2 setups.
  29.  
  30. ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  31. ; set_bank for Trident videocards, work on Trident 9440
  32. ; modified by Mario79
  33. ;set_bank:
  34. ;cli
  35. ;cmp al,[0xfff2]
  36. ;je retsb
  37. ;mov [0xfff2],al
  38. ;push dx
  39. ;mov dx,3D8h
  40. ;out  dx,al
  41. ;pop dx
  42. ;retsb:
  43. ;sti
  44. ;ret
  45.  
  46.  
  47. ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  48. ; set_bank for S3 videocards, work on S3 ViRGE PCI (325)
  49. ; modified by kmeaw
  50. set_bank:
  51. pushfd
  52. cli
  53. cmp al,[0xfff2]
  54. je retsb
  55. mov [0xfff2],al
  56. push ax
  57. push dx
  58. push cx
  59. mov cl, al
  60. mov dx, 0x3D4
  61. mov al, 0x38
  62. out dx, al     ;CR38 Register Lock 1 ;Note: Traditionally 48h is used to
  63.                ;unlock and 00h to lock
  64. inc dx
  65. mov al, 0x48
  66. out dx, al     ;3d5 -?
  67. dec dx
  68. mov al, 0x31
  69. out dx, al     ;CR31 Memory Configuration Register
  70. ;0  Enable Base Address Offset (CPUA BASE). Enables bank operation if set, ;disables if clear.
  71. ;4-5  Bit 16-17 of the Display Start Address. For the 801/5,928 see index 51h,
  72. ;for the 864/964 see index 69h.
  73.  
  74. inc dx
  75. in al, dx
  76. dec dx
  77. mov ah, al
  78. mov al, 0x31
  79. out dx, ax
  80. mov al, ah
  81. or al, 9
  82. inc dx
  83. out dx, al
  84. dec dx
  85. mov al, 0x35
  86. out dx, al   ;CR35 CRT Register Lock
  87. inc dx
  88. in al, dx
  89. dec dx
  90. and al, 0xF0
  91. mov ch, cl
  92. and ch, 0x0F
  93. or ch, al
  94. mov al, 0x35
  95. out dx, al
  96. inc dx
  97. mov al, ch
  98. out dx, ax
  99. dec dx
  100. mov al, 0x51  ;Extended System Control 2 Register
  101. out dx, al
  102. inc dx
  103. in al, dx
  104. dec dx
  105. and al, 0xF3
  106. shr cl, 2
  107. and cl, 0x0C
  108. or cl, al
  109. mov al, 0x51
  110. out dx, al
  111. inc dx
  112. mov al, cl
  113. out dx, al
  114. dec dx
  115. mov al, 0x38
  116. out dx, al
  117. inc dx
  118. xor al, al
  119. out dx, al
  120. dec dx
  121. pop cx
  122. pop dx
  123. pop ax
  124. retsb:
  125. popfd
  126. ret
  127.  
  128. ;Set bank function for Intel 810/815 chipsets
  129. ; *****Modified by Protopopius, Russia.*****
  130. ; ********* http://menuetos.hut.ru **************
  131. ; ************************************************
  132. ;
  133. ;set_bank:
  134. ;cli
  135. ;cmp al,[0xfff2]
  136. ;je retsb
  137. ;mov [0xfff2],al
  138. ;push ax
  139. ;push dx
  140. ;mov dx,3CEh
  141. ;mov ah,al            ; Save value for later use
  142. ;mov al,10h           ; Index GR10 (Address Mapping)
  143. ;out dx,al            ; Select GR10
  144. ;inc dl
  145. ;mov al,3             ; Set bits 0 and 1 (Enable linear page mapping)
  146. ;out dx,al            ; Write value
  147. ;dec dl
  148. ;mov al,11h           ; Index GR11 (Page Selector)
  149. ;out dx,al            ; Select GR11
  150. ;inc dl
  151. ;mov al,ah            ; Write address
  152. ;out dx,al            ; Write the value
  153. ;pop dx
  154. ;pop ax
  155. ;retsb:
  156. ;sti
  157. ;ret
  158.  
  159. ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!}
  160.  
  161. ;set_bank:
  162. ;   cli
  163. ;   cmp al,[0xfff2]
  164. ;   je retsb
  165. ;   mov [0xfff2],al
  166. ;   push ax
  167. ;   push dx
  168. ;   mov ah,al
  169. ;   mov dx,0x03D4
  170. ;   mov al,0x39
  171. ;   out dx,al
  172. ;   inc dl
  173. ;   mov al,0xA5
  174. ;   out dx,al
  175. ;   dec dl
  176. ;   mov al,6Ah
  177. ;   out dx,al
  178. ;   inc dl
  179. ;   mov al,ah
  180. ;   out dx,al
  181. ;   dec dl
  182. ;   mov al,0x39
  183. ;   out dx,al
  184. ;   inc dl
  185. ;   mov al,0x5A
  186. ;   out dx,al
  187. ;   dec dl
  188. ;   pop dx
  189. ;   pop ax
  190. ;
  191. ; retsb:
  192. ;   ret
  193.  
  194.  
  195. vesa12_drawbackground:
  196.  
  197.         call  [disable_mouse]
  198.  
  199.         push  eax
  200.         push  ebx
  201.         push  ecx
  202.         push  edx
  203.  
  204.         xor   edx,edx
  205.         mov   eax,dword[WinMapAddress-8]
  206.         mov   ebx,dword[WinMapAddress-4]
  207.         mul   ebx
  208.         mov   ebx,3
  209.         mul   ebx
  210.         mov   [imax],eax
  211.         mov   eax,[draw_data+32+RECT.left]
  212.         mov   ebx,[draw_data+32+RECT.top]
  213.         mov   edi,0 ;no force
  214.  
  215.       v12dp3:
  216.  
  217.         push  eax
  218.         push  ebx
  219.         mov   esi,0x300000
  220.  
  221.         cmp   [WinMapAddress-12],dword 1     ; tiled background
  222.         jne   no_vesa12_tiled_bgr
  223.  
  224.         push  edx
  225.  
  226.         xor   edx,edx
  227.         mov   ecx,[WinMapAddress-8]
  228.         div   ecx
  229.         mov   eax,edx
  230.  
  231.         push  eax
  232.         mov   eax,ebx
  233.         xor   edx,edx
  234.         mov   ecx,[WinMapAddress-4]
  235.         div   ecx
  236.         mov   ebx,edx
  237.         pop   eax
  238.  
  239.         pop   edx
  240.  
  241.       no_vesa12_tiled_bgr:
  242.  
  243.         cmp   [WinMapAddress-12],dword 2     ; stretched background
  244.         jne   no_vesa12_stretched_bgr
  245.  
  246.         push  edx
  247.  
  248.         imul  eax,dword [WinMapAddress-8]
  249.         xor   edx,edx
  250.         mov   ecx,[0xfe00]
  251.         inc   ecx
  252.         div   ecx
  253.  
  254.         push  eax
  255.         mov   eax,ebx
  256.         imul  eax,dword [WinMapAddress-4]
  257.         xor   edx,edx
  258.         mov   ecx,[0xfe04]
  259.         inc   ecx
  260.         div   ecx
  261.         mov   ebx,eax
  262.         pop   eax
  263.  
  264.         pop   edx
  265.  
  266.       no_vesa12_stretched_bgr:
  267.  
  268.  
  269.         push  eax
  270.         mov   eax,ebx
  271.         xor   edx,edx
  272.         mov   ebx,[WinMapAddress-8]
  273.         add   ebx,[WinMapAddress-8]
  274.         add   ebx,[WinMapAddress-8]
  275.         mul   ebx
  276.         mov   esi,eax
  277.         pop   eax
  278.         add   esi,eax
  279.         add   esi,eax
  280.         add   esi,eax
  281.         add   esi,0x300000
  282.         pop   ebx
  283.         pop   eax
  284.  
  285.       v12di4:
  286.  
  287.         mov   ecx,[esi]
  288.         pusha
  289.         mov   esi,eax
  290.         mov   edi,ebx
  291.         mov   eax,[0xfe00]
  292.         add   eax,1
  293.         mul   ebx
  294.         add   eax,esi
  295.         add   eax,WinMapAddress
  296.         cmp   [eax],byte 1
  297.         jnz   v12nbgp
  298.         mov   eax,[0xfe08]
  299.         mov   ebx,edi
  300.         mul   ebx
  301.         add   eax,esi
  302.         add   eax,esi
  303.         add   eax,esi
  304.         cmp   [0xFBF1],byte 24
  305.         jz    v12bgl3
  306.         add   eax,esi
  307.  
  308.       v12bgl3:
  309.  
  310.         push ebx
  311.         push eax
  312.  
  313.         sub  eax,[0xfe80]
  314.  
  315.         shr  eax,16
  316.         call set_bank
  317.         pop  eax
  318.         and  eax,65535
  319.         add  eax,0xa0000
  320.         pop  ebx
  321.  
  322.         mov   [eax],cx
  323.         add   eax,2
  324.         shr   ecx,16
  325.         mov   [eax],cl
  326.         sti
  327.  
  328.       v12nbgp:
  329.  
  330.         popa
  331.         add   esi,3
  332.         inc   eax
  333.         cmp   eax,[draw_data+32+RECT.right]
  334.         jg    v12nodp31
  335.         jmp   v12dp3
  336.  
  337.       v12nodp31:
  338.  
  339.         mov   eax,[draw_data+32+RECT.left]
  340.         inc   ebx
  341.         cmp   ebx,[draw_data+32+RECT.bottom]
  342.         jg    v12dp4
  343.         jmp   v12dp3
  344.  
  345.       v12dp4:
  346.  
  347.         pop   edx
  348.         pop   ecx
  349.         pop   ebx
  350.         pop   eax
  351.         ret
  352.  
  353.  
  354. vesa12_drawbar:
  355.  
  356.     call  [disable_mouse]
  357.  
  358. ;;    mov  [novesachecksum],dword 0
  359.     sub  edx,ebx
  360.     sub  ecx,eax
  361.     push esi
  362.     push edi
  363.     push eax
  364.     push ebx
  365.     push ecx
  366.     push edx
  367.     mov  ecx,[TASK_BASE]
  368.     add  eax,[ecx-twdw+WDATA.box.left]
  369.     add  ebx,[ecx-twdw+WDATA.box.top]
  370.     push eax
  371.     mov  eax,ebx         ; y
  372.     mov  ebx,[0xfe08]
  373.     mul  ebx
  374.     pop  ecx
  375.     add  eax,ecx         ; x
  376.     add  eax,ecx
  377.     add  eax,ecx
  378.     cmp  [0xfbf1],byte 24     ; 24 or 32 bpp ? - x start
  379.     jz   dbpi2412
  380.     add  eax,ecx
  381.  
  382.   dbpi2412:
  383.  
  384.     add  eax,[0xfe80]
  385.     mov  edi,eax
  386.  
  387.     ; x size
  388.  
  389.     mov  eax,[esp+4] ; [esp+6]
  390.     mov  ecx,eax
  391.     add  ecx,eax
  392.     add  ecx,eax
  393.     cmp  [0xfbf1],byte 24     ; 24 or 32 bpp ? - x size
  394.     jz   dbpi24312
  395.     add  ecx,eax
  396.  
  397.   dbpi24312:
  398.  
  399.     mov  ebx,[esp+0]
  400.  
  401.     ; check limits ?
  402.  
  403.     push eax
  404.     push ecx
  405.     mov  eax,[TASK_BASE]
  406.     mov  ecx,[eax+draw_data-CURRENT_TASK+RECT.left]
  407.     cmp  ecx,0
  408.     jnz  dbcblimitlset12
  409.     mov  ecx,[eax+draw_data-CURRENT_TASK+RECT.top]
  410.     cmp  ecx,0
  411.     jnz  dbcblimitlset12
  412.     mov  ecx,[eax+draw_data-CURRENT_TASK+RECT.right]
  413.     cmp  ecx,[0xfe00]
  414.     jnz  dbcblimitlset12
  415.     mov  ecx,[eax+draw_data-CURRENT_TASK+RECT.bottom]
  416.     cmp  ecx,[0xfe04]
  417.     jnz  dbcblimitlset12
  418.     pop  ecx
  419.     pop  eax
  420.     push dword 0
  421.     jmp  dbcblimitlno12
  422.  
  423.   dbcblimitlset12:
  424.  
  425.     pop  ecx
  426.     pop  eax
  427.     push dword 1
  428.  
  429.   dbcblimitlno12:
  430.  
  431.     cmp  [0xfbf1],byte 24     ; 24 or 32 bpp ?
  432.     jz   dbpi24bit12
  433.     jmp  dbpi32bit12
  434.  
  435.  
  436. ; DRAWBAR 24 BBP
  437.  
  438.  
  439. dbpi24bit12:
  440.  
  441.     push eax
  442.     push ebx
  443.     push edx
  444.     mov  eax,ecx
  445.     mov  ebx,3
  446.     div  ebx
  447.     mov  ecx,eax
  448.     pop  edx
  449.     pop  ebx
  450.     pop  eax
  451.     cld
  452.  
  453.   dbnewpi12:
  454.  
  455.     push ebx
  456.     push edi
  457.     push ecx
  458.  
  459.       xor  edx,edx
  460.       mov  eax,edi
  461.       sub  eax,[0xfe80]
  462.       mov  ebx,3
  463.       div  ebx
  464.       add  eax,WinMapAddress
  465.       mov   ebx,[CURRENT_TASK]
  466.       cld
  467.  
  468.       dbnp2412:
  469.  
  470.         mov  dl,[eax]
  471.         push eax
  472.         push ecx
  473.         cmp  dl,bl
  474.         jnz  dbimp24no12
  475.         cmp  [esp+5*4],dword 0
  476.         jz   dbimp24yes12
  477. ;        call dbcplimit
  478. ;        jnz  dbimp24no12
  479.  
  480.      dbimp24yes12:
  481.  
  482.         push edi
  483.         mov  eax,edi
  484.         sub  eax,[0xfe80]
  485.         shr  eax,16
  486.         call set_bank
  487.         and  edi,0xffff
  488.         add  edi,0xa0000
  489.         mov  eax,[esp+8+3*4+16+4+4]
  490.         stosw
  491.         shr  eax,16
  492.         stosb
  493.         sti
  494.         pop  edi
  495.         add  edi,3
  496.         pop  ecx
  497.         pop  eax
  498.         inc  eax
  499.         loop dbnp2412
  500.         jmp  dbnp24d12
  501.  
  502.       dbimp24no12:
  503.  
  504.         pop  ecx
  505.         pop  eax
  506.         cld
  507.         add  edi,3
  508.         inc  eax
  509.         loop dbnp2412
  510.  
  511.       dbnp24d12:
  512.  
  513.         mov  eax,[esp+3*4+16+4]
  514.         test eax,0x80000000
  515.         jz   nodbgl2412
  516.         cmp  al,0
  517.         jz   nodbgl2412
  518.         dec  eax
  519.         mov  [esp+3*4+16+4],eax
  520.  
  521.       nodbgl2412:
  522.  
  523.     pop  ecx
  524.     pop  edi
  525.     pop  ebx
  526.     add  edi,[0xfe08]
  527.     dec  ebx
  528.     jz   dbnonewpi12
  529.     jmp  dbnewpi12
  530.  
  531.   dbnonewpi12:
  532.  
  533.     add  esp,7*4
  534.  
  535.     ret
  536.  
  537.  
  538. ; DRAWBAR 32 BBP
  539.  
  540.  
  541.   dbpi32bit12:
  542.  
  543.     cld
  544.     shr  ecx,2
  545.  
  546.    dbnewpi3212:
  547.  
  548.     push ebx
  549.     push edi
  550.     push ecx
  551.  
  552.       mov  eax,edi
  553.       sub  eax,[0xfe80]
  554.       shr  eax,2
  555.       add  eax,WinMapAddress
  556.       mov   ebx,[CURRENT_TASK]
  557.       cld
  558.  
  559.       dbnp3212:
  560.  
  561.         mov  dl,[eax]
  562.         push eax
  563.         push ecx
  564.         cmp  dl,bl
  565.         jnz  dbimp32no12
  566.         cmp  [esp+5*4],dword 0
  567.         jz   dbimp32yes12
  568. ;        call dbcplimit
  569. ;        jnz  dbimp32no12
  570.  
  571.       dbimp32yes12:
  572.  
  573.         push edi
  574.         mov  eax,edi
  575.         sub  eax,[0xfe80]
  576.         shr  eax,16
  577.         call set_bank
  578.         and  edi,0xffff
  579.         add  edi,0xa0000
  580.         mov  eax,[esp+8+3*4+16+4+4]
  581.         stosw
  582.         shr  eax,16
  583.         stosb
  584.         sti
  585.         pop  edi
  586.         add  edi,4
  587.         inc  ebp
  588.         pop  ecx
  589.         pop  eax
  590.         inc  eax
  591.         loop dbnp3212
  592.         jmp  dbnp32d12
  593.  
  594.       dbimp32no12:
  595.  
  596.         pop  ecx
  597.         pop  eax
  598.         inc  eax
  599.         add  edi,4
  600.         inc  ebp
  601.         loop dbnp3212
  602.  
  603.       dbnp32d12:
  604.  
  605.         mov  eax,[esp+12+16+4]
  606.         test eax,0x80000000
  607.         jz   nodbgl3212
  608.         cmp  al,0
  609.         jz   nodbgl3212
  610.         dec  eax
  611.         mov  [esp+12+16+4],eax
  612.  
  613.       nodbgl3212:
  614.  
  615.     pop  ecx
  616.     pop  edi
  617.     pop  ebx
  618.     add  edi,[0xfe08]
  619.     dec  ebx
  620.     jz   nodbnewpi3212
  621.     jmp  dbnewpi3212
  622.  
  623.   nodbnewpi3212:
  624.  
  625.     add  esp,7*4
  626.     ret
  627.  
  628.  
  629. Vesa12_putpixel24:
  630.  
  631.         mov  edi,eax ; x
  632.         mov  eax,ebx ; y
  633.         lea  edi,[edi+edi*2]
  634.         mov  ebx,[0xfe08]
  635.         mul  ebx
  636.         add  edi,eax
  637.         mov  eax,edi
  638.         shr  eax,16
  639.         call set_bank
  640.         and  edi,65535
  641.         add  edi,0xa0000
  642.         mov  eax,[esp+28]
  643.         stosw
  644.         shr  eax,16
  645.         mov  [edi],al
  646.         sti
  647.         ret
  648.  
  649.  
  650.  
  651. Vesa12_putpixel32:
  652.  
  653.         mov  edi,eax ; x
  654.         mov  eax,ebx ; y
  655.         shl  edi,2
  656.         mov  ebx,[0xfe08]
  657.         mul  ebx
  658.         add  edi,eax
  659.         mov  eax,edi
  660.         shr  eax,16
  661.         call set_bank
  662.         and  edi,65535
  663.         add  edi,0xa0000
  664.         mov  ecx,[esp+28]
  665.         mov  [edi],ecx
  666.         sti
  667.         ret
  668.  
  669.  
  670. Vesa12_getpixel24:
  671.  
  672.         mov  edi,eax ; x
  673.         mov  eax,ebx ; y
  674.         lea  edi,[edi+edi*2]
  675.         mov  ebx,[0xfe08]
  676.         mul  ebx
  677.         add  edi,eax
  678.         mov  eax,edi
  679.         shr  eax,16
  680.         call set_bank
  681.         and  edi,65535
  682.         add  edi,0xa0000
  683.         mov  ecx,[edi]
  684.         and  ecx,255*256*256+255*256+255
  685.         sti
  686.         ret
  687.  
  688.  
  689. Vesa12_getpixel32:
  690.  
  691.         mov  edi,eax ; x
  692.         mov  eax,ebx ; y
  693.         shl  edi,2
  694.         mov  ebx,[0xfe08]
  695.         xor  edx,edx
  696.         mul  ebx
  697.         add  edi,eax
  698.         mov  eax,edi
  699.         shr  eax,16
  700.         call set_bank
  701.         and  edi,65535
  702.         add  edi,0xa0000
  703.         mov  ecx,[edi]
  704.         and  ecx,255*256*256+255*256+255
  705.         sti
  706.  
  707.         ret
  708.  
  709.  
  710.  
  711. vesa12_putimage:
  712. ; ebx = pointer to image
  713. ; ecx = size [x|y]
  714. ; edx = coordinates [x|y]
  715. ; ebp = pointer to 'get' function
  716. ; esi = pointer to 'init' function
  717. ; edi = parameter for 'get' function
  718.  
  719. ;    mov  ebx,image
  720. ;    mov  ecx,320*65536+240
  721. ;    mov  edx,20*65536+20
  722.  
  723.     call  [disable_mouse]
  724.  
  725.     mov   [novesachecksum],dword 0
  726.     push  esi
  727.     push  edi
  728.     push  eax
  729.     push  ebx
  730.     push  ecx
  731.     push  edx
  732.     movzx eax,word [esp+2]
  733.     movzx ebx,word [esp+0]
  734.     mov   ecx,[TASK_BASE]
  735.     add   eax,[ecx-twdw+WDATA.box.left]
  736.     add   ebx,[ecx-twdw+WDATA.box.top]
  737.     push  eax
  738.     mov   eax,ebx         ; y
  739.     mul   dword [0xfe08]
  740.     pop   ecx
  741.     add   eax,ecx         ; x
  742.     add   eax,ecx
  743.     add   eax,ecx
  744.     cmp  [0xfbf1],byte 24     ; 24 or 32 bpp ? - x start
  745.     jz   pi2412
  746.     add  eax,ecx
  747.  
  748.   pi2412:
  749.  
  750.     add  eax,[0xfe80]
  751.     mov  edi,eax
  752.  
  753.     ; x size
  754.  
  755.     movzx ecx,word [esp+6]
  756.  
  757.     mov   esi,[esp+8]
  758.     movzx ebx,word [esp+4]
  759.  
  760.     ; check limits while draw ?
  761.  
  762.     push  ecx
  763.     mov  eax,[TASK_BASE]
  764.     cmp  dword [eax+draw_data-CURRENT_TASK+RECT.left], 0
  765.     jnz  dbcblimitlset212
  766.     cmp  dword [eax+draw_data-CURRENT_TASK+RECT.top], 0
  767.     jnz  dbcblimitlset212
  768.     mov  ecx,[eax+draw_data-CURRENT_TASK+RECT.right]
  769.     cmp  ecx,[0xfe00]
  770.     jnz  dbcblimitlset212
  771.     mov  ecx,[eax+draw_data-CURRENT_TASK+RECT.bottom]
  772.     cmp  ecx,[0xfe04]
  773.     jnz  dbcblimitlset212
  774.     pop  ecx
  775.     push 0
  776.     jmp  dbcblimitlno212
  777.  
  778.   dbcblimitlset212:
  779.  
  780.     pop  ecx
  781.     push 1
  782.  
  783.   dbcblimitlno212:
  784.  
  785.     cmp  [0xfbf1],byte 24     ; 24 or 32 bpp ?
  786.     jnz  pi32bit12
  787.  
  788.   pi24bit12:
  789.  
  790.   newpi12:
  791.  
  792.     push edi
  793.     push ecx
  794.     push ebx
  795.  
  796.       mov  edx,edi
  797.       sub  edx,[0xfe80]
  798.       mov  ebx,3
  799.       div  ebx
  800.       add  edx,WinMapAddress
  801.       mov  ebx,[CURRENT_TASK]
  802.       mov  bh,[esp+4*3]
  803.  
  804.       np2412:
  805.  
  806.         cmp  bl,[edx]
  807.         jnz  imp24no12
  808. ;        mov  eax,[esi]
  809.         push    dword [esp+4*3+20]
  810.         call    ebp
  811. ;        cmp  bh,0
  812. ;        jz   imp24yes12
  813. ;        call dbcplimit
  814. ;        jnz  imp24no12
  815.  
  816.      imp24yes12:
  817.  
  818.         push edi
  819.         push eax
  820.         mov  eax,edi
  821.         sub  eax,[0xfe80]
  822.         shr  eax,16
  823.         call set_bank
  824.         pop  eax
  825.         and  edi,0xffff
  826.         add  edi,0xa0000
  827.         mov  [edi],ax
  828.         shr  eax,16
  829.         mov  [edi+2],al
  830.         pop  edi
  831.  
  832.      imp24no12:
  833.  
  834.         inc  edx
  835. ;        add  esi,3
  836.         add  edi,3
  837.         dec  ecx
  838.         jnz  np2412
  839.  
  840.       np24d12:
  841.  
  842.      pop  ebx
  843.      pop  ecx
  844.      pop  edi
  845.  
  846.     add  edi,[0xfe08]
  847.     add  esi,[esp+32]
  848.     dec  ebx
  849.     jnz  newpi12
  850.  
  851.   nonewpi12:
  852.  
  853.         pop     eax edx ecx ebx eax edi esi
  854.         xor     eax, eax
  855.         ret
  856.  
  857.  
  858.   pi32bit12:
  859.  
  860.    newpi3212:
  861.  
  862.     push edi
  863.     push ecx
  864.     push ebx
  865.  
  866.       mov  edx,edi
  867.       sub  edx,[0xfe80]
  868.       shr  edx,2
  869.       add  edx,WinMapAddress
  870.       mov   ebx,[CURRENT_TASK]
  871.       mov   bh,[esp+4*3]
  872.  
  873.       np3212:
  874.  
  875.         cmp  bl,[edx]
  876.         jnz  imp32no12
  877. ;        mov  eax,[esi]
  878.         push    dword [esp+4*3+20]
  879.         call    ebp
  880. ;        cmp  bh,0
  881. ;        jz   imp32yes12
  882. ;        call dbcplimit
  883. ;        jnz  imp32no12
  884.  
  885.       imp32yes12:
  886.  
  887.         push edi
  888.         push eax
  889.         mov  eax,edi
  890.         sub  eax,[0xfe80]
  891.         shr  eax,16
  892.         call set_bank
  893.         pop  eax
  894.         and  edi,0xffff
  895.         mov  [edi+0xa0000],eax
  896.         pop  edi
  897.  
  898.       imp32no12:
  899.  
  900.         inc  edx
  901. ;        add  esi,3
  902.         add  edi,4
  903.         dec  ecx
  904.         jnz  np3212
  905.  
  906.       np32d12:
  907.  
  908.      pop  ebx
  909.      pop  ecx
  910.      pop  edi
  911.  
  912.     add   edi,[0xfe08]
  913.     dec   ebx
  914.     jnz   newpi3212
  915.  
  916.   nonewpi3212:
  917.  
  918.         pop     eax edx ecx ebx eax edi esi
  919.         xor     eax, eax
  920.         ret
  921.  
  922.  
  923. vesa12_read_screen_pixel:
  924.  
  925.      and   eax,0x3FFFFF
  926.      cmp   [0xfbf1],byte 24      ; 24 or 32 bpp ?
  927.      jz    v12rsp24
  928.      mov   edi,eax
  929.      shl   edi,2
  930.      mov   eax,edi
  931.      shr   eax,16
  932.      call  set_bank
  933.      and   edi,65535
  934.      add   edi,0xa0000
  935.      mov   eax,[edi]
  936.      and   eax,0x00ffffff
  937.      ret
  938.   v12rsp24:
  939.  
  940.      imul  eax,3
  941.      mov   edi,eax
  942.      shr   eax,16
  943.      call  set_bank
  944.      and   edi,65535
  945.      add   edi,0xa0000
  946.      mov   eax,[edi]
  947.      and   eax,0x00ffffff
  948.      ret
  949.  
  950.  
  951.