Jump to content
  • 1
DusanStrakl

Load data to VRAM from BASIC

Question

Has anybody recently (e.g. Emulator R38) tried to load binary files directly to VRAM from BASIC?

It worked before but now it is driving me crazy and it just doesn't work. If I load the file to regular RAM it works fine with following for example:

LOAD"TEST.BIN",8,1,$8000

The command 

LOAD"TEST.BIN",8,2,$8000

should load to VRAM bank 0, and

LOAD"TEST.BIN",8,3,$8000

should load to VRAM bank 1

but it always just loads to regular RAM even if I try something like

LOAD"TEST.BIN",8,8,$8000

it gets loaded to RAM without error.

I tried changing first two bytes in TEST.BIN file between $00 $00 and $00 $80 and many other combinations with no luck.

Thanks

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0

VLOAD definitely still works.

17 hours ago, DusanStrakl said:

LOAD"TEST.BIN",8,2,$8000

should load to VRAM bank 0, and

LOAD"TEST.BIN",8,3,$8000

should load to VRAM bank 1

Change those to:

VLOAD "TEST.BIN",8,0,$8000

VLOAD "TEST.BIN",8,1,$8000

  • Like 2

Share this post


Link to post
Share on other sites
  • 0

Thanks for both answers. The usual suspects to the rescue 😀

 

To be honest I didn't even know that VLOAD is implemented so I didn't even experiment with it. I saw it mentioned in documentation with TODO comment so I assumed it is not there yet. 

LOAD does not work with loading data directly to VRAM and if there is dedicated VLOAD for that it probably shouldn't. There is no point to have two commands doing the same thing it just add unnecessary confusion.

I think I will test VLOAD thoroughly in the next few days and probably write a short tutorial on how to use it after that.

Share this post


Link to post
Share on other sites
  • 0

I was curious so I took a look at the way LOAD works.  From what I can tell, it puts 0 in to A, pushes it on to the stack, parses the arguments from the LOAD statement, then pops the 0 back off the stack to A, then calls the kernal LOAD routine.  A is what determines how LOAD behaves.  0 just means load to CPU memory, so it's basically hardcoded to always do that.  I looked at the history of the file, and as far as I can tell, this was always the behavior, so I'm kind of surprised it was ever able to load in to VRAM.  (Maybe it did before the current logic of A > 1 meaning a bank of VRAM?)

Edited by Ender

Share this post


Link to post
Share on other sites
  • 0
1 hour ago, Ender said:

I was curious so I took a look at the way LOAD works.  From what I can tell, it puts 0 in to A, pushes it on to the stack, parses the arguments from the LOAD statement, then pops the 0 back off the stack to A, then calls the kernal LOAD routine.  A is what determines how LOAD behaves.  0 just means load to CPU memory, so it's basically hardcoded to always do that.  I looked at the history of the file, and as far as I can tell, this was always the behavior, so I'm kind of surprised it was ever able to load in to VRAM.  (Maybe it did before the current logic of A > 1 meaning a bank of VRAM?)

That was a modification made to the legacy kernal very early on in the X16 ROM development. @Michael Steil could elaborate more, but it looks like it was an easy to way to add VRAM support to the Kernal without breaking the legacy functionality.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Please review our Terms of Use