EASy68K
http://www.easy68k.com/EASy68Kforum/

how to print out the input file content
http://www.easy68k.com/EASy68Kforum/viewtopic.php?f=6&t=1081
Page 1 of 1

Author:  xyz1915 [ Sat Mar 10, 2012 5:30 am ]
Post subject:  how to print out the input file content

this program should read from the file and prints out the content of the file in the output window, but it doesnt work. Can anyone tell me what the problem is and how can i fix it, thanks!!!

Code:
ORG   $1000
START:            ; first instruction of program

   lea   filename,a1
   move   #51,d0      open test.txt file
   trap   #15

   lea   buffer,a1
   move   #900,d2      # bytes to read
   move   #53,d0      read from file
   trap   #15
   

   
   move   #14,d0      output the context of file
   lea   buffer,a1
   trap   #15

   move   #50,d0
   trap   #15      close all files

   MOVE.B   #9,D0
   TRAP   #15      Halt Simulator

filename   dc.b   'test.txt',0

buffer      ds.b   80

   END   $800

Author:  lee [ Sat Mar 10, 2012 1:22 pm ]
Post subject: 

You can probably fix it by reading the help file on the assembler END directive.

Author:  xyz1915 [ Mon Mar 12, 2012 4:39 am ]
Post subject: 

lee wrote:
You can probably fix it by reading the help file on the assembler END directive.


I've change last line to END START
but now when i execute it, it keeps printing yyyyyyyyyyyyyyyyy.......
in the output window and then the simulator got frozen.

Author:  profkelly [ Mon Mar 12, 2012 12:58 pm ]
Post subject: 

Trap task #14 displays a NULL terminated string. Make sure the data loaded from the file ends with a NULL character or switch to task #0 or #1.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/