home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / OTHIRES.ZIP / hires.asm < prev    next >
Assembly Source File  |  1996-03-21  |  9KB  |  322 lines

  1. ; High resolution stringwriter
  2. ; Part of the Magicware BBS intro
  3. ; Call +39 6-52355532 !!!
  4. ; Some weird bug might still exist.
  5. ; By Vulture / Outlaw Triad
  6.  
  7. DOSSEG                          ; Sort segment to DOS standards
  8. .MODEL SMALL
  9. .286
  10. .STACK 200h
  11. .DATA
  12. .CODE
  13. JUMPS                           ; Let tasm handle out of range jumps
  14. ASSUME cs:@code,ds:@code
  15.  
  16. ; === Data ===
  17.  
  18. INCLUDE Font.inc                ; Fontdata
  19.  
  20. Label Credits Byte
  21.        DB 13,10,"▄  ▄▄  ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄  ▄▄  ▄"
  22.        DB 13,10,"                    - An Outlaw Triad Production (c) 1996 -",13,10
  23.        DB 13,10,"                             Code∙∙∙∙∙∙∙∙∙∙Vulture" ,13,10
  24.        DB 13,10,"                            -=≡ Outlaw Triad Is ≡=-",13,10
  25.        DB 13,10,"          Vulture(code) ■ Dazl(artist) ■ Troop(sysop) ■ Xplorer(artist)",13,10
  26.        DB 13,10,"▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄",13,10,"$"
  27.  
  28. Label Palette Byte
  29.        DB   0,0,45              ; Background color
  30.        DB   45,45,45            ; Character color
  31.  
  32. Label Text1 Byte
  33.        DB   '       this file passed magicware',254
  34.        DB   254
  35.        DB   254
  36.        DB   254
  37.        DB   254
  38.        DB   '               distro for',254
  39.        DB   254
  40.        DB   '                valhalla',254
  41.        DB   '              outlaw triad',254
  42.        DB   254
  43.        DB   '           more groups wanted',254
  44.        DB   0
  45.  
  46. Label Text2 Byte
  47.        DB   254
  48.        DB   254
  49.        DB   254
  50.        DB   '               call us for',254
  51.        DB   254
  52.        DB   '                  demos',254
  53.        DB   '                  music',254
  54.        DB   '                 sources',254
  55.        DB   '                 patches',254
  56.        DB   '                 graphix',254
  57.        DB   254
  58.        DB   '                we got it',254
  59.        DB   0
  60.  
  61. Label Text3 Byte
  62.        DB   254
  63.        DB   254
  64.        DB   254
  65.        DB   254
  66.        DB   254
  67.        DB   254
  68.        DB   '    press escape for da magic number',254
  69.        DB   254
  70.        DB   '             intro will reset',254
  71.        DB   0
  72.  
  73. Label TextLabel Word
  74.        DW   offset Text1
  75.        DW   offset Text2
  76.        DW   offset Text3
  77.  
  78. VgaPos  EQU  80*75              ; Start pos on vga
  79. Counter DW   0
  80. TextP   DW   0                  ; Which text to do
  81.  
  82. ; === Sub-routines ===
  83.  
  84. WaitVrt PROC NEAR               ; Waits for vertical retrace
  85.     mov     dx,3dah
  86. Vrt:
  87.     in      al,dx
  88.     test    al,1000b
  89.     jnz     Vrt
  90. NoVrt:
  91.     in      al,dx
  92.     test    al,1000b
  93.     jz      NoVrt
  94.     ret
  95. WaitVrt ENDP
  96.  
  97. SetColor PROC NEAR              ; Needs: cx:=color (0 to 15)
  98.     mov     dx,3ceh             ; Graphic Controller address register port
  99.     mov     ax,0f01h            ; Index 01h  (enable set/reset register)
  100.     out     dx,ax
  101.     xor     al,al               ; Index 00h  (set/reset register)
  102.     mov     ah,cl               ; Color (0 to 15)
  103.     out     dx,ax               ; Set color
  104.     ret
  105. SetColor ENDP
  106.  
  107. TestEsc PROC NEAR
  108.     in      al,60h              ; Was ESCAPE pressed ?
  109.     cmp     al,1
  110.     je      QuitNow             ; Yes => quit now. . .
  111.     ret
  112. TestEsc ENDP
  113.  
  114. WriteLine PROC NEAR             ; Writes a textstring to vga-memory
  115. StartWrite:
  116.     lodsb                       ; Load a character from textstring
  117.     cmp     al,254              ; Reached end of line?
  118.     je      UpdatePos
  119.     cmp     al,0                ; Reached end of da text?
  120.     je      QuitPrint
  121.     cmp     al,' '
  122.     jne     short DoChar
  123.  
  124.     add     di,Xsize            ; Only increase xpos to do
  125.     inc     Counter
  126.     jmp     StartWrite          ; a space
  127.  
  128. DoChar:
  129.     push    si                  ; Save character offset
  130.     push    di                  ; And save vga-pos
  131.  
  132. ; === Locate char in fontdata ===
  133.  
  134.     mov     bl,al
  135.     lea     si,[Order]
  136.     xor     cx,cx
  137. Search:
  138.     lodsb                       ; Load char from order
  139.     cmp     bl,al
  140.     je      CharOk
  141.     inc     cx
  142.     jmp     Search
  143. CharOk:
  144.     lea     si,[Font]
  145.     shl     cl,1                ; *2 (coz Xsize is 2)
  146.     xor     ch,ch
  147.     add     si,cx               ; ds:si=upperleft corner char in fontdata
  148.  
  149.     mov     dx,3ceh             ; Graphic Controller address register port
  150.  
  151. ; === Draw the character ===
  152.     mov     cx,Ysize            ; Do all y-lines
  153. YLoop:
  154.     mov     ah,ds:[si]          ; Load the pattern (8 bits)
  155.     mov     al,08h              ; Index 08h (Bit Mask Register)
  156.     out     dx,ax               ; Pattern selected (if bit=1 then it's drawn)
  157.     movsb                       ; From ds:[si] to es:[di]
  158.     mov     ah,ds:[si]          ; Load the pattern (8 bits)
  159.     out     dx,ax               ; Pattern selected (if bit=1 then it's drawn)
  160.     movsb
  161.     add     si,78               ; Next position in data (lineair)
  162.     add     di,78               ; And next pos on vga
  163.     loop    YLoop
  164.  
  165.     call    WaitVrt
  166.     call    TestEsc
  167.  
  168. ; === Update pointers ===
  169.     inc     Counter
  170.     pop     di
  171.     add     di,Xsize            ; Next position on screen
  172.     pop     si
  173.     jmp     StartWrite          ; Do next char
  174.  
  175. UpdatePos:
  176.     sub     di,Counter          ; *2 coz Xsize is 2 bytes
  177.     sub     di,Counter
  178.     add     di,80*(Ysize+5)     ; Update vga-position
  179.     mov     Counter,0
  180.     jmp     StartWrite          ; And do next char
  181.  
  182. QuitPrint:
  183.     ret
  184. WriteLine ENDP
  185.  
  186. WaitHere PROC NEAR              ; Simple waitloop
  187.     mov     cx,350
  188. WaitLoop:
  189.     call    WaitVrt
  190.     call    TestEsc
  191.     loop    WaitLoop
  192.     ret
  193. ENDP WaitHere
  194.  
  195. DeleteText PROC NEAR            ; Guess what this does, eh?  :-)
  196.     xor     cx,cx               ; cx=0
  197.     call    SetColor            ; Set background color
  198.  
  199.     mov     di,VGAPos
  200.     mov     cx,80               ; Do entire scanline
  201. HoriLoop:
  202.     push    di
  203.     mov     al,0ffh
  204.     mov     bx,358              ; # of scanlines
  205. VertiLoop:
  206.     stosb
  207.     add      di,79              ; Next scanline
  208.     dec      bx
  209.     jnz      VertiLoop
  210.     pop      di
  211.     inc      di                 ; Next position
  212.     call     WaitVrt
  213.     loop     HoriLoop
  214.  
  215.     mov      cx,1
  216.     call     SetColor           ; Reset character color
  217.     ret
  218. DeleteText ENDP
  219.  
  220. ; === Main program ===
  221.  
  222. START:
  223.  
  224. ; === Get into 640*480*16 mode ===
  225.     mov     ax,0012h
  226.     int     10h                 ; Simple, eh? ;-)
  227.  
  228. ; === Set segment pointers ===
  229.     mov     ax,cs
  230.     mov     ds,ax               ; ds points to codesegment
  231.     mov     ax,0a000h
  232.     mov     es,ax               ; es points to vga
  233.  
  234. ; === Init palette stuff ===
  235.  
  236. ; I haven't really figured out how
  237. ; the palette works in these high
  238. ; resolution modes. The code here
  239. ; seems to work but I would like
  240. ; to know more about it. Anyone
  241. ; out there got some more info?
  242. ; Btw, major thanx to Iguana for
  243. ; providing example code.
  244.  
  245.     mov     dx,3c0h        ; Create a linear palette instead of EGA palette
  246.     xor     al,al               ; Index 00h & data 00h
  247.     mov     cx,2
  248. LinPal:
  249.     out     dx,al               ; Index.
  250.     out     dx,al           ; Value => value = index
  251.     inc     al
  252.     loop    LinPal
  253.  
  254.     mov     al,34h          ; Redo it, activating the VGA along
  255.     out     dx,ax
  256.     xor     al,al
  257.     out     dx,al              ; Force DAC index bits p4-p7 to 0
  258.  
  259.     lea     si,Palette
  260.     mov     dx,03c8h
  261.     xor     al,al
  262.     out     dx,al
  263.     inc     dx
  264.     mov     cx,2*3              ; 2 colors
  265.     repz    outsb
  266.  
  267.     mov     cx,1
  268.     call    SetColor
  269.  
  270. ; === Write lines ===
  271.     mov     di,(80*45)+5
  272.     mov     cx,70
  273.     mov     al,0ffh
  274.     rep     stosb
  275.     mov     di,(80*47)+5
  276.     mov     cx,70
  277.     rep     stosb
  278.     mov     di,(80*435)+5
  279.     mov     cx,70
  280.     rep     stosb
  281.     mov     di,(80*437)+5
  282.     mov     cx,70
  283.     rep     stosb
  284.  
  285. ; === Loop intro ===
  286. MainLoop:
  287.     mov     bx,TextP             ; Use bx as pointer
  288.     add     bx,bx
  289.     mov     si,[TextLabel+bx]    ; Load offset current text
  290.     mov     di,VGAPos
  291.     call    WriteLine            ; Write the string
  292.     call    WaitHere             ; Wait a sec
  293.     call    DeleteText           ; And delete the text
  294.     cmp     TextP,2
  295.     je      TheLast
  296.     inc     TextP
  297.     jmp     MainLoop
  298. TheLast:
  299.     mov     TextP,0              ; Text 1 again so we loop the intro
  300.     jmp     MainLoop
  301.  
  302. ; === Back to textmode ===
  303. QuitNow:
  304.     mov     ax,0003h
  305.     int     10h
  306.  
  307. ; === Print string ===
  308.     lea     dx,[Credits]
  309.     mov     ah,9
  310.     int     21h                 ; Who's done it thiz time?
  311.  
  312. ; === Back to DOS ===
  313.     mov     ax,4c00h            ; Return control to DOS
  314.     int     21h
  315.  
  316. END START                       ; End of program
  317.  
  318.  
  319.  
  320.  
  321. ; - Vulture / Outlaw Triad -
  322. ;     comma400@tem.nhl.nl       (at least till june 1996)