From: John Tsiombikas Date: Sun, 6 Oct 2019 20:44:11 +0000 (+0300) Subject: fixed the 32bit version X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=ld45_start_nothing;a=commitdiff_plain;h=78cf90d60c7cdbfcb8bc1d3e3d03a577d1b70f7b fixed the 32bit version --- diff --git a/Makefile b/Makefile index 165c473..aadff36 100644 --- a/Makefile +++ b/Makefile @@ -37,13 +37,13 @@ data/sprsheet.inc: data/sprsheet.png .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 >$@ diff --git a/game.ld b/game.ld index 52a25f5..6e2df60 100644 --- a/game.ld +++ b/game.ld @@ -21,6 +21,7 @@ SECTIONS { . = 1M; _main_start = .; + .startup : { * (*.startup); } .text : { * (.text); } .data : { * (.data); } diff --git a/src/boot/boot.asm b/src/boot/boot.asm index 693bba3..0b6fb04 100644 --- a/src/boot/boot.asm +++ b/src/boot/boot.asm @@ -87,6 +87,7 @@ get_drive_chs: ; 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 @@ -138,6 +139,7 @@ read_sector: call putchar pop cx + pop bx ret abort_read: diff --git a/src/boot/boot2.asm b/src/boot/boot2.asm index d5884bc..0fac8fe 100644 --- a/src/boot/boot2.asm +++ b/src/boot/boot2.asm @@ -24,6 +24,7 @@ boot2_start: mov al, 10 call ser_putchar + call clearscr ; enable A20 address line call enable_a20 @@ -548,7 +549,7 @@ kbc_wait_write: 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 diff --git a/src/data.asm b/src/data.asm index 6da8bdd..e6eab2f 100644 --- a/src/data.asm +++ b/src/data.asm @@ -1,5 +1,7 @@ ; vi:filetype=nasm ts=8 sts=8 sw=8 + section .data + global sprsheet_cmap global sprsheet_tiles %include "data/sprsheet.inc" diff --git a/src/gfx.asm b/src/gfx.asm index 796ede0..ca5cf74 100644 --- a/src/gfx.asm +++ b/src/gfx.asm @@ -46,8 +46,13 @@ init_gfx: 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: diff --git a/src/main.asm b/src/main.asm index 4b2a11a..243ff0d 100644 --- a/src/main.asm +++ b/src/main.asm @@ -1,23 +1,29 @@ ; 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