Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .model tiny
- .386
- .code
- org 100h
- Start:
- mov ah, 0Fh
- int 10h
- mov byte ptr screenWidth, ah
- mov byte ptr mode, al
- sub ah, 39
- shr ah, 1
- mov byte ptr leftPart, ah
- mov ah, byte ptr screenWidth
- sub ah, byte ptr leftPart
- sub ah, 39
- mov byte ptr rightPart, ah
- mov bl, 00011110b
- xor dx, dx
- mov ax, 0B800h
- mov es, ax
- xor di, di
- jmp Main
- screenWidth db ?
- leftPart db ?
- rightPart db ?
- mode db ?
- leftCorner db ?
- middlePipe db ?
- rightCorner db ?
- whiteSpaces proc
- xor ax, ax
- mov al, byte ptr screenWidth
- mov cx, 3
- mul cx
- mov cx, ax
- mov ah, 1Fh
- mov al, 32
- rep stosw
- ret
- whiteSpaces endp
- frameLine proc
- mov cl, byte ptr leftPart
- rep stosw
- mov al, byte ptr leftCorner
- stosw
- mov al, 205
- mov cl, 3
- rep stosw
- mov al, byte ptr middlePipe
- stosw
- mov al, 205
- mov cl, 33
- rep stosw
- mov al, byte ptr rightCorner
- stosw
- mov al, 32
- mov cl, byte ptr rightPart
- rep stosw
- ret
- frameLine endp
- Main:
- call whiteSpaces
- mov byte ptr leftCorner, 201
- mov byte ptr middlePipe, 203
- mov byte ptr rightCorner, 187
- call frameLine
- mov cl, byte ptr leftPart
- rep stosw
- mov al, 186
- stosw
- mov al, 32
- mov cl, 3
- rep stosw
- mov al, 186
- stosw
- mov al, 32
- stosw
- mov al, 48
- numbers:
- stosw
- push ax
- mov al, 32
- stosw
- pop ax
- inc al
- cmp al, 58
- jl numbers
- mov al, 65
- letters:
- stosw
- push ax
- mov al, 32
- stosw
- pop ax
- inc ax
- cmp al, 71
- jl letters
- mov al, 186
- stosw
- mov al, 32
- mov cl, byte ptr rightPart
- rep stosw
- mov byte ptr leftCorner, 204
- mov byte ptr middlePipe, 206
- mov byte ptr rightCorner, 185
- call frameLine
- mov dl, 48
- xor al, al
- print_table:
- push ax
- mov al, 32
- mov cl, byte ptr leftPart
- rep stosw
- mov al, 186
- stosw
- mov al, 32
- stosw
- mov al, dl
- stosw
- inc dl
- cmp dl, 58
- jne continue_printing
- mov dl, 65
- continue_printing:
- mov al, 32
- stosw
- mov al, 186
- stosw
- mov al, 32
- stosw
- mov cx, 16
- table_loop:
- pop ax
- stosw
- inc al
- push ax
- mov al, 32
- stosw
- dec cx
- jnz table_loop
- mov al, 186
- stosw
- mov al, 32
- mov cl, byte ptr rightPart
- rep stosw
- pop ax
- cmp dl, 71
- jl print_table
- mov byte ptr leftCorner, 200
- mov byte ptr middlePipe, 202
- mov byte ptr rightCorner, 188
- call frameLine
- call whiteSpaces
- end_print:
- mov dh, 25
- xor dl, dl
- mov ah, 02h
- int 10h
- xor ax, ax
- int 16h
- xor ax, ax
- mov al, byte ptr mode
- int 10h
- ret
- end Start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement