LOAD ,,1 behaviour

Discuss anything related to the VIC
Post Reply
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

LOAD ,,1 behaviour

Post by nippur72 »

I have an annoying issue with loading program into absolute address. I am developing a new game half in basic and half in ML. Everytime I load the ML part with the ,,1 switch I am unable to "RUN" the basic part because I get an "?out of memory error". I tried by relocating pointers and CLRing, but the only effective thing to do seems to be NEW and loading the BAS part again. This is quite annoying when developing because I usually switch back and forth between compiler and VIC-20.

Someone suggested that I have a keyboard macro for typing all the LOADs and NEWs but VICE doesn't work with WIN32 macro players. Is there any cartdrige that allows keyboard macros?

Listening to suggestions... :)
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

The pointers that change mainly are 45/46 (start of variables), 47/48, 49/50. What you really want is a LOAD routine that:

1. Stores the current values of the mentioned pointers.
2. Lowers RAMTOP (55/56) to the start address of the ML routine loaded and possibly adjusts 51/52 as well.
3. Restores the first set of pointers to their previous values.

Mike posted a great tip in the sticky "ROM calls" thread:

POKE147,0:SYS57809(N$),8,1:POKE780,0:SYS65493

The first SYS will set up a file, the second one will load it to RAM. No pointers affected. It is a bit more clumsy to write than LOAD"FILE",8,1 but works for your purpose. However, I believe it will work from within a program, so your first line of the Basic program could be:

1 POKE147,0:SYS57809("MACHINE CODE.PRG"),8,1:POKE780,0:SYS65493
Anders Carlsson

Image Image Image Image Image
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Post by nippur72 »

THANK YOU!

It works greatly. I've added it as the last line of my bas program, so when I want to update the ML part I simply GOTO 999 or even space-space-space the "999" and hit return for direct mode.

Now my developing runs a bit faster, thank you for the tip!
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Re: LOAD ,,1 behaviour

Post by nbla000 »

nippur72 wrote:I am developing a new game half in basic and half in ML.
Which game are you developing ?
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Post by nippur72 »

Which game are you developing ?
it's a clone of an Emerson-Arcadia game called "R-2D tank". It's something I dreamed to have on the VIC20 at the time, so now I'm going to implement it :)

Emerson ("Leonardo" in Italy) is an old 8-bit console with a graphic similar to VIC20 but with 4 sprites (8x8 mono).

I've already written the sprite routine but I'm having problems with space (1.5K is already gone) and execution time. The game itself is quite easy: you drive a tank and collect munitions, avoiding mines and another enemy tank.

This sprite routine I'm writing will be also useful for other games, mostly maze-based because my sprites move smoothly but always align with screen character matrix (as in the cart "Raid on Fort Knox").
Post Reply