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

  1. /* This script does a simple disassemble of the spectrum's memory, */
  2. /* starting at address 0. Is a very simple example of usage of */
  3. /* the ARexx ZXAMDisassemble() function */
  4.  
  5.     /* check if the emulator is there... */
  6.     address command
  7.     
  8.     if ~show(ports,ZXAM_REXX) then do
  9.         requestchoice 'title "ZXAM Script error..." body "I can't find the emulator's port!!" gadgets "AARGH!"'
  10.         exit
  11.         end
  12.  
  13.     /* store the initial status of the emulator */
  14.     running=zxamactrun()    /* 1=running */
  15.     zxamstop()              /* stop the emulation */
  16.  
  17.     /* open the output window */
  18.     if ~open('fichero','con:0/11/640/200/Example of usage of ZXAMDisassemble()','W') then exit
  19.     
  20.     dir=0
  21.  
  22.     do forever
  23.  
  24.     do i=1 to 20    /* disassemble 20 lines */
  25.         linea=zxamdisassemble(dir,'d')        /* disassemble decimal */
  26.         dummy=writech('fichero',substr(linea,2))
  27.         dummy=writech('fichero','0a'x)
  28.         dir=(dir+left(linea,1))            /* add the size of instruction */
  29.         if dir>65535 then dir=dir-65536
  30.     end i
  31.  
  32.     /* must we continue? */
  33.     requestchoice '>t:zxamdisassem.tmp "ZXAM disassemble..."' '"Continue disassemble?"' GADGETS "OK|CANCEL"
  34.     respuesta=zxampploadfile('t:zxamdisassem.tmp')
  35.     respuesta=left(respuesta,length(respuesta)-1) /* delete the LF */
  36.     if respuesta=0 then signal cleanup
  37.     
  38.     end
  39.  
  40. cleanup:
  41.  
  42.     dummy=close('fichero')
  43.  
  44.     /* restore the status */
  45.     if running=1 then zxamrun()
  46.  
  47.     exit
  48.