home *** CD-ROM | disk | FTP | other *** search
/ ticalc.org / ticalc_org_rev_b.iso / archives / 86 / asm / source / routines / writeback.asm < prev   
Encoding:
Assembly Source File  |  2001-07-01  |  789 b   |  25 lines

  1. ;Writeback routine
  2. ;written by Jonah Cohen <ComAsYuAre@aol.com>
  3. ;http://jonah.ticalc.org
  4. ;
  5. ;A highly optimized writeback routine for saving high scores and saved games.
  6. ;It saves all data between data_start and data_end.
  7.  
  8.  
  9. #include "TI86.inc"            ;Clem's include file (http://jonah.ticalc.org/include.zip)
  10.  
  11. save_data:
  12.     ld hl,_asapvar            ;hl->name of program
  13.     rst 20h                ;copy to OP1
  14.     rst 10h                ;_findsym
  15.     xor a
  16.     ld hl,data_start-_asm_exec_ram+4    ;offset
  17.     add hl,de            ;hl=pointer to data in original prog
  18.     adc a,b                ;in case we overlapped pages
  19.     call _SET_ABS_DEST_ADDR
  20.     xor a                ;no absolute addressing now
  21.     ld hl,data_start        ;get data from here
  22.     call _SET_ABS_SRC_ADDR
  23.     ld hl,data_end-data_start    ;number of bytes to save
  24.     jp _MM_LDIR_SET_SIZE        ;copy data and return
  25.