Post view

Assembly組合語言程式:WINS1.ASM〜WINS5.ASM

;  File Name : wins1.asm

        .286
        .model  small
        .stack
        .data
win1    db      "ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿",10,13
        db      "³               ³",10,13
        db      "³               ³",10,13
        db      "³               ³",10,13
        db      "ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ",10,13,"$"

        .code
show:
        mov     ah,09H
        int     21H
        ret

        .code
main:
        mov     dx,@data
        mov     ds,dx

        lea     dx,win1
        call    show

        mov     ax,4c00H
        int     21H
        end     main

;  File Name : wins2.asm

        .286
        .model  small
        .stack
        .data
win1    db      "ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿",10,13
        db      "³               ³",10,13
        db      "³               ³",10,13
        db      "³               ³",10,13
        db      "ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ",10,13,"$"

win2    db      "ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»",10,13
        db      "º                     º",10,13
        db      "º                     º",10,13
        db      "º                     º",10,13
        db      "º                     º",10,13
        db      "º                     º",10,13
        db      "ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ",10,13,"$"

        .code
show    proc
        mov     ah,09H
        int     21H
        ret
show    endp

        .code
main:
        mov     bx,@data
        mov     ds,bx

        lea     dx,win1
        call    show
        lea     dx,win2
        call    show

        mov     ax,4c00H
        int     21H
        end     main

;  File Name : wins3.asm

        .286
        .model  small
        .stack
        .data
win1    db      10,3
win2    db      20,6

        .code
printch proc
        push    ax
        mov     ah,02H
        int     21H
        pop     ax
        ret
printch endp

newline proc
        push    dx
        mov     dl,13
        call    printch
        mov     dl,10
        call    printch
        pop     dx
        ret
newline endp

ShowWindow    proc
        mov     bx,dx
        mov     dl,218
        call    printch
        mov     cx,0
        mov     cl,[bx]         ;cl = width
        sub     cx,2            ;cx = cx - 2
line1:
        mov     dl,196
        call    printch
        loop    line1
        mov     dl,191
        call    printch
        call    newline

        mov     cl,[bx+1]       ;cl = length
        sub     cx,2            ;cx = cx - 2
        mov     di,cx
line2:
        mov     dl,179
        call    printch
        mov     cl,[bx]         ;cl = width
        sub     cx,2            ;cx = cx - 2
space:
        mov     dl,32
        call    printch
        loop    space
        mov     dl,179
        call    printch
        call    newline
        dec     di
        jnz     line2
        mov     dl,192
        call    printch
        mov     cl,[bx]         ;cl = width
        sub     cx,2            ;cx = cx - 2
line3:
        mov     dl,196
        call    printch
        loop    line3
        mov     dl,217
        call    printch
        call    newline
        ret
ShowWindow    endp

        .code
main:
        mov     bx,@data
        mov     ds,bx

        lea     dx,win1
        call    ShowWindow
        lea     dx,win2
        call    ShowWindow

        mov     ax,4c00H
        int     21H
        end     main

;  File Name : wins4.asm

include winslib.inc

        .data
win1    db      10,3
win2    db      20,6

        .code
main:
        mov     bx,@data
        mov     ds,bx

        lea     dx,win1
        call    ShowWindow
        lea     dx,win2
        call    ShowWindow

        mov     ax,4c00H
        int     21H
        end     main

;  File Name : wins5.asm

        .286
        .model  small
        .stack
        .data
win1    db      3,3,30,8,071H
win2    db      5,5,30,8,017H

        .code
clrwin  proc
        pusha
        mov   cl,[bx]
        mov   ch,[bx+1]
        mov   dl,[bx+2]
        mov   dh,[bx+3]
        add   dl,cl
        add   dh,ch
        dec   dl
        dec   dh
        mov   bh,[bx+4]
        mov   al,0
        mov   ah,06H
        int   10H
        popa
        ret
clrwin  endp

gotoxy  proc
        pusha
        mov   bh,0
        mov   ah,02H
        int   10H
        popa
        ret
gotoxy  endp

printch proc
        pusha
        mov   bh,0
        mov   ah,0eH
        int   10H
        popa
        ret
printch endp

ShowWindow    proc
        mov   bx,dx
        call  clrwin
        mov   dl,[bx]
        mov   dh,[bx+1]
        call  gotoxy
        mov   al,218
        call  printch
        mov   cx,0
        mov   cl,[bx+2]         ;cl = width
        sub   cx,2              ;cx = cx - 2
line1:
        mov   al,196
        call  printch
        loop  line1
        mov   al,191
        call  printch
        mov   dl,[bx]
        mov   dh,[bx+1]
        inc   dh
        mov   si,dx
        mov   dx,0
        mov   dl,[bx+3]
        sub   dx,2
        mov   di,dx
line2:
        mov   dx,si
        call  gotoxy
        mov   al,179
        call  printch
        mov   dx,si
        add   dl,[bx+2]
        dec   dl
        call  gotoxy
        mov   al,179
        call  printch
        mov   dx,si
        inc   dh
        mov   si,dx
        dec   di
        jnz   line2
        mov   dx,si
        call  gotoxy
        mov   al,192
        call  printch
        mov   cl,[bx+2]         ;cl = width
        sub   cx,2              ;cx = cx - 2
line3:
        mov   al,196
        call  printch
        loop  line3
        mov   al,217
        call  printch
        ret
ShowWindow    endp

        .code
main:
        mov     bx,@data
        mov     ds,bx

        lea     dx,win1
        call    ShowWindow
        lea     dx,win2
        call    ShowWindow

        mov     ax,4c00H
        int     21H
        end     main

蘇言霖 2013/09/11 0 1809
Comments
Order by: 
Per page:
 
  • There are no comments yet
Rate
0 votes
Post info
蘇言霖
「超級懶貓級」社群網站站長
2013/09/11 (3874 days ago)
Actions