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

how do i print a number from a data register to a textfile?
http://www.easy68k.com/EASy68Kforum/viewtopic.php?f=5&t=966
Page 1 of 1

Author:  matl1990 [ Fri Mar 11, 2011 7:34 am ]
Post subject:  how do i print a number from a data register to a textfile?

how do i print a number from a data register to a textfile?

Author:  profkelly [ Fri Mar 11, 2011 5:25 pm ]
Post subject: 

Trap task 54 writes the contents of a memory buffer to a file. To save the contents of a register to a file it will be necessary to save the register to a memory buffer then save the buffer to file.

Code:
*-----------------------------------------------------------
* Write register D3 to text file.
*-----------------------------------------------------------
        ORG   $1000

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

        lea     buffer,a1   buffer
        move.b  d3,(a1)     store d3 to buffer
        move    #1,d2       # bytes to write
        move    #54,d0      write buffer to 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
buffer      ds.b    80

        END   start


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