1; 2; ZX IF1 & Microdrive functions 3; 4; int if1_touch_file (int drive, int name); 5; 6; Works like the 'touch' command. 7; Returns with the sector number associated to the file. 8; 9; ... no timestamp, just opens a file creating it if necessary and closes it immediately. 10; A temp buffer in the BASIC area is created and destroyed, so don't locate your code too low. 11; 12; $Id: if1_touch_file.asm,v 1.3 2016-07-01 22:08:20 dom Exp $ 13; 14 15 SECTION code_clib 16 PUBLIC if1_touch_file 17 PUBLIC _if1_touch_file 18 19 EXTERN if1_setname 20 21if1_touch_file: 22_if1_touch_file: 23 rst 8 24 defb 31h ; Create Interface 1 system vars if required 25 26 pop hl 27 pop de ;filename 28 pop bc ;driveno 29 push bc 30 push de 31 push hl 32 push ix ;save callers 33 34 ld a,c 35 ld ($5cd6),a 36 37 push de 38 ld hl,filename ; filename location 39 push hl 40 call if1_setname 41 ld ($5cda),hl ; length 42 pop hl 43 ld (5cdch),hl ; pointer to filename 44 pop de 45 46 rst 8 47 defb 22h ; Open temporary 'M' channel (touch) 48 49 ; Now IX points to the newly created channel 50 51 ld h,0 52 ld l,(ix+$29) ; save the sector number 53 push hl 54 rst 8 55 defb 23h ; Close channel and write current sector. 56 pop hl 57 pop ix ;restore callers 58 ret 59 60 SECTION bss_clib 61filename: defs 10 62