Skip to content

Instantly share code, notes, and snippets.

@Skarsnik
Created September 16, 2020 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Skarsnik/fb0674aa171131b1e550f59db1aba582 to your computer and use it in GitHub Desktop.
Save Skarsnik/fb0674aa171131b1e550f59db1aba582 to your computer and use it in GitHub Desktop.
multi method put-address(Int $addr, Blob $data, :$space = 'SNES') {
self.send-command(PutAddress, $addr.base(16), $data.bytes.base(16));
$!ws.send($data)
}
multi method put-address(**@args, :$space = 'SNES') {
my @params;
my @datas;
for @args -> $arg {
say $arg.raku, $arg.WHAT.raku;
say "I am a list" if $arg ~~ List;
@params.push(($arg[0].base(16), $arg[1].base(16))) if $arg ~~ List;
@datas.push:$arg if $arg ~~ Blob;
}
say @params.raku, @datas.raku;
return ;
self.send-command(PutAddress, |@params, :space($space));
$!ws.send(@datas.join);
}
$usb2snes.put-address((0xF50050, 4), (0xF50054, 2), Buf.new(<1 2 3 4>), Buf.new(<5 6>));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment