An emulator, assembler, and disassembler for the Sega Game Gear
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 

31 rader
687 B

  1. /* Copyright (C) 2014 Ben Kurtovic <ben.kurtovic@gmail.com>
  2. Released under the terms of the MIT License. See LICENSE for details. */
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include "rom.h"
  6. /* Create and return a ROM object located at the given path. Return NULL if
  7. there was an error; errno will be set appropriately. */
  8. rom_type* open_rom(char *path)
  9. {
  10. rom_type *rom;
  11. FILE* fp;
  12. if (!(fp = fopen(path, "r")))
  13. return NULL;
  14. if (!(rom = malloc(sizeof(rom_type))))
  15. return NULL;
  16. // load data from file into a buffer
  17. return rom;
  18. }
  19. /* Free a ROM object previously created with open_rom(). */
  20. void close_rom(rom_type *rom)
  21. {
  22. free(rom);
  23. }