User:Johnburger/Demo/User/Frame

From OSDev Wiki
Jump to navigation Jump to search

Drawing a frame is easy. I used the high OEM character set of the standard PC characters to draw the various corners and edges, and simply looped through the height and repeated widths.

The characters quoted below may not look like frame characters, but that's because they're in Unicode. The OEM equivalents come out just fine...

Demo/User/Frame.inc

;
; User/Frame.inc
;
; This function draws the frame using ASCII art and OEM characters
User.Frame:
PUSHECX
MOVAH,User.FrameColour
MOVEBX,ECX; Save this away
XORECX,ECX; Zero high part of ECX
MOVEDX,EDI; Save this away
MOVAL,'Ú'; TopLeft corner
STOSW; Store on screen
MOVAL,'Ä'; Top
MOVCL,BL; This many
REPSTOSW; Store on screen
MOVAL,'¿'; TopRight corner
STOSW; Store on screen
LEAEDI,[EDX+EBP]; Go to start of next row
MOVCL,BH; Height
MOVZXEBX,BL; Don't need BH any more
.Side:
MOVEDX,EDI; Save this away
MOVAL,'3'; Side
STOSW; Store on screen
LEAEDI,[EDI+EBX*2]; Move to right side
STOSW; Store on screen
LEAEDI,[EDX+EBP]; Go to start of next row
LOOP.Side
; MOV EDX,EDI  ; Save this away
MOVAL,'À'; Bottom left
STOSW; Store on screen
MOVAL,'Ä'; Bottom
MOVCL,BL; This many
REPSTOSW; Store on screen
MOVAL,'Ù'; Bottom right
STOSW; Store on screen
; LEA EDI,[EDX+EBP]  ; (Last row anyway)
POPECX
RET
Retrieved from "https://wiki.osdev.org/index.php?title=User:Johnburger/Demo/User/Frame&oldid=21447"