;
; **** DONT DISTERBUTE THIS BECAUSE I DIDNT FINISH THIS LOADER YET!!!
; **** DONT DISTERBUTE THIS BECAUSE I DIDNT FINISH THIS LOADER YET!!!
; **** DONT DISTERBUTE THIS BECAUSE I DIDNT FINISH THIS LOADER YET!!!
; **** DONT DISTERBUTE THIS BECAUSE I DIDNT FINISH THIS LOADER YET!!!
; **** DONT DISTERBUTE THIS BECAUSE I DIDNT FINISH THIS LOADER YET!!!
; **** DONT DISTERBUTE THIS BECAUSE I DIDNT FINISH THIS LOADER YET!!!
; **** DONT DISTERBUTE THIS BECAUSE I DIDNT FINISH THIS LOADER YET!!!
; **** DONT DISTERBUTE THIS BECAUSE I DIDNT FINISH THIS LOADER YET!!!
;
;

               .model  tiny

;
;
;
;                                 ____
;                                �_^^_� -Project-
;                                �/__\� -N--e--w-
;                                /\__/\ -A--g--e-
;
;                                 VGA Loader #19
;                              ASM Source/Comments
;
;              this is a simple vga loader, nothing special about it
;              (originally made for the technodrome bbs), but with
;              comments for beginners or average programmers.
;  Disclaimer: we disterbute the source because we want you to use it...
;              but we ask:  1) if you ripoff the source to make a new
;              one give us some credit... 2) if you disterbute a modified
;              source, dont remove or modify our comments in the src code
;  Questions/Comments:
;              Send to any one of the programmers here,
;              TonyHawk/ViRGO/V@N0R/MegaBst/Tera Versial/Danken-M/Deux2
;
;              call Tower of Power or The TechnoDrome, or contact via email:
;              TonyHawk: [email protected]             (temp address)
;              ViRGO   : ask                            (temp address)
;              Tera Vr.: [email protected]      (temp address)
;              Deux-2  : [email protected]  (temp address)
;

code segment byte public
assume cs:code,ds:code
;.code

org 256

start:
jmp begin_intro


initcol db      4
message db 35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35
       db 35,35,35,35,35,35,35,35,35,35,35,35,35,35,0,35,35,35,35,35
       db 126,126,126,126,35,35,35,35,126,126,126,35,35,35,126,126,35
       db 35,35,126,126,126,126,126,35,35,35,35,35,0,35,35,35,35,126
       db 126,35,35,35,126,126,35,35,126,126,126,126,35,35,126,126
       db 35,35,126,126,35,35,35,126,126,35,35,35,35,0,35,35,35,35,126
       db 126,35,35,126,126,126,35,35,126,126,126,126,126,35,126,126,35
       db 35,126,126,126,126,126,126,126,35,35,35,35,0,35,35,35,35,126
       db 126,126,126,126,35,35,35,35,126,126,35,35,126,126,126,126,35
       db 35,126,126,126,126,35,126,126,35,35,35,35,0,35,35,35,35,126
       db 126,35,35,35,35,35,35,35,126,126,35,35,35,126,126,126,35,35
       db 126,126,35,35,35,126,126,35,35,35,35,0,35,35,35,35,126,126,35
       db 35,35,35,35,35,35,126,126,35,35,35,35,126,126,35,35,126,126,35
       db 35,35,126,126,35,35,35,35,0,35,35,35,35,35,35,35,35,35,35,35,35
       db 35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35
       db 35,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32
       db 32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,2,32,32,32,32,32
       db 32,32,32,111,114,105,103,105,110,97,108,108,121,32,109,97,100
       db 101,32,102,111,114,32,32,32,32,32,32,32,0,32,32,32,32,32,32,32
       db 32,42,32,116,104,101,32,116,101,99,104,110,111,100,114,111,109
       db 101,32,42,32,32,32,32,32,32,32,0,32,32,32,97,32,115,105,109,112
       db 108,101,32,118,103,97,32,108,111,97,100,101,114,32,98,121,32,116
       db 104,47,116,101,114,97,32,0,0,3,32,32,32,32,32,32,32,32,32,32,32
       db 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32
       db 32,0,32,32,42,32,97,100,100,101,100,32,100,105,115,115,111,108,118
       db 101,32,105,110,32,116,101,120,116,109,111,100,101,32,32,32,32,0,0
       db 1,32,32,42,32,97,100,100,101,100,32,118,103,97,32,99,97,114,100,32
       db 100,101,116,101,99,116,105,111,110,32,32,32,32,32,32,0,0,0,0,0,7,32
       db 32,32,32,32,32,32,32,32,64,32,49,57,57,51,32,98,121,32,40,112,110,97
       db 41,32,32,32,48,41,45,58,32,32,32,0,0,6,105,110,101,116,58,32,97,109
       db 111,115,32,62,32,112,104,121,115,52,46,116,101,99,104,110,105,111,110
       db 46,97,99,46,105,108,32,0,0,255

pic2pal db  60,60,0,55,55,0,50,50,0,45,45,0,40,40,0,35,35,0,30,30,0,60,0,60,55
       db  0,55,50,0,50,45,0,45,40,0,40,35,0,35,30,0,30,0,60,0,0,55,0,0,50,0
       db  0,45,0,0,40,0,0,35,0,0,30,0,60,60,60,55,55,55,50,50,50,45,45,45,40
       db  40,40,35,35,35,30,30,30,0,60,60,0,55,55,0,50,50,0,45,45,0,40,40,0
       db  35,35,0,30,30,60,0,0,55,0,0,50,0,0,45,0,0,40,0,0,35,0,0,30,0,0,60
       db  0,30,55,0,28,50,0,26,45,0,24,40,0,24,35,0,22,30,0,20,60,30,30,55
       db  28,28,50,26,26,45,24,24,40,24,24,35,22,22,30,20,20
;       db  'RotemBors ToolZ'

num_of_char_colors    db 8
num_of_char_colors_2  db 7
the_palette db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
           db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2
           db 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,1,2,3
           db 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,2,1,2,3,4
           db 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,3,2,1,2,3,4,5
           db 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,4,3,2,1,2,3,4,5,5
           db 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,3,2,1,2,3,4,4,4,4
           db 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,2,1,2,3,3,3,3,3,3
           db 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,1,2,2,2,2,2,2,2,2
           db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1
           db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2
           db 2,2,2,2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3
           db 3,3,2,1,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4
           db 3,2,1,2,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,4,3
           db 2,1,2,3,4,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,5,4,3,2
           db 1,2,3,4,5,6,6,6,6,6,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,4,3,2,1
           db 2,3,4,5,5,5,5,5,5,5,5,5,5,5,5,5,4,4,4,4,4,4,4,4,4,4,4,4,4,3,2,1,2
           db 3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,1,2,3
           db 3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,2
           db 2,2,2,2,2,2,2,2,2,2,2,2,2

font_data db  10,10,30,10,10,35,10,10,40,10,10,45,10,10,50,10,10,55,126,241
         db  241,255,241,241,241,254,241,241,254,241,241,254,127,240,240,240
         db  240,240,127,254,241,241,241,241,241,254,255,240,240,252,240,240
         db  255,255,240,240,252,240,240,240,127,240,240,243,241,241,127,241
         db  241,241,255,241,241,241,126,60,60,60,60,60,126,31,15,15,15,15
         db  15,254,241,241,242,252,242,241,241,240,240,240,240,240,240,255
         db  254,245,245,245,245,245,245,254,241,241,241,241,241,241,126,241
         db  241,241,241,241,126,254,241,241,254,240,240,240,126,241,241,241
         db  243,243,127,254,241,241,254,241,241,241,127,240,240,126,15,15,254
         db  255,60,60,60,60,60,60,241,241,241,241,241,241,126,241,241,241,241
         db  122,60,24,245,245,245,245,245,245,122,241,241,122,60,122,241,241
         db  143,143,143,127,15,15,254,255,15,30,60,120,240,255,0,0,0,0,0,60
         db  60,0,0,0,0,0,56,112,0,60,60,0,60,60,0,0,0,0,60,0,0,0,0,0,24,60
         db  24,0,0,0,60,126,126,126,60,0,255,255,255,255,255,255,255,31,60
         db  60,60,60,60,31,248,60,60,60,60,60,248,0,32,127,255,127,32,0,0,4
         db  254,255,254,4,0,60,60,60,60,60,0,60,126,143,15,62,60,0,60,15,15
         db  30,60,120,240,240,240,240,120,60,30,15,15,60,124,60,60,60,60,126
         db  126,143,15,126,240,240,255,254,15,15,62,15,15,254,240,240,240,255
         db  15,15,15,255,240,240,254,15,15,254,127,240,240,254,241,241,126,255
         db  15,30,60,60,60,60,126,241,241,126,241,241,126,126,143,143,127,15
         db  15,254,126,241,241,241,241,241,126,60,66,153,161,153,66,60,234,78,74
         db   0,0,0,0,0,0,0,0,0,0,0

chars_array     db 'abcdefghijklmnopqrstuvwxyz.,:-+*#()<>!?/\1234567890@~'
blank_buf       db 0,0

palettes_buffer db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
               db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
               db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
               db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
               db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
               db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
               db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
               db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
               db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
               db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
               db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
               db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
               db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
               db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
               db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
               db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
               db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
               db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
               db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
               db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
               db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
               db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
               db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
               db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
palettes_array db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
              db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
              db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
              db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
              db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
              db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
              db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
              db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
              db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
              db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
              db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
              db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
              db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
              db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
              db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
              db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
              db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
              db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
              db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
              db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
              db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
              db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
              db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
              db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
              db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
              db  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

out_byte                db      1
number_of_three         dw      765
copyright               db      '[PNA]$';
no_vga_text             db      'You dont have a vga!!!$'
flag dw 1
count dw 0

begin_intro:
        mov    bx,47104                ; memory address
        mov    dx,2000                 ; full screen
screen:  mov    es,bx                   ; screen segment
diss:    mov    cx,dx                   ; bytes in screen
        xor    bx,bx
        xor    di,di
mainloop:
        mov    ax,es:[di]              ; get char
        cmp    al,' '                  ; space?
        jz     next                    ; yes = do nothing
        cmp    al,' '                  ; space?
        jl     increase                ; less than a space?
        dec    al                      ; no = dec 1 2 space
        jmp    movit
increase:
        inc    al                      ; inc 2 space
movit:
        mov    es:[di],ax
        inc    bx                      ; set flag
next:
        inc    di                      ; next
        inc    di
        loop   mainloop                ; all bytes on screen
        cmp    bx,00                   ; change anything???
        jnz    diss                    ; continue until all spaces
        xor bx,bx
        mov ax,01A00h
        int 10h                        ; check screen
        cmp bl,7                       ; check screen type
        jae vga1                       ; if vga then continue
        mov dx,offset no_vga_text
        mov ah,9                       ; display no vga message
        int 21h
        int 20h                        ; exit
vga1:
       mov ah,0
       mov al,13h
       int 10h                 ; Set vga mode
       cld
       call load_pal                ; Load palette
       call draw_wall               ;* I will add this tomorrow
       call drawtext                ; Load the text into memory
       call fadein                  ; Draw it...


; for 1.i

 graphics_loop:
 call waitvrt;
main_loop:

; for 2.i

mov ah,1                   ;key?
int 16h
jnz exit_from_loader       ;exit
   jmp graphics_loop
   exit_from_loader:
   call split_screen
               mov     ah,0                    ; text mode
               mov     al,3
               int     10h

               mov dx,offset copyright
               mov ah,9
               int 21h
               int 20h                         ; exit


; Split the screen

split_screen    proc    near
               mov     cx,12



split_loop:
               push    cx
               mov     ah,6
               mov     al,2
               mov     ch,0
               mov     cl,20
               mov     dh,24
               mov     dl,39
               mov     bh,0
               int     10h                     ; up

               mov     ah,7                    ; down
               mov     al,2

               mov     ch,0
               mov     cl,0
               mov     dh,24
               mov     dl,19
               mov     bh,0
               int     10h
               pop     cx
               loop    split_loop              ; split the screen

               retn
split_screen    endp


; palette
load_pal        proc    near
               mov     dx,3C8h
               mov     al,out_byte
               out     dx,al                   ; send to the vga
               inc     dx
               mov     si,offset palettes_array
               mov     cx,number_of_three
load_pal_loop:
               lodsb
               out     dx,al                   ; make palette
               loop    load_pal_loop
               retn
load_pal        endp


; Draw the background *I am too lazy to paint the picture..
; I will add it tomorrow
draw_wall       proc    near
               mov     ax,0A000h                 ; vga screen
               mov     es,ax
               xor     di,di
               mov     cx,10
draw_wall_loop:
               push    cx                        ; save
               mov     si,offset the_palette     ; the wall palette
               mov     cx,20                     ; how much

big_print_wall:
               push    cx
               mov     cx,32                     ; how much

print_wall:
       lodsb
       inc     di
       loop    print_wall

; I will add this tomorrow
;*

       add     di,121h
       pop     cx
       loop    big_print_wall          ; if not done

       pop     cx
       loop    draw_wall_loop

               retn
draw_wall       endp


; Vertical retrace
WaitVRT         proc    near
               mov     dx,3DAh
waitvrt_1:
               in      al,dx
               test    al,8
               jnz     waitvrt_1
               mov     cx,8
waitvrt_2:
               in      al,dx
               test    al,8
               jz      waitvrt_2
               retn
WaitVRT         endp



fadein          proc    near
               mov     si,offset font_data
               mov     di,851h
               mov     cx,12h
               rep     movsb
               mov     si,offset pic2pal
               mov     al,num_of_char_colors
               mov     bl,21
               mul     bl
               mov     cx,ax
               rep     movsb
               mov     number_of_three,2E5h
               mov     cx,64

fadein_loops:
               push    cx
               mov     cx,720                     ; number of colors
               mov     si,offset palettes_buffer
               mov     di,offset palettes_array

fadein_loops_1:
               mov     al,[si]
               mov     ah,[di]
               cmp     al,ah           ; check colors
               je      fadein_loops_2
               inc     ah              ; next
               mov     [di],ah
fadein_loops_2:
               inc     si
               inc     di
               loop    fadein_loops_1

               call    WaitVRT
               call    load_pal
               pop     cx
               loop    fadein_loops   ; continue fade in

               retn
fadein          endp


; Routine added by tonyhawk, temp address: [email protected]
tonyhawks_routine proc  near
               push    si
               push    di
               mov     cx,7
th_loop_1:
               push    cx
               mov     dl,[si]
               mov     cx,8
th_loop_2:
               shl     dl,1
               jnc     th_main_loop_1
               mov     es:[di],ah
th_main_loop_1:
               inc     di
               loop    th_loop_2
               inc     si
               add     di,312
               inc     ah
               pop     cx
               loop    th_loop_1
               pop     di
               pop     si
               retn
tonyhawks_routine endp


build_text_arr  proc    near
               mov     si,offset chars_array
build_1:
               lodsb
               cmp     al,ah
               jne     build_1
               dec     si
               sub     si,81Ah
               mov     ax,si
               mov     si,7
               mul     si
               mov     si,ax
               add     si,1696
               retn
build_text_arr  endp



drawtext        proc    near
               mov     word ptr blank_buf,1287
               mov     di,1287
               mov     bx,offset initcol
check_chars_1:
               mov     ah,[bx]
               inc     bx
               cmp     ah,' '       ; space bar??
               je      its_space
               cmp     ah,0FFh      ; is end?
               jne     not_end
               mov     ax,cs
               mov     es,ax
               retn
not_end:
               cmp     ah,0
               jne     next_ln
               mov     ax,word ptr blank_buf
               add     ax,0A00h                  ; guess...
               mov     word ptr blank_buf,ax
               mov     di,ax
               jmp     check_chars_1
next_ln:
               cmp     ah,num_of_char_colors
               jg      all_done
               mov     al,ah
               mov     cl,7
               mul     cl
               mov     num_of_char_colors_2,al
               jmp     check_chars_1
all_done:
               call    build_text_arr
               mov     ah,num_of_char_colors_2
               mov     al,ah
               push    di
               mov     ah,0F8h
               add     di,offset message+60
               call    tonyhawks_routine         ; black
               pop     di
               mov     ah,al
               call    tonyhawks_routine         ; full colors
its_space:
               add     di,9
               jmp     check_chars_1
drawtext        endp

      palette:

code ends


               end     start