1; 2; ZX IF1 & Microdrive functions 3; 4; void if1_update_map (int drive, char *mdvmap); 5; 6; 7; Load in a Microdrive MAP array (32 bytes) 8; the actual values for the specified drive. 9; 10; $Id: if1_update_map.asm,v 1.3 2016-07-01 22:08:20 dom Exp $ 11; 12 13 SECTION code_clib 14 PUBLIC if1_update_map 15 PUBLIC _if1_update_map 16 17 18if1_update_map: 19_if1_update_map: 20 rst 8 21 defb 31h ; Create Interface 1 system vars if required 22 23 pop af 24 pop hl ;map location 25 pop bc ;driveno 26 push bc 27 push hl 28 push af 29 30 push ix ;save callers 31 32 push hl 33 34 ld a,c 35 ld ($5cd6),a 36 37 ld hl,4 38 ld ($5cda),hl ; length 39 ld hl,filename 40 ld ($5cdc),hl ; pointer to filename 41 42 ;rst 8 ; Erase if file exists ? 43 ;defb 24h 44 45 rst 8 46 defb 22h ; Open temporary 'M' channel (touch) 47 48 xor a 49 rst 8 50 defb 21h ; stop microdrive motor 51 52 pop de 53 ld l,(ix+$1a) ; load address of the associated 54 ld h,(ix+$1b) ; map into the HL register. 55 ld bc,32 56 ldir ; copy the map 57 58 rst 8 59 defb 2Ch ; Reclaim the channel 60 pop ix ;restore callers 61 ret 62 63 SECTION rodata_clib 64filename: defm "!h7$" ; foo file name: it will never be written ! 65