display4.s
来自「LINUX lilo-22.7 源代码。」· S 代码 · 共 1,346 行 · 第 1/2 页
S
1,346 行
d4_I575a: mov WORD [_Mode],#18 ;0012H;; mov cx,#8;; cwd ;; idiv cx;; mov WORD [_ypitch],ax; Line 318 br d4_I577d4_I576:; Line 319 mov ax,#3 stc br _display4_retd4_Vesa_Setup: mov WORD [_Mode],#0x101 ; 640x480x256 mov di,#MAP ; ES:DI -> 512 byte buffer mov DWORD (di),#SIG_VBE2 ; "VBE2" mov ax,#0x4f00 ; get mode information push es push ds pop es ; -> communication area int 0x10 ; video interrupt pop es#if FAIL xor ax,ax#endif cmp ax,#0x004f jne d4_I576_4 ; no VESA cmp DWORD (di),#SIG_VESA ; "VESA" jne d4_I576_4 mov ax,#0x4f01 ; get mode information mov cx,[_Mode] push es push ds pop es ; -> communication area int 0x10 ; video interrupt pop es cmp ax,#0x004f;;d4_I576_jne: jne d4_I576_4 ; no VESA mov ax,v_BytesPerScanLine(di) mov [_ypitch],ax mov ax,v_WinASegment(di) mov [_seg],ax mov cx,v_WinGranularity(di) mov ax,#9 ; shift = 9d4_J575: jcxz d4_K575 inc ax ; shift++ shr cx,#1 jmp d4_J575d4_K575: mov [_shift],ax xchg ax,cx ; shift to CX mov eax,#-1 shl eax,cl ; not eax mov DWORD [_mask],eax not eax and eax,#0x00FFFFFF mov DWORD [_himask],eax ; test BYTE v_ModeAttributes(di),#1 jz d4_I576_4 mov al,v_WinAAttributes(di) and al,#05 cmp al,#05 jne d4_I576_4;;; mov bx,#0x8000;;; mov WORD (bp-10),bx ;disable;;; or bx,[_Mode] mov bx,[_Mode] mov ax,#0x4f02 ; set video mode int 0x10 cmp ax,#0x004f;;; jne d4_I576_4 je d4_Line_327d4_I576_4: mov ax,#4 stc br _display4_ret; Line 321d4_I577:; Line 322; Line 323 mov bx,#0 mov ax,#6656 ;1a00H int 0x10#if FAIL xor ax,ax#endif cmp al,#26 ;001aH jne d4_I578 cmp bl,#7 je d4_I579 cmp bl,#8 je d4_I579d4_I578: mov ax,#2 stc br _display4_ret; Line 324d4_I579: mov bx,#49 ;0031H mov ax,#4609 ;1201H int 0x10;;; mov WORD (bp-10),#128 ;0080H ;disable mov ax,WORD [_Mode];;; or al,#128 ;0080H int 0x10; Line 327d4_Line_327: mov dx,#480/16 mov bx,#0 mov ax,#0x1124 ;set for 8x16 characters int 0x10; Line 331;;; cmp WORD (bp-10),#0 ;disable;;; je d4_I580 mov bx,#54 ;0036H mov ax,#4609 ;1201H int 0x10; Line 333d4_I580: les bx,(bp-22) ;bmh seg es mov si,WORD (bx) add si,WORD [_tp] push ds mov ds,WORD [_tp+2]; Line 334 xor bx,bx ;id4_FC582:; Line 335 push bx seg cs cmp [_Mode],#0x12 ja d4_Vesa_Palette mov bh,bl mov ax,#0x1000 int 0x10d4_Vesa_Palette: mov bx,#0x3fff ;00ffH lodsb mul bh div bl mov cl,al lodsb mul bh div bl mov ch,al lodsb mul bh div bl mov dh,al xor dl,dl pop bx ;color = i mov ax,#0x1010 int 0x10; Line 336 mov di,(bp-22) ;bmh cmp BYTE (di),#12 ; test for OS/2 bitmap je d4_F580 inc sid4_F580:; Line 337 inc bx ;WORD (bp-8) ;id4_F581: cmp WORD (bp-6),bx ;colors jg d4_FC582 pop ds; Line 339 les bx,(bp-18) ;bmfh seg es mov ax,WORD (bx+10) seg es mov dx,WORD (bx+12) add ax,WORD [_bmp] adc dx,#0 shl dx,#12 add dx,WORD [_bmp+2] mov WORD [_tp],ax mov WORD [_tp+2],dx; Line 340 xor ax,ax call d4_setstate; Line 341 mov ax,#1 call d4_setstate; Line 342 les bx,(bp-22) ;bmh;; seg es;; mov ax,WORD (bx+8) ; 480 mov ax,#480 ; Windows or OS2;; seg es;; mov dx,WORD (bx+4) ; 640 mov dx,#640 ; Windows or OS2 seg es cmp BYTE (bx),#13 ; OS2 sbb cx,cx ; OS2 = -1, Win = 0 not cx seg es and cx,WORD (bx+16) ; compression mov bx,cx ; compression to BX mov si,#d4_getrow4 mov di,#d4_putrow4 cmp WORD [_Mode],#0x12 jbe d4_FC586 mov si,#d4_getrow8 mov di,#d4_putrow8d4_FC586: dec ax js d4_FC587; Line 343 xchg ax,bx;;; call d4_getrow4 call si ;getrow; Line 344 xchg ax,bx;;; call d4_putrow4 call di ;putrow; Line 345 jmp d4_FC586d4_FC587:; Line 346 xor ax,ax ; restore state call d4_setstate; Line 348 mov bx,#54 ;0036H ;enable refresh mov ax,#4608 ;1200H int 0x10 xor ax,ax ;clears the carry_display4_ret: pop di pop si leave ret .even ; 4_done4: xor ax,ax call d4_setstate ;restore state; Line 356; enable default palette loading mov bx,#49 ;0031H mov ax,#4608 ;1200H int 0x10; Line 357 mov ax,#0x0003 ; set video mode int 0x10; Line 359 ret ; pixadr8 - pixel address in 256 color mode;; Enter with:; AX = y; BX = x;; Exit with:; ES:DI = pointer to byte;d4_pixadr8: push ax push cx push dx push ds push cs pop ds;; seg cs mul WORD [_ypitch] add ax,bx adc dx,#0 mov di,ax;; seg cs mov cl,[_shift];; seg cs and di,[_mask] shrd ax,dx,cl;; seg cs cmp ax,[_VesaWindow] je d4p8_1;; seg cs mov [_VesaWindow],ax xchg ax,dx push bx xor cx,cx xor bx,bx mov ax,#0x4f05 int 0x10 pop bxd4p8_1:;; seg cs mov es,[_seg] pop ds pop dx pop cx pop ax ret; putrow8;; Enter with:; AX = y; BX = compression; DX = npix (640); DS == CS;; Exit with:; ES is trashed; all other registers preserved;d4_putrow8: pusha mov si,#_line ; source mov cx,WORD [_mask] ; mask xor bx,bx xor di,did4p8_2: test di,cx jnz d4p8_3 call d4_pixadr8d4p8_3: inc bx movsb cmp bx,dx jb d4p8_2 popa ret; getrow8;; AX = compression; DX = npix (640); BX = y;;d4_getrow8: pusha push ds push cs pop es mov di,#_line ; ES:DI setup lds si,[_tp] ; DS:SI is a HUGE pointer mov bp,ds ; also in BP:SI test ax,ax jz d4_get8_nocompr; get with compression;; DX is npix; BH is repeat; BL is skip; CX is rpt; repeat = 1; mov bh,#1; while (npix>0) { jmp d4_get8_99d4_get8_1:; while (repeat && npix>0) { jmp d4_get8_30d4_get8_10:; rpt = GETC(infile); call getbyte xchg ax,cx; repeat = rpt; mov bh,cl; if (repeat) { test bh,bh jz d4_get8_20; c = GETC(infile); call getbyte; npix -= rpt; sub dx,cx; while (rpt>0) {; *lp++ = c;; rpt--;; } rep stosb; }d4_get8_20:; } /* end while (repeat && npix>0) */d4_get8_30: test bh,bh ; repeat jz d4_get8_40 cmp dx,#0 jg d4_get8_10d4_get8_40:; if (npix>0) { /* get some enumerated data */ cmp dx,#0 jle d4_get8_95; rpt = GETC(infile); call getbyte xchg ax,cx; npix -= rpt; sub dx,cx; skip = (rpt%2 != 0); mov bl,cl; while (rpt>0) { jcxz d4_get8_75d4_get8_70:; c = GETC(infile); call getbyte; *lp++ = c; stosb; rpt--;; } loop d4_get8_70d4_get8_75:; if (skip) c = GETC(infile); shr bl,#1 jnc d4_get8_80 call getbyted4_get8_80:; }d4_get8_95:; repeat = 1; mov bh,#1; } /* end while (npix>0) */d4_get8_99: cmp dx,#0 jg d4_get8_1; GETC(infile);; c=GETC(infile); call getbyte call getbyte jmp d4_get8_exit; get with no compression; really just a super movsb with a huge source pointerd4_get8_nocompr: mov cx,dxd4_get8_nloop: call getbyte ; BP==DS is required stosb loop d4_get8_nloopd4_get8_exit: seg cs mov [_tp],si ; seg cs mov [_tp+2],ds ; pop ds popa ret; char256;; Enter with:; AL character to display; BX ypos; DX xpos; (bp+4) far pointer to ;; Exit with:; ES is trashed;;; Stack used:; bp-2 points; bp-4 ypos; bp-6 xpos; bp-8 bits; bp-10 xtem;; Variables:; DS:SI cgen; SI i; BX xtem; ES:DI buf;d4_char256: enter #10,#0 pusha push ds push WORD #0 pop ds; points = *(short*)0x00000485UL; /* 40:85 */ mov cx,WORD [0x485] ;points xor ah,ah ;AL is char to put out mov WORD (bp-2),cx ;points mov WORD (bp-4),bx ;ypos mov WORD (bp-6),dx ;xpos; cgen = *(char**)(0x43 * 4UL); /* int 0x43 points to char bitmap */; cgen += (unsigned)c * points; imul ax,cx ;leave DX alone; 386 form of instruction mov si,#268 ;010cH ; int 0x43 -> character bitmaps add ax,WORD (si) mov ds,WORD (si+2) ;cgen xchg si,ax ;cgen in DS:SI; shadow = 0; xor ch,ch les di,(bp+4) ;sch->; fg = sch->fg; seg es mov cl,(di); bg = sch->bg; seg es mov dh,(di+2); sh = sch->sh; seg es mov dl,(di+4);; while (points--) {d4_char256_10:; int i;;; bits = *cgen++; ;cgen in DS:SI lodsb mov WORD (bp-8),ax ;bits push si ; save SI; fore = bits; ; fore is BL xchg bx,ax ; fore is BL; xtem = x; mov ax,WORD (bp-6) mov WORD (bp-10),ax ;xtem; for (i=8; i; i--) { mov si,#8 ;i xor di,di ;bufd4_char256_20: seg cs test di,WORD [_mask] jnz d4_char256_22 push bx mov ax,WORD (bp-4) ;ypos mov bx,WORD (bp-10) ;xtem call d4_pixadr8 ;buf to ES:DI pop bxd4_char256_22:; int color = 0x400; mov ax,#0x400; if (bg != fg) color = bg; cmp dh,cl ;bg:fg je d4_char256_31 mov al,dh ;color = bg cbwd4_char256_31:; if ( (shadow&0200) && sh != fg) color = sh; shl ch,#1 ;shadow jnc d4_char256_33 cmp dl,cl ;sh:fg je d4_char256_33 mov al,dl ; color = sh cbwd4_char256_33:; if ( (fore & 0200) ) color = fg; shl bl,#1 jnc d4_char256_35 mov al,cl ; color = fg cbwd4_char256_35:; buf = pixadr8(xtem++, y);; if (color<256) *buf = color; inc ah cmp ah,#1 ja d4_char256_39 seg es mov BYTE (di),ald4_char256_39: inc di inc WORD (bp-10) ;xtem; shadow <<= 1;; fore <<= 1;; } dec si ;i jnz d4_char256_20; y++; inc WORD (bp-4) ;ypos; shadow = bits>>1; mov ch,BYTE (bp-8) shr ch,#1; } pop si ;cgen dec WORD (bp-2) jnz d4_char256_10d4_char256_exit: pop ds popa leave ret
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?