Re: A86: HI.


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

Re: A86: HI.




Write back.  Store the variables inside your program like this:

GameSaveData:         ; put this somewhere like the end of your program
...
PlayerMoney: .dw 0
PlayerLevel: .dw 0
...
GameSaveDataSize = $ - GameSaveData

Then write it back with a routine like this:

 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:
 .db 4,"name"       ; 4 is the number of chars in 'name', which is the
program variable's name

Note that I haven't done any 86 coding in a while and I just ripped this
from my last project, so there could be a more optimized way...

> I don't really know enough assembly to understand how to help you with
your
> save game problem.
> Second, what's an easy (or any) way to save games without storing to
> variables that can be used for something else, or modified (what's a
little
> cheating going to hurt;))?




Follow-Ups: References: