1; 2; ZX IF1 & Microdrive functions 3; write a new record for the current buffer 4; 5; if1_write_record (int drive, struct M_CHAN buffer); 6; 7; This one is similar to "write sector" but fixes the record header. 8; It is necessary to load a copy of the microdirve MAP and to pass it 9; putting its location into the record structure.; 10; 11; $Id: if1_write_record.asm,v 1.4 2017-01-03 01:40:06 aralbrec Exp $ 12; 13 14 SECTION code_clib 15 PUBLIC if1_write_record 16 PUBLIC _if1_write_record 17 18if1_write_record: 19_if1_write_record: 20 rst 8 21 defb 31h ; Create Interface 1 system vars if required 22 23 push ix ;save callers 24 ld ix,4 25 add ix,sp 26 ld a,(ix+2) 27 ld hl,-1 28 and a ; drive no. = 0 ? 29 jr z,if1_write_record_exit ; yes, return -1 30 dec a 31 cp 8 ; drive no. >8 ? 32 jr nc,if1_write_record_exit ; yes, return -1 33 inc a 34 ;push af 35 36 ld ($5cd6),a 37 38 ld hl,1 39 ld ($5cda),hl ; filename length 40 ld hl,filename ; filename location 41 ld (5cdch),hl ; pointer to filename 42 43 ld l,(ix+0) ; buffer 44 ld h,(ix+1) 45 46 push hl 47 48 pop ix 49 50 rst 8 51 defb 26h ; Write Record 52 53 ;pop ix 54 ;rst 8 55 ;defb 23h ; (close) 56 57 ;rst 8 58 ;defb 2Ch ; reclaim buffer 59 60 xor a 61 rst 8 62 defb 21h ; Switch microdrive motor off (a=0) 63if1_write_record_exit: 64 pop ix ; restore callers 65 ret 66 67 SECTION rodata_clib 68filename: defm 3 69