PlayBoyScout.pp 1.2 KB

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