EASy68K  
It is currently Mon Dec 09, 2019 10:23 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sat Mar 10, 2012 5:30 am 
Offline

Joined: Tue Mar 06, 2012 1:58 am
Posts: 2
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


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 10, 2012 1:22 pm 
Offline

Joined: Mon Dec 27, 2004 11:40 pm
Posts: 318
You can probably fix it by reading the help file on the assembler END directive.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 12, 2012 4:39 am 
Offline

Joined: Tue Mar 06, 2012 1:58 am
Posts: 2
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.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 12, 2012 12:58 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1109
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.

_________________
Prof. Kelly


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group