t-edson / P65Pas

CPU 6502 Pascal Compiler/IDE/Debugger
GNU General Public License v3.0
120 stars 27 forks source link

[feature request] including binary files via directive #31

Closed mvdhoning closed 1 year ago

mvdhoning commented 3 years ago

There are some nice tools on pc allowing for easy making graphics charset and sprites for the c64 like charpad and spritpad. It would be nice to import charsets and screens and spriteset from those easly into p65pas code. Now it is a export to assembly and strip away .byte or just dump it an asm block. But for including a koala image i think there is no such a workaround. (or sid music) So a {$BINARY filename.ext} directive would be handy. That loads the data on the spot of the directive.

var
screen1: []byte = [ {$BINARY screen.bin} ];

It would be even more powerfull with the multiple org directive feature request allowing the data at a specified location in c64 memory. E.g. for including a SID fie and next calling the init and play routines via pointers pointed at an absolute memory position what should already be possible.

t-edson commented 3 years ago

This feature was commented by other user before. I think it's useful and need to be implemented, in the new version of the compiler. But currently, I'm busy in other profitable projects . I need to get some free time to work in the compiler.

t-edson commented 1 year ago

Hi. The new version of the compiler have the new directive $BIN2CSV. It can be used to include external binary files like a comma separated text. Check this example:

var 
  //Initialize with a binary content
  AAA: array[3] of byte = ({$BIN2CSV data.bin});
begin

end.