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

traps that handles files in easy 68k
http://www.easy68k.com/EASy68Kforum/viewtopic.php?f=6&t=614
Page 1 of 1

Author:  easy68k-J [ Sun Mar 01, 2009 8:32 pm ]
Post subject:  traps that handles files in easy 68k

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

Author:  profkelly [ Mon Mar 02, 2009 4:48 am ]
Post subject: 

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

Author:  etw3 [ Sun Mar 04, 2012 12:46 am ]
Post subject:  where is the data

When you read from the file where is the data being placed?

Author:  profkelly [ Sun Mar 04, 2012 1:13 am ]
Post subject: 

The data is loaded into buffer.

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