mirror of
https://github.com/ksherlock/wdc-utils.git
synced 2024-12-12 19:30:38 +00:00
updated stdio test.
This commit is contained in:
parent
18c9ede89f
commit
bcb2ba03ef
@ -3,9 +3,11 @@
|
||||
|
||||
|
||||
void main(void) {
|
||||
|
||||
FILE *fp = fopen("file.txt", "wb");
|
||||
FILE *fp;
|
||||
|
||||
fputs("hello, world\n", stdout);
|
||||
|
||||
fp = fopen("file.txt", "wb");
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
@ -24,7 +26,30 @@ size_t read(int fd, void *buffer, size_t count) {
|
||||
}
|
||||
|
||||
size_t write(int fd, void *buffer, size_t count) {
|
||||
return -1;
|
||||
static struct {
|
||||
unsigned pCount;
|
||||
unsigned refNum;
|
||||
void *dataBuffer;
|
||||
unsigned long requestCount;
|
||||
unsigned long transferCount;
|
||||
unsigned cachePriority;
|
||||
} dcb;
|
||||
|
||||
unsigned tool_error = 0x0043;
|
||||
|
||||
dcb.pCount = 4;
|
||||
dcb.refNum = fd+1;
|
||||
dcb.dataBuffer = buffer;
|
||||
dcb.requestCount = count;
|
||||
#asm
|
||||
pea #$2012
|
||||
pea #^%%dcb
|
||||
pea #%%dcb
|
||||
jsl $e100b0
|
||||
sta %%tool_error;
|
||||
#endasm
|
||||
if (tool_error) return -1;
|
||||
return dcb.transferCount;
|
||||
}
|
||||
|
||||
long lseek(int fd, long offset, int whence) {
|
||||
@ -45,6 +70,6 @@ int isatty(int fd) {
|
||||
|
||||
|
||||
#pragma section udata=heap
|
||||
char __heap[8092];
|
||||
char __heap[8192];
|
||||
void *heap_start = (void *)__heap;
|
||||
void *heap_end = (void *)&__heap[8092];
|
||||
|
@ -1,4 +1,4 @@
|
||||
Mon Jan 16 2017 13:57 Page 1
|
||||
Tue Jan 17 2017 23:02 Page 1
|
||||
|
||||
|
||||
***************************************
|
||||
@ -25,384 +25,462 @@
|
||||
16 longi on
|
||||
17 00:0000: 3B tsc
|
||||
18 00:0001: 38 sec
|
||||
19 00:0002: E9 04 00 sbc #L2
|
||||
19 00:0002: E9 08 00 sbc #L2
|
||||
20 00:0005: 1B tcs
|
||||
21 00:0006: 0B phd
|
||||
22 00:0007: 5B tcd
|
||||
23 ;
|
||||
24 ; FILE *fp = fopen("file.txt", "wb");
|
||||
25 ;
|
||||
26 ; fclose(fp);
|
||||
27 00000000 fp_1 set 0
|
||||
28 00:0008: F4 xx xx pea #^L1+9
|
||||
29 00:000B: F4 xx xx pea #<L1+9
|
||||
30 00:000E: F4 xx xx pea #^L1
|
||||
31 00:0011: F4 xx xx pea #<L1
|
||||
32 00:0014: 22 xx xx xx jsl ~~fopen
|
||||
33 00:0018: 85 01 sta <L3+fp_1
|
||||
34 00:001A: 86 03 stx <L3+fp_1+2
|
||||
35 00:001C: D4 03 pei <L3+fp_1+2
|
||||
36 00:001E: D4 01 pei <L3+fp_1
|
||||
37 00:0020: 22 xx xx xx jsl ~~fclose
|
||||
38 ;}
|
||||
39 L4:
|
||||
40 00:0024: 2B pld
|
||||
41 00:0025: 3B tsc
|
||||
42 00:0026: 18 clc
|
||||
43 00:0027: 69 04 00 adc #L2
|
||||
44 00:002A: 1B tcs
|
||||
45 00:002B: 6B rtl
|
||||
46 00000004 L2 equ 4
|
||||
47 00000001 L3 equ 1
|
||||
48 ends
|
||||
49 efunc
|
||||
50 data
|
||||
51 L1:
|
||||
52 00:0000: 66 69 6C 65 db $66,$69,$6C,$65,$2E,$74,$78,$74,$00,$77,
|
||||
Mon Jan 16 2017 13:57 Page 2
|
||||
23 ; FILE *fp;
|
||||
24 ;
|
||||
25 ; fputs("hello, world\n", stdout);
|
||||
26 00000000 fp_1 set 0
|
||||
27 00:0008: A9 xx xx lda #<~~_iob+20
|
||||
28 00:000B: 85 01 sta <R0
|
||||
29 xref _BEG_DATA
|
||||
30 00:000D: A9 xx xx lda #_BEG_DATA>>16
|
||||
31 00:0010: 85 03 sta <R0+2
|
||||
32 00:0012: D4 03 pei <R0+2
|
||||
33 00:0014: D4 01 pei <R0
|
||||
34 00:0016: F4 xx xx pea #^L1
|
||||
35 00:0019: F4 xx xx pea #<L1
|
||||
36 00:001C: 22 xx xx xx jsl ~~fputs
|
||||
37 ;
|
||||
38 ; fp = fopen("file.txt", "wb");
|
||||
39 00:0020: F4 xx xx pea #^L1+23
|
||||
40 00:0023: F4 xx xx pea #<L1+23
|
||||
41 00:0026: F4 xx xx pea #^L1+14
|
||||
42 00:0029: F4 xx xx pea #<L1+14
|
||||
43 00:002C: 22 xx xx xx jsl ~~fopen
|
||||
44 00:0030: 85 05 sta <L3+fp_1
|
||||
45 00:0032: 86 07 stx <L3+fp_1+2
|
||||
46 ; fclose(fp);
|
||||
47 00:0034: D4 07 pei <L3+fp_1+2
|
||||
48 00:0036: D4 05 pei <L3+fp_1
|
||||
49 00:0038: 22 xx xx xx jsl ~~fclose
|
||||
50 ;}
|
||||
51 L4:
|
||||
52 00:003C: 2B pld
|
||||
Tue Jan 17 2017 23:02 Page 2
|
||||
|
||||
|
||||
$62,$00
|
||||
00:0004: 2E 74 78 74
|
||||
00:0008: 00 77 62 00
|
||||
53 00:000C: ends
|
||||
54 ;
|
||||
55 ;// these stubs are not provided in the library bu
|
||||
53 00:003D: 3B tsc
|
||||
54 00:003E: 18 clc
|
||||
55 00:003F: 69 08 00 adc #L2
|
||||
56 00:0042: 1B tcs
|
||||
57 00:0043: 6B rtl
|
||||
58 00000008 L2 equ 8
|
||||
59 00000005 L3 equ 5
|
||||
60 ends
|
||||
61 efunc
|
||||
62 data
|
||||
63 L1:
|
||||
64 00:0000: 68 65 6C 6C db $68,$65,$6C,$6C,$6F,$2C,$20,$77,$6F,$72,
|
||||
$6C,$64,$0A,$00,$66
|
||||
00:0004: 6F 2C 20 77
|
||||
00:0008: 6F 72 6C 64
|
||||
00:000C: 0A 00 66
|
||||
65 00:000F: 69 6C 65 2E db $69,$6C,$65,$2E,$74,$78,$74,$00,$77,$62,
|
||||
$00
|
||||
00:0013: 74 78 74 00
|
||||
00:0017: 77 62 00
|
||||
66 00:001A: ends
|
||||
67 ;
|
||||
68 ;// these stubs are not provided in the library bu
|
||||
t could call gs/os.
|
||||
56 ;
|
||||
57 ;int open(const char *name, int mode) {
|
||||
58 code
|
||||
59 xdef ~~open
|
||||
60 func
|
||||
61 ~~open:
|
||||
62 longa on
|
||||
63 longi on
|
||||
64 00:002C: 3B tsc
|
||||
65 00:002D: 38 sec
|
||||
66 00:002E: E9 00 00 sbc #L6
|
||||
67 00:0031: 1B tcs
|
||||
68 00:0032: 0B phd
|
||||
69 00:0033: 5B tcd
|
||||
70 00000004 name_0 set 4
|
||||
71 00000008 mode_0 set 8
|
||||
72 ; return -1;
|
||||
73 00:0034: A9 FF FF lda #$ffff
|
||||
74 L8:
|
||||
75 00:0037: A8 tay
|
||||
76 00:0038: A5 02 lda <L6+2
|
||||
77 00:003A: 85 08 sta <L6+2+6
|
||||
78 00:003C: A5 01 lda <L6+1
|
||||
79 00:003E: 85 07 sta <L6+1+6
|
||||
80 00:0040: 2B pld
|
||||
81 00:0041: 3B tsc
|
||||
82 00:0042: 18 clc
|
||||
83 00:0043: 69 06 00 adc #L6+6
|
||||
84 00:0046: 1B tcs
|
||||
85 00:0047: 98 tya
|
||||
86 00:0048: 6B rtl
|
||||
87 ;}
|
||||
88 00000000 L6 equ 0
|
||||
89 00000001 L7 equ 1
|
||||
90 ends
|
||||
91 efunc
|
||||
92 ;
|
||||
93 ;int close(int fd) {
|
||||
94 code
|
||||
95 xdef ~~close
|
||||
96 func
|
||||
97 ~~close:
|
||||
98 longa on
|
||||
99 longi on
|
||||
100 00:0049: 3B tsc
|
||||
101 00:004A: 38 sec
|
||||
102 00:004B: E9 00 00 sbc #L9
|
||||
103 00:004E: 1B tcs
|
||||
104 00:004F: 0B phd
|
||||
105 00:0050: 5B tcd
|
||||
106 00000004 fd_0 set 4
|
||||
Mon Jan 16 2017 13:57 Page 3
|
||||
69 ;
|
||||
70 ;int open(const char *name, int mode) {
|
||||
71 code
|
||||
72 xdef ~~open
|
||||
73 func
|
||||
74 ~~open:
|
||||
75 longa on
|
||||
76 longi on
|
||||
77 00:0044: 3B tsc
|
||||
78 00:0045: 38 sec
|
||||
79 00:0046: E9 00 00 sbc #L6
|
||||
80 00:0049: 1B tcs
|
||||
81 00:004A: 0B phd
|
||||
82 00:004B: 5B tcd
|
||||
83 00000004 name_0 set 4
|
||||
84 00000008 mode_0 set 8
|
||||
85 ; return -1;
|
||||
86 00:004C: A9 FF FF lda #$ffff
|
||||
87 L8:
|
||||
88 00:004F: A8 tay
|
||||
89 00:0050: A5 02 lda <L6+2
|
||||
90 00:0052: 85 08 sta <L6+2+6
|
||||
91 00:0054: A5 01 lda <L6+1
|
||||
92 00:0056: 85 07 sta <L6+1+6
|
||||
93 00:0058: 2B pld
|
||||
94 00:0059: 3B tsc
|
||||
95 00:005A: 18 clc
|
||||
96 00:005B: 69 06 00 adc #L6+6
|
||||
97 00:005E: 1B tcs
|
||||
98 00:005F: 98 tya
|
||||
99 00:0060: 6B rtl
|
||||
100 ;}
|
||||
101 00000000 L6 equ 0
|
||||
102 00000001 L7 equ 1
|
||||
Tue Jan 17 2017 23:02 Page 3
|
||||
|
||||
|
||||
107 ; return -1;
|
||||
108 00:0051: A9 FF FF lda #$ffff
|
||||
109 L11:
|
||||
110 00:0054: A8 tay
|
||||
111 00:0055: A5 02 lda <L9+2
|
||||
112 00:0057: 85 04 sta <L9+2+2
|
||||
113 00:0059: A5 01 lda <L9+1
|
||||
114 00:005B: 85 03 sta <L9+1+2
|
||||
115 00:005D: 2B pld
|
||||
116 00:005E: 3B tsc
|
||||
117 00:005F: 18 clc
|
||||
118 00:0060: 69 02 00 adc #L9+2
|
||||
119 00:0063: 1B tcs
|
||||
120 00:0064: 98 tya
|
||||
121 00:0065: 6B rtl
|
||||
122 ;}
|
||||
123 00000000 L9 equ 0
|
||||
124 00000001 L10 equ 1
|
||||
125 ends
|
||||
126 efunc
|
||||
127 ;
|
||||
128 ;size_t read(int fd, void *buffer, size_t count) {
|
||||
129 code
|
||||
130 xdef ~~read
|
||||
131 func
|
||||
132 ~~read:
|
||||
133 longa on
|
||||
134 longi on
|
||||
135 00:0066: 3B tsc
|
||||
136 00:0067: 38 sec
|
||||
137 00:0068: E9 00 00 sbc #L12
|
||||
138 00:006B: 1B tcs
|
||||
139 00:006C: 0B phd
|
||||
140 00:006D: 5B tcd
|
||||
141 00000004 fd_0 set 4
|
||||
142 00000006 buffer_0 set 6
|
||||
143 0000000A count_0 set 10
|
||||
144 ; return -1;
|
||||
145 00:006E: A9 FF FF lda #$ffff
|
||||
146 L14:
|
||||
147 00:0071: A8 tay
|
||||
148 00:0072: A5 02 lda <L12+2
|
||||
149 00:0074: 85 0A sta <L12+2+8
|
||||
150 00:0076: A5 01 lda <L12+1
|
||||
151 00:0078: 85 09 sta <L12+1+8
|
||||
152 00:007A: 2B pld
|
||||
153 00:007B: 3B tsc
|
||||
154 00:007C: 18 clc
|
||||
155 00:007D: 69 08 00 adc #L12+8
|
||||
156 00:0080: 1B tcs
|
||||
157 00:0081: 98 tya
|
||||
158 00:0082: 6B rtl
|
||||
159 ;}
|
||||
160 00000000 L12 equ 0
|
||||
161 00000001 L13 equ 1
|
||||
162 ends
|
||||
163 efunc
|
||||
164 ;
|
||||
Mon Jan 16 2017 13:57 Page 4
|
||||
103 ends
|
||||
104 efunc
|
||||
105 ;
|
||||
106 ;int close(int fd) {
|
||||
107 code
|
||||
108 xdef ~~close
|
||||
109 func
|
||||
110 ~~close:
|
||||
111 longa on
|
||||
112 longi on
|
||||
113 00:0061: 3B tsc
|
||||
114 00:0062: 38 sec
|
||||
115 00:0063: E9 00 00 sbc #L9
|
||||
116 00:0066: 1B tcs
|
||||
117 00:0067: 0B phd
|
||||
118 00:0068: 5B tcd
|
||||
119 00000004 fd_0 set 4
|
||||
120 ; return -1;
|
||||
121 00:0069: A9 FF FF lda #$ffff
|
||||
122 L11:
|
||||
123 00:006C: A8 tay
|
||||
124 00:006D: A5 02 lda <L9+2
|
||||
125 00:006F: 85 04 sta <L9+2+2
|
||||
126 00:0071: A5 01 lda <L9+1
|
||||
127 00:0073: 85 03 sta <L9+1+2
|
||||
128 00:0075: 2B pld
|
||||
129 00:0076: 3B tsc
|
||||
130 00:0077: 18 clc
|
||||
131 00:0078: 69 02 00 adc #L9+2
|
||||
132 00:007B: 1B tcs
|
||||
133 00:007C: 98 tya
|
||||
134 00:007D: 6B rtl
|
||||
135 ;}
|
||||
136 00000000 L9 equ 0
|
||||
137 00000001 L10 equ 1
|
||||
138 ends
|
||||
139 efunc
|
||||
140 ;
|
||||
141 ;size_t read(int fd, void *buffer, size_t count) {
|
||||
142 code
|
||||
143 xdef ~~read
|
||||
144 func
|
||||
145 ~~read:
|
||||
146 longa on
|
||||
147 longi on
|
||||
148 00:007E: 3B tsc
|
||||
149 00:007F: 38 sec
|
||||
150 00:0080: E9 00 00 sbc #L12
|
||||
151 00:0083: 1B tcs
|
||||
152 00:0084: 0B phd
|
||||
153 00:0085: 5B tcd
|
||||
154 00000004 fd_0 set 4
|
||||
155 00000006 buffer_0 set 6
|
||||
156 0000000A count_0 set 10
|
||||
157 ; return -1;
|
||||
158 00:0086: A9 FF FF lda #$ffff
|
||||
159 L14:
|
||||
160 00:0089: A8 tay
|
||||
Tue Jan 17 2017 23:02 Page 4
|
||||
|
||||
|
||||
165 ;size_t write(int fd, void *buffer, size_t count)
|
||||
161 00:008A: A5 02 lda <L12+2
|
||||
162 00:008C: 85 0A sta <L12+2+8
|
||||
163 00:008E: A5 01 lda <L12+1
|
||||
164 00:0090: 85 09 sta <L12+1+8
|
||||
165 00:0092: 2B pld
|
||||
166 00:0093: 3B tsc
|
||||
167 00:0094: 18 clc
|
||||
168 00:0095: 69 08 00 adc #L12+8
|
||||
169 00:0098: 1B tcs
|
||||
170 00:0099: 98 tya
|
||||
171 00:009A: 6B rtl
|
||||
172 ;}
|
||||
173 00000000 L12 equ 0
|
||||
174 00000001 L13 equ 1
|
||||
175 ends
|
||||
176 efunc
|
||||
177 ;
|
||||
178 ;size_t write(int fd, void *buffer, size_t count)
|
||||
{
|
||||
166 code
|
||||
167 xdef ~~write
|
||||
168 func
|
||||
169 ~~write:
|
||||
170 longa on
|
||||
171 longi on
|
||||
172 00:0083: 3B tsc
|
||||
173 00:0084: 38 sec
|
||||
174 00:0085: E9 00 00 sbc #L15
|
||||
175 00:0088: 1B tcs
|
||||
176 00:0089: 0B phd
|
||||
177 00:008A: 5B tcd
|
||||
178 00000004 fd_0 set 4
|
||||
179 00000006 buffer_0 set 6
|
||||
180 0000000A count_0 set 10
|
||||
181 ; return -1;
|
||||
182 00:008B: A9 FF FF lda #$ffff
|
||||
183 L17:
|
||||
184 00:008E: A8 tay
|
||||
185 00:008F: A5 02 lda <L15+2
|
||||
186 00:0091: 85 0A sta <L15+2+8
|
||||
187 00:0093: A5 01 lda <L15+1
|
||||
188 00:0095: 85 09 sta <L15+1+8
|
||||
189 00:0097: 2B pld
|
||||
190 00:0098: 3B tsc
|
||||
191 00:0099: 18 clc
|
||||
192 00:009A: 69 08 00 adc #L15+8
|
||||
193 00:009D: 1B tcs
|
||||
194 00:009E: 98 tya
|
||||
195 00:009F: 6B rtl
|
||||
196 ;}
|
||||
197 00000000 L15 equ 0
|
||||
198 00000001 L16 equ 1
|
||||
199 ends
|
||||
200 efunc
|
||||
201 ;
|
||||
202 ;long lseek(int fd, long offset, int whence) {
|
||||
203 code
|
||||
204 xdef ~~lseek
|
||||
205 func
|
||||
206 ~~lseek:
|
||||
207 longa on
|
||||
208 longi on
|
||||
209 00:00A0: 3B tsc
|
||||
210 00:00A1: 38 sec
|
||||
211 00:00A2: E9 00 00 sbc #L18
|
||||
212 00:00A5: 1B tcs
|
||||
213 00:00A6: 0B phd
|
||||
214 00:00A7: 5B tcd
|
||||
215 00000004 fd_0 set 4
|
||||
216 00000006 offset_0 set 6
|
||||
217 0000000A whence_0 set 10
|
||||
218 ; return -1;
|
||||
219 00:00A8: A9 FF FF lda #$ffff
|
||||
220 00:00AB: AA tax
|
||||
221 00:00AC: A9 FF FF lda #$ffff
|
||||
Mon Jan 16 2017 13:57 Page 5
|
||||
179 code
|
||||
180 xdef ~~write
|
||||
181 func
|
||||
182 ~~write:
|
||||
183 longa on
|
||||
184 longi on
|
||||
185 00:009B: 3B tsc
|
||||
186 00:009C: 38 sec
|
||||
187 00:009D: E9 02 00 sbc #L15
|
||||
188 00:00A0: 1B tcs
|
||||
189 00:00A1: 0B phd
|
||||
190 00:00A2: 5B tcd
|
||||
191 00000004 fd_0 set 4
|
||||
192 00000006 buffer_0 set 6
|
||||
193 0000000A count_0 set 10
|
||||
194 ; static struct {
|
||||
195 ; unsigned pCount;
|
||||
196 ; unsigned refNum;
|
||||
197 ; void *dataBuffer;
|
||||
198 ; unsigned long requestCount;
|
||||
199 ; unsigned long transferCount;
|
||||
200 ; unsigned cachePriority;
|
||||
201 ; } dcb;
|
||||
202 udata
|
||||
203 L10001:
|
||||
204 00:0000: ds 18
|
||||
205 00:0012: ends
|
||||
206 ;
|
||||
207 ; unsigned tool_error = 0x0043;
|
||||
208 ;
|
||||
209 ; dcb.pCount = 4;
|
||||
210 00000000 tool_error_1 set 0
|
||||
211 00:00A3: A9 43 00 lda #$43
|
||||
212 00:00A6: 85 01 sta <L16+tool_error_1
|
||||
213 00:00A8: A9 04 00 lda #$4
|
||||
214 00:00AB: 8D xx xx sta |L10001
|
||||
215 ; dcb.refNum = fd+1;
|
||||
216 00:00AE: A5 06 lda <L15+fd_0
|
||||
217 00:00B0: 1A ina
|
||||
Tue Jan 17 2017 23:02 Page 5
|
||||
|
||||
|
||||
222 L20:
|
||||
223 00:00AF: A8 tay
|
||||
224 00:00B0: A5 02 lda <L18+2
|
||||
225 00:00B2: 85 0A sta <L18+2+8
|
||||
226 00:00B4: A5 01 lda <L18+1
|
||||
227 00:00B6: 85 09 sta <L18+1+8
|
||||
228 00:00B8: 2B pld
|
||||
229 00:00B9: 3B tsc
|
||||
230 00:00BA: 18 clc
|
||||
231 00:00BB: 69 08 00 adc #L18+8
|
||||
232 00:00BE: 1B tcs
|
||||
233 00:00BF: 98 tya
|
||||
234 00:00C0: 6B rtl
|
||||
235 ;}
|
||||
236 00000000 L18 equ 0
|
||||
237 00000001 L19 equ 1
|
||||
238 ends
|
||||
239 efunc
|
||||
240 ;
|
||||
241 ;int creat(const char *name, int mode) {
|
||||
242 code
|
||||
243 xdef ~~creat
|
||||
244 func
|
||||
245 ~~creat:
|
||||
246 longa on
|
||||
247 longi on
|
||||
248 00:00C1: 3B tsc
|
||||
249 00:00C2: 38 sec
|
||||
250 00:00C3: E9 00 00 sbc #L21
|
||||
251 00:00C6: 1B tcs
|
||||
252 00:00C7: 0B phd
|
||||
253 00:00C8: 5B tcd
|
||||
254 00000004 name_0 set 4
|
||||
255 00000008 mode_0 set 8
|
||||
256 ; return -1;
|
||||
257 00:00C9: A9 FF FF lda #$ffff
|
||||
258 L23:
|
||||
259 00:00CC: A8 tay
|
||||
260 00:00CD: A5 02 lda <L21+2
|
||||
261 00:00CF: 85 08 sta <L21+2+6
|
||||
262 00:00D1: A5 01 lda <L21+1
|
||||
263 00:00D3: 85 07 sta <L21+1+6
|
||||
264 00:00D5: 2B pld
|
||||
265 00:00D6: 3B tsc
|
||||
266 00:00D7: 18 clc
|
||||
267 00:00D8: 69 06 00 adc #L21+6
|
||||
268 00:00DB: 1B tcs
|
||||
269 00:00DC: 98 tya
|
||||
270 00:00DD: 6B rtl
|
||||
271 ;}
|
||||
272 00000000 L21 equ 0
|
||||
273 00000001 L22 equ 1
|
||||
274 ends
|
||||
275 efunc
|
||||
276 ;
|
||||
277 ;int unlink(const char *name) {
|
||||
278 code
|
||||
279 xdef ~~unlink
|
||||
Mon Jan 16 2017 13:57 Page 6
|
||||
218 00:00B1: 8D xx xx sta |L10001+2
|
||||
219 ; dcb.dataBuffer = buffer;
|
||||
220 00:00B4: A5 08 lda <L15+buffer_0
|
||||
221 00:00B6: 8D xx xx sta |L10001+4
|
||||
222 00:00B9: A5 0A lda <L15+buffer_0+2
|
||||
223 00:00BB: 8D xx xx sta |L10001+4+2
|
||||
224 ; dcb.requestCount = count;
|
||||
225 00:00BE: A5 0C lda <L15+count_0
|
||||
226 00:00C0: 8D xx xx sta |L10001+8
|
||||
227 00:00C3: 9C xx xx stz |L10001+8+2
|
||||
228 ; #asm
|
||||
229 ; pea #$2012
|
||||
230 ; pea #^%%dcb
|
||||
231 ; pea #%%dcb
|
||||
232 ; jsl $e100b0
|
||||
233 ; sta %%tool_error;
|
||||
234 ; #endasm
|
||||
235 asmstart
|
||||
236 00:00C6: F4 12 20 pea #$2012
|
||||
237 00:00C9: F4 xx xx pea #^L10001
|
||||
238 00:00CC: F4 xx xx pea #L10001
|
||||
239 00:00CF: 22 B0 00 E1 jsl $e100b0
|
||||
240 00:00D3: 85 01 sta <L16+tool_error_1;
|
||||
241 asmend
|
||||
242 ; if (tool_error) return -1;
|
||||
243 00:00D5: A5 01 lda <L16+tool_error_1
|
||||
244 00:00D7: D0 03 bne L17
|
||||
245 00:00D9: 82 15 00 brl L10002
|
||||
246 L17:
|
||||
247 00:00DC: A9 FF FF lda #$ffff
|
||||
248 L18:
|
||||
249 00:00DF: A8 tay
|
||||
250 00:00E0: A5 04 lda <L15+2
|
||||
251 00:00E2: 85 0C sta <L15+2+8
|
||||
252 00:00E4: A5 03 lda <L15+1
|
||||
253 00:00E6: 85 0B sta <L15+1+8
|
||||
254 00:00E8: 2B pld
|
||||
255 00:00E9: 3B tsc
|
||||
256 00:00EA: 18 clc
|
||||
257 00:00EB: 69 0A 00 adc #L15+8
|
||||
258 00:00EE: 1B tcs
|
||||
259 00:00EF: 98 tya
|
||||
260 00:00F0: 6B rtl
|
||||
261 ; return dcb.transferCount;
|
||||
262 L10002:
|
||||
263 00:00F1: AD xx xx lda |L10001+12
|
||||
264 00:00F4: 82 E8 FF brl L18
|
||||
265 ;}
|
||||
266 00000002 L15 equ 2
|
||||
267 00000001 L16 equ 1
|
||||
268 ends
|
||||
269 efunc
|
||||
270 ;
|
||||
271 ;long lseek(int fd, long offset, int whence) {
|
||||
272 code
|
||||
273 xdef ~~lseek
|
||||
274 func
|
||||
275 ~~lseek:
|
||||
Tue Jan 17 2017 23:02 Page 6
|
||||
|
||||
|
||||
280 func
|
||||
281 ~~unlink:
|
||||
282 longa on
|
||||
283 longi on
|
||||
284 00:00DE: 3B tsc
|
||||
285 00:00DF: 38 sec
|
||||
286 00:00E0: E9 00 00 sbc #L24
|
||||
287 00:00E3: 1B tcs
|
||||
288 00:00E4: 0B phd
|
||||
289 00:00E5: 5B tcd
|
||||
290 00000004 name_0 set 4
|
||||
291 ; return -1;
|
||||
292 00:00E6: A9 FF FF lda #$ffff
|
||||
293 L26:
|
||||
294 00:00E9: A8 tay
|
||||
295 00:00EA: A5 02 lda <L24+2
|
||||
296 00:00EC: 85 06 sta <L24+2+4
|
||||
297 00:00EE: A5 01 lda <L24+1
|
||||
298 00:00F0: 85 05 sta <L24+1+4
|
||||
299 00:00F2: 2B pld
|
||||
300 00:00F3: 3B tsc
|
||||
301 00:00F4: 18 clc
|
||||
302 00:00F5: 69 04 00 adc #L24+4
|
||||
303 00:00F8: 1B tcs
|
||||
304 00:00F9: 98 tya
|
||||
305 00:00FA: 6B rtl
|
||||
306 ;}
|
||||
307 00000000 L24 equ 0
|
||||
308 00000001 L25 equ 1
|
||||
309 ends
|
||||
310 efunc
|
||||
311 ;
|
||||
312 ;int isatty(int fd) {
|
||||
313 code
|
||||
314 xdef ~~isatty
|
||||
315 func
|
||||
316 ~~isatty:
|
||||
317 longa on
|
||||
318 longi on
|
||||
319 00:00FB: 3B tsc
|
||||
320 00:00FC: 38 sec
|
||||
321 00:00FD: E9 00 00 sbc #L27
|
||||
322 00:0100: 1B tcs
|
||||
323 00:0101: 0B phd
|
||||
324 00:0102: 5B tcd
|
||||
325 00000004 fd_0 set 4
|
||||
326 ; return -1;
|
||||
327 00:0103: A9 FF FF lda #$ffff
|
||||
328 L29:
|
||||
329 00:0106: A8 tay
|
||||
330 00:0107: A5 02 lda <L27+2
|
||||
331 00:0109: 85 04 sta <L27+2+2
|
||||
332 00:010B: A5 01 lda <L27+1
|
||||
333 00:010D: 85 03 sta <L27+1+2
|
||||
334 00:010F: 2B pld
|
||||
335 00:0110: 3B tsc
|
||||
336 00:0111: 18 clc
|
||||
337 00:0112: 69 02 00 adc #L27+2
|
||||
Mon Jan 16 2017 13:57 Page 7
|
||||
276 longa on
|
||||
277 longi on
|
||||
278 00:00F7: 3B tsc
|
||||
279 00:00F8: 38 sec
|
||||
280 00:00F9: E9 00 00 sbc #L19
|
||||
281 00:00FC: 1B tcs
|
||||
282 00:00FD: 0B phd
|
||||
283 00:00FE: 5B tcd
|
||||
284 00000004 fd_0 set 4
|
||||
285 00000006 offset_0 set 6
|
||||
286 0000000A whence_0 set 10
|
||||
287 ; return -1;
|
||||
288 00:00FF: A9 FF FF lda #$ffff
|
||||
289 00:0102: AA tax
|
||||
290 00:0103: A9 FF FF lda #$ffff
|
||||
291 L21:
|
||||
292 00:0106: A8 tay
|
||||
293 00:0107: A5 02 lda <L19+2
|
||||
294 00:0109: 85 0A sta <L19+2+8
|
||||
295 00:010B: A5 01 lda <L19+1
|
||||
296 00:010D: 85 09 sta <L19+1+8
|
||||
297 00:010F: 2B pld
|
||||
298 00:0110: 3B tsc
|
||||
299 00:0111: 18 clc
|
||||
300 00:0112: 69 08 00 adc #L19+8
|
||||
301 00:0115: 1B tcs
|
||||
302 00:0116: 98 tya
|
||||
303 00:0117: 6B rtl
|
||||
304 ;}
|
||||
305 00000000 L19 equ 0
|
||||
306 00000001 L20 equ 1
|
||||
307 ends
|
||||
308 efunc
|
||||
309 ;
|
||||
310 ;int creat(const char *name, int mode) {
|
||||
311 code
|
||||
312 xdef ~~creat
|
||||
313 func
|
||||
314 ~~creat:
|
||||
315 longa on
|
||||
316 longi on
|
||||
317 00:0118: 3B tsc
|
||||
318 00:0119: 38 sec
|
||||
319 00:011A: E9 00 00 sbc #L22
|
||||
320 00:011D: 1B tcs
|
||||
321 00:011E: 0B phd
|
||||
322 00:011F: 5B tcd
|
||||
323 00000004 name_0 set 4
|
||||
324 00000008 mode_0 set 8
|
||||
325 ; return -1;
|
||||
326 00:0120: A9 FF FF lda #$ffff
|
||||
327 L24:
|
||||
328 00:0123: A8 tay
|
||||
329 00:0124: A5 02 lda <L22+2
|
||||
330 00:0126: 85 08 sta <L22+2+6
|
||||
331 00:0128: A5 01 lda <L22+1
|
||||
332 00:012A: 85 07 sta <L22+1+6
|
||||
333 00:012C: 2B pld
|
||||
Tue Jan 17 2017 23:02 Page 7
|
||||
|
||||
|
||||
338 00:0115: 1B tcs
|
||||
339 00:0116: 98 tya
|
||||
340 00:0117: 6B rtl
|
||||
341 ;}
|
||||
342 00000000 L27 equ 0
|
||||
343 00000001 L28 equ 1
|
||||
344 ends
|
||||
345 efunc
|
||||
346 ;
|
||||
347 ;
|
||||
348 ;#pragma section udata=heap
|
||||
349 heap section
|
||||
350 00:0000: ends
|
||||
351 ;char __heap[8092];
|
||||
352 ;void *heap_start = (void *)__heap;
|
||||
353 data
|
||||
354 xdef ~~heap_start
|
||||
355 ~~heap_start:
|
||||
356 00:000C: xx xx xx xx dl ~~__heap
|
||||
357 00:0010: ends
|
||||
358 ;void *heap_end = (void *)&__heap[8092];
|
||||
359 data
|
||||
360 xdef ~~heap_end
|
||||
361 ~~heap_end:
|
||||
362 00:0010: xx xx xx xx dl ~~__heap+8092
|
||||
363 00:0014: ends
|
||||
364 ;
|
||||
365 xref ~~fopen
|
||||
366 xref ~~fclose
|
||||
367 heap
|
||||
368 xdef ~~__heap
|
||||
369 ~~__heap
|
||||
370 00:0000: ds 8092
|
||||
371 00:1F9C: ends
|
||||
372 end
|
||||
334 00:012D: 3B tsc
|
||||
335 00:012E: 18 clc
|
||||
336 00:012F: 69 06 00 adc #L22+6
|
||||
337 00:0132: 1B tcs
|
||||
338 00:0133: 98 tya
|
||||
339 00:0134: 6B rtl
|
||||
340 ;}
|
||||
341 00000000 L22 equ 0
|
||||
342 00000001 L23 equ 1
|
||||
343 ends
|
||||
344 efunc
|
||||
345 ;
|
||||
346 ;int unlink(const char *name) {
|
||||
347 code
|
||||
348 xdef ~~unlink
|
||||
349 func
|
||||
350 ~~unlink:
|
||||
351 longa on
|
||||
352 longi on
|
||||
353 00:0135: 3B tsc
|
||||
354 00:0136: 38 sec
|
||||
355 00:0137: E9 00 00 sbc #L25
|
||||
356 00:013A: 1B tcs
|
||||
357 00:013B: 0B phd
|
||||
358 00:013C: 5B tcd
|
||||
359 00000004 name_0 set 4
|
||||
360 ; return -1;
|
||||
361 00:013D: A9 FF FF lda #$ffff
|
||||
362 L27:
|
||||
363 00:0140: A8 tay
|
||||
364 00:0141: A5 02 lda <L25+2
|
||||
365 00:0143: 85 06 sta <L25+2+4
|
||||
366 00:0145: A5 01 lda <L25+1
|
||||
367 00:0147: 85 05 sta <L25+1+4
|
||||
368 00:0149: 2B pld
|
||||
369 00:014A: 3B tsc
|
||||
370 00:014B: 18 clc
|
||||
371 00:014C: 69 04 00 adc #L25+4
|
||||
372 00:014F: 1B tcs
|
||||
373 00:0150: 98 tya
|
||||
374 00:0151: 6B rtl
|
||||
375 ;}
|
||||
376 00000000 L25 equ 0
|
||||
377 00000001 L26 equ 1
|
||||
378 ends
|
||||
379 efunc
|
||||
380 ;
|
||||
381 ;int isatty(int fd) {
|
||||
382 code
|
||||
383 xdef ~~isatty
|
||||
384 func
|
||||
385 ~~isatty:
|
||||
386 longa on
|
||||
387 longi on
|
||||
388 00:0152: 3B tsc
|
||||
389 00:0153: 38 sec
|
||||
390 00:0154: E9 00 00 sbc #L28
|
||||
391 00:0157: 1B tcs
|
||||
Tue Jan 17 2017 23:02 Page 8
|
||||
|
||||
|
||||
Lines assembled: 372
|
||||
392 00:0158: 0B phd
|
||||
393 00:0159: 5B tcd
|
||||
394 00000004 fd_0 set 4
|
||||
395 ; return -1;
|
||||
396 00:015A: A9 FF FF lda #$ffff
|
||||
397 L30:
|
||||
398 00:015D: A8 tay
|
||||
399 00:015E: A5 02 lda <L28+2
|
||||
400 00:0160: 85 04 sta <L28+2+2
|
||||
401 00:0162: A5 01 lda <L28+1
|
||||
402 00:0164: 85 03 sta <L28+1+2
|
||||
403 00:0166: 2B pld
|
||||
404 00:0167: 3B tsc
|
||||
405 00:0168: 18 clc
|
||||
406 00:0169: 69 02 00 adc #L28+2
|
||||
407 00:016C: 1B tcs
|
||||
408 00:016D: 98 tya
|
||||
409 00:016E: 6B rtl
|
||||
410 ;}
|
||||
411 00000000 L28 equ 0
|
||||
412 00000001 L29 equ 1
|
||||
413 ends
|
||||
414 efunc
|
||||
415 ;
|
||||
416 ;
|
||||
417 ;#pragma section udata=heap
|
||||
418 heap section
|
||||
419 00:0000: ends
|
||||
420 ;char __heap[8192];
|
||||
421 ;void *heap_start = (void *)__heap;
|
||||
422 data
|
||||
423 xdef ~~heap_start
|
||||
424 ~~heap_start:
|
||||
425 00:001A: xx xx xx xx dl ~~__heap
|
||||
426 00:001E: ends
|
||||
427 ;void *heap_end = (void *)&__heap[8092];
|
||||
428 data
|
||||
429 xdef ~~heap_end
|
||||
430 ~~heap_end:
|
||||
431 00:001E: xx xx xx xx dl ~~__heap+8092
|
||||
432 00:0022: ends
|
||||
433 ;
|
||||
434 xref ~~fputs
|
||||
435 xref ~~fopen
|
||||
436 xref ~~fclose
|
||||
437 heap
|
||||
438 xdef ~~__heap
|
||||
439 ~~__heap
|
||||
440 00:0000: ds 8192
|
||||
441 00:2000: ends
|
||||
442 xref ~~_iob
|
||||
443 end
|
||||
|
||||
|
||||
Lines assembled: 443
|
||||
Errors: 0
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user