10.5. Writing to User Defined Files

With the createFile function you can create/overwrite a file on the disk. You call it with a file name and it returns a value that can be used to write data to the file:

.var myFile = createFile("breakpoints.txt") 
.eval myFile.writeln("Hello World")

IMPORTANT! For security reasons, you will have to use the –afo switch on the command line otherwise file generation will be blocked. Eg “java –jar KickAss.jar source.asm -afo” will do the trick.

File creation is useful for generating extra data for emulators. The following example shows how to generate a file with breakpoint for VICE:

.var brkFile = createFile("breakpoints.txt") 

.macro break() {
    .eval brkFile.writeln(“break “ + toHexString(*))

*=$0801 “Basic”

*=$1000 "Code"
    inc $d020
    jmp start

When running VICE with the breakpoint file (use the –moncommands switch), VICE will run until the break and then exit to the monitor.

Here is a list of the functions on a file value:

Table 10.4. FileValue Functions

Attribute/Function Description
Attribute/Function Description.
writeln(text) Writes the ‘text’ to the file and insert a line shift.
writeln() Insert a line shift.