diff --git a/.program.asm.swp b/.program.asm.swp deleted file mode 100644 index bcace04..0000000 Binary files a/.program.asm.swp and /dev/null differ diff --git a/Makefile b/Makefile index 1def271..9dea123 100755 --- a/Makefile +++ b/Makefile @@ -3,7 +3,12 @@ all : image compile : nasm -f bin -o boot.bin boot.asm nasm -f bin -o program.bin program.asm + nasm -f bin -o software.bin software.asm + nasm -f bin -o food.bin food.asm nasm -f bin -o beep.bin beep.asm + nasm -f bin -o voice.bin voice.asm + nasm -f bin -o silence.bin silence.asm + nasm -f bin -o light.bin light.asm # nasm -f bin -o program2.bin program2.asm @@ -12,13 +17,23 @@ image : compile #cat boot.bin program.bin > exe.bin sudo dd if=boot.bin of=disk.img bs=512 count=1 conv=notrunc sudo dd if=program.bin of=disk.img bs=512 seek=1 count=2 conv=notrunc - sudo dd if=beep.bin of=disk.img bs=512 seek=3 count=1 conv=notrunc + sudo dd if=software.bin of=disk.img bs=512 seek=3 count=1 conv=notrunc + sudo dd if=food.bin of=disk.img bs=512 seek=4 count=1 conv=notrunc + sudo dd if=beep.bin of=disk.img bs=512 seek=5 count=1 conv=notrunc + sudo dd if=voice.bin of=disk.img bs=512 seek=6 count=1 conv=notrunc + sudo dd if=silence.bin of=disk.img bs=512 seek=7 count=1 conv=notrunc + sudo dd if=light.bin of=disk.img bs=512 seek=8 count=1 conv=notrunc flashusb : image sudo dd if=boot.bin of=/dev/sdb bs=512 count=1 sudo dd if=program.bin of=/dev/sdb bs=512 seek=1 count=2 - sudo dd if=beep.bin of=/dev/sdb bs=512 seek=3 count=1 + sudo dd if=software.bin of=/dev/sdb bs=512 seek=3 count=1 + sudo dd if=food.bin of=/dev/sdb bs=512 seek=4 count=1 + sudo dd if=beep.bin of=/dev/sdb bs=512 seek=5 count=1 + sudo dd if=voice.bin of=/dev/sdb bs=512 seek=6 count=1 + sudo dd if=silence.bin of=/dev/sdb bs=512 seek=7 count=1 + sudo dd if=light.bin of=/dev/sdb bs=512 seek=8 count=1 # sudo dd if=exe.bin of=/dev/sdb bs=512 count=4 diff --git a/README.md b/README.md index dbd557b..3c34000 100755 --- a/README.md +++ b/README.md @@ -34,3 +34,9 @@ https://blog.ghaiklor.com/how-to-implement-a-second-stage-boot-loader-80e75ae427 ###Boc drawing characters https://en.wikipedia.org/wiki/Box-drawing_character + +###Good Array Tutorial +https://www.cs.uaf.edu/2017/fall/cs301/lecture/09_15_strings_arrays.html + +###ASCII Table +https://theasciicode.com.ar/ascii-printable-characters/space-ascii-code-32.html diff --git a/beep.asm b/beep.asm index 6ecf832..81d65cf 100644 --- a/beep.asm +++ b/beep.asm @@ -1,4 +1,4 @@ -[org 0x2000] +[org 0x4000] start: mov [bootdev], dl @@ -35,11 +35,10 @@ int 15h ; jne .pause2 ; dec bx ; jne .pause1 -; in al, 61h ; Turn off note (get value from -; ; port 61h). -; and al, 11111100b ; Reset bits 1 and 0. -; out 61h, al ; Send new value. -jmp exit + in al, 61h ; Turn off note (get value from + ; port 61h). + and al, 11111100b ; Reset bits 1 and 0. + out 61h, al ; Send new value. waitforkey: @@ -55,7 +54,7 @@ exit: and al, 11111100b ; Reset bits 1 and 0. out 61h, al ; Send new value. mov dl, [bootdev] - jmp 0x1000 + jmp 0x0:0x1000 bootdev db 0x80 ; Boot device number diff --git a/beep.bin b/beep.bin index ba63910..b0b5852 100644 Binary files a/beep.bin and b/beep.bin differ diff --git a/boot.asm b/boot.asm index 52f32b7..48ff1ee 100755 --- a/boot.asm +++ b/boot.asm @@ -79,7 +79,7 @@ load_it_all_1: mov bx, 0x1000 ; BX = 0x1000. ES:BX=0x0:0x1000 ; ES:BX = starting address to read sector(s) into mov ah, 02 ; Int 13h/AH=2 = Read Sectors From Drive - mov al, 0x10 ; Sectors to read = 1 + mov al, 0x02 ; Sectors to read = 1 mov ch, 00 ; CH=Cylinder. Second sector of disk ; is at Cylinder 0 not 1 mov cl, 02 ; Sector to read = 2 diff --git a/boot.bin b/boot.bin index e8c7266..7557ac5 100644 Binary files a/boot.bin and b/boot.bin differ diff --git a/disk.img b/disk.img index b709635..270f8ef 100755 Binary files a/disk.img and b/disk.img differ diff --git a/food.asm b/food.asm new file mode 100644 index 0000000..330ac6d --- /dev/null +++ b/food.asm @@ -0,0 +1,60 @@ +[org 0x3000] + +start: + mov [bootdev], dl + 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, 4Fh ; YellowOnBlue + int 10H ; execute interrupt + + mov al, 182 ; meaning that we're about to load + out 43h, al ; prepare speaker for output + + mov ax, 2153 ; frequency countdown value is stored in ax. It is calculated by + out 42h, al ; Output low byte. + mov al, ah ; Output high byte. + out 42h, al + + in al, 61h + or al, 00000011b + out 61h, al ; Send the new value +; mov bx, 200 ; Pause for duration of note. + +mov al, 0 +mov ah, 86h +mov cx, 1 +mov dx, 200 +int 15h + +;.pause1: +; mov cx, 65535 +;.pause2: +; dec cx +; jne .pause2 +; dec bx +; jne .pause1 + in al, 61h ; Turn off note (get value from + ; port 61h). + and al, 11111100b ; Reset bits 1 and 0. + out 61h, al ; Send new value. + + +waitforkey: + mov ah, 0x00 + int 0x16 + cmp ah, 01h + je exit + jmp waitforkey + +exit: + in al, 61h ; Turn off note (get value from + ; port 61h). + and al, 11111100b ; Reset bits 1 and 0. + out 61h, al ; Send new value. + mov dl, [bootdev] + jmp 0x0:0x1000 + +bootdev db 0x80 ; Boot device number + diff --git a/food.bin b/food.bin new file mode 100644 index 0000000..e91bcf7 Binary files /dev/null and b/food.bin differ diff --git a/light.asm b/light.asm new file mode 100644 index 0000000..ff580bd --- /dev/null +++ b/light.asm @@ -0,0 +1,60 @@ +[org 0x7000] + +start: + mov [bootdev], dl + 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, 4Fh ; YellowOnBlue + int 10H ; execute interrupt + + mov al, 182 ; meaning that we're about to load + out 43h, al ; prepare speaker for output + + mov ax, 2153 ; frequency countdown value is stored in ax. It is calculated by + out 42h, al ; Output low byte. + mov al, ah ; Output high byte. + out 42h, al + + in al, 61h + or al, 00000011b + out 61h, al ; Send the new value +; mov bx, 200 ; Pause for duration of note. + +mov al, 0 +mov ah, 86h +mov cx, 1 +mov dx, 200 +int 15h + +;.pause1: +; mov cx, 65535 +;.pause2: +; dec cx +; jne .pause2 +; dec bx +; jne .pause1 + in al, 61h ; Turn off note (get value from + ; port 61h). + and al, 11111100b ; Reset bits 1 and 0. + out 61h, al ; Send new value. + + +waitforkey: + mov ah, 0x00 + int 0x16 + cmp ah, 01h + je exit + jmp waitforkey + +exit: + in al, 61h ; Turn off note (get value from + ; port 61h). + and al, 11111100b ; Reset bits 1 and 0. + out 61h, al ; Send new value. + mov dl, [bootdev] + jmp 0x0:0x1000 + +bootdev db 0x80 ; Boot device number + diff --git a/light.bin b/light.bin new file mode 100644 index 0000000..d53215d Binary files /dev/null and b/light.bin differ diff --git a/program.asm b/program.asm index 87e37a5..eaf752e 100755 --- a/program.asm +++ b/program.asm @@ -156,10 +156,49 @@ waitforkey: loadproject: - - -mov bx, [currentselection] - + 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, 04 ; Sector to read = 4 + jmp load +.two + mov bx, 0x3000 ; BX = 0x1000. ES:BX=0x0:0x1000 + mov cl, 05 ; Sector to read = 4 + jmp load +.three + mov bx, 0x4000 ; BX = 0x1000. ES:BX=0x0:0x1000 + mov cl, 06 ; Sector to read = 4 + jmp load +.four + mov bx, 0x5000 ; BX = 0x1000. ES:BX=0x0:0x1000 + mov cl, 07 ; Sector to read = 4 + jmp load +.five + mov bx, 0x6000 ; BX = 0x1000. ES:BX=0x0:0x1000 + mov cl, 08 ; Sector to read = 4 + jmp load +.six + mov bx, 0x7000 ; BX = 0x1000. ES:BX=0x0:0x1000 + mov cl, 09 ; Sector to read = 4 + jmp load + + +load: pushf stc @@ -169,24 +208,23 @@ mov bx, [currentselection] .read_sector: mov ax, 0x0 mov es, ax ; ES = 0 - mov bx, 0x2000 ; BX = 0x1000. ES:BX=0x0:0x1000 ; ES:BX = starting address to read sector(s) in$ mov ah, 02 ; Int 13h/AH=2 = Read Sectors From Drive; - mov al, 0x10 ; Sectors to read = 1 + mov al, 0x01 ; Sectors to read = 1 mov ch, 00 ; CH=Cylinder. Second sector of disk ; is at Cylinder 0 not 1 - mov cl, 04 ; Sector to read = 2 mov dh, 00 ; Head to read = 0 mov dl, [bootdev] int 13h - jc wolf_error - popf - jmp 0x0:0x2000 - cli - hlt + jc wolf_error + popf + jmp bx + cli + hlt + wolf_error: @@ -213,12 +251,12 @@ print: msg1 db "ARTIST / TITLE",0 -project1 db "Name / Exampletitle of this",0 -project2 db "Name2 / Silence and more",0 -project3 db "Name3 / C00l, new title and more", 0 -project4 db "Name4 / Everyon", 0 -project5 db "Name5 / Voices and more", 0 -project6 db "Name6 / Examples of titles", 0 +project1 db "Alex / Poetic Software",0 +project2 db "Alice / f00d",0 +project3 db "Angeliki / Voices", 0 +project4 db "Joca / Ghost in the Speaker", 0 +project5 db "Tash / Silence making", 0 +project6 db "Zalan / Phantasmagoria", 0 projects dq project1, project2, project3, project4, project5, project6 diff --git a/program.bin b/program.bin index 601ab62..15f2950 100644 Binary files a/program.bin and b/program.bin differ diff --git a/silence.asm b/silence.asm new file mode 100644 index 0000000..aef53df --- /dev/null +++ b/silence.asm @@ -0,0 +1,60 @@ +[org 0x6000] + +start: + mov [bootdev], dl + 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, 4Fh ; YellowOnBlue + int 10H ; execute interrupt + + mov al, 182 ; meaning that we're about to load + out 43h, al ; prepare speaker for output + + mov ax, 2153 ; frequency countdown value is stored in ax. It is calculated by + out 42h, al ; Output low byte. + mov al, ah ; Output high byte. + out 42h, al + + in al, 61h + or al, 00000011b + out 61h, al ; Send the new value +; mov bx, 200 ; Pause for duration of note. + +mov al, 0 +mov ah, 86h +mov cx, 1 +mov dx, 200 +int 15h + +;.pause1: +; mov cx, 65535 +;.pause2: +; dec cx +; jne .pause2 +; dec bx +; jne .pause1 + in al, 61h ; Turn off note (get value from + ; port 61h). + and al, 11111100b ; Reset bits 1 and 0. + out 61h, al ; Send new value. + + +waitforkey: + mov ah, 0x00 + int 0x16 + cmp ah, 01h + je exit + jmp waitforkey + +exit: + in al, 61h ; Turn off note (get value from + ; port 61h). + and al, 11111100b ; Reset bits 1 and 0. + out 61h, al ; Send new value. + mov dl, [bootdev] + jmp 0x0:0x1000 + +bootdev db 0x80 ; Boot device number + diff --git a/silence.bin b/silence.bin new file mode 100644 index 0000000..9319a66 Binary files /dev/null and b/silence.bin differ diff --git a/software.asm b/software.asm new file mode 100644 index 0000000..9498fd0 --- /dev/null +++ b/software.asm @@ -0,0 +1,78 @@ +[org 0x2000] + +start: + mov [bootdev], dl + mov al, 182 ; meaning that we're about to load + out 43h, al ; prepare speaker for output + + mov ax, 2153 ; frequency countdown value is stored in ax. It is calculated by + out 42h, al ; Output low byte. + mov al, ah ; Output high byte. + out 42h, al + + in al, 61h + or al, 00000011b + out 61h, al ; Send the new value + +mov al, 0 +mov ah, 86h +mov cx, 1 +mov dx, 200 +int 15h + in al, 61h ; Turn off note (get value from + ; port 61h). + and al, 11111100b ; Reset bits 1 and 0. + out 61h, al ; Send new value. + + + 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, 9Bh ; YellowOnBlue + int 10H ; execute interrupt + + mov ah, 02h ;sets cursor to top to write + mov bh, 0h + mov dh, 2h + mov dl, 2h + int 10h + mov si, description + call print + jmp waitforkey + +print: + lodsb + or al,al + jz .exit + mov ah,0x0e + int 10h + jmp print + .exit: + ret + +waitforkey: + mov ah, 0x00 + int 0x16 + cmp ah, 01h + je exit + jmp waitforkey + +exit: + in al, 61h ; Turn off note (get value from + ; port 61h). + and al, 11111100b ; Reset bits 1 and 0. + out 61h, al ; Send new value. + mov dl, [bootdev] + jmp 0x0:0x1000 + +description db "Poetic Software is a project .... . . . .",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 le$ + + diff --git a/software.bin b/software.bin new file mode 100644 index 0000000..67e34df Binary files /dev/null and b/software.bin differ diff --git a/voice.asm b/voice.asm new file mode 100644 index 0000000..e56a92b --- /dev/null +++ b/voice.asm @@ -0,0 +1,60 @@ +[org 0x5000] + +start: + mov [bootdev], dl + 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, 4Fh ; YellowOnBlue + int 10H ; execute interrupt + + mov al, 182 ; meaning that we're about to load + out 43h, al ; prepare speaker for output + + mov ax, 2153 ; frequency countdown value is stored in ax. It is calculated by + out 42h, al ; Output low byte. + mov al, ah ; Output high byte. + out 42h, al + + in al, 61h + or al, 00000011b + out 61h, al ; Send the new value +; mov bx, 200 ; Pause for duration of note. + +mov al, 0 +mov ah, 86h +mov cx, 1 +mov dx, 200 +int 15h + +;.pause1: +; mov cx, 65535 +;.pause2: +; dec cx +; jne .pause2 +; dec bx +; jne .pause1 + in al, 61h ; Turn off note (get value from + ; port 61h). + and al, 11111100b ; Reset bits 1 and 0. + out 61h, al ; Send new value. + + +waitforkey: + mov ah, 0x00 + int 0x16 + cmp ah, 01h + je exit + jmp waitforkey + +exit: + in al, 61h ; Turn off note (get value from + ; port 61h). + and al, 11111100b ; Reset bits 1 and 0. + out 61h, al ; Send new value. + mov dl, [bootdev] + jmp 0x0:0x1000 + +bootdev db 0x80 ; Boot device number + diff --git a/voice.bin b/voice.bin new file mode 100644 index 0000000..7da6452 Binary files /dev/null and b/voice.bin differ