a assembly program for everyone

master
Your Name 5 years ago
parent 5e506981df
commit 03b2e723b0

Binary file not shown.

@ -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

@ -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

@ -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

Binary file not shown.

@ -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

Binary file not shown.

Binary file not shown.

@ -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

Binary file not shown.

@ -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

Binary file not shown.

@ -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

Binary file not shown.

@ -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

Binary file not shown.

@ -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$

Binary file not shown.

@ -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

Binary file not shown.
Loading…
Cancel
Save