So there's already a mechanism to type keystrokes into LPW via the Edit Paste mechanism, so adding a bit more code to allow pasting from a script shouldn't be too hard, so that handles the input side of things.
In the last few days I've been trying to locate what routine LPW uses to print strings to the console. I found this by working backwards from a routine that does NOT.B 8x at 90 bytes apart - this of course reverses the screen locations where the cursor lives:
1734582
1734583 1/00bcfa24 (0 0/0/0) : 4611 : F. : 608 : NOT.B (A1) SRC:clk:0000000049b78fb0 +12 clks
1734584 src/lisa/cpu_board/memory.c:dmem68k_fetch_byte:406::::::READ BYTE ff '.' from @1/00fb5758 (@00fb5758) using 17-ram| 12:19:20.3 1236766640
1734585 src/lisa/cpu_board/memory.c:dmem68k_store_byte:484::::::WRITE BYTE 00 ' ' to @1/00fb5758 using 17-ram| 12:19:20.3 1236766640 1734586 D 0:00f70001 1:00bcb743 2:00000001 3:00fb0050 4:00000001 5:00cc7fce 6:00000200 7:00cc0d46 ..z.... imsk:0 pnd:3 (0/0/normal cx:1)SRC:
1734587 A 0:00bd05a4 1:00fb5758 2:00bcb743 3:00cc7fd6 4:00cc6900 5:00cc4408 6:00f7bb10 7:00f7bad2 SP:00cc0000 PC:00bcfa26 SRC:
1734588
1734589 1/00bcfa26 (0 0/0/0) : 4629 005a : F..Z : 611 : NOT.B $005a(A1) SRC:clk:0000000049b78fbc +16 clks
1734590 src/lisa/cpu_board/memory.c:dmem68k_fetch_byte:406::::::READ BYTE ff '.' from @1/00fb57b2 (@00fb57b2) using 17-ram| 12:19:20.3 1236766652
1734591 src/lisa/cpu_board/memory.c:dmem68k_store_byte:484::::::WRITE BYTE 00 ' ' to @1/00fb57b2 using 17-ram| 12:19:20.3 1236766652 1734592 D 0:00f70001 1:00bcb743 2:00000001 3:00fb0050 4:00000001 5:00cc7fce 6:00000200 7:00cc0d46 ..z.... imsk:0 pnd:3 (0/0/normal cx:1)SRC:
1734593 A 0:00bd05a4 1:00fb5758 2:00bcb743 3:00cc7fd6 4:00cc6900 5:00cc4408 6:00f7bb10 7:00f7bad2 SP:00cc0000 PC:00bcfa2a SRC:
1734594
1734595 1/00bcfa2a (0 0/0/0) : 4629 00b4 : F... : 611 : NOT.B $00b4(A1) SRC:clk:0000000049b78fcc +16 clks
1734596 src/lisa/cpu_board/memory.c:dmem68k_fetch_byte:406::::::READ BYTE ff '.' from @1/00fb580c (@00fb580c) using 17-ram| 12:19:20.3 1236766668
1734597 src/lisa/cpu_board/memory.c:dmem68k_store_byte:484::::::WRITE BYTE 00 ' ' to @1/00fb580c using 17-ram| 12:19:20.3 1236766668
1734598 D 0:00f70001 1:00bcb743 2:00000001 3:00fb0050 4:00000001 5:00cc7fce 6:00000200 7:00cc0d46 ..z.... imsk:0 pnd:3 (0/0/normal cx:1)SRC:
1734599 A 0:00bd05a4 1:00fb5758 2:00bcb743 3:00cc7fd6 4:00cc6900 5:00cc4408 6:00f7bb10 7:00f7bad2 SP:00cc0000 PC:00bcfa2e SRC:
1734600
1734601 1/00bcfa2e (0 0/0/0) : 4629 010e : F... : 611 : NOT.B $010e(A1) SRC:clk:0000000049b78fdc +16 clks
1734602 src/lisa/cpu_board/memory.c:dmem68k_fetch_byte:406::::::READ BYTE ff '.' from @1/00fb5866 (@00fb5866) using 17-ram| 12:19:20.3 1236766684 1734603 src/lisa/cpu_board/memory.c:dmem68k_store_byte:484::::::WRITE BYTE 00 ' ' to @1/00fb5866 using 17-ram| 12:19:20.3 1236766684
1734604 D 0:00f70001 1:00bcb743 2:00000001 3:00fb0050 4:00000001 5:00cc7fce 6:00000200 7:00cc0d46 ..z.... imsk:0 pnd:3 (0/0/normal cx:1)SRC:
1734605 A 0:00bd05a4 1:00fb5758 2:00bcb743 3:00cc7fd6 4:00cc6900 5:00cc4408 6:00f7bb10 7:00f7bad2 SP:00cc0000 PC:00bcfa32 SRC:
1734606
1734607 1/00bcfa32 (0 0/0/0) : 4629 0168 : F..h : 611 : NOT.B $0168(A1) SRC:clk:0000000049b78fec +16 clks
1734608 src/lisa/cpu_board/memory.c:dmem68k_fetch_byte:406::::::READ BYTE ff '.' from @1/00fb58c0 (@00fb58c0) using 17-ram| 12:19:20.3 1236766700
1734609 src/lisa/cpu_board/memory.c:dmem68k_store_byte:484::::::WRITE BYTE 00 ' ' to @1/00fb58c0 using 17-ram| 12:19:20.3 1236766700
1734610 D 0:00f70001 1:00bcb743 2:00000001 3:00fb0050 4:00000001 5:00cc7fce 6:00000200 7:00cc0d46 ..z.... imsk:0 pnd:3 (0/0/normal cx:1)SRC:
1734611 A 0:00bd05a4 1:00fb5758 2:00bcb743 3:00cc7fd6 4:00cc6900 5:00cc4408 6:00f7bb10 7:00f7bad2 SP:00cc0000 PC:00bcfa36 SRC:
1734612
1734613 1/00bcfa36 (0 0/0/0) : 4629 01c2 : F... : 611 : NOT.B $01c2(A1) SRC:clk:0000000049b78ffc +16 clks
1734614 src/lisa/cpu_board/memory.c:dmem68k_fetch_byte:406::::::READ BYTE ff '.' from @1/00fb591a (@00fb591a) using 17-ram| 12:19:20.3 1236766716
1734615 src/lisa/cpu_board/memory.c:dmem68k_store_byte:484::::::WRITE BYTE 00 ' ' to @1/00fb591a using 17-ram| 12:19:20.3 1236766716
1734616 D 0:00f70001 1:00bcb743 2:00000001 3:00fb0050 4:00000001 5:00cc7fce 6:00000200 7:00cc0d46 ..z.... imsk:0 pnd:3 (0/0/normal cx:1)SRC:
1734617 A 0:00bd05a4 1:00fb5758 2:00bcb743 3:00cc7fd6 4:00cc6900 5:00cc4408 6:00f7bb10 7:00f7bad2 SP:00cc0000 PC:00bcfa3a SRC:
1734618
1734619 1/00bcfa3a (0 0/0/0) : 4629 021c : F... : 611 : NOT.B $021c(A1) SRC:clk:0000000049b7900c +16 clks
1734620 src/lisa/cpu_board/memory.c:dmem68k_fetch_byte:406::::::READ BYTE ff '.' from @1/00fb5974 (@00fb5974) using 17-ram| 12:19:20.3 1236766732
1734621 src/lisa/cpu_board/memory.c:dmem68k_store_byte:484::::::WRITE BYTE 00 ' ' to @1/00fb5974 using 17-ram| 12:19:20.3 1236766732
1734622 D 0:00f70001 1:00bcb743 2:00000001 3:00fb0050 4:00000001 5:00cc7fce 6:00000200 7:00cc0d46 ..z.... imsk:0 pnd:3 (0/0/normal cx:1)SRC:
1734623 A 0:00bd05a4 1:00fb5758 2:00bcb743 3:00cc7fd6 4:00cc6900 5:00cc4408 6:00f7bb10 7:00f7bad2 SP:00cc0000 PC:00bcfa3e SRC:
1734624
1734625 1/00bcfa3e (0 0/0/0) : 4629 0276 : F..v : 611 : NOT.B $0276(A1) SRC:clk:0000000049b7901c +16 clks
1734626 src/lisa/cpu_board/memory.c:dmem68k_fetch_byte:406::::::READ BYTE ff '.' from @1/00fb59ce (@00fb59ce) using 17-ram| 12:19:20.3 1236766748
1734627 src/lisa/cpu_board/memory.c:dmem68k_store_byte:484::::::WRITE BYTE 00 ' ' to @1/00fb59ce using 17-ram| 12:19:20.3 1236766748
1734628 D 0:00f70001 1:00bcb743 2:00000001 3:00fb0050 4:00000001 5:00cc7fce 6:00000200 7:00cc0d46 ..z.... imsk:0 pnd:3 (0/0/normal cx:1)SRC:
1734629 A 0:00bd05a4 1:00fb5758 2:00bcb743 3:00cc7fd6 4:00cc6900 5:00cc4408 6:00f7bb10 7:00f7bad2 SP:00cc0000 PC:00bcfa42 SRC:
1734630
1734631 1/00bcfa42 (0 0/0/0) : 4e75 : Nu : 749 : RTS SRC:clk:0000000049b7902c +20 clks
So working upwards from here, I found a few A-Line traps that were used and some procedure names around them. I think the one I found is either inside of CKOUTRED or DWTRANSLATE or something like that. So now I'm able to capture the output that LPW produces like so:
LISACONSOLE:00000000110e3aab: str@00f7c2f9 size:0002 text:*
LISACONSOLE:00000000111166ea: str@00f7c2c5 size:0004 text:=-0
LISACONSOLE:000000001111ccbf: str@000202d5 size:002e text: Workshop
LISACONSOLE:000000001112b728: str@00f7c2c8 size:0001 text:⌤
LISACONSOLE:00000000111322b9: str@00f7c2c5 size:0004 text:=/0
LISACONSOLE:0000000011138482: str@000202a5 size:002e text:Copyright 1983, 1984, 1985 Apple Computer Inc.
LISACONSOLE:00000000111472f7: str@00f7c2c8 size:0001 text:⌤
LISACONSOLE:000000001114da80: str@00f7c2c5 size:0004 text:=
LISACONSOLE: CLS
LISACONSOLE:0000000011153dc3: str@00f7c2f9 size:0002 text:T
LISACONSOLE:000000001115cf65: str@00020101 size:004f text:{V3.9} WORKSHOP: FILE-MGR, SYSTEM-MGR, Edit, Run, Debug, Pascal, Basic, Quit, ?
And this works fairly well, except it also captures other operations on text strings. So it's not perfect yet. Likely this is a trap routine that's part of the thing that prints to the display, it also does a copy as part of its operation and accepts 3 parameters, a size parameter, a source and destination. The source and destination parameters are NOT pascal strings. So this is a very low level routine here, likely some part of LisaGraf/QuickDraw.
So there's also stuff like this that gets caught in the intake:
src/lisa/cpu_board/memory.c:getsnbit:692:Possible read of serial number from 0/0000400c| 17:43:51.7 210829164
LISACONSOLE:0000000010a360f8: str@00f7bd10 size:0006 text:Filer
LISACONSOLE:0000000010ac5d4a: str@00f7bd10 size:000a text:The Scrap
LISACONSOLE:0000000010ad11d4: str@00f7bd10 size:0007 text:Dialog
LISACONSOLE:0000000010adcc2e: str@00f7bd10 size:0006 text:Alert
LISACONSOLE:0000000010ae7e39: str@00f7bd10 size:0005 text:Menu
LISACONSOLE:0000000011038993: str@00f7a037 size:0001 text:-
LISACONSOLE:000000001103914b: str@00f7a037 size:0001 text:#
LISACONSOLE:0000000011039903: str@00f7a037 size:0001 text:1
LISACONSOLE:000000001103a0bb: str@00f7a037 size:0001 text:1
LISACONSOLE:000000001103a873: str@00f7a037 size:0001 text:-
LISACONSOLE:000000001103b02b: str@00f7a037 size:0001 text:C
LISACONSOLE:000000001103b7e3: str@00f7a037 size:0001 text:I
LISACONSOLE:000000001103bf9b: str@00f7a037 size:0001 text:S
LISACONSOLE:000000001103c753: str@00f7a037 size:0001 text:T
LISACONSOLE:000000001103cf0b: str@00f7a037 size:0001 text:A
LISACONSOLE:000000001103d6c3: str@00f7a037 size:0001 text:R
LISACONSOLE:000000001103de7b: str@00f7a037 size:0001 text:T
LISACONSOLE:000000001103e633: str@00f7a037 size:0001 text:.
LISACONSOLE:000000001103edeb: str@00f7a037 size:0001 text:T
LISACONSOLE:000000001103f5a3: str@00f7a037 size:0001 text:E
LISACONSOLE:000000001103fd5b: str@00f7a037 size:0001 text:X
LISACONSOLE:0000000011040513: str@00f7a037 size:0001 text:T
LISACONSOLE:00000000110462b1: str@00de0118 size:0012 text:-#11-CISTART.TEXT
LISACONSOLE:000000001104662c: str@00f7c896 size:0001 text:
LISACONSOLE:00000000110468b5: str@00f7c896 size:0001 text:
LISACONSOLE:0000000011046b4a: str@00f7c896 size:0001 text:
LISACONSOLE:0000000011047eed: str@00f77521 size:0004 text:-#11
LISACONSOLE:000000001104870b: str@00f77521 size:0007 text:CISTART
LISACONSOLE:0000000011048aa0: str@00f77528 size:0005 text:.TEXT
LISACONSOLE:000000001104b0e4: str@00f77a44 size:0005 text:-#11
LISACONSOLE:000000001104baf1: str@00f77945 size:0007 text:CISTART
LISACONSOLE:000000001104bfc4: str@00f7751f size:0006 text:..TEXT
LISACONSOLE:0000000011050184: str@00de0118 size:0012 text:-#11-CISTART.TEXT
LISACONSOLE:000000001105050f: str@00f7c896 size:0001 text:
LISACONSOLE:0000000011051d60: str@00f77407 size:0004 text:-#11
LISACONSOLE:0000000011053c02: str@00f7772c size:0012 text:-#11-CISTART.TEXT
LISACONSOLE:00000000110563f1: str@00f7772c size:0012 text:-#11-CISTART.TEXT
LISACONSOLE:00000000110743a1: str@00de0118 size:0012 text:-#11-CISTART.TEXT
LISACONSOLE:000000001107472c: str@00f7c896 size:0001 text:
LISACONSOLE:0000000011075f7d: str@00f77733 size:0004 text:-#11
LISACONSOLE:00000000110a7b04: str@00f7c2c8 size:0001 text:⌤
LISACONSOLE: CLS
Doing things like File-Manager, List shows information about the files in the output (and extra junk):
LISACONSOLE:00000003dc5aba0c: str@00f7a907 size:0002 text:*
LISACONSOLE:00000003dc5de338: str@00f7a8d6 size:0001 text:⌤
LISACONSOLE:00000003dc5e4bb6: str@00f7a8d6 size:0001 text:⌤
LISACONSOLE:00000003dc5eb235: str@00f7e0d5 size:0012 text:Contents of -#11-=
LISACONSOLE:00000003dc5f4740: str@00f7a8d6 size:0001 text:⌤
LISACONSOLE:00000003dc5fb1db: str@00f7e157 size:004d text:Filename Size Psize Last-Mod-Date Creation-Date Attr
LISACONSOLE:00000003dc60febf: str@00f7a8d6 size:0001 text:⌤
LISACONSOLE:00000003dc61654e: str@00f7e1d9 size:004d text:-------- ---- ----- ------------- ------------- ----
LISACONSOLE:00000003dc62b232: str@00f7a8d6 size:0001 text:⌤
LISACONSOLE:00000003dc6819ed: str@00f7b713 size:0005 text:56832
LISACONSOLE:00000003dc681e1d: str@00f7aa2a size:0009 text: 56832
LISACONSOLE:00000003dc683ffb: str@00f7aae4 size:0004 text:111
LISACONSOLE:00000003dc6861d7: str@00f7aae4 size:0003 text:85
LISACONSOLE:00000003dc6878ec: str@00f7aae4 size:0002 text:5
LISACONSOLE:00000003dc688caa: str@00f7aae4 size:0002 text:2
LISACONSOLE:00000003dc68a774: str@00f7aae4 size:0003 text:16
LISACONSOLE:00000003dc68be79: str@00f7aae4 size:0003 text:52
LISACONSOLE:00000003dc68dc38: str@00f7aae4 size:0003 text:85
LISACONSOLE:00000003dc68f34d: str@00f7aae4 size:0002 text:5
LISACONSOLE:00000003dc69070b: str@00f7aae4 size:0002 text:2
LISACONSOLE:00000003dc6921d5: str@00f7aae4 size:0003 text:16
LISACONSOLE:00000003dc693ce6: str@00f7aae4 size:0003 text:52
LISACONSOLE:00000003dc69670f: str@00f7aa29 size:0049 text:ASSEMBLER.OBJ 56832 111 05/02/85-16:52 05/02/85-16:52
LISACONSOLE:00000003dc6aa7c1: str@00f7a8de size:0001 text:⌤
LISACONSOLE:00000003dc6f83cf: str@00f7b713 size:0005 text:70144
LISACONSOLE:00000003dc6f87ff: str@00f7aa2a size:0009 text: 70144
LISACONSOLE:00000003dc6faa67: str@00f7aae4 size:0004 text:137
LISACONSOLE:00000003dc6fcc43: str@00f7aae4 size:0003 text:85
LISACONSOLE:00000003dc6fe0fc: str@00f7aae4 size:0002 text:3
LISACONSOLE:00000003dc6ffbce: str@00f7aae4 size:0003 text:20
LISACONSOLE:00000003dc7012d3: str@00f7aae4 size:0003 text:17
LISACONSOLE:00000003dc7029d8: str@00f7aae4 size:0003 text:57
LISACONSOLE:00000003dc704797: str@00f7aae4 size:0003 text:85
LISACONSOLE:00000003dc705c50: str@00f7aae4 size:0002 text:3
LISACONSOLE:00000003dc707722: str@00f7aae4 size:0003 text:20
LISACONSOLE:00000003dc708e27: str@00f7aae4 size:0003 text:17
LISACONSOLE:00000003dc70a938: str@00f7aae4 size:0003 text:56
LISACONSOLE:00000003dc70d377: str@00f7aa29 size:004a text:CODE.OBJ 70144 137 03/20/85-17:57 03/20/85-17:56 O
LISACONSOLE:00000003dc72174a: str@00f7a8de size:0001 text:⌤
LISACONSOLE:00000003dc76f16f: str@00f7b713 size:0004 text:3072
LISACONSOLE:00000003dc76f589: str@00f7aa2a size:0009 text: 3072
LISACONSOLE:00000003dc77093f: str@00f7aae4 size:0002 text:6
LISACONSOLE:00000003dc7732bb: str@00f7aae4 size:0003 text:87
LISACONSOLE:00000003dc774774: str@00f7aae4 size:0002 text:3
LISACONSOLE:00000003dc776246: str@00f7aae4 size:0003 text:22
LISACONSOLE:00000003dc777237: str@00f7aae4 size:0002 text:4
LISACONSOLE:00000003dc7785ed: str@00f7aae4 size:0002 text:6
LISACONSOLE:00000003dc77a771: str@00f7aae4 size:0003 text:84
LISACONSOLE:00000003dc77b9e0: str@00f7aae4 size:0002 text:1
LISACONSOLE:00000003dc77cd9e: str@00f7aae4 size:0002 text:6
LISACONSOLE:00000003dc77e868: str@00f7aae4 size:0003 text:12
LISACONSOLE:00000003dc77ff6d: str@00f7aae4 size:0003 text:10
LISACONSOLE:00000003dc782dce: str@00f7aa29 size:004b text:Edit.Menus.Text 3072 6 03/22/87-04:06 01/06/84-12:10 CO
So next steps would be to fine tune this to get just the output and not the other stuff in between. This will allow some sort of puppet strings to allow remote control of LisaEm while running LPW and send keypresses to it. The goal of course is to do something like this:
https://github.com/ksherlock/mpwAfter that, as mentioned earlier, I need to build something that allows LisaEm to ask the running LOS/LPW to allow it to open a file handle, read or write a portion or whole file, close the file handle, get a directory, get or set file attributes. Sort of a LisaEm Tools/Guest Addition, and making the whole thing scriptable.
Once this is properly fleshed out, it will allow retro Lisa Office System development to really take off and you can create a Makefile that takes the source code from your IDE, pushes it to a running copy of LPW, runs an ExecFile there and captures any error messages and returns them to your IDE. So you won't have to deal with the lameness of LPW and can use a proper editor and Makefile.
This originally started as an effort to help Al Kossow with his efforts to clean up the LOS source code for release, so that's the first use case, but certainly, I'm sure many of you will want to try your hand at writing Lisa Tools.
If you've got internal details about how LPW writes to the screen and the exact A-Line trap I should tap into, please let me know.I'm tapping into this one: 0xa022024c