You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

464 lines
8.9 KiB
NASM

[org 0x1000]
5 years ago
start:
mov [bootdev], dl
5 years ago
mov bx, 0
mov [helpon], bx
5 years ago
mov ah, 01h ;make cursor invisible
mov cx, 2607h
int 10h
5 years ago
mov ah, 06h ; Scroll up function
xor al, al ; Clear entire screen
xor cx, cx ; Upper left corner CH=row, CL=column
mov dx, 184FH ; lower right corner DH=row, DL=column
mov bh, 1Eh ; YellowOnBlue
int 10H ; execute interrupt
mov ah, 06h; top bar, make background
xor cx, cx
mov dx, 0x004F
mov bh, 30h
int 10h
mov ah, 02h ;top bar setting the position and then write title $
mov bh, 0h
mov dh, 0h
mov dl, 20h
int 10h
mov si, title
call print
5 years ago
mov ah, 06h ;draw rect on background
mov cx, 0201h
mov dx, 124Dh
5 years ago
mov bh, 3Eh
int 10h
call drawshadow
5 years ago
; menu bottom
mov ah, 06h ;draw rect on background
mov cx, 1700h
mov dx, 184Fh
mov bh, 3Fh
int 10h
5 years ago
mov ah, 02h ;sets cursor to top to write
mov bh, 0h
mov dh, 17h
mov dl, 2h
5 years ago
int 10h
mov si, menuhelp
call print
5 years ago
mov si, menuselect
call print
mov si, menuexit
call print
mov si, menuenter
call print
5 years ago
mov ah, 02h ;sets cursor to top to write
mov bh, 0h
mov dh, 4h
mov dl, 4h
int 10h
mov si, msg1
call print
5 years ago
print_projects:
mov ah, 02h ;sets cursor to top to write
mov bh, 0h
mov dh, 6h ;row
mov dl, 4h ;col
int 10h
xor bx, bx ; Starting at offset zero
lea di, [projects] ; RDI now has the address of the array
.loop
5 years ago
mov [storebx], bx
5 years ago
mov ah, 02h
;mov bh, 0h
add dh, 1h ;move cursor down
5 years ago
mov dl, 4h;
int 10h
mov ax, [currentselection]
cmp ax, bx
jne .normalbackground
mov ah, 06h ;draw rect on background
mov ch, dh
mov cl, 4h
mov dl, 40h
5 years ago
mov bh, 7Ch
int 10h
jmp .drawstring
.normalbackground
mov ah, 06h ;draw rect on background
mov ch, dh
mov cl, 4h
mov dl, 40h
5 years ago
mov bh, 1Eh
5 years ago
int 10h
5 years ago
jmp .drawstring
5 years ago
5 years ago
.drawstring
mov bx, [storebx]
5 years ago
mov si, [di+bx] ; Get the address of string1
call print
add bx, 8
cmp bx, 48
jne .loop
5 years ago
jmp waitforkey
waitforkey:
mov ah, 0x00
int 0x16
cmp ah, 1Fh
je .up
cmp ah, 50h
je .up
5 years ago
cmp ah, 11h
je .down
cmp ah, 48h
je .down
cmp ah, 1Ch
je loadproject
5 years ago
cmp ah, 01h
je goback
5 years ago
cmp ah, 3Bh
je help
5 years ago
jmp waitforkey
.up
mov ax, [helpon]
cmp ax, 1
je .uphelp
5 years ago
mov ax, [currentselection]
cmp ax, 40
je .reup
add ax, 8
mov [currentselection], ax
jmp print_projects
.uphelp
sub dl, cl
movzx dx, dl
inc dx
mov ax, [scrollchars]
add ax, dx
mov [scrollchars], ax
jmp help
5 years ago
.reup
mov ax, 0
mov [currentselection], ax
jmp print_projects
.down
mov ax, [helpon]
cmp ax, 1
je .downhelp
5 years ago
mov ax, [currentselection]
cmp ax, 0
je .redown
sub ax, 8
mov [currentselection], ax
jmp print_projects
.downhelp
sub dl, cl
movzx dx, dl
inc dx
mov ax, [scrollchars]
sub ax, dx
mov [scrollchars], ax
jmp help
5 years ago
.redown
mov ax, 40
mov [currentselection], ax
jmp print_projects
5 years ago
5 years ago
help:
mov bx, 1
mov [helpon], bx
mov ah, 06h ;draw rect on background
mov cx, 060Fh
mov dx, 103Bh
5 years ago
mov bh, 70h
int 10h
push dx
push cx
5 years ago
mov si, helptext
call printinrect
pop cx
pop dx
push dx
push cx
call drawshadow
5 years ago
jmp waitforkey
pop cx
pop dx
loadproject:
mov bx, [currentselection]
cmp bx, 0
je .one
cmp bx, 8
je .two
cmp bx, 16
je .three
cmp bx, 24
je .four
cmp bx, 32
je .five
cmp bx, 40
je .six
jmp waitforkey
.one
mov bx, 0x2000 ; BX = 0x1000. ES:BX=0x0:0x1000
mov cl, 06 ; Sector to read = 4
jmp load
.two
mov bx, 0x3000 ; BX = 0x1000. ES:BX=0x0:0x1000
mov cl, 08 ; Sector to read = 4
jmp load
.three
mov bx, 0x4000 ; BX = 0x1000. ES:BX=0x0:0x1000
mov cl, 10 ; Sector to read = 4
jmp load
.four
mov bx, 0x5000 ; BX = 0x1000. ES:BX=0x0:0x1000
mov cl, 12 ; Sector to read = 4
jmp load
.five
mov bx, 0x9000 ; BX = 0x1000. ES:BX=0x0:0x1000
mov cl, 14 ; Sector to read = 4
jmp load
.six
mov bx, 0x7000 ; BX = 0x1000. ES:BX=0x0:0x1000
mov cl, 16 ; Sector to read = 4
jmp load
load:
pushf
stc
mov ah,00
int 13h
.read_sector:
mov ax, 0x0
mov es, ax ; ES = 0
; ES:BX = starting address to read sector(s) in$
mov ah, 02 ; Int 13h/AH=2 = Read Sectors From Drive;
mov al, 0x02 ; Sectors to read = 1
mov ch, 00 ; CH=Cylinder. Second sector of disk
; is at Cylinder 0 not 1
mov dh, 00 ; Head to read = 0
mov dl, [bootdev]
int 13h
jc wolf_error
popf
jmp bx
cli
hlt
wolf_error:
mov si, wolf_error_msg
call print
mov si, wolf_error_msg1
call print
mov ah,00
int 16h
xor ax,ax
int 19h
;------------;
;ch=row ;
;cl=column ;
;dh=row ;
;dl=column ;
;------------;
drawshadow:
push cx
push dx
mov al, dl
mov ah, ch
inc ah
inc al
mov cx, ax
mov bl, dl
mov bh, dh
inc bl
inc bh
mov dx, bx
mov ah, 06h ;draw shadow
mov bh, 0Ch
int 10h
pop dx
pop cx
mov al, cl
mov ah, dh
inc ah
inc al
mov cx, ax
mov bl, dl
mov bh, dh
inc bl
inc bh
mov dx, bx
mov ah, 06h ;draw shadow
mov bh, 0Ch
int 10h
ret
5 years ago
printinrect:
mov ax, 0
mov [writtenchars], ax
push cx
mov bx, dx
push bx
5 years ago
mov ah, 02h ;sets cursor to top to write
mov bh, 0h
mov dh, ch
mov dl, cl
int 10h
.loop:
mov ax, [writtenchars]
inc ax
mov [writtenchars], ax
lodsb ; load next char
5 years ago
mov bh, 0
mov ah, 0x03
int 10h ;read cursor position
push dx
pop dx
pop bx
cmp dh, bh ;comp for scroll
jg .stop
push bx
push dx
or al,al
5 years ago
jz .exit
mov bx, [writtenchars]
cmp bx, [scrollchars]
jg .writechar
.continue:
pop dx
pop bx
cmp dl, bl ;if caracter over width of rect
je .newline ; go to next line
push bx
5 years ago
jmp .loop
.writechar:
mov ah, 0x0e
mov bh, 0x00
mov cx, 0x01
int 10h ;write char
jmp .continue
.stop:
pop cx
ret
5 years ago
.exit:
pop dx
pop bx
pop cx
5 years ago
ret
.newline:
pop cx
push bx
mov dl, cl ;set column
inc dh ;increment row by one, works!
mov ah, 02h ;sets cursor
mov bh, 0h ;page number 0 constant
5 years ago
int 10h
pop bx
push cx
push bx
5 years ago
jmp .loop
5 years ago
print:
lodsb
or al,al
5 years ago
jz .exit
5 years ago
mov ah,0x0e
int 10h
jmp print
5 years ago
.exit:
5 years ago
ret
5 years ago
goback:
5 years ago
mov dl, [bootdev]
mov ax, [helpon]
cmp ax, 1
je start
5 years ago
jmp 0x0:0x7c00
hlt
5 years ago
helpon dw 0
5 years ago
scroll db 1
scrollchars dw 0
writtenchars dw 0
msg1 db " ARTIST | TITLE",0
5 years ago
project1 db " Alex | Poetic Software",0
project2 db " Alice | Is it time to eat / is there no more time to eat?",0
project3 db " Angeliki | Let's amplify unspeakable things", 0
project4 db " Joca | The Smart Speaker Theatre", 0
project5 db " Tash | Instant Warnet", 0
project6 db " Zalan | Eigengrau", 0
5 years ago
projects dq project1, project2, project3, project4, project5, project6
5 years ago
helptext db "The concept behind 'Upsetting settings' arises from the defaults of technology.", 0x0A,"Graduation projects initiated by Alexander Roidl, Alice Strete, Angeliki Diakrousi, Joca van der Horst, Natasha Berting and Zalan Szakacs. The works resulted from a year of research done at the Experimental Publishing (XPUB) master in Fine Art and Design program of the Piet Zwart Institute. XPUB focuses on the acts of making things public and creating publics in the age of post-digital networks. It uses publishing as the inquiry and participation into the technological frameworks, political contexts, and cultural processes through which things are made. This supports an artistic practice where the default modes can be questioned and challenged.",0
5 years ago
menuhelp db "F1 Help", 0
menuselect db " ",0x18,"/",0x19," Select Item",0
menuexit db 0x0D,0x0A," ESC Exit", 0
5 years ago
menuenter db " Enter Select",0
title db "UPSETTING SETTINGS",0
5 years ago
wolf_error_msg db 'Program not found!',0x0D,0x0A,0
wolf_error_msg1 db 'Press any key to restart..',0
5 years ago
currentselection dw 0
storebx dw 0
bootdev db 0x80 ; Boot device number
%assign usedMemory ($-$$)
%assign usableMemory (512*16)
%warning [usedMemory/usableMemory] Bytes used
times (512*16)-($-$$) db 0 ;kernel must have size multiple of 512 so let's pad it to the correct size