File tree 3 files changed +21
-24
lines changed
src/libraries/fileio_src/v2
3 files changed +21
-24
lines changed Original file line number Diff line number Diff line change 14
14
#define BUFSIZ 128 /* buffer size */
15
15
#define EOF (-1) /* end of file */
16
16
#define L_tmpnam 12
17
- #define SEEK_CUR 0
18
- #define SEEK_END 1
19
- #define SEEK_SET 2
20
- #define SYS_OPEN 3 /* max open files */
17
+ #define SEEK_CUR 1
18
+ #define SEEK_END 2
19
+ #define SEEK_SET 0
20
+ #define SYS_OPEN 5 /* max open files */
21
21
#define FOPEN_MAX SYS_OPEN
22
22
#define TMP_MAX 50
23
23
Original file line number Diff line number Diff line change @@ -151,9 +151,9 @@ int ti_GetC(const ti_var_t slot);
151
151
152
152
/**
153
153
* Seeks to an offset from the origin:
154
- * SEEK_SET (2 ) - Seek from beginning of file
155
- * SEEK_END (1) - Seek from end of file
156
- * SEEK_CUR (0 ) - Seek from current offset in file
154
+ * SEEK_SET (0 ) - Seek from beginning of file
155
+ * SEEK_CUR (1) - Seek from current offset in file
156
+ * SEEK_END (2 ) - Seek from end of file
157
157
* slot:
158
158
* varaible slot seeking in
159
159
*/
Original file line number Diff line number Diff line change @@ -507,41 +507,38 @@ _Seek:
507
507
ld iy , 0
508
508
add iy , sp
509
509
ld de , (iy + 3 )
510
- ld c , (ix + 9 )
510
+ ld c , (iy + 9 )
511
511
call _CheckIfSlotOpen \.r
512
512
jp z , _ReturnNEG1L \.r
513
513
ld a , (iy + 6 )
514
514
or a , a
515
- jr z , SeekCur
515
+ jr z , SeekSet
516
516
dec a
517
- jr z , SeekEnd
517
+ jr z , SeekCur
518
518
dec a
519
519
jp nz , _ReturnNEG1L \.r
520
- _SeekHandler_ASM:
520
+ SeekEnd:
521
+ push de
522
+ call _GetSlotSize_ASM \.r
523
+ SeekSet_ASM:
524
+ pop hl
525
+ add hl , bc
526
+ ex de , hl
527
+ SeekSet:
521
528
call _GetSlotSize_ASM \.r
522
529
push bc
523
530
pop hl
524
531
or a , a
525
- sbc hl , de
532
+ sbc hl , de
526
533
push de
527
534
pop bc
528
535
jp c , _ReturnNEG1L \.r
529
536
jp _SetSlotOffset_ASM \.r
530
537
SeekCur:
531
538
push de
532
539
call _GetSlotOffset_ASM \.r
533
- pop hl
534
- add hl , bc
535
- ex de , hl
536
- jr _SeekHandler_ASM
537
- SeekEnd:
538
- push de
539
- call _GetSlotSize_ASM \.r
540
- pop hl
541
- add hl , bc
542
- ex de , hl
543
- jr _SeekHandler_ASM
544
-
540
+ jr SeekSet_ASM
541
+
545
542
;-------------------------------------------------------------------------------
546
543
_PutChar:
547
544
; Performs an fputc on an AppVar
You can’t perform that action at this time.
0 commit comments