-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathv5.asm
35 lines (32 loc) · 1.72 KB
/
v5.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
; Vintage Computing Christmas Challenge 2024
; Jose Moreno Prieto 'Xeleh' - 10/12/2024
org 100h
main mov di,string+4 ; di = pointer to present string (+4 = after the lace)
mov dx,18 ; dx = current row = 18
.l1 mov ax,0d0ah ; ax = crlf
stosw ; add crlf to string
mov bx,'+-' ; chars for horizontal line: bl = "+", bh = "-"
mov al,dl ; al = current row
aam 9 ; horizontal line?
jz .go ; yes -> use current chars
mov bx,'| ' ; no -> use chars for vertical line: bl = "|", bh = " "
.go xchg ax,bx ; al = bl, ah = bh (optimized)
.l2 stosw ; add chars to the string
xchg al,ah ; exchange chars so al = fill char
mov cl,7 ;
rep stosb ; add fill char 7 times
xchg al,ah ; exchange chars so al = line char
cmc ;
jc .l2 ; one more time
stosb ; add closing line char to string
dec dx ; previous row
jns .l1 ; loop until row is -1
mov byte[di],'$' ; add msdos end char to the string
xchg bp,ax ; ah = 09h (print string - msdos function)
mov dx,string ; dx = present string
int 21h ; print string
%ifdef debug
waitkey
ret
%endif
string db 9,'\o/' ; lace