A82: Re: VAT problems (help me)


[Prev][Next][Index][Thread]

A82: Re: VAT problems (help me)




The problem is that the VAT is not updated when you run an asm program,
and the external VARS might be messed up when you try to acces them. Using
the current relocation method it is very hard make this work because of
relocation. I had a quick look at the code and this seems to be the only
problem.

Ash 3.1 has two routines which would help you relocate and unrelocate. If
you call unrelocate and then acces the external level var and the call
relocate you should have no problem. If you are interested I can send you
a beta of Ash 3.1 so you can see if it works (no docs yet, but i works). 

If you do not use Ash 3.1 you need to unrelocate your program whch might
be rather hard, but it can of course be done.

Dines
-----Original Message-----
From: ilya winham <ilyamojo@geocities.com>
To: assembly-82@lists.ticalc.org <assembly-82@lists.ticalc.org>
Date: 10. marts 1998 00:26
Subject: A82: VAT problems (help me)


>
>Ok, here is the story. I have ported Joe W.'s Breakout game to the 
>TI-82. It works perfectly except for the EXTERNAL LEVEL selector 
>routine. You know, searches the vat for stuff and loads the level, kind 
>of like penguins. Well, I can't get it to work. After I play a game, 
>then quit, the next button I press crashes the calc, your typical VAT 
>crash. If you can help me fix it, then porting this and Diamonds v1.5 
>will be a snap. Both of those games use the same external level routine. 
>And I bet more games made by Joe will, so I would love to get this 
>ported!
>
>Here is the code below, with comments:
>
>;close to the very beginning of the game.
>prmenu: 
> ld hl,levels
> ld (file),hl
> ld hl,(VAT_START) ;THIS IS THE PROBLEM!!
>                    ;in the 83 version this line is ld hl,(fat)
>                    ;yes folks, (fat), not a typo.
>                    ;I need to find the appropiate substitute for 'fat'
> ld (curwrld),hl
>
>.......
><snip>
>;Deleted more code that IN NO WAY has any effect on the level selection.
>........
>
>;Start of level select routine, I didn't have to change anything when
>;I ported it. Please take a look and see what my problem is.
>;---------- Change World ----------
>; the level data is set up as follows in the level sets:
>; -"Breakout v1.0 by Joe W" (22 bytes)
>; -number of byte to start of level
>; -level name
>; -$00
>; -number of bytes in the level name (including the zero)
>; -high score (2 bytes)
>; -number of levels
>; -start of levels (33 bytes each)
>
>chgwrld:
> xor a
> ld (startlev),a
> ld hl,(curwrld)    ;loads that (fat) addr here.
>chgwlp:
> ld (temp),hl ; in case a program is found
> ld a,(hl) ; but no good.
> and %00011111
> cp 0x06
> jr z,cwchck
> cp 0x05
> jr z,nogood2 ; a program, but not protected
> cp 0x01 ; (using an unprotected program
> jr z,list ; could be dangerous)
> cp 0x0D
> jr z,list
> jp prmenu
>
>cwchck:
> dec hl ; move to ptr (skip var type)
> push hl
> ld b,(hl)
> dec hl
> ld c,(hl)
> ld h,c
> ld l,b
> inc hl ; skip file length (2 bytes, but see below)
> ld de,name-1
> ld b,22 ; "Breakout v1.0 by Joe W"
>ckprog:
> inc hl ; file length is 2 bytes so we save one byte!
> inc de ; skip the string length (we know it already!)
> ld c,(hl)
> ld a,(de)
> cp c
> jr nz,nogood
> djnz ckprog
> inc hl
> ld c,(hl) ; 24th byte of file is added to ptr to get
> ld b,0x00 ; the start of level data
> add hl,bc
> inc hl
> ld (file),hl
> pop hl
> dec hl
> dec hl
> ld b,(hl) ; length of name
> inc b ; move to next program as well in case the
>skprog:
> dec hl ; user doen't want this world
> djnz skprog
> ld (curwrld),hl
> jp menu
>nogood2:
> ; push something so we can safely pop!
> push hl ; anything will work but.....
>nogood:
> pop hl ; who cares (not needed)
> ld hl,(temp)
>list:
> dec hl ; lists enter here to be skipped
> dec hl
> dec hl
> ld b,(hl)
>nogdlp:
> dec hl ; not the fastest, but is the smallest!
> djnz nogdlp
> dec hl ; next item
> jp chgwlp
>
>
>There is all the suff. All the variables you see are stored in TEXT_MEM 
>(in case your wondering) Please, Crash_Man, Dines, Thomas, Adamman, Evil 
>Same, anyone who has any knowledge of the VAT please tell me why this 
>doesn't work. Thanks a lot. If you need more info please email me. I 
>will release Breakout, even if I can never get this level selection to 
>work, all the levels then will just have to be in the game.
>~Ilya
>
>
>

_______________________________________

Dines Justesen
Email: dines@post1.com or
       c958362@student.dtu.dk
WWW  : http://www.gbar.dtu.dk/~c958362/
_______________________________________