This is the code I used for entering a line into SuperBASIC. It should of
course be called from a SuperBASIC environment.
* Enter line into SuperBASIC system
* The SuperBASIC text should be in the buffer (BV.BFBAS(A6) to BV.BFP(A6))
P2_ENT MOVE.L A5,-(A7) Save A5
QDOS MT.INF Get QDOS version
MOVE.W $13A,A2 If >1.03, pa_init is vectored
CMPI.L #'1.03',D2
BHI.S P2_E_2
MOVE.W $12C,A2 If <= 1.03, we get the address from
ADDA.W #$138,A2 an offset from pa_graph
P2_E_2 JSR $4000(A2) call pa_init to reset SB tables
MOVE.W $12E,A2 pa_table vector
ADDA.W #$4000,A2 add offset $4000
MOVE.W $12C,A0
JSR $4000(A0) call pa_graph to parse line
BEQ.S P2_E_3 syntax ok?
MOVE.W $134,A2 no, insert "MISTake"
JSR $4000(A2)
P2_E_3 MOVE.W $132,A2 pa_strip
JSR $4000(A2) strip forced spaces
MOVE.W $136,A2 ed_nwlin
JSR $4000(A2) enter line into SB program
NOP error return point; ignored here
MOVE.L (A7)+,A5 restore A5
RTS
Like I stated earlier, this code has been shamelessly copied from the TK2
ED command :-/.
Now the interesting question is whether this will work under SMSQ/E. The
vectors are indeed present and point to several JMP instructions to the
actual code. However the pa_table vector at $12E is not really the address
of a subroutine but a pointer to a syntax table (as is pa_expr at $130
which is not used here), which is needed for pa_graph. Interestingly, on
SMSQ/E it still points to a JMP (but it might as well be ignored by
pa_graph).
Another interesting vector might be ed_liste at $138, which is used to
execute a LIST (D7=0) or DLINE (D7<>0) lines from D4 to D6.
Jan.
--
*Jan Bredenbeek* | Hilversum, NL | [email protected]
_______________________________________________
QL-Users Mailing List