;  WARNING...this is what happens when you drink TOO much coffee.
; 121, 118, 115, 99, 98, 97, 96, 94, 92, 91, 90, 89, 88
; see nice for the explanation of what the fuck i'm doing here.

;Eldre8 - found 3 bytes to save!

code  segment para public 'CODE'
      assume cs:code, ds:code
		.386
		org 100h
start:
  db 8ah, 1eh, 80h, 00h       ; hehehe that was fun. (mov bl, [80h])
  mov [bx+81h], al

  mov ah, 3dh
  mov dl, 82h
  int 21h
  jc FuckHead
  mov bx, ax

  mov al, 13h   ; this is a fluke one...
  int 10h

  push 0a000h   ; pissed off that nothing can be done about this.
  pop es        ; well, at least nothing i can think of.

;鞍鞍DECODE PCX北北北北北北北北北北北北北北北北北北北北北北北北北北北北

  mov ah, 3fh
  mov ch, (64768+128)/256     ; evil zoon tricks. ;)
  lea dx, Manufacturer
  int 21h

  xor di, di            ; damn inconsistant initial values...

  lea si, ScrPal
DecodePCX:
  mov cl, 1
  lodsb
  cmp al, 192
  jb Single
  and al, 63
  mov cl, al
  lodsb
Single:
  rep stosb
  cmp di, 64001
  jb DecodePCX

  mov dx, 3c8h
  xor al, al
  out dx, al
  inc dx

  mov ch, 3   ;cx=768..zoon's trick is VERY nice.  as you can tell. :)
SetPal:
  lodsb
  shr al, 2
  out dx, al
  loop SetPal

;北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北
  xor ah, ah     ;
  int 16h        ;  Very tempted to use Pascal's tactic for these... :)
                 ;  the 20 byte starfield is amazing...but he could've
  mov al, 3      ;  just been nice and at least returned to dos :)
  int 10h        ;  but i suppose it's justified, as these three things
                 ;  are around 11 bytes total anyway.  damn that thing
FuckHead:        ;  was small.
  ret            ;

;鞍癙CX decoder data北北北北北北北北北北北北北北北北北北北北北北北北北北
Manufacturer	db 	?
PCXVersion		db 	?
Encoding 		db 	?
BitsPerPixel	db 	?
XMin				dw 	?
YMin				dw 	?
XMax				dw 	?
YMax				dw 	?
Hres				dw 	?
Vres				dw 	?
CrapPalette 	db 	48 dup (?)
Reserved1		db 	?
ColorPlanes 	db 	?			  ; so i like the american spelling better...
BytesPerLine	dw 	?
PaletteType 	dw 	?
Reserved2		db 	58 dup (?)

ScrPal   db   64768 dup (?)     ; screen + palette.
;北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北

ends code
end start
