General Category > LisaList2

Writing new Lisa Office System applications

(1/3) > >>

ried:
There's a dearth of LOS 3.1 software out there and, aside from a few odds and ends made by third-party providers, it seems like you have to run MacWorks in order to access a broad library of software. Why is that? Is Lisa Office System incomplete and lacking comparable APIs? It doesn't seem that way when using apps like LisaWrite and LisaDraw, which seem to be feature rich and perhaps even more capable than the subsequent Macintosh version.

On a whim, I asked Grok if it understands Pascal, whether it could write applications for Lisa Office System using Pascal, and whether or not Macintosh software written in Pascal could be rewritten and compiled for the Lisa.

Disclaimer: I am not a developer. The following is purely for curiosity's sake.

========= BEGIN =========

Me: Can you help me to write an application for the Lisa Office System using the PASCAL programming language?

Grok: I’d be happy to help you write a Pascal application for the Lisa Office System! Since the Lisa Office System was built using Pascal (specifically Lisa Pascal, with some extensions like Clascal for object-oriented features), we can create a simple example that aligns with its development style. The Lisa Workshop was the primary environment for coding such applications, and programs typically leveraged the Lisa Toolkit for GUI and system integration. However, without access to the full Lisa Toolkit or Workshop today, I’ll craft a basic Pascal program that mimics the structure and style of a Lisa application, assuming a simplified environment.

Let’s create a "Hello, Lisa!" application that could conceptually run on the Lisa Office System. It will include basic Pascal constructs and simulate a simple window-like output (though actual GUI code would require the Lisa Toolkit’s QuickDraw and event-handling libraries, which aren’t fully replicable here). I’ll keep it compatible with standard Pascal, noting where Lisa-specific features would typically be used.

Here’s the plan:
- Use Pascal’s structured programming features (e.g., procedures).
- Simulate a basic "window" output via text (since we can’t call the real Lisa GUI).
- Include comments to indicate where Lisa Toolkit calls would go.

### Pascal Code Example: HelloLisa.pas

```pascal
PROGRAM HelloLisa;

(* A simple Pascal program simulating a Lisa Office System application *)

CONST
  WindowWidth = 40;  (* Simulated window width *)
  WindowHeight = 10; (* Simulated window height *)

TYPE
  Point = RECORD
    x, y: INTEGER;
  END;

VAR
  windowOrigin: Point;  (* Origin point for our "window" *)

(* Procedure to simulate initializing a window *)
PROCEDURE InitWindow(VAR origin: Point);
BEGIN
  origin.x := 10;  (* Arbitrary screen position *)
  origin.y := 5;
  (* In Lisa Pascal with Toolkit, this would call QuickDraw’s InitWindow *)
  WRITELN('Initializing window at (', origin.x, ', ', origin.y, ')...');
END;

(* Procedure to draw a border - text simulation of a window frame *)
PROCEDURE DrawWindowBorder;
VAR
  i: INTEGER;
BEGIN
  (* Top border *)
  FOR i := 1 TO WindowWidth DO WRITE('-');
  WRITELN;
 
  (* Sides *)
  FOR i := 1 TO WindowHeight - 2 DO
  BEGIN
    WRITE('|');
    FOR i := 1 TO WindowWidth - 2 DO WRITE(' ');
    WRITELN('|');
  END;
 
  (* Bottom border *)
  FOR i := 1 TO WindowWidth DO WRITE('-');
  WRITELN;
END;

(* Procedure to display the message *)
PROCEDURE DisplayMessage;
BEGIN
  (* Simulate positioning text in the window *)
  WRITELN(' ');  (* Spacing to simulate inside window *)
  WRITELN('         Hello, Lisa!');  (* Centered message *)
  WRITELN(' ');  (* More spacing *)
  (* In Lisa Pascal, this would use QuickDraw’s DrawString *)
END;

(* Main program block *)
BEGIN
  WRITELN('Starting Lisa Office System Application...');
 
  (* Initialize the "window" *)
  InitWindow(windowOrigin);
 
  (* Draw the window frame *)
  DrawWindowBorder;
 
  (* Display the message inside the "window" *)
  DisplayMessage;
 
  WRITELN('Application complete.'); 
  (* In a real Lisa app, this would loop for events with GetNextEvent *)
END.
```

### Explanation

1. **Program Structure**:
   - The program follows Pascal’s structured style with a `PROGRAM` block, constants, types, variables, and procedures—hallmarks of Pascal as designed by Niklaus Wirth.
   - Lisa Pascal applications typically used units (like Pascal’s `UNIT` feature) for modularity, but I’ve kept this simple as a single file.

2. **Simulated Window**:
   - `InitWindow` sets a fictional origin point, mimicking how Lisa’s QuickDraw would position a window.
   - `DrawWindowBorder` uses text to simulate a rectangular window frame, since we can’t access the real GUI tools.
   - `DisplayMessage` prints "Hello, Lisa!" as if it’s inside the window.

3. **Lisa-Specific Notes**:
   - On the real Lisa, you’d use the Lisa Toolkit and QuickDraw for graphics (e.g., `InitGraf`, `OpenWindow`, `DrawString`).
   - Event handling (mouse clicks, menu selections) would involve an event loop with `GetNextEvent`, but here it’s a one-shot text output.
   - The Lisa Pascal compiler supported extensions like long integers and separate compilation, though we don’t need those here.

4. **Running It**:
   - You can compile this with a modern Pascal compiler like Free Pascal (`fpc HelloLisa.pas`) to test the output. On the Lisa, you’d use the Workshop, compile to Motorola 68000 object code, link with Lisa OS libraries, and install it as a tool via `InstallTool`.

### Output (Simulated)
Running this in a Pascal environment would produce something like:

```
Starting Lisa Office System Application...
Initializing window at (10, 5)...
----------------------------------------
|                                      |
|                                      |
|                                      |
|         Hello, Lisa!                 |
|                                      |
|                                      |
|                                      |
|                                      |
----------------------------------------
Application complete.
```

### Next Steps for a Real Lisa App
If you had a Lisa emulator (e.g., LisaEm) and the Workshop disks:
1. Boot into the Workshop environment.
2. Use the text editor to enter this code (or a more complex version with Toolkit calls).
3. Compile and link it against the Lisa OS libraries.
4. Install it to the Office System partition to run as a desktop tool.

Since the Lisa OS source was released in 2023 by the Computer History Museum, you could theoretically study the Toolkit and QuickDraw APIs to extend this with real GUI features—though that requires setting up an emulator and the original development tools.

Would you like to expand this further (e.g., add a mock menu or event loop), or do you have a specific feature in mind for your Lisa app? Let me know!

========= END =========

I subsequently asked Grok about porting Pascal apps for the Macintosh to Lisa Office System.

========= BEGIN =========

Me: I would like to port software written in PASCAL for the Macintosh to the Lisa Office System. Is that possible?

Grok: Yes, it’s theoretically possible to port Pascal software written for the Macintosh to the Lisa Office System, but there are several factors to consider due to differences in hardware, operating systems, and development environments. Since both platforms used Motorola 68000 processors and Pascal as a primary language, there’s a good foundation for compatibility. However, the Lisa Office System (and its Pascal dialect, Lisa Pascal) and the Macintosh System Software have distinct APIs, libraries, and architectural quirks that require careful adaptation. Let’s break this down and outline the process.

---

### Feasibility Assessment

1. **Common Ground**:
   - **Pascal**: Both the Lisa and early Macintosh relied heavily on Pascal. The Macintosh used MPW Pascal or earlier variants (like the Lisa-derived Pascal), while the Lisa used Lisa Pascal with extensions (e.g., Clascal for object-oriented features).
   - **68000 Processor**: Both systems share the same CPU architecture, so low-level assembly or machine code (if present) could be compatible with minor tweaks.
   - **QuickDraw**: The Macintosh’s graphics library originated from the Lisa, so any QuickDraw-based code has a decent chance of being portable with adjustments.

2. **Key Differences**:
   - **Operating System**:
     - The Lisa Office System (Lisa OS) integrates a desktop metaphor with a multitasking kernel and a unique file system, managed via the Lisa Workshop.
     - The Macintosh System Software (early versions like System 1–6) is single-tasking, simpler, and relies on the Toolbox ROM and System files.
   - **Development Environment**:
     - Lisa: Programs were written in the Lisa Workshop, using the Lisa Toolkit for GUI and system calls.
     - Macintosh: Programs used the Macintosh Programmer’s Workshop (MPW) or simpler tools like the Lisa Pascal compiler in early days, with the Toolbox APIs.
   - **GUI Libraries**:
     - Lisa Toolkit provides high-level abstractions for windows, menus, and events, tailored to Lisa OS.
     - Macintosh Toolbox offers similar but not identical APIs (e.g., `WindowManager`, `MenuManager`), optimized for its lighter OS.
   - **Memory and Hardware**:
     - Lisa has a larger memory footprint (minimum 512 KB, often 1 MB) and supports hardware like dual floppy drives or a hard disk.
     - Early Macs had tighter constraints (128 KB initially), influencing how software was written.

3. **Challenges**:
   - API calls (e.g., Toolbox vs. Lisa Toolkit) will differ, requiring rewrites for GUI and system interactions.
   - Event handling loops and memory management may need adjustment due to OS differences.
   - Lisa Pascal supports features like separate compilation and units, which might not align perfectly with Macintosh Pascal implementations.

---

### Steps to Port Macintosh Pascal Software to Lisa

Let’s assume you have a simple Macintosh Pascal program—say, a basic app with a window, menu, and some text output (like a "Hello, Mac" demo). Here’s how to approach porting it to the Lisa Office System:

#### 1. Analyze the Source Code
- **Identify Dependencies**: Check for Macintosh Toolbox calls (e.g., `InitGraf`, `NewWindow`, `DrawString`, `GetNextEvent`). These are the primary areas needing adaptation.
- **Isolate Core Logic**: Separate pure Pascal logic (e.g., calculations, data structures) from system-specific code. The core logic should port easily since it’s standard Pascal.
- **Check for Inline Assembly**: If the Mac code uses 68000 assembly (e.g., via `INLINE` directives), verify compatibility with Lisa’s memory model.

#### 2. Set Up the Lisa Environment
- **Emulator or Hardware**: Use a Lisa emulator like LisaEm with Lisa OS 7/7 and the Workshop installed, or a real Lisa if available.
- **Toolkit Access**: Ensure you have the Lisa Toolkit documentation or libraries (partially available via the 2023 Lisa OS source release). This defines Lisa’s equivalents to Toolbox calls.

#### 3. Map Macintosh Toolbox to Lisa Toolkit
Here’s a rough mapping of common Toolbox calls to Lisa Toolkit equivalents (based on historical documentation and Lisa OS design):

| Macintosh Toolbox Call       | Lisa Toolkit Equivalent (Hypothetical)         | Notes                                      |
|------------------------------|-----------------------------------------------|--------------------------------------------|
| `InitGraf`                   | `InitDrawing` or similar                    | Initializes QuickDraw graphics context     |
| `NewWindow`                  | `OpenWindow` or `NewWindow`                 | Creates a window; Lisa may use different parameters |
| `DrawString`                 | `DrawText` or QuickDraw equivalent          | Renders text; QuickDraw is shared but may differ in setup |
| `InitMenus`                  | `SetUpMenus` or similar                    | Initializes menu bar; Lisa menus are more complex |
| `GetNextEvent`               | `EventLoop` or `GetEvent`                   | Event handling; Lisa’s multitasking changes this |
| `DisposWindow`               | `CloseWindow`                              | Closes window; similar but Lisa may manage memory differently |

- **QuickDraw**: Since QuickDraw originated on the Lisa, most graphics calls (`MoveTo`, `LineTo`, etc.) should work with minor tweaks to initialization or coordinate systems.
- **Event Loop**: Replace the Mac’s `WHILE GetNextEvent(...) DO` loop with Lisa’s event-handling mechanism, which might involve a different structure due to multitasking.

#### 4. Rewrite System-Specific Code
- **Example Conversion**:
  Let’s say your Mac code looks like this:

  ```pascal
  PROGRAM HelloMac;
  USES
    QuickDraw, Windows, Events;
  VAR
    myWindow: WindowPtr;
  BEGIN
    InitGraf(@thePort);
    InitWindows;
    myWindow := NewWindow(NIL, Rect(50, 50, 300, 200), 'Hello, Mac', TRUE, documentProc, NIL, FALSE, 0);
    SetPort(myWindow);
    MoveTo(10, 20);
    DrawString('Hello from Macintosh!');
    REPEAT
      GetNextEvent(everyEvent, myEvent);
    UNTIL FALSE;
  END.
  ```

  For Lisa, you might adapt it to:

  ```pascal
  PROGRAM HelloLisa;
  (* Assuming Lisa Toolkit units *)
  VAR
    windowOrigin: Point;
    windowRect: Rect;
  PROCEDURE InitWindow;
  BEGIN
    (* Replace InitGraf and InitWindows with Lisa equivalents *)
    windowOrigin.x := 50; windowOrigin.y := 50;
    windowRect.top := 50; windowRect.left := 50;
    windowRect.bottom := 200; windowRect.right := 300;
    (* Hypothetical Lisa Toolkit call *)
    OpenWindow(windowRect, 'Hello, Lisa', TRUE);  (* Simplified *)
  END;
  BEGIN
    InitWindow;
    MoveTo(10, 20);  (* QuickDraw should still work *)
    DrawText('Hello from Lisa!');  (* Lisa’s text drawing *)
    (* Lisa event loop - might need a custom procedure *)
    REPEAT
      (* GetEvent or similar *)
    UNTIL FALSE;
  END.
  ```

- **Notes**: The Lisa Toolkit likely uses different window creation parameters and event structures. Without exact docs, this is speculative but follows Lisa’s design patterns.

#### 5. Compile and Test
- **Compile**: In the Lisa Workshop, compile the adapted `.pas` file (`Compile` command), link it with Lisa OS libraries (`Link`), and generate an executable.
- **Install**: Use `InstallTool` to add it to the Lisa Office System desktop.
- **Debug**: Test in the emulator or on hardware, adjusting for runtime errors (e.g., memory allocation or undefined Toolkit calls).

#### 6. Handle Edge Cases
- **Memory**: Lisa’s larger memory may require adjusting Mac code written for 128 KB constraints.
- **File I/O**: Replace Mac’s `FSRead`/`FSWrite` with Lisa’s file system calls (e.g., via the Pascal runtime or Toolkit).
- **Multitasking**: Ensure the app plays nicely with Lisa’s cooperative multitasking, unlike the Mac’s single-task focus.

---

### Practical Considerations
- **Toolkit Availability**: Without the full Lisa Toolkit, you’d need to reverse-engineer calls from the Lisa OS source or rely on preserved documentation (e.g., from Bitsavers or the Computer History Museum).
- **Time Investment**: Porting a small app might take a few hours to days; larger apps with heavy Toolbox reliance could take weeks.
- **Alternative**: If the Mac app is simple, rewriting it from scratch for Lisa might be faster than porting, using the Lisa Workshop’s examples as a guide.

---

### Is It Worth It?
If your goal is historical preservation, experimentation, or running the app on Lisa hardware/emulators, it’s absolutely doable with effort. For practical use, the Lisa’s obscurity makes it less viable unless you’re targeting a specific retro computing niche.

Do you have a specific Macintosh Pascal app in mind? If you share its purpose or code snippets, I can tailor the porting advice more precisely! What do you think—want to proceed with an example?

========= END =========

I am wondering if anyone has recently written apps for (or ported existing apps to) LOS, especially with new AI tools like Grok - and perhaps others like ChatGPT - to aid in the process. This does not seem... impossible, does it?

blusnowkitty:
I can't speak for Workshop specifically but modern AI tools do seem to show promise in helping understand weird high-level languages. I've been dabbling in IBM minicomputers lately; I was able to get an LLM to spit out almost perfectly valid 1977-era RPG II code for System/34 and System/36. It wasn't quite perfect but between period source code and reference books I have I was able to tweak the LLM output into valid, compilable RPG II code.

In my opinion though, the real barrier to entry for Lisa development is hardware access - did all the compiler bugs in LisaEm ever get fixed? If not, you have to have a 10MB ProFile or Widget; I don't believe Workshop is really usable in 5MB. I'm sure it's incredibly easy to create 10MB disk images in the new breed of emulators we have now but I've never been able to figure out how to set my X/Profile up for 10MB without crashing it.

Barring LisaEm and hardware issues, there's also the whole problem of having to learn the entire Pascal P-System in order to get anywhere with even writing a basic Hello World app. Not having any kind of terminal access in the Workshop is one of my biggest complaints in this day and age; I just want to xmodem files into the development environment and start hacking... Dropping them in a .dc42 image and sneakernetting is also acceptable.

ried:
It'll never be practical, given the small user base and number of real machines out there... but enthusiasts do all kinds of interesting niche things. A couple of things I'd like to see:


* Networking. Would it be possible to implement the protocols necessary to support a lightweight email client? Terminal is cool and all, but email would be pretty amazing to see working in LOS. I'm sure TCP/IP and a web browser (even text only) is a lot to ask for.
* Games. A while back we discussed Apple's only first-party game, Through the Looking Glass (aka Alice), which featured a funny sticker that reads "Works on Macintosh and Lisa" on the packaging. That got me wondering if it really did work on LOS, but nope... It works in the Macintosh XL mode only.
So far I've made use of the 800K disk driver, and just seeing one third-party app that had a UI was neat. But there are all kinds of fun little utilities that could be made or ported to run natively on LOS. I hope that either someone gives it a try, or I learn to do so myself someday. I do have a 5MB ProFile with Workshop and some other ResumeWriter source code on it... hmmm...  :P

warmech:
So, I've been brushing up on Pascal and have started working on a long-term side project for LOS: a Z-Machine interpreter. In a way, it's kind of a great little entry into LOS programming; I'm working on the non-graphical meat and potatoes of it in modern Pascal on Linux (vCPU opcodes, for instance) for the sake of convenience and plan on basically back-porting it to the Lisa's Pascal in Toolkit. Once I'm back to working on the Lisa, I'll work on implementing windowing and I/O. In the end, it will probably require a full 1MB of RAM due to a) LOS' overhead, b) the larger of the Infocom games pushing over 128K+ of RAM (can't recall the largest, but I know they wouldn't run on the C128 due to this), and c) that I am not a good programmer. I'm mostly interested in trying my hand at this because it's Lisa-specific properties are fairly... simple? A window, text output, a prompt, and a basic menu system to handle opening/closing games and saving/loading files. If anyone wants to build in transcription, printouts, etc., I'll leave that to them - Frotz, this ain't.

I dunno, we'll see how it goes. This isn't getting released next week or anything; if it ever sees the light of day, it will probably be months and months before it would ever be in a position to call it "usable". You can chalk that up to item "c" above, lol.

AlexTheCat123:

--- Quote from: ried on March 04, 2025, 08:17:51 pm ---I do have a 5MB ProFile with Workshop and some other ResumeWriter source code on it... hmmm...  :P

--- End quote ---


It might be worth archiving the contents of that ProFile. I've never even heard of ResumeWriter and I have no idea where that source code might've come from, but I bet it would be neat to take a look at.

Navigation

[0] Message Index

[#] Next page

Go to full version