View Single Post
Old 02 February 2012, 20:44   #286
Registered User
Join Date: Aug 2004
Posts: 2,912
Originally Posted by Toni Wilen View Post
This example is quite bad because it assumes dos jump vectors are using BCPL-style code (moveq #vectorid,d0; bra.w bcpl_magic). Only way to support this kind of code is to "emulate" BCPL jump vectors.

It wouldn't be too difficult but problem is that all low level system programs (like snoopdos) made/updated after 2.0+ was introduced most likely expects "normal" dos jump vectors and would crash..
ABasiC, the Window example and the example code in the Amiga Guru Book (p288-295 in the English version) all use the technique of jumping to offset _LVOOpen+2 from DOSBase. Probably Ralph Babel just copied the ABasic/Window technique!

I guess it's kind of academic now, but if a program attached a CON: handler to its window by calling the BCPL routines in the correct way (like the 1.x CLI commands must do), it probably wouldn't be much trouble to support that BCPL technique in AROS.

As it is, since those programs all jump to _LVOOpen+2, it might be feasible to hack the Open vector so it consists of a BRA.B to code which calls the "real" Open routine, followed by a BRA.W to the BCPL setup routine. I'm not suggesting the AROS M68K ROM itself should do that, but it would be possible to write such a program which the end user could run, before running ABasiC or whatever. Maybe with support from AROS dos.library in the form of a couple of free longwords in DOSBase, which the patch program could use for JMP instructions.

The "correct" way for those programs to call BCPL routines would (I think?) have been to reproduce the BCPL routine setup code, which looks like this (assuming DOSBase is in A6). The BRA.Ws in the Kickstart 1.x DOSBase point to code like this (the code is at offset $4E from DOSBase; the code in 1.x DOSBase references dl_A2 PC-relative, not based on A6):
MOVEM.L D2-D7/A2-A6,-(SP)
SUBI.L  #1500,D5
BCLR    #1,D5
MOVEM.L (dl_A2,A6),A2/A5/A6
ASL.L   #2,D0
MOVEA.L (A2,D0.L),A4
MOVEQ   #12,D0
JSR     (A5)
MOVEM.L (SP)+,D2-D7/A2-A6
In fact... if AROS DOSBase has that code or equivalent at offset $4E, as probably all Kickstart 1.x versions do, then an easy 4-byte patch to the unmodified ABasiC executable should be enough to get it working, once there is support for attaching a CON handler to an existing window. The patch would just change instances of JMP (-$1C,A6) to JMP ($4E,A6).
mark_k is offline  
Page generated in 0.03885 seconds with 10 queries