#include "logo.h" /* Fast Pixel Plotting */ unsigned char far *ScreenMem = (char far *) 0xA0000000L; #define pixel(x,y) (*(ScreenMem + ( x ) + (( y ) << 8) + (( y ) << 6))) void top_bar() { /* Makes the top bar on the screen */ asm { mov ax, 0A000h mov es, ax sub di, di mov ah, 200 mov al, 200 mov dx, 10 } LoopInit1: asm { mov cx, 160 inc ah inc al rep stosw dec dx jnz LoopInit1 mov dx, 10 } LoopInit2: asm { mov cx, 160 dec ah dec al rep stosw dec dx jnz LoopInit2 } } /* top_bar */ void wait_vsync() { asm mov dx, 3dah loop1: asm { in al, dx test al, 8 jnz loop1 } loop2: asm { in al, dx test al, 8 jz loop2 } } void init_image() { asm { push ds mov ax, seg logodata mov ds, ax mov si, offset logodata mov ax, 0A000h mov es, ax mov di, 160*320 mov cx, 320*20 rep movsw pop ds } } /***** Palette Funcs Begin ******/ char logopal[(64-18)*3]; char txtpal[16*3]; char txtbgpal[20*3]; void initpal() { int x, z; char *logopalptr = logopal; char *txtpalptr = txtpal; z = 10; for (x = 0; x < 16; x ++) { *txtpalptr = 0; txtpalptr++; *txtpalptr = z; txtpalptr++; *txtpalptr = 0; txtpalptr++; if (x > ((16) >> 1)) z -= 3; else z += 3; } z = 0; txtpalptr = txtbgpal; for (x = 200; x < 220; x ++) { *txtpalptr = z; txtpalptr++; *txtpalptr = 0; txtpalptr++; *txtpalptr = 0; txtpalptr++; if (x > 210) z -= 4; else z += 4; } z = 15; for (x = 0; x < (64-18); x ++) { *logopalptr = z; logopalptr++; *logopalptr = 0; logopalptr++; *logopalptr = z; logopalptr++; if (x > ((64-18) >> 1)) z --; else z ++; } } /*** initpal ***/ void rotatepal() { static int offse, lof, lof2; static int wait; static int dir_lof2 = 3; if (wait++ != 2) return; wait = 0; asm { push ds mov ax, seg logopal mov ds, ax mov si, offset logopal add si, offse mov dx, 03C8h mov al, 18 out dx, al mov cx, (64-18)*3 sub cx, offse inc dx rep outsb mov cx, offse mov si, offset logopal rep outsb mov si, offset txtpal mov ax, seg txtpal mov ds, ax add si, lof mov dx, 03C8h mov al, 100 out dx, al mov cx, (16)*3 sub cx, lof inc dx rep outsb mov cx, lof mov si, offset txtpal rep outsb mov si, offset txtbgpal mov ax, seg txtbgpal mov ds, ax add si, lof2 mov dx, 03C8h mov al, 200 out dx, al mov cx, (20)*3 sub cx, lof2 inc dx rep outsb mov cx, lof2 mov si, offset txtbgpal rep outsb pop ds } offse += 3; lof += 3; lof2 += dir_lof2; if (offse >= 138) offse = 0; if (lof >= 48) lof = 0; if (lof2 > 36) { dir_lof2 = -3; lof2 = 36; } else if (lof2 < 0) { dir_lof2 = 3; lof2 = 0; } } /**** RotatePal ****/ char far *fontptr; void init_txt() { asm { push bp mov ax, 1130h mov bh, 3 int 10h mov word ptr fontptr+2, es mov word ptr fontptr, bp pop bp } } /*** INIT_TXT (gets 8x8 rom font) ***/ char txtbuf[8*320]; /* TEXT OUT BUFFER! */ void write_buf() { asm { push ds mov ax, seg txtbuf mov ds, ax mov si, offset txtbuf mov ax, 0A000h mov es, ax mov di, 640+1280 mov cx, 320*4 rep movsw pop ds } } /* Writes the buffer FAST */ void sm_top_bar() { /* Refreshes a small portion of the bar in buf */ #define BOOGA_VAL 16843009 asm { .386 mov ax, seg txtbuf mov es, ax mov di, offset txtbuf mov eax, 206*BOOGA_VAL mov dx, 4 } LoopRef1: asm { mov cx, 80 add eax, BOOGA_VAL rep stosd dec dx jnz LoopRef1 mov dx, 4 } LoopRef2: asm { mov cx, 80 sub eax, BOOGA_VAL rep stosd dec dx jnz LoopRef2 .286p } #undef BOOGA_VAL } void dispchar(int xx, char c) { unsigned char far *font = fontptr + (c << 3); asm { push ds lds si, font mov ax, seg txtbuf mov es, ax mov di, offset txtbuf add di, xx mov bh, 4 mov cl, 100 } y_Loop: asm { mov bl, 128 mov dx, ds:[si] } x_Loop: asm { mov al, dl and al, bl jz nowrite mov es:[di], cl } nowrite: asm { inc di shr bl, 2 org $-1 db 1 jnz x_Loop add di, 312 inc cl mov bl, 128 } x_Loop2: asm { mov al, dh and al, bl jz nowrite2 mov es:[di], cl } nowrite2: asm { inc di shr bl, 2 org $-1 db 1 jnz x_Loop2 add di, 312 add si, 2 dec bh jnz y_Loop pop ds } } /* dispchar: writes char at offset in buffer */ void dispchar_r(int xx, char c) { unsigned char far *font = fontptr + (c << 3); asm { push ds lds si, font mov ax, seg txtbuf mov es, ax mov di, offset txtbuf add di, xx mov bh, 4 mov cl, 100 } y_Loop: asm { mov bl, 1 mov dx, ds:[si] } x_Loop: asm { mov al, dl and al, bl jz nowrite mov es:[di], cl } nowrite: asm { inc di add bl, bl jnz x_Loop add di, 312 inc cl mov bl, 1 } x_Loop2: asm { mov al, dh and al, bl jz nowrite2 mov es:[di], cl } nowrite2: asm { inc di add bl, bl jnz x_Loop2 add di, 312 add si, 2 dec bh jnz y_Loop pop ds } } /* dispchar_r: writes char at offset in buffer */ void dispstr(char dir, int offs, char *str) { int x; for (x = 312 - offs; *str && x <= 312; x += 8, str++) { if (x < 0) continue; if (!dir) dispchar(x,*str); else dispchar_r(x,*str); } } /* Writes string to buffer */ void do_scrolly() { static int wait; static int i; static char dir; sm_top_bar(); dispstr(dir, wait, msgs[i]); wait += 2; write_buf(); if ((wait - 310) >= (strlen(msgs[i])<<3)) { i++; wait = 0; } if (!*msgs[i]) { dir ^= 1; i = 0; } } int starpos[200-40-20]; char stardata[200-40-20]; void initstars() { int x; int lr = *((int far *) 0x46CL); for (x = 0; x < 200-60; x ++) { lr = ((lr * 9421) + 1); starpos[x] = lr % 320; lr = ((lr * 9421) + 1); stardata[x] = lr % 3; } } void scrollstars() { asm { push ds .386 mov ax, seg stardata mov fs, ax mov dx, offset stardata mov ax, seg starpos mov ds, ax mov si, offset starpos mov cx, 139 mov ax, 0A000h mov es, ax mov di, 6400+320 } big_loop: asm { mov bx, ds:[si] add bx, di mov byte ptr es:[bx], 0 mov ax, ds:[si] xchg dx, bx mov dl, fs:[bx] xchg dx, bx cmp bl, 0 jne not0 inc ax mov bh, 8 jmp done0 } not0: asm { cmp bl, 1 jne not1 add ax, 2 mov bh, 7 jmp done0 } not1: asm { add ax, 4 mov bh, 15 } done0: asm { cmp ax, 319 jle done1 sub ax, 320 } done1: asm { mov ds:[si], ax add ax, di xchg ax, bx mov es:[bx], ah xchg ax, bx add di, 320 inc dx add si, 2 loop big_loop .286p pop ds } }