home *** CD-ROM | disk | FTP | other *** search
/ Der Mediaplex Sampler - Die 6 von Plex / 6_v_plex.zip / 6_v_plex / DISK2 / MULTI_04 / I2R.ZIP / SHOWPIC.ASM < prev    next >
Assembly Source File  |  1991-10-06  |  7KB  |  336 lines

  1. ;======================================================================
  2. ;||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  3. ;======================================================================
  4. ;======================================================================
  5. ;||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  6. ;======================================================================
  7. CODE        SEGMENT PARA 'CODE'
  8.  
  9.         ORG    100h
  10.  
  11.         ASSUME CS:CODE, DS:CODE, ES:CODE, SS:CODE
  12.  
  13. START:        jmp    INIT
  14. ;======================================================================
  15. SHOWELCOM    PROC    NEAR
  16.  
  17. ELSTART:    cli
  18.         call    GETVID
  19.         call    ORGRAM
  20.         call    OPENFILES
  21.         call    SET256
  22.         call    READFILES
  23. ;        call    TRANSPIC
  24.         call    GETKEY
  25.  
  26. ELEND:        call    RESVID
  27.         call    CLOSEHANDLE
  28.  
  29.         sti
  30.         mov    ax,4c00h
  31.         int    21h
  32.  
  33. SHOWELCOM    ENDP
  34. ;======================================================================
  35. SET256        PROC NEAR
  36.  
  37.         call    VBLANC
  38.         
  39.         mov    ah,00
  40.         mov    al,13h            ;320*200/256 Farben
  41.         int    10h
  42.         ret
  43.  
  44. SET256        ENDP
  45. ;======================================================================
  46. TRANSPIC    PROC NEAR
  47.  
  48. ENTPAK:        push    ds
  49.         
  50.         mov    ds,PICRAM        ;source
  51.         mov    si,2
  52.  
  53.         mov    dx,0a000h        ;destination
  54.         mov    es,dx
  55.         xor    di,di
  56.  
  57.         mov    dx,ds:[si-2]        ;get length
  58.         sub    dx,2h            ;
  59.         cld
  60. ENTPLOOP:    lodsb
  61.         dec    dx
  62.         cmp    al,0
  63.         jl    NORMPAK
  64.  
  65. UNPACK:        xor    ch,ch
  66.         mov    cl,al
  67.         inc    cx
  68.         lodsb
  69.     rep    stosb
  70.         dec    dx
  71.         cmp    dx,0
  72.         jle    PACKEND
  73.         jmp    ENTPLOOP
  74.  
  75. NORMPAK:    not    al
  76.         xor    ah,ah
  77.         inc    ax
  78.         mov    cx,ax
  79.         sub    dx,ax
  80.     rep    movsb
  81.         cmp    dx,0
  82.         jle    PACKEND
  83.         jmp    ENTPLOOP
  84.  
  85. PACKEND:    cmp    dx,00h
  86.         jb    ENTPLOOP
  87.         pop    ds
  88.         ret
  89.  
  90. TRANSPIC    ENDP
  91. ;======================================================================
  92. ORGRAM        PROC NEAR
  93.  
  94. ;        mov    bx,65536/16        ;17072 Bytes (body)
  95. ;        call    GETRAM
  96. ;        mov    PICRAM,ax
  97.  
  98.         mov    bx,768/16        ;768 Bytes (colors)
  99.         call    GETRAM
  100.         mov    COLRAM,ax
  101.  
  102.         ret
  103.  
  104. ORGRAM        ENDP
  105. ;======================================================================
  106. GETRAM        PROC    NEAR
  107.  
  108.         mov    ah,48h            ;Speicher reservieren
  109.         int    21h
  110.  
  111.         ret
  112.  
  113. GETRAM        ENDP
  114. ;======================================================================
  115. GETKEY        PROC NEAR
  116.  
  117.         mov    ah,0ch
  118.         mov    al,01h
  119.         int    21h        ;Warten auf Tastendruck
  120.         ret
  121.  
  122. GETKEY        ENDP
  123. ;======================================================================
  124. WRSTRING    PROC NEAR
  125.  
  126.         mov    ah,13h        ;Zeichenkette ausgeben
  127.         mov    al,01h        ;Cursorpos. aktualisieren
  128.         mov    cx,2ch        ;26 Zeichen
  129.         mov    dh,0eh        ;Zeile
  130.         mov    dl,12h        ;Spalte
  131.         mov    bl,10011100b    ;ROT blinkend!
  132.         mov    bh,BSEITE    ;Bildschirmseite holen
  133.         int    10h
  134.         call    GETKEY
  135.         ret
  136.  
  137. WRSTRING    ENDP
  138. ;======================================================================
  139. OPENFILES    PROC NEAR
  140.  
  141.         lea    bx,COLNAM
  142.         call    GETHANDLE
  143.         mov    COLHANDLE,ax    ;rette Datei-Handle
  144.         
  145.         lea    bx,PICNAM
  146.         call    GETHANDLE
  147.         mov    PICHANDLE,ax    ;rette Datei-Handle
  148.  
  149.         ret
  150.  
  151. OPENFILES    ENDP
  152. ;======================================================================
  153. GETHANDLE    PROC NEAR
  154.  
  155.         mov    ax,cs
  156.         mov    ds,ax
  157.         mov    ah,3dh        ;Datei öffnen (Handle)
  158.         mov    al,00h        ;nur lesen!
  159.         mov    dx,bx        ;Offset
  160.         int    21h
  161.         jc    CHERROR
  162.  
  163.         ret
  164. ;-----------------
  165. CHERROR:    lea    bp,INITERR    ;Error ausgeben
  166.         mov    bx,2eh
  167.         sub    ax,02h
  168.         mul    bx
  169.         add    bp,ax
  170.         call    WRSTRING
  171.  
  172.         jmp    ELEND
  173.         ret
  174.  
  175. GETHANDLE    ENDP
  176. ;======================================================================
  177. CLOSEHANDLE    PROC NEAR
  178.  
  179.         mov    cx,02h
  180.         lea    dx,COLHANDLE
  181. DOCLOSE:    mov    bx,dx
  182.         mov    bx,es:[bx]
  183.         cmp    bx,00h
  184.         jz    NOHAND
  185.  
  186.         mov    ah,3eh        ;doit
  187.         int    21h
  188.  
  189. NOHAND:        add    dx,02h        ;next Handle
  190.         loop    DOCLOSE
  191.         ret
  192.  
  193. CLOSEHANDLE    ENDP
  194. ;======================================================================
  195. READFILES    PROC NEAR
  196.  
  197.         mov    bx,COLHANDLE
  198.         mov    cx,-1
  199.         mov    dx,COLRAM
  200.         call    READ
  201.         call    BURSTCOL
  202.  
  203.         mov    bx,PICHANDLE
  204.         mov    cx,-1
  205.         mov    dx,PICRAM
  206.         call    READ
  207.  
  208.         ret
  209.  
  210. READFILES    ENDP
  211. ;======================================================================
  212. READ        PROC NEAR
  213.  
  214.         push    ds
  215.         mov    ds,dx        ;Segmentadresse
  216.         xor    dx,dx        ;Offset
  217.         mov    ah,3fh        ;Datei lesen
  218.         int    21h
  219.         pop    ds
  220.  
  221.         ret
  222.  
  223. READ        ENDP
  224. ;======================================================================
  225. BURSTCOL    PROC    NEAR
  226.  
  227.         call    VBLANC        ;wait until vertical blanking
  228.  
  229.         mov    es,COLRAM
  230.         xor    bx,bx
  231.         xor    cx,cx        ;cl=start first color and counter
  232.         mov    dx,03c8h    ;dx=03c8 write pel address reg.
  233.         mov    al,cl        ;locate address
  234.         out    dx,al        ;write the following datas
  235.         inc    dx        ;dx=03c9 : pel data reg.
  236.  
  237. COLLOOP:    mov    al,es:[bx]    ;R
  238.         out    dx,al
  239.         mov    al,es:[bx+1]    ;G
  240.         out    dx,al
  241.         mov    al,es:[bx+2]    ;B
  242.         out    dx,al
  243.         add    bx,03h
  244.         inc    cl
  245.         jnz    COLLOOP
  246.  
  247.         ret
  248.  
  249. BURSTCOL    ENDP
  250. ;======================================================================
  251. VBLANC        PROC    NEAR
  252.  
  253.         mov    dx,3dah        ;input status reg. #1
  254. VE1:        in    al,dx        ;get data
  255.         test    al,8        ;vert. retrace ?
  256.         je    VE1
  257.         ret
  258.  
  259. VBLANC        ENDP
  260. ;======================================================================
  261. RESVID        PROC NEAR
  262.  
  263.         call    VBLANC
  264.         
  265.         xor    ah,ah        ;auf Originalzustand
  266.         mov    al,VMODE    ;zurückschalten
  267.         mov    bh,BSEITE
  268.  
  269.         int    10h
  270.         ret
  271.  
  272. RESVID        ENDP
  273. ;======================================================================
  274. GETVID        PROC NEAR
  275.  
  276.         mov    ah,0fh        ;Auslesen des Videomodus
  277.         int    10h
  278.         mov    BSEITE,bh
  279.         mov    VMODE,al
  280.  
  281.         cmp    al,7
  282.         jne    GOUT
  283.         jmp    ELEND
  284. GOUT:        ret
  285.  
  286. GETVID        ENDP
  287. ;======================================================================
  288.  
  289. ;======================================================================
  290. OPENERR        db    "    >>> fehlende File-Sharing-Software <<<    "
  291.         db    "         >>> Datei nicht gefunden <<<         "
  292.         db    "        >>> Datei existiert nicht! <<<        "
  293.         db    "       >>> kein freies Handle mehr! <<<       "
  294.         db    "         >>> Zugriff verweigert ! <<<         "
  295. INITERR        db    "       >>> Grafik nicht gefunden! <<<         "
  296.         db    "          >>> kein freies Handle <<<          "
  297.         db    "          >>> Zugriff verweigert <<<          "
  298.  
  299. PICRAM        dw    0a000h
  300. COLRAM        dw    0
  301.  
  302. PICNAM        db    "dario.pic",0
  303. COLNAM        db    "dario.col",0
  304.  
  305. COLHANDLE    dw    0
  306. PICHANDLE    dw    0
  307.  
  308. BSEITE        db    0
  309. VMODE        db    0
  310.         db    'DZ'
  311. ;======================================================================
  312. ;======================================================================
  313. ;||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  314. ;== INIT  =============================================================
  315. INIT:        mov    ah,4ah
  316.         mov    bx,offset ende
  317.         mov    cl,4
  318.         shr    bx,cl
  319.         inc    bx
  320.         int    21h
  321.         mov    sp,offset ende
  322.         jmp    ELSTART
  323.  
  324. INIT_ENDE    LABEL    NEAR
  325. ;======================================================================
  326. ;||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  327. ;== STACK =============================================================
  328.         dw    (256-((init_ende-init) shr 1)) dup (?)
  329. ENDE        equ    this byte
  330. ;======================================================================
  331. ;||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  332. ;== ENDE ==============================================================
  333. CODE        ENDS
  334.         END        START
  335. 
  336.