home *** CD-ROM | disk | FTP | other *** search
/ ticalc.org / ticalc_org_rev_b.iso / archives / 86 / asm / source / routines / crtstrng.asm < prev    next >
Encoding:
Assembly Source File  |  2001-07-01  |  1.5 KB  |  39 lines

  1. ;==========================================================
  2. ; Create String routine
  3. ; by Andreas Finne <a_finne@hotmail.com>
  4. ; date: 10 Dec 1999
  5. ;
  6. ; Size: 40 bytes
  7. ;
  8. ; Input:
  9. ; de = length of data
  10. ; a  = length of name <=8
  11. ; hl = pointer to filename
  12. ; bc = pointer to start of data (Must be on ram page 0 or 1)
  13. ;==========================================================
  14.  
  15. CreateString:
  16.     push bc                        ;Save the pointer to start of data
  17.     push de                        ;Save the length of data twice
  18.     push de
  19.     ld de,_OP1+1                ;Point de to OP1+1
  20.     ld (de),a                    ;Load length of string name to OP1+1
  21.     ld c,a                        ;
  22.     xor a                        ;Load length of string name to bc
  23.     ld b,a                        ;
  24.     inc de                        ;de = OP1+2
  25.     ldir                        ;Copy the name into OP1+2->
  26.     pop hl                        ;hl = length of data
  27.     call _createstrng            ;create a string with namelength=OP1+1, name=OP1+2->, hl=number of bytes
  28.     ld a,b                        ;_createstrng returns the ABS address of the created string to bde
  29.     ex de,hl                    ;bde to ahl
  30.     call _ahl_plus_2_pg3        ;Skip size bytes of the string (ahl=ahl+2)
  31.     call _set_abs_dest_addr        ;Set destination address of _mm_ldir to ahl
  32.     pop hl                        ;hl = length of data
  33.     xor a                        ;a=0
  34.     call _set_mm_num_bytes        ;Number of bytes to copy = ahl
  35.     pop hl                        ;hl = pointer to start of data
  36.     call _set_abs_src_addr        ;Set source address of _mm_ldir to ahl
  37.     call _mm_ldir                ;Copy _mm_num_bytes from _abs_src_addr to _abs_dest_addr
  38.     jp _ram_page_1                ;_mm_ldir changes ram pages, this loads page #1 and returns
  39.