i cant get this code to work



im not really sure how it works. ive tried using open screen and screen commands in basic and drawing on them but the code seems to do nothing... ive tried all the screens from 1 to 16. i dont know where it is expecting to find a screen. at hex 8000 maybe? or at a certain page? where does this correspond to a screen number, if at all? as im unfamiliar with lmpr, hmpr and vmpr a little advice would be most welcome. ive looked at screen memory and paging too but this just confuses the hell out of me...

This is unfortunately complicated and the routine probably needs a bit of extra setup before it will run.

It is reading an image from one screen and writing it onto another. The screen it reads from is hard-coded as page LMPR=11; that is, an address in BASIC of 16384*(11+1) = 196608.

The screen it writes to is in the same page where you loaded and called the code. On a 512K Sam, the default screen is in pages 30-31, which starts at the address BASIC in 16384*(30+1) = 507904. So you might think you can load the code 24K later - unfortunately this won't work because even though you've told the routine its origin is 0xE000, if you ask BASIC to CALL 532480, it will setup HMPR to point at page 31 and start your code running at 0xA000. 

Sadly, this most likely comes across as gobbledegook - there is a later article in that series which explains Sam's memory paging system a bit.  https://sam.speccy.cz/coding/mc-fred/mc-fred_pt14.txt . Unfortunately you can't do a lot of screen coding on the Sam without using lmpr and hmpr.

ive managed to find the routine here:


just break out fo the menu and its in ram.

you call it at 16384

you can put any picture you want in it... you just load it into 196608

ive been trying to move it from the top of the screen to the bottom by using the debugger but cannot find the value that i need to alter. but ive managed to stretch the image. how do i move it? any ideas? the routine seems to jump straight to e000. 

Yes the short routine at 16384 is doing the kind of setup I was talking about, it writes hmpr to get the main routine into the right place in the cpu's memory view.

The destination address on the screen is DE. Where it says "LD DE,8080" you could change that to something like "LD DE,C080".