0

I haven't been able to fix this problem.

I developed a bootloader using NASM for X86 using this tutorial as reference: http://fisnikhasani.com/building-your-own-bootloader/

Using the command:

nasm -f bin boot.asm -o boot.bin

I was able to run my bootloader called boot.bin on a usb key.

However I also developed a Pacman game using x86 assembly called pacman.asm. I want to be able to boot into the bootloader and play the pacman game.

However I have not idea how to run the pacman.asm file once my usb key with the boot.bin file is connected and booted.

Any help is appreciated.

  • 1
    Does this pacman game rely on DOS interrupts or was it designed to work in a boot loader environment with BIOS calls and direct hardware access? – Michael Petch Aug 27 '16 at 20:44
  • 2
    Generally you would assemble pacman.asm and store it in a sector of the disk (or disk image) as a binary file. Your bootloader would read the sctor from the disk where the game was placed and load it into a memory. The bootloader would then jump to that pacman code. – Michael Petch Aug 27 '16 at 21:00
  • Surely there must be some existing SO questions about booting multi-sector binaries. I had a quick look, but I didn't find a good duplicate target, so just voting to close this as too broad (because it's a well known problem that's been solved many times, e.g. with bootloaders like syslinux) – Peter Cordes Aug 27 '16 at 21:18
  • 1
    This answer might give you some ideas. It is a 2 stage bootloader but you could replace stage2.asm with pacman.asm and make sure you use `org 0x0000` at the top. The only change you might have to make if your pacman.bin(stage2.bin) is greater than one sector (512) bytes you will have to increase the value 1 in this line of the bootloader `mov al,0x1 ;Reading one sector` . http://stackoverflow.com/a/34095896/3857942 – Michael Petch Aug 28 '16 at 00:11
  • 2
    @MichaelPetch Thanks, that example you gave me worked perfectly. Sorry for the general question, I've searched for a couple of hours and couldn't make the bootloader call the game. – Carlos Perez Aug 28 '16 at 01:31

1 Answers1

0

if you use windows then this worked for me:

type into you command line:

copy /b bootldr.bin + pacman.bin myGame.img

this will copy bootloader.bin and then it puts pacman.bin at the end of the bootloader and stores the end result in MyGame.img

you dont have to use .img or .bin

then you load the pacman game into memory and do a far jump
and now you can play your game :)

SeeSoftware
  • 531
  • 6
  • 17