;  draws a box on screen using BIOS api
;
;  prints a string called 'top_bottom_border" on the 1st a 6th row of the screen
;  then moves cursor to the beggining of the second row.
;  then repeatedly prints one char to fill the space between the rows #1 and #6
;
;  prints to screen using bios calls
;  bios api lets us specify where on screen the string shall print
;  we'll change the cursor position thru bios
;  we'll also use the bios function "print char at current cursor position"
;   note: there is a "get cursor position" function, but we won't use it here
;
;  after your done, try adding to the program.
;  try this: before the program terminates, change the cursor position again
;  so that the dos-prompt doesn't startout writing in the box we printed
;  If you don't understand, don't worry, you'll see what I mean
.model small
.stack 100h
.data
top_bottom_border db "\ | / - \ | / - \ | / - \ | / - \ | / - \ | / - \ | / - \ | / - \ | / - \ | / - "         ;80 chars long
.code
main proc
mov ax, @data
mov ds, ax
mov es, ax
        ;print top border
mov ah, 13h         ; print string function
mov al, 0         ; bit 0 and 1 are clear       don't update cursor and string only contain text (no attributes)
mov bh, 0         ;page # is 0
mov bl, 6         ;text attribute. low 4 bits are foreground color, next 3 bits are background, high-bit sets text blinking
mov cx, 80         ;length of string. bios will print this many characters
mov dh, 0         ;row - 0 is first row
mov dl, 0         ;column - 0 is first column
mov bp, offset top_bottom_border         ; offset address of our string goes into the bp, segment is already in the es
int 10h         ;call to BIOS
        ;print bottom border
        ;in practice, all the registers are still set and only minor modifications should be made (change DH to change row)
mov ah, 13h
mov al, 0
mov bh, 0
mov bl, 6
mov cx, 80
mov dh, 5         ;row - 5 is sixth row
mov dl, 0
mov bp, offset top_bottom_border
int 10h
        ; set cursor position
mov ah, 2         ;set cursor function
mov bh, 0         ;video page
mov dh, 1         ;row- 1 is second row
mov dl, 0         ;column- 0 is first column
int 10h
        ; fill space between top & bottom rows with a repeatedly-printed character
mov ah, 9         ;WRITE CHARACTER AND ATTRIBUTE AT CURSOR POSITION
mov al, '@'         ;character to print
mov bh, 0         ;video page
mov bl, 9         ;text attribute
mov cx, 320         ;number of times to print char. 4 rows x 80 columns = 320 chars
int 10h
        ;return to DOS
mov ah, 4Ch
mov al, 0
int 21h
main endp
end main