X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=libsrc%2Fatari%2Fdiopncls.s;h=7826e0cc19a1c4faa5fea3c7fcdd3d39c8a8f7bc;hb=5b1b4ea00dd0af34b333d4692018d3765cff57df;hp=50899bfe7a166f4d943d7989ba36780a29fb77e6;hpb=6f60139c57e6c8e8d95f625ff871e7a24d142101;p=cc65 diff --git a/libsrc/atari/diopncls.s b/libsrc/atari/diopncls.s index 50899bfe7..7826e0cc1 100644 --- a/libsrc/atari/diopncls.s +++ b/libsrc/atari/diopncls.s @@ -3,44 +3,77 @@ ; ; This file provides the __dio_open and __dio_close functions ; Since on the Atari no real open and close is necessary, they -; do not much. The __dio_open queries the sector size of the +; do not much. The __dio_open sets the sector size of the ; drive which is later used by the _dio_read and _dio_write ; functions. ; -; unsigned char __fastcall__ _dio_open (_driveid_t drive_id); -; unsigned char __fastcall__ _dio_close (_driveid_t drive_id); +; dhandle_t __fastcall__ dio_open (driveid_t drive_id); +; unsigned char __fastcall__ dio_close (dhandle_t handle); ; - .export __dio_open,__dio_close + .export _dio_open,_dio_close .export sectsizetab + .import __oserror + .importzp ptr1,tmp1 .include "atari.inc" + .bss sectsizetab: - .res NUMDRVS * 2 + .res NUMDRVS * sst_size .code -.proc __dio_open +.proc _dio_open - asl a ; make index from drive id + cmp #NUMDRVS ; valid drive id? + bcs _inv_drive + tay ; drive # + asl a ; make index from drive id + asl a tax - lda #128 ; currently hardcoded (until I get an 815 :-) - sta sectsizetab,x + lda #128 ; currently hardcoded (until I get an 815 :-) + sta sectsizetab+sst_sectsize,x + sta sectsizetab+sst_flag,x ; set flag that drive is "open" lda #0 - sta sectsizetab+1,x + sta sectsizetab+sst_sectsize+1,x + sta __oserror ; success + tya + sta sectsizetab+sst_driveno,x +; lda #SSTIDVAL +; sta sectsizetab+sst_id+1,x + stx tmp1 + lda #sectsizetab + adc #0 + tax + lda tmp1 + rts - ; fall thru to __dio_close +_inv_drive: + lda #NONDEV ; non-existent device + sta __oserror + lda #0 + tax + rts ; return NULL .endproc -.proc __dio_close +.proc _dio_close + sta ptr1 + stx ptr1+1 lda #0 + ldy #sst_flag + sta (ptr1),y + sta __oserror ; success tax - rts ; return no error + rts ; return no error .endproc