-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDoTC_Disc.asm
188 lines (167 loc) · 2.69 KB
/
DoTC_Disc.asm
1
; ------------------------------------------------------------------------------; from DISC.ASM; ---------------------------; Lecture et execution d'un fichier; hl-> filename addressrunfile:; --------------------------- ld (runfile_save_de),de ex (sp),hl ld e,(hl) inc hl ld d,(hl) inc hl ex (sp),hl ex de,hl push af push bc push de ld de,BUFOVL call readfil2 pop hlrunfile_save_de equ $+1 ld de,0 pop bc pop af jp BUFOVL+2 ; skip file length at the beginning of the data; ---------------------------; Lecture d'un fichier; hl -> filename address; de -> adresse d'implantation.; bc <- nombre d'octets lus.; de <- adresse premier octet suivant le fichier lu; hl <- length of the file; modifies- af,bc,de,hlreadfile:; --------------------------- ld bc,BUFFER_DATA ld (savebuf),bcreadfil2: ld a,(current_drive) ld (current_drive_change_test),a ld a,(hl) inc hl ld (sidestr),a ld (defrdf10+1),hl ld (load_address),de ld hl,drive_a_defender_side cp (hl) jp z,z_drive_a_defender_side ld (update_drive_defender_side),hl ld hl,drive_b_defender_side cp (hl) jp z,z_drive_b_defender_side ld (update_drive_defender_side),hl xor a ld hl,current_drive ld (hl),a ld hl,current_drive_change_test ld (hl),a jr defrdf10defrdfi0current_drive equ $+1 ld a,0 xor 1 ld (current_drive),a call fdc_set_drive_numbercurrent_drive_change_test equ $+1 cp 0 jr nz,defrdf10 push af push bc push de push hl push ix ld hl,PALFIX-11 call setpal ld hl,#0b18 call SCR_CHAR_POSITION push hl ld b,8 ld de,#c7d0deferr2 ld a,b push hl ld bc,#30 ldir ld hl,#7d0 add hl,de ex de,hl pop hl call nextline ld b,a djnz deferr2 ld hl,#0c19 call TXT_SET_CURSOR ld hl,errtext ld b,17deferr1 ld a,(hl) call TXT_OUTPUT inc hl djnz deferr1; ld a,7 ; beep; call txt_outputdeferr0 call getjoy jr nc,deferr0 pop hl ld b,8 ld de,#c7d0deferr3 ld a,b push hl ld bc,#30 ex de,hl ldir ex de,hl ld hl,#7d0 add hl,de ex de,hl pop hl call nextline ld b,a djnz deferr3 call restore_image_pal pop ix pop hl pop de pop bc pop afz_drive_a_defender_sidez_drive_b_defender_side; hl -> ptr on filename; de -> load address; bc -> free buffer (=DISK_SECTOR_LENGTH (ex &200))defrdf10 ld hl,0load_address equ $+1 ld de,0 call loadfile; 0 -> File Loaded; 1 -> Disc Missing; 2 -> Read Fail; 3 -> File Not Found or a jp nz,defrdfi0update_drive_defender_side equ $ +1 ld hl,0 ld a,(sidestr) ld (hl),a;; Get file length; ld hl,(load_address) ld e,(hl) inc hl ld d,(hl) dec hl add hl,de ex de,hl jp fdc_set_disk_drive_motor_off;errtext db "ins[rez la face "sidestr db "a"drive_a_defender_side db "0"drive_b_defender_side db "0"