Re: A86: Re: saving high scores


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

Re: A86: Re: saving high scores




You need to calculate the correct address in the program variable.
GameSaveData-_asm_exec_ram will be the offset in your program of the data to
be saved.  Just think about what the values of the labels are and it'll make
sense.  The +4 is because you need to skip the size and asm token bytes at
the beginning (don't remember exactly what's there, but I know that asm
progs have a 4 byte header).


>
>  i came up with some thing like this but i dont understand the
> >   ld de,GameSaveData-_asm_exec_ram+4
>
>
>
>  david@acz.org writes:
>
> >
> >  SaveGame:
> >   ld hl,ProgramVar-1
> >   rst 20h
> >   rst 10h
> >   call _ex_ahl_bde
> >   ld de,GameSaveData-_asm_exec_ram+4
> >   add hl,de
> >   adc a,0
> >   call _set_abs_dest_addr
> >   sub a
> >   ld hl,GameSaveData
> >   call _set_abs_src_addr
> >   ld hl,GameSaveDataSize
> >   call _set_mm_num_bytes
> >   call _mm_ldir
> >   ret
> >
> >  ProgramVar:
> >   6,"mygame"
> >
> >  GameSaveData:
> >  highscore:
> >   .db 0
> >  GameSaveDataSize =$-GameSaveData
> >
> >  >
> >  > is there a good high score routine out there.
> >  >
> >  > i need to save a byte from
> >  > score = _textShadow
> >  >
> >  > to
> >  >
> >  > highscore:
> >  > .db 0
> >  > i cant get anything to work
> >  >
> >  >
> >
>
>



References: