diff --git a/compiler/res/prog8lib/cx16/cx16diskio.p8 b/compiler/res/prog8lib/cx16/cx16diskio.p8 index bdd06b443..5e6f749cb 100644 --- a/compiler/res/prog8lib/cx16/cx16diskio.p8 +++ b/compiler/res/prog8lib/cx16/cx16diskio.p8 @@ -37,14 +37,19 @@ cx16diskio { asmsub vload(str name @R0, ubyte device @Y, ubyte bank @A, uword address @R1) -> ubyte @A { ; -- like the basic command VLOAD "filename",device,bank,address ; loads a file into Vera's video memory in the given bank:address, returns success in A + ; the file has to have the usual 2 byte header (which will be skipped) %asm {{ - ; -- load a file into video ram + clc +internal_vload: phx pha tya tax - lda #1 - ldy #0 + bcc + + ldy #%00000010 ; headerless load mode + bne ++ ++ ldy #0 ; normal load mode ++ lda #1 jsr c64.SETLFS lda cx16.r0 ldy cx16.r0+1 @@ -71,6 +76,15 @@ cx16diskio { }} } + asmsub vload_raw(str name @R0, ubyte device @Y, ubyte bank @A, uword address @R1) -> ubyte @A { + ; -- like the basic command BVLOAD "filename",device,bank,address + ; loads a file into Vera's video memory in the given bank:address, returns success in A + ; the file is read fully including the first two bytes. + %asm {{ + sec + jmp vload.internal_vload + }} + } ; replacement function that makes use of fast block read capability of the X16 ; use this in place of regular diskio.f_read() diff --git a/docs/source/libraries.rst b/docs/source/libraries.rst index 66b9d9853..8973bbfec 100644 --- a/docs/source/libraries.rst +++ b/docs/source/libraries.rst @@ -365,6 +365,7 @@ cx16diskio (cx16 only) ----------------------- Available for the Cx16 target. Contains extensions to the load and load_raw routines from the regular diskio module, to deal with loading of potentially large files in to banked ram (HiRam). +Routines to directly load data into video ram are also present (vload and vload_raw). Also contains a helper function to calculate the file size of a loaded file (although that is truncated to 16 bits, 64Kb) diff --git a/docs/source/todo.rst b/docs/source/todo.rst index 3a130d76e..d3b35b9da 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -4,7 +4,6 @@ TODO For next release ^^^^^^^^^^^^^^^^ - ir: asmsub contents remains blank in IR file -- add cx16diskio.vload_raw() to load headerless files into vram - mention the syntax highlighting files in the readme and the docs, and add note to the IDEA one that it can also be used in Rider ...