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

Subject: NEDI for 98+MASM ソノ2

mov     yp,bx
        pop     bx
        ret
not_up:
        cmp     al,0ah
        jnz     not_down
        mov     bx,yp
        cmp     bx,94
        ja      not_down

        mov     ax,offset logical_page
        push    ax
        push    yp
        push    xp
        call    point

        push    ax
        push    yp
        push    xp
        call    pset

        inc     bx
        mov     yp,bx
not_down:
        pop     bx
        ret

;--------------------------------------

point_edit:
        push    ax
        push    bx

        cmp     al,'0'
        jb      not_edit
        cmp     al,'7'
        ja      not_edit
        mov     bl,al
        sub     bl,'0'
        mov     bh,0

        mov     ax,offset logical_page
        push    ax
        push    bx
        push    yp
        push    xp
        call    logical_pset

        push    bx
        push    yp
        push    xp
        call    pset

not_edit:
        pop     bx
        pop     ax
        ret

;--------------------------------------
;
;       input_file_name(file_name,message)
;
;       char    *file_name,*message
;
;--------------------------------------

input_file_name proc    near

        push    bp
        mov     bp,sp

        push    ax
        push    bx
        push    cx
        push    dx
        push    si
        push    di

        mov     ah,11h                  ;corsor on
        int     18h
        mov     ah,65                   ;Prohibit to display graphic
        int     24
        mov     ah,09h                  ;Display string
        mov     dx,[bp+6]               ;message pointer
        int     21h
        mov     ah,0ah                  ;Buffered keyboard input
        mov     dx,offset templete
        int     21h
        mov     cl,byte ptr templete+1
        mov     ch,0
        mov     si,offset templete+2
        mov     di,[bp+4]
        cld
        rep     movsb
        mov     byte ptr [di],0

        mov     ah,09h                  ;Display string
        mov     dx,offset cls
        int     21h
        mov     ah,64                   ;Admit to display graphic
        int     24
        mov     ah,12h                  ;corsor off
        int     18h

        pop     di
        pop     si
        pop     dx
        pop     cx
        pop     bx
        pop     ax

        pop     bp

        ret     4

input_file_name endp

;--------------------------------------
;
;       read(file_name,logial_page)
;
;       char    *file_name,*logical_page
;
;--------------------------------------
public  read

read_arg        struc
        dw      ?
        dw      ?
fn      dw      ?       ;&file_name
lp      dw      ?       ;&logical_page
read_arg        ends

read    proc    near

        push    bp
        mov     bp,sp

        push    bx
        push    cx
        push    dx
        push    di
        push    si

        mov     ah,65                   ;Prohibit to display graphic
        int     24

        mov     ah,3dh                  ;file open
        mov     al,0                    ;read mode
        mov     dx,[bp].fn
        int     21h
        jb      error
        mov     si,[bp].lp
        mov     di,offset read_buffer

        mov     bx,ax                   ;file handle
        mov     ah,3fh                  ;read from file
        mov     cx,8000                 ;data length
        mov     dx,offset read_buffer
        int     21h

get_1char:
        mov     al,[di]
        inc     di
        sub     al,' '
        jb      get_1char

        cmp     al,80h
        jb      skip0
        sub     al,' '
skip0:
        mov     dl,al
        and     dl,00111000b
        shr     dl,1
        shr     dl,1
        shr     dl,1
        mov     dh,al
        and     dh,00000111b

        test    al,01000000b
        mov     cx,1
        jz      not_press

        mov     cl,[di]
        inc     di
        sub     cl,' '
        cmp     cl,80h
        jb      skip1
        sub     cl,' '
skip1:
        mov     ch,0
        inc     cx
        inc     cx
not_press:
loop3:  mov     [si],dx
        inc     si
        inc     si
        loop    loop3
        mov     ax,[bp].lp
        add     ax,15360
        cmp     si,ax
        jb      get_1char

        mov     ah,3eh                  ;Close file
        int     21h

        mov     ax,0
        jmp     short exit_read

error:
        mov     ah,09h                  ;Display string
        mov     dx,offset cls
        int     21h
        mov     ah,09h                  ;Display string
        mov     dx,offset error_message
        int     21h
        mov     cx,0ffffh
wait0:  mov     ax,0001h
        mov     dx,0000h
        mov     bx,1