home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Emulation / ZXAMSpectrum / ZXAM_Rexx / English / SaveZ80.zxam < prev    next >
Text File  |  1995-07-31  |  2KB  |  57 lines

  1. /* This script saves the actual program in Z80 1.45 format */
  2.  
  3.     /* check if the emulator is present */
  4.     address command
  5.  
  6.     if ~show(ports,ZXAM_REXX) then do
  7.         requestchoice 'title "ZXAM Script error..." body "I cant find the emulator port!!" gadgets "AARGH!"'
  8.         exit
  9.         end
  10.  
  11.     /* store the initial status of the emulator */
  12.     running=zxamactrun()    /* 1=running */
  13.     zxamstop()              /* stop the emulation */
  14.  
  15.     /* SAVE requester */
  16.     oldpath=zxamactsavepath()
  17.     oldpattern=zxamactpattern()
  18.     zxampattern('#?.Z80')
  19.     nombre=zxamsaverequester('Name for the .Z80 file...')
  20.     zxamsavepath(oldpath)
  21.     zxampattern(oldpattern)
  22.     if nombre='' then exit 0    /* CANCEL */
  23.  
  24.     /* open the file */
  25.     if ~open('fichero',nombre,'W') then exit 0
  26.  
  27.     /* write all the registers */
  28.     dummy=writech('fichero',d2c(zxamgetreg(a)))
  29.     dummy=writech('fichero',d2c(zxamgetreg(f)))
  30.     dummy=writech('fichero',d2c(zxamgetreg(cb),2))
  31.     dummy=writech('fichero',d2c(zxamgetreg(lh),2))
  32.     dummy=writech('fichero',d2c(zxamgetreg(cp),2))
  33.     dummy=writech('fichero',d2c(zxamgetreg(ps),2))
  34.     dummy=writech('fichero',d2c(zxamgetreg(i)))
  35.     dummy=writech('fichero',d2c(zxamgetreg(r)))
  36.     dummy=writech('fichero',d2c((zxamgetreg(bor)*2)+(zxamgetreg(r)%128)))
  37.     dummy=writech('fichero',d2c(zxamgetreg(ed),2))
  38.     dummy=writech('fichero',d2c(zxamgetreg(cb2),2))
  39.     dummy=writech('fichero',d2c(zxamgetreg(ed2),2))
  40.     dummy=writech('fichero',d2c(zxamgetreg(lh2),2))
  41.     dummy=writech('fichero',d2c(zxamgetreg(a2)))
  42.     dummy=writech('fichero',d2c(zxamgetreg(f2)))
  43.     dummy=writech('fichero',d2c(zxamgetreg(yi),2))
  44.     dummy=writech('fichero',d2c(zxamgetreg(xi),2))
  45.     dummy=writech('fichero',d2c(zxamgetreg(int)))
  46.     dummy=writech('fichero',d2c(0))
  47.     dummy=writech('fichero',d2c(zxamgetreg(im)))
  48.  
  49.     dummy=writech('fichero',zxamgetmem(16384,49152))
  50.  
  51.     dummy=close('fichero')
  52.  
  53.     /* restore the status */
  54.     if running=1 then zxamrun()
  55.  
  56.     exit
  57.