2 Copyright © 1995-2009, The AROS Development Team. All rights reserved.
5 Desc: BCPL stubs that call into Exec and Dos libraries.
9 #define BCPLSTRINGDEBUG 0
10 #include <aros/m68k/asm.h>
14 #define BCPL(id,name) .equ GV_##name, id
18 /* BCPL equivalents of JSR and RTS */
22 .globl BCPL_jsr /* A5 */
24 move.l %sp@+,%a3 /* Get return address from C stack */
25 movem.l %a1/%a3-%a4,-12(%a1,%d0.l)
26 adda.l %d0,%a1 /* Move to next BCPL FP */
27 movem.l %d1-%d4,(%a1) /* Save argument on BCPL FP */
29 bra.s BCPL_jsr_mult /* This MUST be at BCPL_jsr+0x10 */
30 bra.s BCPL_jsr_divmod /* This MUST be at BCPL_jsr+0x12 */
32 /* Call out to GCC's __mulsi3 */
42 /* Call out to GCC's __divsi3 and __modsi3 */
54 .globl BCPL_rts /* A6 */
56 movem.l -12(%a1),%a1/%a3 /* Restore old BCPL FP and return address */
57 move.l -4(%a1),%a4 /* Get old A4 */
58 jmp (%a3) /* Go back */
65 .string "BCPL %s, D1=%p D2=%p D3=%p D4=%p, GV %p\n"
67 .string " %s, D1=%p\n"
69 .string " %s, D1=%p IoErr=%p\n"
71 /* For dummy functions */
80 /* Stash away pr_Result2 into the GV */
82 move.l %a0@(ThisTask),%a0
83 move.l %a0@(pr_Result2),%d0
84 move.l %d0,%a2@(GV_DEBUG_Result2)
87 movem.l %d1/%a0-%a1,%sp@-
94 move.l #.LBCPL_format_trace,%sp@-
98 movem.l %sp@+,%d1/%a0-%a1
99 clr.l %d0 /* DOSFALSE */
103 /* Retrieve old pr_Result2 */
104 move.l %a2@(GV_DEBUG_Result2), %d2
106 movem.l %d0/%a0-%a1,%sp@-
108 move.l %a0@(ThisTask),%a0
109 move.l %a0@(pr_Result2),%a1
115 move.l #.LBCPL_format_err,%sp@-
118 move.l #.LBCPL_format_ret,%sp@-
120 jsr bcpl_command_name
123 movem.l %sp@+,%d0/%a0-%a1
128 /* For real functions */
148 /* Global vector table entries */
149 BCPLd sysRequest /* -84, void, @line1, @line2, @line3 */
152 /* In-place conversion of BSTR to C string */
153 BCPL toCStr /* -80, char *, @string */
154 movem.l %a0-%a1,%sp@-
169 movem.l %sp@+,%a0-%a1
172 BCPL toBSTR /* -7c, void, &src, @dest */
173 movem.l %d1-%d2/%a0-%a1,%sp@-
179 beq 1f /* src == NULL */
191 movem.l %sp@+,%d1-%d2/%a0-%a1
194 BCPL Execute /* -6c, BOOL, &command, @input, @output */
195 movem.l %a0-%a1/%a6,%sp@-
196 move.l %a2@(GV_DOSBase),%a6
197 jsr %a6@(37 * -6) /* DOS/Execute() */
198 movem.l %sp@+,%a0-%a1/%a6
201 BCPL IsInteractive /* -68, BOOL, @filehandle */
202 movem.l %a0-%a1/%a6,%sp@-
203 move.l %a2@(GV_DOSBase),%a6
204 jsr %a6@(36 * -6) /* DOS/IsInteractive() */
205 movem.l %sp@+,%a0-%a1/%a6
208 BCPL DateStamp /* -64, timeval *, &time */
209 movem.l %a0-%a1/%a6,%sp@-
210 move.l %a2@(GV_DOSBase),%a6
211 jsr %a6@(32 * -6) /* DOS/DateStamp() */
212 movem.l %sp@+,%a0-%a1/%a6
215 BCPL SetProtection /* -60, BOOL, &name, mask */
216 movem.l %a0-%a1/%a6,%sp@-
217 move.l %a2@(GV_DOSBase),%a6
218 jsr %a6@(31 * -6) /* DOS/SetProtection() */
219 movem.l %sp@+,%a0-%a1/%a6
222 BCPL SetComment /* -5c, BOOL, &name, &comment */
223 movem.l %a0-%a1/%a6,%sp@-
224 move.l %a2@(GV_DOSBase),%a6
225 jsr %a6@(30 * -6) /* DOS/SetComment() */
226 movem.l %sp@+,%a0-%a1/%a6
229 BCPL NoReqLoadSeg /* -54, SegList ^, @name */
230 movem.l %a0-%a1/%a6,%sp@-
231 move.l %a2@(GV_DOSBase),%a6
232 jsr %a6@(28 * -6) /* DOS/NoReqLoadSeg() */
233 movem.l %sp@+,%a0-%a1/%a6
236 BCPL clearvec /* -50, void, @buff, lw_length */
240 /* clears one extra long by design! */
244 dbf %d2,.Lclearmem_loop
248 BCPL LoadSeg /* -4c, SegList ^, &name */
249 movem.l %a0-%a1/%a6,%sp@-
250 move.l %a2@(GV_DOSBase),%a6
251 jsr %a6@(25 * -6) /* DOS/LoadSeg() */
252 movem.l %sp@+,%a0-%a1/%a6
255 BCPL CreateProc /* -48, MessagePort *, &name, pri, seg, stackbytes */
256 movem.l %a0-%a1/%a6,%sp@-
257 move.l %a2@(GV_DOSBase),%a6
258 jsr %a6@(23 * -6) /* DOS/CreateProc() */
259 movem.l %sp@+,%a0-%a1/%a6
262 BCPL IoErr /* -44, long */
263 movem.l %a0-%a1/%a6,%sp@-
264 move.l %a2@(GV_DOSBase),%a6
265 jsr %a6@(22 * -6) /* DOS/IoErr() */
266 movem.l %sp@+,%a0-%a1/%a6
269 BCPL CurrentDir /* -40, FileLock ^, @FileLock */
270 movem.l %a0-%a1/%a6,%sp@-
271 move.l %a2@(GV_DOSBase),%a6
272 jsr %a6@(21 * -6) /* DOS/CurrentDir() */
273 movem.l %sp@+,%a0-%a1/%a6
276 BCPL CreateDir /* -3c, FileLock ^, &name */
277 movem.l %a0-%a1/%a6,%sp@-
278 move.l %a2@(GV_DOSBase),%a6
279 jsr %a6@(20 * -6) /* DOS/CreateDir() */
280 movem.l %sp@+,%a0-%a1/%a6
283 BCPL Info /* -38, BOOL, @FileLock, &InfoData */
284 movem.l %a0-%a1/%a6,%sp@-
285 move.l %a2@(GV_DOSBase),%a6
286 jsr %a6@(19 * -6) /* DOS/Info() */
287 movem.l %sp@+,%a0-%a1/%a6
290 BCPL ExNext /* -34, BOOL, @FileLock, &FileInfo */
291 movem.l %a0-%a1/%a6,%sp@-
292 move.l %a2@(GV_DOSBase),%a6
293 jsr %a6@(18 * -6) /* DOS/ExNext() */
294 movem.l %sp@+,%a0-%a1/%a6
297 BCPL Examine /* -30, BOOL, @FileLock, &FileInfo */
298 movem.l %a0-%a1/%a6,%sp@-
299 move.l %a2@(GV_DOSBase),%a6
300 jsr %a6@(17 * -6) /* DOS/Examine() */
301 movem.l %sp@+,%a0-%a1/%a6
304 BCPL Lock /* -2c, FileLock ^, &name, mode */
305 movem.l %a0-%a1/%a6,%sp@-
306 move.l %a2@(GV_DOSBase),%a6
307 jsr %a6@(14 * -6) /* DOS/Lock() */
308 movem.l %sp@+,%a0-%a1/%a6
311 BCPL Rename /* -28, BOOL, &oldname, &newname */
312 movem.l %a0-%a1/%a6,%sp@-
313 move.l %a2@(GV_DOSBase),%a6
314 jsr %a6@(13 * -6) /* DOS/Rename() */
315 movem.l %sp@+,%a0-%a1/%a6
318 BCPL DeleteFile /* -24, BOOL, &name */
319 movem.l %a0-%a1/%a6,%sp@-
320 move.l %a2@(GV_DOSBase),%a6
321 jsr %a6@(12 * -6) /* DOS/DeleteFile() */
322 movem.l %sp@+,%a0-%a1/%a6
325 BCPL Seek /* -20, LONG, @FileHandle, pos, mode */
326 movem.l %a0-%a1/%a6,%sp@-
327 move.l %a2@(GV_DOSBase),%a6
328 jsr %a6@(11 * -6) /* DOS/Seek() */
329 movem.l %sp@+,%a0-%a1/%a6
332 BCPL Write /* -18, LONG, Write, @FileHandle, &buf, len */
333 movem.l %a0-%a1/%a6,%sp@-
334 move.l %a2@(GV_DOSBase),%a6
335 jsr %a6@(8 * -6) /* DOS/Write() */
336 movem.l %sp@+,%a0-%a1/%a6
339 BCPL Read /* -0c, LONG, Read, @FileHandle, &buf, len */
340 movem.l %a0-%a1/%a6,%sp@-
341 move.l %a2@(GV_DOSBase),%a6
342 jsr %a6@(7 * -6) /* DOS/Read() */
343 movem.l %sp@+,%a0-%a1/%a6
346 BCPL copyvec /* -08, void, @src, @dest, n */
347 movem.l %d2-%d3/%a0-%a1,%sp@-
354 /* copies one extra long by design! */
359 movem.l %sp@+,%d2-%d3/%a0-%a1
362 BCPL Open /* -04, FileHandle ^, &name, mode */
363 movem.l %a0-%a1/%a6,%sp@-
370 move.l %a2@(GV_DOSBase),%a6
371 jsr %a6@(5 * -6) /* DOS/Open() */
372 movem.l %sp@+,%a0-%a1/%a6
378 /* FALLTHROUGH to BCPL_Exit */
380 BCPL Exit /* 08, void, code */
386 move.l %a0@(pr_ReturnAddr),%a0
391 BCPL multiply /* 0c, D1 = D1 * D2 */
395 BCPL divide /* 10, D1 = D1 / D2 */
400 BCPL mod /* 14, D1 = D1 % D2 */
402 move.l %d2,%d0 /* BRTS does move.l %d0,%d1 */
406 BCPL setIO /* 18, void, @IOStdReq, command, &data, len, offset */
408 move.w %d2,%a0@(28,%d1)
411 move.l %d0,%a0@(40,%d1)
412 move.l %d4,%a0@(36,%d1)
413 /* only first 4 params are in registers */
414 move.l %a1@(4*4),%a0@(44,%d1)
417 BCPL packlw /* 20, LONG, &data, len */
422 move.b %a0@(%d1.l),%d0
429 BCPL unpacklw /* 24, void, &data, len, LONG */
430 movem.l %d2/%d3,%sp@-
433 move.b %d3,%a0@(%d1.l)
437 movem.l %sp@+,%d2/%d3
440 BCPL Res2 /* 28, LONG, is_set_flag, result_code */
441 movem.l %a0-%a1/%a6,%sp@-
442 move.l %a2@(GV_DOSBase),%a6
447 jsr %a6@(77 * -6) /* DOS/SetIoErr */
449 jsr %a6@(22 * -6) /* DOS/IoErr */
450 movem.l %sp@+,%a0-%a1/%a6
453 /* 30, BCPL_FrameLower */
455 BCPLd makeGVarea /* 34, void, @buff */
458 BCPL findtask /* 38, &Process->MsgPort *, */
459 movem.l %a0-%a1/%a6,%sp@-
463 add.l #92,%d0 /* point to &MsgPort */
464 movem.l %sp@+,%a0-%a1/%a6
467 BCPL getbyte /* 3c, BYTE, @lw_addr, bytenum */
471 move.b %a0@(%d1.l),%d0
474 BCPL putbyte /* 40, BYTE, @lw_addr, bytenum, byte */
477 move.b %d3,%a0@(%d1.l)
480 BCPL level /* 44, LONG (or BPTR?) */
481 move.l %a1@(-12),%d0 /* Return caller's BCPL frame */
484 BCPL longcall /* 48, LONG, level, label */
489 BCPL allocMem /* 4c, BPTR, lwlength, reqs */
490 movem.l %a0-%a1/%a6,%sp@-
493 addq.l #4,%d0 /* 4 additional words for padding */
496 bset.l #16,%d1 /* MEMF_CLEAR */
497 jsr %a6@(114 * -6) /* Exec/AllocVec() */
499 movem.l %sp@+,%a0-%a1/%a6
502 BCPLd longjump /* 50, LONG, label */
505 BCPL doIO /* 54, LONG, @IORequest */
506 movem.l %a0-%a1/%a6,%sp@-
510 jsr %a6@(76 * -6) /* Exec/DoIO() */
513 movem.l %sp@+,%a0-%a1/%a6
516 BCPL sendIO /* 58, void, @IORequest */
517 movem.l %a0-%a1/%a6,%sp@-
520 move.l %d2,%a0@(ln_Name,%d1) /* NULL dos packet */
523 jsr %a6@(77 * -6) /* Exec/SendIO */
524 movem.l %sp@+,%a0-%a1/%a6
527 /* Coroutine support:
534 BCPLd createco /* 5c, void, @coroutine, lwlength */
537 BCPLd deleteco /* 60, void, @coroutine */
540 BCPLd callco /* 64, void, @coroutine, arg */
543 BCPLd cowait /* 68, void, result */
546 BCPLd resumeco /* 6c, void, @coroutine */
549 BCPL installSeg /* 70, BOOL, @memseg_BCPL */
550 movem.l %a0-%a1,%sp@-
555 movem.l %sp@+,%a0-%a1
558 BCPL getvec /* 74, LONG ^, lw_length */
559 movem.l %a0-%a1/%a6,%sp@-
562 addq.l #1,%d0 /* extra long */
565 jsr %a6@(114 * -6) /* Exec/AllocVec() */
567 tst.l %d0 /* If the result is NULL... */
570 tst.l %d1 /* And we have a GlobVec... */
572 move.l %a2@(GV_DOSBase),%a6
573 move.l 103,%d1 /* ERRROR_NO_FREE_STORE */
574 jsr %a6@(77 * -6) /* DOS/SetIoErr */
577 movem.l %sp@+,%a0-%a1/%a6
580 BCPL freevec /* 78, void, @vec */
581 movem.l %a0-%a1/%a6,%sp@-
585 jsr %a6@(115 * -6) /* Exec/FreeVec() */
586 movem.l %sp@+,%a0-%a1/%a6
589 BCPL openDevice /* 7c, BOOL, @IORequest, @name, unit, flags */
590 movem.l %d5/%a0-%a1/%a6,%sp@-
609 move.l %d0,%a1@(14) /* replyport = &Process->pr_MsgPort */
612 jsr %a6@(74 * -6) /* Exec/OpenDevice() */
619 movem.l %sp@+,%d5/%a0-%a1/%a6
622 BCPL closeDevice /* 80, void, @IORequest */
623 movem.l %a0-%a1/%a6,%sp@-
627 jsr %a6@(75 * -6) /* Exec/CloseDevice() */
628 movem.l %sp@+,%a0-%a1/%a6
631 BCPL createProcBCPL /* 84, MessagePort *, @segarray, lw_stack_size, pri, @name, */
632 movem.l %a0-%a1/%a6,%sp@-
633 move.l %a2@(GV_DOSBase),%a6
645 jsr BCPL_CreateProcBCPL
646 lea.l %sp@(5 * 4),%sp
647 movem.l %sp@+,%a0-%a1/%a6
650 BCPL remProcess /* 88, void */
651 jmp BCPL_Exit /* TODO: Review if this is correct */
653 BCPL ParentDir /* 8c, FileLock ^, @FileLock */
654 movem.l %a0-%a1/%a6,%sp@-
655 move.l %a2@(GV_DOSBase),%a6
656 jsr %a6@(35 * -6) /* DOS/ParentDir() */
657 movem.l %sp@+,%a0-%a1/%a6
660 BCPL setSignals /* 90, void, &MsgPort, mask */
661 movem.l %a0-%a1/%a6,%sp@-
663 add.l #mp_SigTask,%d1
667 lsl.l #4,%d0 /* shift to C-F signals */
668 and.l #0xf000,%d0 /* mask only C-F signals */
669 jsr %a6@(54 * -6) /* Signal */
670 movem.l %sp@+,%a0-%a1/%a6
673 BCPL clearSignals /* 94, BOOL , mask */
674 movem.l %d2/%a0-%a1/%a6,%sp@-
681 jsr %a6@(51 * -6) /* SetSignal */
687 movem.l %sp@+,%d2/%a0-%a1/%a6
690 BCPL DOSAlert /* 98, void, alertnumber */
691 movem.l %d7/%a0-%a1/%a6,%sp@-
694 jsr %a6@(18 * -6) /* Exec/Alert() */
695 movem.l %sp@+,%d7/%a0-%a1/%a6
698 BCPL findRootNode /* 9c, RootNode @, */
699 move.l %a2@(GV_DOSBase),%d0
701 move.l %a0@(%d0),%d0 /* %a0 is always 0 in BCPL */
705 BCPL readinput /* a0, bytelength , &buf, bytelength */
706 movem.l %d1-%d3/%a0-%a1/%a6,%sp@-
707 move.l %a2@(GV_DOSBase),%a6
710 jsr %a6@(9 * -6) /* DOS/Input() */
712 jsr %a6@(7 * -6) /* DOS/Read() */
713 movem.l %sp@+,%d1-%d3/%a0-%a1/%a6
716 /* Wait on the process's pr_MsgPort for a packet.
718 BCPL taskwait /* a4, DosPacket @, */
719 movem.l %a0-%a1/%a6,%sp@-
720 move.l %a2@(GV_DOSBase),%a6
721 jsr %a6@(42 * -6) /* Dos/WaitPkt() */
723 movem.l %sp@+,%a0-%a1/%a6
726 /* When passed in, DosPacket's dp_Link points to
727 * an allocated, but empty, memory location.
728 * Sent to the port of the current directory's handler.
730 BCPL putPkt /* a8, void, @DosPacket */
731 movem.l %a0-%a1/%a6,%sp@-
732 move.l %a2@(GV_DOSBase),%a6
734 movem.l %sp@+,%a0-%a1/%a6
737 BCPL writeoutput /* ac, void, &buf, bytelength */
738 movem.l %d2-%d3/%a0-%a1/%a6,%sp@-
739 move.l %a2@(GV_DOSBase),%a6
742 jsr %a6@(10 * -6) /* DOS/Output() */
744 jsr %a6@(8 * -6) /* DOS/Write() */
745 movem.l %sp@+,%d2-%d3/%a0-%a1/%a6
748 /* copy src LONG array to destination, LONG -> BYTE */
749 BCPL packstring /* b0, long, @Array, @String */
750 movem.l %d2-%d3/%a0-%a1,%sp@-
773 movem.l %sp@+,%d2-%d3/%a0-%a1
776 /* copy src BSTR to destination array, BYTE -> LONG */
777 BCPL unpackstring /* b4, void, @String, @Array */
778 movem.l %a0-%a1,%sp@-
795 movem.l %sp@+,%a0-%a1
798 BCPLd holdTask /* b8, void, @memseg */
801 BCPL Delay /* bc, void, ticks */
802 movem.l %a0-%a1/%a6,%sp@-
803 move.l %a2@(GV_DOSBase),%a6
804 jsr %a6@(33 * -6) /* DOS/Delay() */
805 movem.l %sp@+,%a0-%a1/%a6
808 /* Call the DOS internal 'dopacket' function
810 BCPL sendPacket /* c0, BOOL, -, MsgPort, Type, -, -, Arg1,... */
811 movem.l %a0-%a1/%a6,%sp@-
812 move.l %a1@((4 + 7) * 4), %sp@- /* Arg7 */
813 move.l %a1@((4 + 6) * 4), %sp@- /* Arg6 */
814 move.l %a1@((4 + 5) * 4), %sp@- /* Arg5 */
815 move.l %a1@((4 + 4) * 4), %sp@- /* Arg4 */
816 move.l %a1@((4 + 3) * 4), %sp@- /* Arg3 */
817 move.l %a1@((4 + 2) * 4), %sp@- /* Arg2 */
818 move.l %a1@((4 + 1) * 4), %sp@- /* Arg1 */
819 move.l %d3, %sp@- /* Type */
820 move.l %d2, %sp@- /* Port */
821 move.l %a0, %sp@- /* A0 is still 0 */
823 lea.l %sp@(10 * 4), %sp
824 movem.l %sp@+,%a0-%a1/%a6
827 BCPL returnPacket /* c4, void, @DosPacket, res1, res2 */
828 tst.l %d1 /* Don't try to reply NULL Dos Packets */
830 movem.l %a0-%a1/%a6,%sp@-
831 move.l %a2@(GV_DOSBase),%a6
833 jsr %a6@(43 * -6) /* DOS/ReplyPkt() */
834 movem.l %sp@+,%a0-%a1/%a6
839 #define TAG_USER (1 << 31)
840 #define WA_Dummy (TAG_USER + 99)
841 #define WA_Left (WA_Dummy + 1)
842 #define WA_Top (WA_Dummy + 2)
843 #define WA_Width (WA_Dummy + 3)
844 #define WA_Height (WA_Dummy + 4)
845 #define WA_Title (WA_Dummy + 11)
846 #define WA_PubScreen (WA_Dummy + 22)
847 #define WA_AutoAdjust (WA_Dummy + 45)
849 BCPL openWindow /* c8, struct Window *, leftedge, topedge, width, height, @title */
850 movem.l %a0-%a1/%a6,%sp@-
851 move.l %a2@(GV_DOSBase),%a6
852 move.l %a6@(dl_IntuitionBase),%a6
853 move.l #TAG_END, %sp@-
855 move.l #WA_AutoAdjust, %sp@-
857 move.l #WA_PubScreen, %sp@-
858 move.l %a1@(4*4),%sp@-
859 move.l #WA_Title, %sp@-
861 move.l #WA_Height, %sp@-
863 move.l #WA_Width, %sp@-
865 move.l #WA_Top, %sp@-
867 move.l #WA_Left, %sp@-
868 move.l %sp, %a1 /* a0 is still 0 here */
869 jsr %a6@(101 * -6) /* OpenWindowTagList */
870 lea.l %sp@(15 * 4),%sp
871 movem.l %sp@+,%a0-%a1/%a6
874 /* If BOOL is DOSTRUE, set current directory
875 * Always return old current directory
877 BCPL setCurrentDir /* cc, FileLock @, BOOL, @FileLock */
878 movem.l %d3-%d4/%a0-%a1/%a6,%sp@-
886 /* sanity check in CurrentDir() complained so I did this */
887 move.l %a0@(152),%d4 /* pr_CurrentDir */
892 move.l %a2@(GV_DOSBase),%a6
894 jsr %a6@(21 * -6) /* DOS/CurrentDir() */
897 movem.l %sp@+,%d3-%d4/%a0-%a1/%a6
900 BCPLd systemRequest /* d0, void, @line1, @line2, @line3 */
903 BCPL writet /* d4, void, @string, n */
904 movem.l %d2-%d4,%sp@-
906 lsl.l #2, %d3 /* D3 = BADDR(string) */
908 move.b %a0@(%d3),%d4 /* D4 = string[0] (strlen) */
910 beq .LBCPL_writet_pad
912 bra .LBCPL_writet_loop_cond
915 addq.l #1,%d3 /* D3 = pointer to next char */
916 subq.l #1,%d2 /* D2 = reduce pad amount by 1 */
917 move.l #(3*4 + 1*4),%d0
919 move.b %a0@(%d3),%d1 /* D1 = next char */
920 move.l %a2@(GV_wrch), %a4
922 .LBCPL_writet_loop_cond:
923 dbf %d4,.LBCPL_writet_loop
927 ble .LBCPL_writet_exit
928 bra .LBCPL_writet_pad_cond
930 .LBCPL_writet_pad_loop:
931 move.l #(3*4 + 2*4),%d0
933 move.l %a2@(GV_wrch), %a4
935 .LBCPL_writet_pad_cond:
936 dbf %d2,.LBCPL_writet_pad_loop
939 movem.l %sp@+,%d2-%d4
942 BCPLnd rdch /* d8, char , */
943 movem.l %a0-%a1/%a6,%sp@-
944 move.l %a2@(GV_DOSBase),%a6
945 jsr %a6@(9 * -6) /* DOS/Input() */
947 jsr %a6@(51 * -6) /* DOS/FGetC() */
948 movem.l %sp@+,%a0-%a1/%a6
951 BCPL unrdch /* dc, void, */
952 movem.l %d2/%a0-%a1/%a6,%sp@-
953 move.l %a2@(GV_DOSBase),%a6
954 jsr %a6@(9 * -6) /* DOS/Input() */
957 jsr %a6@(53 * -6) /* DOS/UnGetC() */
958 movem.l %sp@+,%d2/%a0-%a1/%a6
961 BCPLnd wrch /* e0, void, char */
962 movem.l %d2/%a0-%a1/%a6,%sp@-
963 move.l %a2@(GV_DOSBase),%a6
965 jsr %a6@(10 * -6) /* DOS/Output() */
967 jsr %a6@(52 * -6) /* DOS/FPutC() */
968 movem.l %sp@+,%d2/%a0-%a1/%a6
971 BCPL readinput_long /* e4, lwlength , @buf, lwlength */
972 movem.l %d1-%d3/%a0-%a1/%a6,%sp@-
973 move.l %a2@(GV_DOSBase),%a6
976 jsr %a6@(9 * -6) /* DOS/Input() */
980 jsr %a6@(7 * -6) /* DOS/Read() */
982 movem.l %sp@+,%d1-%d3/%a0-%a1/%a6
985 BCPL writeoutput_long /* e8, void, @buf, lwlength */
986 movem.l %d2-%d4/%a0-%a1/%a6,%sp@-
987 move.l %a2@(GV_DOSBase),%a6
988 move.l %d2, %d4 /* Num blocks */
989 moveq.l #4, %d3 /* Block len (sizeof(ULONG)) */
990 move.l %d1, %d2 /* Buffer */
992 jsr %a6@(10 * -6) /* DOS/Output() */
993 move.l %d0, %d1 /* Outfile */
994 jsr %a6@(55 * -6) /* DOS/FWrite() */
995 movem.l %sp@+,%d2-%d4/%a0-%a1/%a6
998 BCPL findinput /* ec, FileHandle ^, @name */
999 movem.l %d2/%a0-%a1/%a6,%sp@-
1009 move.l %a2@(GV_DOSBase),%a6
1010 move.l #1005 /* MODE_OLDFILE */,%d2
1011 jsr %a6@(5 * -6) /* DOS/Open() */
1012 movem.l %sp@+,%d2/%a0-%a1/%a6
1015 BCPL findoutput /* f0, FileHandle ^, @name */
1016 movem.l %d2/%a0-%a1/%a6,%sp@-
1026 move.l %a2@(GV_DOSBase),%a6
1027 move.l #1006 /* MODE_NEWFILE */,%d2
1028 jsr %a6@(5 * -6) /* DOS/Open() */
1029 movem.l %sp@+,%d2/%a0-%a1/%a6
1032 BCPL SelectInput /* f4, void , @FileHandle */
1033 movem.l %a0-%a1/%a6,%sp@-
1034 move.l %a2@(GV_DOSBase),%a6
1035 jsr %a6@(49 * -6) /* DOS/SelectInput() */
1036 movem.l %sp@+,%a0-%a1/%a6
1039 BCPL SelectOutput /* f8, void , @FileHandle */
1040 movem.l %a0-%a1/%a6,%sp@-
1041 move.l %a2@(GV_DOSBase),%a6
1042 jsr %a6@(50 * -6) /* DOS/SelectOutput() */
1043 movem.l %sp@+,%a0-%a1/%a6
1046 BCPL endread /* fc, void, */
1047 movem.l %a0-%a1/%a6,%sp@-
1048 move.l %a2@(GV_DOSBase),%a6
1049 jsr %a6@(9 * -6) /* DOS/Input() */
1051 jsr %a6@(6 * -6) /* DOS/Close() */
1053 jsr %a6@(49 * -6) /* DOS/SelectInput() */
1054 movem.l %sp@+,%a0-%a1/%a6
1057 BCPL endwrite /* 100, void, */
1058 movem.l %a0-%a1/%a6,%sp@-
1059 move.l %a2@(GV_DOSBase),%a6
1060 jsr %a6@(10 * -6) /* DOS/Output() */
1062 jsr %a6@(6 * -6) /* DOS/Close() */
1064 jsr %a6@(50 * -6) /* DOS/SelectOutput() */
1065 movem.l %sp@+,%a0-%a1/%a6
1068 BCPL Input /* 104, FileHandle @, */
1069 movem.l %a0-%a1/%a6,%sp@-
1070 move.l %a2@(GV_DOSBase),%a6
1071 jsr %a6@(9 * -6) /* DOS/Input() */
1072 movem.l %sp@+,%a0-%a1/%a6
1075 BCPL Output /* 108, FileHandle @, */
1076 movem.l %a0-%a1/%a6,%sp@-
1077 move.l %a2@(GV_DOSBase),%a6
1078 jsr %a6@(10 * -6) /* DOS/Output() */
1079 movem.l %sp@+,%a0-%a1/%a6
1082 BCPL readn /* 10c, void, */
1083 /* no dos.library equivalent for this :(
1084 * ignore all whitespace at the beginning
1085 * converts ascii to decimal
1087 movem.l %d2-%d7/%a0-%a1/%a6,%sp@-
1088 move.l %a2@(GV_DOSBase),%a6
1089 jsr %a6@(9 * -6) /* DOS/Input() */
1091 moveq #0,%d4 /* val */
1092 moveq #0,%d5 /* neg */
1098 jsr %a6@(51 * -6) /* DOS/FGetC() */
1127 moveq #1,%d7 /* got at least one digit */
1129 jsr %a6@(51 * -6) /* DOS/FGetC() */
1135 jsr %a6@(53 * -6) /* DOS/UnGetC() */
1142 jsr %a6@(77 * -6) /* DOS/SetIoErr() */
1144 tst.b %d5 /* negative? */
1149 movem.l %sp@+,%d2-%d7/%a0-%a1/%a6
1152 BCPL newline /* 110, void, */
1156 BCPL_write_base: /* number, width, base, canneg */
1157 movem.l %d2-%d7,%sp@-
1159 move.l %d3,%d6 /* D6 = base */
1160 move.l %d2,%d5 /* D5 = width */
1161 move.l %d1,%d3 /* D3 = Number */
1165 beq .Lwrite_base_pos
1167 tst.l %d3 /* Number < 0? */
1168 bge .Lwrite_base_pos
1170 bset #31,%d7 /* D7 bit 31 = negative sign needed */
1175 clr.l %d4 /* D4 = Digit */
1176 clr.w %d7 /* D7 = Num pushed chars */
1181 jsr %a5@(0x12) /* divmod: D1 = D3/base, D2 = D3 % base */
1188 add.b #(('A'-10)-'0'),%d1
1190 add.b #'0',%d1 /* D1 = '0' .. '9' */
1191 move.b %d1, %a1@(3*4 + 4*4, %d7.w)
1195 bgt.s .Lwrite_base_loop
1197 /* Any extra field bits? */
1198 bra .LBCPL_write_base_pad_cond
1199 .LBCPL_write_base_pad:
1202 beq.s .LBCPL_write_base_pad_char
1204 .LBCPL_write_base_pad_char:
1205 move.l #(3*4 + 4*4 + 8*4), %d0
1206 move.l %a2@(GV_wrch), %a4
1208 .LBCPL_write_base_pad_cond:
1210 bpl.s .LBCPL_write_base_pad
1213 beq.s .Lwrite_base_emit
1216 move.l #(3*4 + 4*4 + 8*4), %d0
1217 move.l %a2@(GV_wrch), %a4
1225 move.b %a1@(3*4 + 4*4, %d7.w),%d1
1226 move.l #(3*4 + 4*4 + 8*4), %d0
1227 move.l %a2@(GV_wrch), %a4
1229 jmp .Lwrite_base_emit
1232 movem.l %sp@+,%d2-%d7
1235 BCPL writei /* 114, void, number, width */
1236 movem.l %d3-%d4,%sp@-
1238 move.l #(3*4 + 2*4), %d0
1241 lea.l BCPL_write_base, %a4
1244 movem.l %sp@+,%d3-%d4
1247 BCPL writen /* 118, void, number */
1248 movem.l %d2-%d4,%sp@-
1250 move.l #(3*4 + 1*4), %d0
1254 lea.l BCPL_write_base, %a4
1257 movem.l %sp@+,%d2-%d4
1260 BCPL writehex /* 11c, void, number, width */
1261 movem.l %d3-%d4,%sp@-
1263 move.l #(3*4 + 2*4), %d0
1266 lea.l BCPL_write_base, %a4
1269 movem.l %sp@+,%d3-%d4
1272 BCPL writeoct /* 120, void, number, width */
1273 movem.l %d3-%d4,%sp@-
1275 move.l #(3*4 + 2*4), %d0
1278 lea.l BCPL_write_base, %a4
1281 movem.l %sp@+,%d3-%d4
1284 BCPL writes /* 124, void, @string */
1287 move.l #(3*4 + 1*4),%d0
1288 move.l %a2@(GV_writet), %a4
1293 #if 0 /* This is defined in bcpl_writef.S */
1294 BCPLd writef /* 128, void, @format, arg1, arg2, ... */
1298 BCPL toupper /* 12c, void, char */
1307 BCPL charicmp /* 130, long , char1, char2 */
1323 BCPL stricmp /* 134, long , @String1, @String2 */
1324 movem.l %d1-%d3/%a0-%a1,%sp@-
1375 movem.l %sp@+,%d1-%d3/%a0-%a1
1378 BCPL rdargs /* 138, ULONG, @template, array, array_size */
1379 /* BCPL rdargs and DOS/ReadArgs() don't match up
1380 * very nicely. We'll need to call a BCPL/ReadArgs
1381 * routine that works the way this expects
1383 movem.l %a0-%a1/%a6,%sp@-
1384 move.l %a2@(GV_DOSBase),%a6
1386 movem.l %sp@+,%a0-%a1/%a6
1389 BCPL rditem /* 13c, void, @buf, maxlongs */
1390 movem.l %d2-%d3/%a0-%a2/%a6,%sp@-
1391 move.l %a2@(GV_DOSBase),%a6
1399 /* this can't be right but at least c:execute does something now */
1400 jsr %a6@(135 * -6) /* DOS/ReadItem() */
1407 move.b %d2,%a2@(-1) /* fix buf BSTR length */
1418 movem.l %sp@+,%d2-%d3/%a0-%a2/%a6
1421 BCPL subString /* 140, void, @string, @substring */
1423 movem.l %d2-%d3/%a0-%a6,%sp@-
1425 move.l %a2@(GV_DOSBase),%a5
1448 jsr %a6@(114 * -6) /* AllocVec */
1457 beq.s findarg_copy11
1460 bra.s findarg_copy12
1467 beq.s findarg_copy21
1470 bra.s findarg_copy22
1475 jsr %a6@(134 * -6) /* DOS/FindArg() */
1481 jsr %a6@(115 * -6) /* FreeVec */
1484 movem.l %sp@+,%d2-%d3/%a0-%a6
1487 /* C:Resident uses this */
1488 BCPL load /* 144, SegList ^, @filename */
1489 movem.l %a0-%a1/%a6,%sp@-
1490 move.l %a2@(GV_DOSBase),%a6
1499 jsr %a6@(25 * -6) /* DOS/LoadSeg() */
1500 movem.l %sp@+,%a0-%a1/%a6
1503 BCPL UnLoadSeg /* 148, void, @seg */
1504 movem.l %a0-%a1/%a6,%sp@-
1505 move.l %a2@(GV_DOSBase),%a6
1506 jsr %a6@(26 * -6) /* DOS/UnLoadSeg */
1507 movem.l %sp@+,%a0-%a1/%a6
1510 BCPLd tidyup /* 150, void, */
1513 BCPL addDevice /* 154, void, @name */
1514 movem.l %d2/%a0-%a1/%a6,%sp@-
1515 move.l %a2@(GV_DOSBase),%a6
1524 moveq #0,%d2 /* DLT_DEVICE */
1525 jsr %a6@(116 * -6) /* DOS/MakeDosEntry */
1530 jsr %a6@(113 * -6) /* DOS/AddDosEntry */
1533 jsr %a6@(117 * -6) /* DOS/FreeDosEntry */
1536 movem.l %sp@+,%d2/%a0-%a1/%a6
1539 BCPL datestamp /* 158, @DateStamp, @DateStamp */
1540 movem.l %a0-%a1/%a6,%sp@-
1542 move.l %a2@(GV_DOSBase),%a6
1543 jsr.l %a6@(32 * -6) /* DOS/DateStamp() */
1545 movem.l %sp@+,%a0-%a1/%a6
1548 BCPLd WaitForChar /* 15c, BOOL , @FileHandle, time */
1551 BCPL execLib /* 160, long , LVOffset, d0, d1, a0, a1, a2 */
1552 movem.l %d2/%a0-%a3/%a6,%sp@-
1556 movem.l %a3@(4),%d0-%d1/%a0-%a2
1558 movem.l %sp@+,%d2/%a0-%a3/%a6
1561 BCPL findSegArray /* 164, Array @, */
1562 movem.l %a0-%a1/%a6,%sp@-
1567 move.l %a0@(pr_SegList),%d0
1568 movem.l %sp@+,%a0-%a1/%a6
1571 BCPL deleteObject /* 168, void, @name */
1572 movem.l %a0-%a1/%a6,%sp@-
1575 move.l %a2@(GV_DOSBase),%a6
1576 jsr %a6@(12 * -6) /* DOS/DeleteFile() */
1577 movem.l %sp@+,%a0-%a1/%a6
1580 BCPL rename /* 16c, void, @oldname, @newname */
1581 movem.l %d2/%a0-%a2/%a6,%sp@-
1582 move.l %a2@(GV_DOSBase),%a6
1589 0: move.b %a0@+,%a1@+
1596 jsr %a6@(13 * -6) /* DOS/Rename() */
1598 movem.l %sp@+,%d2/%a0-%a2/%a6
1601 /* 170 - contains APTR to IntuitionBase */
1603 BCPL Close /* 174, void, @FileHandle */
1604 movem.l %a0-%a1/%a6,%sp@-
1605 move.l %a2@(GV_DOSBase),%a6
1606 jsr %a6@(6 * -6) /* DOS/Close() */
1607 movem.l %sp@+,%a0-%a1/%a6
1610 BCPL getword /* 178, void, longaddress, wordnumber */
1616 move.w %a0@(%d2.l),%d0
1620 BCPL putword /* 17c, void, longaddress, wordnumber */
1625 move.w %d3,%a0@(%d2.l)
1630 BCPLd taskwait_190 /* 190, DosPacket ^, */
1633 BCPL execute /* 194, void, &string , @in, @out */
1634 movem.l %a0-%a1/%a6,%sp@-
1635 move.l %a2@(GV_DOSBase),%a6
1636 jsr %a6@(37 * -6) /* DOS/Execute() */
1637 movem.l %sp@+,%a0-%a1/%a6
1640 BCPL deviceproc /* 198, FileLock ^, @filename */
1641 movem.l %a0-%a1/%a6,%sp@-
1642 move.l %a2@(GV_DOSBase),%a6
1647 jsr %a6@(29 * -6) /* DOS/DeviceProc() */
1648 movem.l %sp@+,%a0-%a1/%a6
1651 BCPL libcall /* 19c, void, libbase, LVOffset, d0, d1, a0, a1 */
1652 movem.l %a0-%a1/%a6,%sp@-
1654 move.l %a1@(0x08),%d0
1655 move.l %a1@(0x0c),%d1
1656 move.l %a1@(0x10),%a0
1657 move.l %a1@(0x14),%a1
1659 movem.l %sp@+,%a0-%a1/%a6
1662 BCPL writeErr /* 1a0, void, LONG, BSTR */
1663 /* oddly enough D2 points to BSTR name of the command
1664 * which seems to be ignored.
1666 movem.l %d2/%a0-%a1/%a6,%sp@-
1670 move.l %a2@(GV_DOSBase),%a6
1671 jsr %a6@(-0x1da) /* PrintFault */
1675 0: movem.l %sp@+,%d2/%a0-%a1/%a6
1678 BCPL findConsoleHandler /* 1a4, MsgPort *, */
1679 movem.l %a0-%a1/%a6,%sp@-
1684 move.l %a0@(pr_ConsoleTask),%d0
1685 movem.l %sp@+,%a0-%a1/%a6
1688 BCPL findFileHandler /* 1a8, MsgPort *, */
1689 movem.l %a0-%a1/%a6,%sp@-
1694 move.l %a0@(pr_FileSystemTask),%d0
1695 movem.l %sp@+,%a0-%a1/%a6
1698 BCPL extractDeviceName /* 1ac, void, @buf, separator, @name , oldpos */
1699 movem.l %d1-%d5/%a0-%a1/%a6,%sp@-
1700 move.l %a2@(GV_DOSBase),%a6
1707 /* D2 = SplitName 'separator' */
1708 subq.l #1,%d4 /* D4 = oldpos - 1 (?) */
1713 /* D1 = SplitName 'name' */
1715 move.l %a1@(0), %d3 /* Recover D1 (buf) from A1[0] */
1717 addq.l #1,%d3 /* D3 = SplitName 'buf' */
1719 moveq #30,%d5 /* D5 = SplitName 'size' */
1721 jsr %a6@(69 * -6) /* SplitName */
1729 move.b %d1,%a0@(-1) /* fix buf BSTR length */
1731 addq.l #1,%d0 /* newpos + 1 (?) */
1732 movem.l %sp@+,%d1-%d5/%a0-%a1/%a6
1735 BCPL lock /* 1b0, FileLock ^, @name */
1736 movem.l %d2/%a0-%a1/%a6,%sp@-
1737 move.l %a2@(GV_DOSBase),%a6
1742 moveq.l #-2,%d2 /* Shared lock */
1743 jsr %a6@(14 * -6) /* DOS/Lock() */
1744 movem.l %sp@+,%d2/%a0-%a1/%a6
1747 BCPL UnLock /* 1b4, void, @FileLock */
1748 movem.l %a0-%a1/%a6,%sp@-
1749 move.l %a2@(GV_DOSBase),%a6
1750 jsr %a6@(15 * -6) /* DOS/UnLock() */
1751 movem.l %sp@+,%a0-%a1/%a6
1754 BCPL getlong /* 1b8, void, longoffset, &struct */
1757 move.l %a0@(%d1),%d0
1760 BCPL putlong /* 1bc, void, longoffset, &struct, data */
1763 move.l %a0@(%d1),%d0
1764 move.l %d3,%a0@(%d1)
1767 BCPL openDevInfo /* 1c0, FileHandle ^, @DevInfo, @filename/window */
1768 movem.l %a0-%a1/%a6,%sp@-
1769 move.l %a2@(GV_DOSBase),%a6
1775 movem.l %sp@+,%a0-%a1/%a6
1778 BCPL DupLock /* 1c4, FileLock ^, @FileLock */
1779 movem.l %a0-%a1/%a6,%sp@-
1780 move.l %a2@(GV_DOSBase),%a6
1781 jsr %a6@(16 * -6) /* DOS/DupLock() */
1782 movem.l %sp@+,%a0-%a1/%a6
1785 /* Calls ErrorReport(IoErr(), ...)
1786 * Why this is called 'makesysreq' is a question
1787 * for the TripOS guys.
1789 BCPL makesysreq /* 1c8, BOOL, type, arg, *msgport */
1790 movem.l %a0-%a1/%a6,%sp@-
1794 move.l %a2@(GV_DOSBase),%a6
1795 jsr %a6@(22 * -6) /* IoErr */
1796 jsr %a6@(80 * -6) /* ErrorReport */
1797 movem.l %sp@+,%a0-%a1/%a6
1800 BCPL strcpy /* 1cc, void, @src, @dest */
1805 move.b %a0@(%d1),%d0
1806 0: move.b %a0@(%d1),%a0@(%d2)
1813 BCPL runCommand /* 1e4, ULONG, @codeseg, stacklongs, @cmdline, cmdlinelength */
1814 movem.l %a0-%a1/%a6,%sp@-
1818 move.l %a2@(GV_DOSBase),%a6
1819 jsr %a6@(84 * -6) /* DOS/RunCommand() */
1820 movem.l %sp@+,%a0-%a1/%a6
1823 BCPL lock_1ec /* 1ec, FileLock ^, &name */
1824 movem.l %d2/%a0-%a1/%a6,%sp@-
1829 move.l %a2@(GV_DOSBase),%a6
1832 moveq.l #-2,%d2 /* Shared lock */
1833 jsr %a6@(14 * -6) /* DOS/Lock() */
1834 movem.l %sp@+,%d2/%a0-%a1/%a6
1837 BCPL findDevInfo /* 1f0, DevInfo ^, @name */
1838 movem.l %d2-%d3/%a0-%a1/%a6,%sp@-
1839 move.l %a2@(GV_DOSBase),%a6
1850 moveq #0x1d,%d1 /* LDF_ALL | LDF_READ */
1851 jsr %a6@(109 * -6) /* DOS/LockDosList */
1854 moveq #0x1d,%d3 /* LDF_ALL | LDF_READ */
1855 jsr %a6@(114 * -6) /* DOS/FindDosEntry */
1857 moveq #0x1d,%d1 /* LDF_ALL | LDF_READ */
1858 jsr %a6@(110 * -6) /* DOS/UnlockDosList */
1861 movem.l %sp@+,%d2-%d3/%a0-%a1/%a6
1864 BCPL createDir /* 1f4, FileLock^, @name */
1865 movem.l %a0-%a1/%a6,%sp@-
1866 move.l %a2@(GV_DOSBase),%a6
1871 jsr %a6@(20 * -6) /* DOS/CreateDir() */
1872 movem.l %sp@+,%a0-%a1/%a6
1875 BCPLd compareTime /* 1f8, SIGN , @timeval, @timeval */
1876 /* I suspect this is actually Dos/CompareDates(), but
1877 * I haven't found a user of this routine yet.
1881 BCPL timerIO /* 1fc, void, command, @IOStdReq, secs, usecs */
1882 movem.l %a0-%a1/%a6,%sp@-
1885 move.w %d1,%a1@(io_Command)
1886 move.l %d3,%a1@(tr_time + 0)
1887 move.l %d4,%a1@(tr_time + 4)
1889 jsr.l %a6@(76 * -6) /* Exec/DoIO() */
1891 movem.l %sp@+,%a0-%a1/%a6
1894 BCPL settime /* 200, void, @DateStamp */
1895 move.l %a2@(GV_DOSBase),%d0
1896 move.l %a0@(dl_TimeReq,%d0),%d2
1898 move.l %a0@(0,%d1),%d3 /* ds_Days */
1899 mulu.w #(60*24),%d3 /* mulu.w is fine until 2162 AD, */
1900 /* but tv_secs is too small in 2047 AD */
1901 add.l %a0@(4,%d1),%d3 /* ds_Minute */
1910 mov.l %a0@(8,%d1),%d4 /* ds_Tick */
1916 move.l #11,%d1 /* TR_SETSYSTIME */
1917 move.l #(1*4 + 3*4),%d0
1918 move.l %a2@(GV_timerIO),%a4
1923 * On AOS, this routine called the internal
1924 * CliInit(), which handled setting up the
1925 * core SYS: lock, assigns, and paths.
1927 * The (normally NULL) DOS Packet is always ignored.
1929 * Although (for various reasons) this has been done
1930 * before this routine has been called, we still need
1931 * to call CliInit* to process the inbound AROS packet.
1933 * If the passed in DOS Packet is NULL, then we have
1934 * nothing to do, since that's not valid under AROS.
1936 * If the DOS Packet is *not* NULL, then pass it
1937 * to the appropriate CliInit* routine.
1940 BCPL CliInit /* 214, APTR, @DosPacket */
1942 beq.s .L_CliInit_exit
1945 move.l %a0@(dp_Res1,%d1),%d2
1947 beq.s .L_CliInit_Run
1951 move.l #(155*-6),%d2
1952 bra.s .L_CliInit_Init
1956 move.l #(156*-6),%d2
1959 movem.l %a0-%a1/%a6,%sp@-
1961 move.l %a2@(GV_DOSBase),%a6
1963 movem.l %sp@+,%a0-%a1/%a6
1967 BCPLnd CliInit_NEWCLI
1969 move.l #1, %a0@(dp_Type, %d1)
1970 jmp .L_CliInit_Newcli
1974 move.l #-1, %a0@(dp_Type, %d1)
1977 BCPLnd CliInit_SYSTEM
1979 move.l #-2, %a0@(dp_Type, %d1)
1982 BCPLnd CliInit_ASYSTEM
1984 move.l #-3, %a0@(dp_Type, %d1)
1989 move.l #-4, %a0@(dp_Type, %d1)
1993 BCPL findCLI /* 218, CommandLineInterpreter ^, */
1994 movem.l %a0-%a1/%a6,%sp@-
1995 move.l %a2@(GV_DOSBase),%a6
1996 jsr %a6@(82 * -6) /* DOS/Cli() */
1998 movem.l %sp@+,%a0-%a1/%a6
2002 /* Helper routines */
2003 /* Convert BCPL string to Cstring inline in the A1 vector
2005 * D0: Index into A1, in words, to hold dest
2006 * D1: BSTR to convert
2010 * D1: Memory address of Cstring
2014 movem.l %d0/%a0-%a1,%sp@-
2019 move.b %a0@(-1,%d1),%sp@(3) /* Arg3 = strlen */
2020 move.l %d1,%sp@- /* Arg2 = src */
2022 pea.l %a1@(%d0) /* Arg1 = dest */
2024 move.l %sp@+,%a0 /* A0 = dest */
2025 addq.l #4,%sp /* Drop src */
2026 move.l %sp@+,%d1 /* D1 = strlen */
2027 move.b #0,%a0@(%d1) /* Terminate string with an ASCIIZ */
2028 move.l %a0,%d1 /* D1 = dest */
2029 movem.l %sp@+,%d0/%a0-%a1
2034 .string "%p->%p:%d:'%b'\n"
2036 movem.l %d1/%a0-%a1,%sp@-
2046 pea .bstr_format(%pc)
2049 movem.l %sp@+,%d1/%a0-%a1