EASy68K  
It is currently Mon Sep 23, 2019 12:04 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sun Mar 01, 2009 8:32 pm 
Offline

Joined: Sun Mar 01, 2009 6:53 pm
Posts: 1
hello everyone
i'd like to have a good reference regarding how to use trap instruction to handle files how to create and write on a text file for example ,i've checked the help on easy68k ,but the information wasn't enough i thought ,i mean after i read it ,i couldn't know how to use it .
if someone can help me i'de be glad
thanks
regards


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 02, 2009 4:48 am 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1102
Code:
*-----------------------------------------------------------
* Program Number:
* Written by    : Chuck Kelly
* Date Created  :
* Description   : Creates test1.txt, writes a string of text to the file
*                 reads the contents of the file, closes the file.
*-----------------------------------------------------------
    ORG     $1000

    lea     filename,a1     ;file name
    move    #52,d0          ;open new file
    trap    #15

    lea     data,a1         ;data to write
    move    #datasize,d2    ;# bytes to write
    move    #54,d0          ;write to file
    trap    #15

    move    #0,d2           ;reset file position to start of file
    move    #55,d0
    trap    #15

    lea     buffer,a1       ;store file data in buffer
    move    #datasize,d2    ;# bytes to read
    move    #53,d0          ;read from file
    trap    #15
   
    move    #50,d0
    trap    #15             ;close all files

    MOVE.B  #9,D0
    TRAP    #15             ; halt simulator
   
filename    dc.b    'test1.txt',0
data        dc.b    'this is a test'
            dc.b    1,2,3,4,5,6,7,8,9,0
datasize    equ     *-data
buffer      ds.b    80

    END     $1000

_________________
Prof. Kelly


Last edited by profkelly on Sun Mar 04, 2012 5:42 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: where is the data
PostPosted: Sun Mar 04, 2012 12:46 am 
Offline

Joined: Wed Feb 22, 2012 2:17 am
Posts: 8
Location: toronto
When you read from the file where is the data being placed?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 04, 2012 1:13 am 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1102
The data is loaded into buffer.

_________________
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 2 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