; WriteBytes Example ; ------------------ ; Fill a 16-byte bank with a recognisable pattern bank=CreateBank(16) For i=0 To 15 PokeByte bank,i,i*16 Next ; WriteBytes copies a block of bank bytes straight into a file stream file=WriteFile("demo_block.dat") WriteBytes bank,file,0,16 CloseFile file Print "Wrote 16 bank bytes - demo_block.dat is "+FileSize("demo_block.dat")+" bytes" ; Read the block back into a fresh bank to prove the round trip FreeBank bank bank=CreateBank(16) file=ReadFile("demo_block.dat") ReadBytes bank,file,0,16 CloseFile file ; Hex dump of the recovered bank dump$="" For i=0 To 15 dump$=dump$+Right$(Hex$(PeekByte(bank,i)),2)+" " Next Print "Bank now holds: "+dump$ FreeBank bank ; Clean up the demo file DeleteFile "demo_block.dat" Print "Deleted demo_block.dat" Print "" Print "Press any key to close the example" WaitKey End