PlayBoyScout.pp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. program PlayBoyScout;
  2. {$l data/ScoutSplash.pcx.o}
  3. {$l data/tune.bgf.o}
  4. uses
  5. ctypes, gba;
  6. var
  7. ScoutSplash_pcx: array [0..0] of cuint8; cvar; external;
  8. ScoutSplash_pcx_size: array [0..0] of cuint32; cvar; external;
  9. ScoutSplash_pcx_end: array [0..0] of cuint8; cvar; external;
  10. tune_bgf: array [0..0] of cuint8; cvar; external;
  11. tune_bgf_size: array [0..0] of cuint32; cvar; external;
  12. tune_bgf_end: array [0..0] of cuint8; cvar; external;
  13. PaletteBuffer: array [0..255] of u16;
  14. frame: cuint;
  15. nBSSongSize: cuint;
  16. procedure VblankInterrupt();
  17. begin
  18. BoyScoutUpdateSong();
  19. frame := frame + 1;
  20. end;
  21. begin
  22. // Set up the interrupt handlers
  23. irqInit();
  24. // Initialize BoyScout
  25. BoyScoutInitialize();
  26. // Get needed song memory
  27. nBSSongSize := BoyScoutGetNeededSongMemory(tune_bgf);
  28. // Allocate and set BoyScout memory area
  29. BoyScoutSetMemoryArea(u32(GetMem(nBSSongSize)));
  30. // Open song
  31. BoyScoutOpenSong(tune_bgf);
  32. // Play song and loop
  33. BoyScoutPlaySong(1);
  34. irqSet(IRQ_VBLANK, @VblankInterrupt);
  35. // Enable Vblank Interrupt to allow VblankIntrWait
  36. irqEnable(IRQ_VBLANK);
  37. // Allow Interrupts
  38. REG_IME^ := 1;
  39. SetMode( MODE_4 or BG2_ON ); // screen mode & background to display
  40. DecodePCX(@ScoutSplash_pcx, pu16(VRAM), PaletteBuffer);
  41. FadeToPalette( PaletteBuffer, 60);
  42. while true do
  43. VBlankIntrWait();
  44. // This part will never be reached but just for completion
  45. // Free memory
  46. free(@BoyScoutGetMemoryArea);
  47. end.