Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- org 256
- mov ax, 0x0013
- int 0x10
- push 15
- push 20
- push 50
- push 150
- push 149
- call rectangle
- add sp, 10
- while:
- mov ah, 0
- int 0x16
- cmp al, 'q'
- jnz while
- mov ah, 0x00
- mov al, 0x03
- int 0x10
- ret
- rectangle:
- push bp
- mov bp, sp
- push bx
- push ds
- push si
- push ax
- push cx
- mov bx, 0xA000 ; Сегмент с видеопамятью
- mov ds, bx
- mov ax, [bp + 8] ; y1
- mov bx, 320
- mul bx
- mov bx, ax ; in bx — zeroth byte of line y1
- mov cl, [bp + 12] ; color
- mov ax, [bp + 4] ; y2
- mov si, 320
- mul si
- mov si, ax
- sub si, bx ; si — offset between top and bottom lines
- mov ax, bx
- add ax, [bp + 6] ; add x2, in ax — x2 byte of line y1
- add bx, [bp + 10] ; add x1, in bx — x1 byte of line y1
- rect_while1:
- mov [bx], cl
- mov [bx + si], cl
- inc bx
- cmp bx, ax
- jnz rect_while1
- mov ax, [bp + 8] ; y1
- mov bx, 320
- mul bx
- mov bx, ax
- add bx, [bp + 10] ; add x1, in bx — x1 byte of line y1
- mov si, 320
- mov ax, [bp + 4] ; y2
- mul si
- add si, [bp + 6] ; x2
- sub si, [bp + 10] ; sub x1, now si — offset between left and right lines
- add ax, [bp + 10] ; add x1
- rect_while2:
- mov [bx], cl
- mov [bx + si], cl
- add bx, 320
- cmp bx, ax
- jnz rect_while2
- pop cx
- pop ax
- pop si
- pop ds
- pop bx
- pop bp
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement