#11 Article 175 Posted at 1987/06/11 04:08:08 by NOZOMU (MAP041) [PRG.NL2]

Subject: NEDI for 98+MASM ソノ4

;--------------------------------------
;
;       display(logial_page)
;
;       char    *logical_page
;
;--------------------------------------
public  display

display_arg     struc
        dw      ?
        dw      ?
lpd     dw      ?       ;&logical_page
display_arg     ends

display proc    near

        push    bp
        mov     bp,sp

        push    bx
        push    cx
        push    dx
        push    si

        mov     cx,0
loop2:
        mov     bx,0

loop1:
        push    [bp].lpd
        push    bx
        push    cx
        call    point

        push    ax
        push    bx
        push    cx
        call    pset

        inc     bx
        cmp     bx,96
        jb      loop1

        inc     cx
        cmp     cx,160
        jb      loop2

        mov     ax,0
        pop     si
        pop     dx
        pop     cx
        pop     bx

        pop     bp

        ret     2

display endp

;--------------------------------------
;
;       pset(x,y,c)
;
;       int     x,y,c
;
;--------------------------------------
public  pset

pset_arg        struc
bpsave  dw      ?
retadd  dw      ?
x       dw      ?
y       dw      ?
c       dw      ?
pset_arg        ends

pset    proc    near

        push    bp
        mov     bp,sp
        push    bx
        push    cx
        push    dx
        push    si
        push    di

        mov     ax,[bp].y
        add     ax,ax           ;*2
        add     ax,ax           ;*4
        add     ax,ax           ;*8
        add     ax,ax           ;*16
        mov     bx,ax
        add     ax,ax           ;*32
        add     ax,ax           ;*64
        add     ax,bx           ;*80
        add     ax,ax           ;*160
        mov     di,ax

        mov     ax,[bp].x
        shr     ax,1
        mov     bl,0
        rcl     bl,1
        add     di,ax

        mov     ax,[bp].c
        add     ax,ax
        mov     si,offset pattern
        cmp     gray,0
        jne     draw_pattern
        mov     si,offset color
draw_pattern:
        add     si,ax
        add     si,ax
        add     si,ax

        mov     dx,0000111111110000b
        cmp     bl,1
        jne     left
        mov     dx,1111000000001111b
left:
        mov     cx,0a800h
        mov     es,cx

        mov     ax,[si]
        inc     si
        inc     si
        mov     bl,al
        and     bl,dl
        mov     bh,es:[di]
        and     bh,dh
        or      bl,bh
        mov     es:[di],bl

        mov     bl,ah
        and     bl,dl
        mov     bh,es:[di+80]
        and     bh,dh
        or      bl,bh
        mov     es:[di+80],bl

        mov     cx,0b000h
        mov     es,cx

        mov     ax,[si]
        inc     si
        inc     si
        mov     bl,al
        and     bl,dl
        mov     bh,es:[di]
        and     bh,dh
        or      bl,bh
        mov     es:[di],bl

        mov     bl,ah
        and     bl,dl
        mov     bh,es:[di+80]
        and     bh,dh
        or      bl,bh
        mov     es:[di+80],bl

        mov     cx,0b800h
        mov     es,cx

        mov     ax,[si]
        mov     bl,al
        and     bl,dl
        mov     bh,es:[di]
        and     bh,dh
        or      bl,bh
        mov     es:[di],bl

        mov     bl,ah
        and     bl,dl
        mov     bh,es:[di+80]
        and     bh,dh
        or      bl,bh
        mov     es:[di+80],bl

        mov     ax,[bp].c

        push    cs
        pop     es
        pop     di
        pop     si
        pop     dx
        pop     cx
        pop     bx
        pop     bp
        ret     6

pset    endp

;--------------------------------------
;
;       int     point(x,y,logical_page)
;
;       int     x,y,*logical_page
;
;--------------------------------------
point   proc    near

push    bp
mov     bp,sp

        push    bx
        push    cx
        push    dx
        push    si

        mov     si,[bp+8]
        mov     bx,[bp+6]
        mov     cx,[bp+4]

        mov     ax,cx           ;x
        add     ax,ax           ;*2
        add     ax,ax           ;*4
        add     ax,ax           ;*8
        add     ax,ax           ;*16