mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Implement READFILE function (#1759)
This commit is contained in:
24
test/asm/readfile-binary.asm
Normal file
24
test/asm/readfile-binary.asm
Normal file
@@ -0,0 +1,24 @@
|
||||
section "tilemap", rom0
|
||||
/*
|
||||
input:
|
||||
$20
|
||||
$01 $03 $05 $07 $09
|
||||
$02 $04 $06 $08 $10
|
||||
$00 $de $01 $df $80
|
||||
5
|
||||
*/
|
||||
def tilemap equs readfile("readfile-binary.inc.bin")
|
||||
def area = bytelen(#tilemap) - 2
|
||||
def offset = strbyte(#tilemap, 0)
|
||||
def width = strbyte(#tilemap, area + 1)
|
||||
db width, area / width
|
||||
for idx, area
|
||||
db strbyte(#tilemap, idx + 1) + offset
|
||||
endr
|
||||
/*
|
||||
output:
|
||||
5, 3
|
||||
$21 $23 $25 $27 $29
|
||||
$22 $24 $26 $28 $30
|
||||
$20 $fe $21 $ff $a0
|
||||
*/
|
||||
Reference in New Issue
Block a user