home *** CD-ROM | disk | FTP | other *** search
/ Groovy Bytes: Behind the Moon / groovybytes.iso / GROOVY / DEMOS / MISC_DEM / SUNKNOWN.ZIP / ASMDRAW.ASM next >
Encoding:
Assembly Source File  |  1994-04-07  |  4.1 KB  |  309 lines

  1. ; ASMDRAW.ASM
  2.  
  3. ; Thomas H.
  4.  
  5. AC_INDEX        = 03c0h
  6. MISC_OUTPUT     = 03c2h
  7. SC_INDEX        = 03c4h
  8. GC_INDEX    = 03ceh
  9. CRTC_INDEX      = 03d4h
  10. INPUT_STATUS_0  = 03dah
  11. MAP_MASK    = 02h
  12. READ_MAP        = 04h
  13. BIT_MASK    = 08h
  14.  
  15. .model large
  16.  
  17. public _draw80, _sizeb, _size14
  18. public _idy4, _leftdi, _inx, _iny, _idx, _idy, _idx4
  19. public _spos,_sw_ptr, _hswap, _vswap, sw_whole
  20. public _FA, _FB, _FAC, _FBC, _cxmin, _cxmax, _cymin, _cymax, _Vx, _Vy
  21. public _Nx, _Ny, _CAMx, _CAMy
  22.  
  23. .code
  24. .386
  25.  
  26. swapt     dw (256+8) dup (?)
  27. label _sw_ptr    dword
  28. sw_corr    dw offset swapt, seg swapt
  29.  
  30. _FA    dd ?
  31. _FB    dd ?
  32. _FAC    dd ?
  33. _FBC    dd ?
  34. _cxmin    dd ?
  35. _cxmax    dd ?
  36. _cymin    dd ?
  37. _cymax    dd ?
  38. _Vx    dd ?
  39. _Vy    dd ?
  40. _Nx    dd ?
  41. _Ny    dd ?
  42. _CAMx    dw ?
  43. _CAMy    dw ?
  44.  
  45.  
  46. swapoff    dw ?
  47. sw_left    dw ?
  48. sw_whole    db ?
  49. keepcx    dw ?
  50. keepdx    dw ?
  51. keepdi    dw ?
  52. tempbp    dw ?
  53. tempsi    dw ?
  54. _idx4    dw ?
  55. _idy4      dw ?
  56. _spos    dw ?
  57. _leftdi    dw ?
  58. _idx    dw ?
  59. _idy    dw ?
  60. _inx    dw ?
  61. _iny    dw ?
  62. _size14 dw ?
  63. asmx    db ?
  64. asmy    db ?
  65. _sizeb    db ?
  66. keepcb    db ?
  67.  
  68. ; ***************************************************************************
  69. ;
  70. ; TEGN80
  71. ;
  72. ; ***************************************************************************
  73.  
  74. _draw80 proc far
  75.  
  76.     mov tempbp,bx
  77.     mov keepcx,cx
  78.     mov keepdx,dx
  79.  
  80. rept    39
  81.     mov bl,ch
  82.     mov bh,dh
  83.     mov ah,[bx]
  84.     mov es:[di],ah
  85.     dec di
  86.     sub cx,si
  87.     sub dx,tempbp
  88. endm
  89.     mov bl,ch
  90.     mov bh,dh
  91.     mov ah,[bx]
  92.     mov es:[di],ah
  93.     add di,40
  94.     mov cx,keepcx
  95.     mov dx,keepdx
  96.     add cx,si
  97.     add dx,tempbp
  98.  
  99. rept    39
  100.     mov bl,ch
  101.     mov bh,dh
  102.     mov ah,[bx]
  103.     ;and ah,al
  104.     ;or ah,al
  105.     mov es:[di],ah
  106.     inc di
  107.     add cx,si
  108.     add dx,tempbp
  109. endm
  110.     mov bl,ch
  111.     mov bh,dh
  112.     mov ah,[bx]
  113.     ;and ah,07h
  114.     ;or ah,al
  115.     mov es:[di],ah
  116.     add di,40
  117.  
  118.     retf
  119.  
  120. _draw80 endp
  121.  
  122. ; ***************************************************************************
  123. ;
  124. ; HSWAP
  125. ;
  126. ; ***************************************************************************
  127.  
  128. _hswap    proc far
  129.  
  130.     pusha
  131.  
  132.     mov ah,cl
  133.     and ax,0700h
  134.     mov swapoff,ax
  135.     and cx,not 7
  136.     mov ax,cx
  137.     shl ax,5
  138.     mov cx,dx
  139.     shr dx,3
  140.     add ax,dx
  141.     mov si,ax
  142.     mov tempsi,ax
  143.     mov al,[si]
  144.     xor ah,ah
  145.     add ax,ax
  146.     mov si,ax
  147.     add si,sw_corr
  148.     mov si,[cs:si]
  149.     and cx,7
  150.     add si,cx
  151.     add si,swapoff
  152.     mov sw_whole,32
  153.     mov keepcx,cx
  154.     jz none_1
  155.     dec sw_whole
  156.     neg cx
  157.     add cx,8
  158. next_1:
  159.     mov al,[si]
  160.     inc si
  161.     mov [es:bx],al
  162.     inc bl
  163.     dec cl
  164.     jnz next_1
  165.  
  166. next_whole:
  167.     inc tempsi
  168. none_1:
  169.     mov si,tempsi
  170.     mov al,[si]
  171.     xor ah,ah
  172.     add ax,ax
  173.     add ax,sw_corr
  174.     mov si,ax
  175.     mov si,[cs:si]
  176.     add si,swapoff
  177. rept 8
  178.     mov al,[si]
  179.     inc si
  180.     mov [es:bx],al
  181.     inc bl
  182. endm
  183.     dec sw_whole
  184.     jnz next_whole
  185.  
  186.     inc tempsi
  187.     mov si,tempsi
  188.     mov al,[si]
  189.     xor ah,ah
  190.     add ax,ax
  191.     mov si,ax
  192.     add si,sw_corr
  193.     mov si,[cs:si]
  194.     add si,swapoff
  195.     mov cx,keepcx
  196.     or cl,cl
  197.     jz none_2
  198. next2:
  199.     mov al,[si]
  200.     inc si
  201.     mov [es:bx],al
  202.     inc bl
  203.     dec cl
  204.     jnz next2
  205. none_2:
  206.  
  207.     popa
  208.     retf
  209. _hswap    endp
  210.  
  211. ; ***************************************************************************
  212. ;
  213. ; VSWAP
  214. ;
  215. ; ***************************************************************************
  216.  
  217. _vswap    proc far
  218.  
  219.     pusha
  220.  
  221.     mov al,dl
  222.     and ax,0007h
  223.     mov swapoff,ax
  224.  
  225.     mov ax,cx
  226.     and ax,not 7
  227.     shl ax,5
  228.     shr dx,3
  229.     add ax,dx
  230.     mov si,ax
  231.     mov tempsi,ax
  232.     mov al,[si]
  233.     xor ah,ah
  234.     add ax,ax
  235.     mov si,ax
  236.     add si,sw_corr
  237.     mov si,[cs:si]
  238.     and cl,7
  239.     mov ch,cl
  240.     xor cl,cl
  241.     add si,cx
  242.  
  243.     add si,swapoff
  244.     mov sw_whole,32
  245.     and cx,0700h
  246.     mov keepcx,cx
  247.     jz none_1b
  248.     dec sw_whole
  249.     neg ch
  250.     add ch,8
  251. next_1b:
  252.     mov al,[si]
  253.     cmp al,15
  254.     jbe ok
  255.     nop
  256. ok:
  257.     add si,256
  258.     mov [es:bx],al
  259.     inc bh
  260.     dec ch
  261.     jnz next_1b
  262.  
  263. next_wholeb:
  264.     add tempsi,256
  265. none_1b:
  266.     mov si,tempsi
  267.     mov al,[si]
  268.     xor ah,ah
  269.     add ax,ax
  270.     add ax,sw_corr
  271.     mov si,ax
  272.     mov si,[cs:si]
  273.     add si,swapoff
  274. rept 8
  275.     mov al,[si]
  276.     add si,256
  277.     mov [es:bx],al
  278.     inc bh
  279. endm
  280.     dec sw_whole
  281.     jnz next_wholeb
  282.  
  283.     mov si,tempsi
  284.     add si,256
  285.     mov al,[si]
  286.     xor ah,ah
  287.     add ax,ax
  288.     add ax,sw_corr
  289.     mov si,ax
  290.     mov si,[cs:si]
  291.     add si,swapoff
  292.     mov cx,keepcx
  293.     or ch,ch
  294.     jz none_2b
  295. next2b:
  296.     mov al,[si]
  297.     add si,256
  298.     mov [es:bx],al
  299.     inc bh
  300.     dec ch
  301.     jnz next2b
  302. none_2b:
  303.     popa
  304.     retf
  305. _vswap  endp
  306.  
  307. end
  308.  
  309.