Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Felix Bernhardt
committed
Jan 25, 2017
1 parent
87f50bb
commit d6bfa01
Showing
8 changed files
with
51 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
; initialize the environment | ||
mov ax, 0x07c0 | ||
mov ds, ax | ||
|
||
; the segment of the game | ||
mov ax, 0x07e0 | ||
|
||
; setup the file-source | ||
mov ch, 0x00 ; cylinder 0 | ||
mov cl, 0x02 ; sector 2 (skip first sector, which is the bootloader) | ||
mov dh, 0x00 ; head 0 | ||
mov dl, 0x00 ; drive 0 (floppy disk) | ||
|
||
; setup the destination | ||
mov es, ax ; segment starts directly after the bootloader (7c00 - 7dff) | ||
mov bx, 0x0000 | ||
|
||
; copy data into RAM | ||
read: | ||
mov al, 0x02 ; read two sectors | ||
mov ah, 0x02 ; int 13h subfunction 2 -> read sectors (512 bytes) from disk | ||
int 0x13 ; copy sectors to ES:BX | ||
jc read ; carry-flag is set -> there was a read-error, retry | ||
|
||
; rebase segments for game execution | ||
mov ax, 0x07e0 | ||
mov ds, ax ; data segment | ||
mov es, ax ; additional segments | ||
mov fs, ax | ||
mov gs, ax | ||
mov ss, ax ; stack segment | ||
|
||
; reset stack pointer | ||
; mov sp, 0x0000 | ||
|
||
; enter the game code -> set CS:IP | ||
jmp 0x07e0:0x0000 | ||
|
||
; spacing and signature | ||
times 510 - ($ - $$) db 0 | ||
dw 0xaa55 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
nasm bootloader.asm -f bin -o build/bootloader.bin | ||
nasm space-invaders.asm -f bin -o build/space-invaders.bin | ||
|
||
dd if=build/bootloader.bin of=build/image.bin bs=512 count=1 | ||
dd if=build/space-invaders.bin of=build/image.bin bs=512 count=2 seek=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
qemu-system-x86_64 -fda build/image.bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters