I guess this is stupid but I cannot see why.. using hatari / STF / TOS 1.02 it crashes in the first trap (Fcreate)
Code: Select all
LC2_create_prg:
; create file
clr.w -(sp) ; attributes = 0
lea.l L1D8_filename(pc), a3 ;
move.l a3, -(sp) ; fname = L1D8_filename
move.w #$3c, -(sp) ; long Fcreate(char* fname, word attr), returns a long, word value is the file handle, if neg, error
trap #$1 ; stack 8
; create file with modified DISKBUFP
move.l DISKBUFP.w, -(sp) ; buf = DISKBUFP
move.l #$400, -(sp) ; count = 1024 bytes
move.w d0, -(sp) ; handle = d0
move.w #$40, -(sp) ; long Fwrite(word handle, long count, voidp buf)
trap #$1 ; stack 10
; close file
subq.w #$2, (sp) ; call long Fclose(word handle), previous word opcode is set to $3e
trap #$1 ; stack = 0
; set file attribute to hidden
move.l #$10002, -(sp) ; flag = 1 (set) | attr = 2 (hidden file)
lea.l L1D8_filename(pc), a3 ;
move.l a3, -(sp) ; fname = L1D8_filename
move.w #$43, -(sp) ; long Fattrib(char* fname, word flag, word attr)
trap #$1 ; stack = 10
lea.l $1e(sp), sp ; fix all stacks
rts
L1D8_filename:
dc.b "A:\T.PRG", 0