.PHONY: clean
clean:
- rm -f $(bin) $(obj) bootldr.img floppy.img boot.img
+ rm -f $(bin) $(obj) bootldr.bin floppy.img boot.img
.PHONY: disasm
-disasm: bootldr.disasm $(bin).disasm
+disasm: bootldr.disasm $(name).disasm
-bootldr.disasm: bootldr.img
- ndisasm -b 16 -o 7c00h $< >$@
+bootldr.disasm: $(elf)
+ objdump -d $< -j .boot -j .boot2 -m i8086 >$@
$(name).disasm: $(elf)
objdump -d $< -j .text -m i386 >$@
. = 1M;
_main_start = .;
+ .startup : { * (*.startup); }
.text : { * (.text); }
.data : { * (.data); }
; read_sector expects a linear sector number in cx, converts it to CHS
; and loads the sector at es:bx
read_sector:
+ push bx ; save dest offset
mov byte [read_retries], 3
.read_try:
push cx ; save linear sector number
call putchar
pop cx
+ pop bx
ret
abort_read:
mov al, 10
call ser_putchar
+ call clearscr
; enable A20 address line
call enable_a20
jnz kbc_wait_write
ret
-numbuf: resb 16
+numbuf: times 16 db 0
; this part is placed at the very end of all boot sections
; vi:filetype=nasm ts=8 sts=8 sw=8
+ section .data
+
global sprsheet_cmap
global sprsheet_tiles
%include "data/sprsheet.inc"
call set_palette_entry
inc cl
jnz .cmaploop
- ret
+ ; force color 0 to black
+ xor ax, ax
+ xor bx, bx
+ call set_palette_entry
+
+ ret
global clear
clear:
; vi:filetype=nasm ts=8 sts=8 sw=8:
bits 32
- section .text
-
extern init_gfx
extern clear
extern slow_sprite
extern wait_vsync
extern swap_buffers
+ ; this is placed at the beginning of our binary at 1mb (see game.ld)
+ ; and it's what gets executed directly by the boot loader
+ section .startup
+ jmp main
+
+ ; start of main
+ section .text
+main:
call init_gfx
main_loop:
call clear
- push word 100
- push word 160
- push word 0
+ push dword 100
+ push dword 160
+ push dword 0
call slow_sprite
- add esp, 6
+ add esp, 16
call wait_vsync
call swap_buffers