ProDOS-8 / ProDOS8-Testing

QA and Testing for ProDOS-8 Releases
MIT License
29 stars 1 forks source link

ProDOS 2.4.x Default Serial Settings Prevent Printing From BASIC #58

Open nick3092 opened 3 years ago

nick3092 commented 3 years ago

Description

While messing around with my ImageWriter II and //c tonight, I found I was having a difficult time printing anything from the DOS/BASIC prompt (or from within a BASIC program designed to print some output) by doing a PR#1 and typing 'list' or 'cat' with any of the 2.4.x versions. The printer would just spit out a line of garbage, then feed a sheet, line of garbage, etc. I loaded up a 2.0.3 image, and printing worked fine as expected with a simple PR#1.

I booted 2.4.2 again, and this time did a PR#1, and then started using Ctrl-I commands to reset the port to 9600 8n1. Then I was able to print again. Albeit in a much larger font than normal. So it appears the default port settings were changed from the original ProDOS settings, which usually kept slot 1 9600 8n1.

Expected Behavior

When typing PR#1 from a prompt, the printer should engage with no additional settings needed. The printer should print in normal, default font.

Actual Behavior

Without modifying the serial port settings, the printer spits out a line of garbage, then feeds a page, line of garbage, feeds a page, etc. After adjusting the serial port settings using Ctrl-I, it will print. But the font is much larger than usual.

Possible Fix

Change the default slot 1 serial settings back to the way they functioned in 2.0.3 and earlier.

Steps to Reproduce

issue impacts Apple IIc real-hardware and MAME emulator

  1. Boot a ProDOS 2.4.x image into BASIC
  2. Type PR#1
  3. Type CAT and press RETURN

On Apple IIc

Context

This bug prevented printing from within a BASIC program, as well as trying to print off a listing of a basic program to troubleshoot.

Your Environment

Hardware:

Apple //c ROM 255, ImageWriter II, Floppy EMU

ProDOS8 version:

Any 2.4.x version. Tested the 2.5 alpha just out of curiosity and the issue occurs there as well.

Non-Operating System release software being used:

None, just printing from BASIC.

nick3092 commented 3 years ago

Attached are pictures of what it looks like normally under 2.0.3 and what it looks like under 2.4.2 after I changed the serial port settings to get it to print. It changed the font somehow to be much larger.

Large Print After 2 4 Fix Normal Print DOS 2 0 3

nick3092 commented 3 years ago

I confirmed the issue on my other //c (ROM 04) as well. However, PR#1 is working as expected on my IIgs with 2.4.2 images. So it may be limited to something specifically with the //c? Maybe it has to do with the //c's limited function serial port? I'm not an expert, but I believe it lacks proper handshaking, where the IIgs has it.

nick3092 commented 3 years ago

A little more info that may help or be interesting. With 2.0.3, when I type PR#1, the flashing checkerboard cursor moves below the basic ] prompt. With 2.4.2, after I type PR#1, the cursor seems to disappear completely. I'm not entirely sure, but I believe that is because the printer didn't respond when it tried to initialize the port.

Also, this behavior can be seen/replicated in the most recent version of MAME as well. I started MAME using the apple2c driver, configured a serial printer in the printer slot, and then booted a 2.0.3 image. I got the flashing cursor after typing PR#1. I can go back to the screen/BASIC prompt by typing PR#0. Doing the same with a 2.4.2 image, I lose the cursor after typing PR#1. And it will not go back to the screen/prompt if I type PR#0.

Using the apple2gs driver in MAME with a serial printer in the printer slot results in PR#1 giving you a blinking cursor after PR#1 in both 2.0.3 and 2.4.2

DevoKun commented 3 years ago

Hello, @nick3092 . I have been testing this using the Apple IIe and Apple II+ emulation in Virtual ][. My results are the same as yours. It does appear that the issue is specific to the IIc.

Please share the specific commands you used to make the printer work with the IIc.

Thanks.

nick3092 commented 3 years ago

I'm not sure what commands you are looking for, I'm just doing basic printing via pr#1. To test this, all I am doing is booting to a BASIC prompt, type "PR#1", then issuing any command, like 'cat' and press return. Under 2.0.3, I get a print out of the disk contents. Under 2.4.2, I just get garbage and a lot of sheets fed.

I just confirmed it seems to be specifically the data format setting that is tripping up on the //c. I just booted 2.4.2, did a PR#1, return, followed by a 'cat' and hit return. I got a line of garbage and it started to feed a sheet.

I turned off the printer and did a PR#0 to get back to the screen. (My previous comments about not getting a blinking cursor or being able to PR#0 back to the screen were with the apple2c driver in MAME. On real hardware, that part is working, but still seems to indicate the //c driver is affected by this issue.)

After going back to the screen/prompt, I typed pr#1 again and pressed return. This time I pressed CTRL-I, and at the ? prompt I typed 0D (which sets the port to 8 data and 1 stop bit, which should be standard). Again I typed 'cat' followed by a return. This time it printed the disk catalog normally.

So it does seem to be setting the baud correctly, but something is tripping up the data format with the //c.

DevoKun commented 3 years ago

Thank you, @nick3092 . This is very helpful. Do you mind testing with the latest ProDOS 2.5 alpha?

nick3092 commented 3 years ago

@DevoKun No problem. It acted the exact same way with the 2.5 alpha you linked. A PR#1 followed by a CAT printed garbage. But a PR#1 followed by a Ctrl-I, then a 0D, then a CAT printed as expected.

nick3092 commented 2 years ago

I had my //c and Imagewriter II out today and had a thought to try and narrow down where the issue exists - in ProDOS or BASIC.SYSTEM. So I created two images with Cider Press. One had ProDOS 2.4.2 with the BASIC.SYSTEM 1.5 from the 2.0.3 disk. And the other had ProDOS 2.0.3 with BASIC.SYSTEM 1.6 from the 2.4.2 disk.

The combo of ProDOS 2.0.3 and BASIC.SYSTEM 1.6 printed fine with no serial port setting changes.

The combo of ProDOS 2.4.2 and BASIC.SYSTEM 1.5 printed garbage with no serial port setting changes.

Based on that, it appears the issue lies within ProDOS and not BASIC.SYSTEM. Not sure if that is helpful at all, but was just a thought I had.

mabalmer commented 2 years ago

I can confirm that this behavior is not limited to BASIC, either -- the exact same symptom appears when AppleWorks 2 is loaded up on a ProDOS 2.4.2 image. On my original AppleWorks disk, it loads ProDOS 1.1.1, and printing occurs with no issues.

tim1724 commented 11 months ago

I would assume that something is messing with the screen holes in aux memory. As far as I know peripherals on the other models of the Apple II only store settings in the screen holes in the main bank of memory, but the //c stores some of its serial port settings in the aux mem screen holes. So if anything in ProDOS 2.5 touches those it would mess up the //c serial ports without affecting other models.

I set up a //c in Virtual ][ and set watchpoints for the documented screen holes in aux mem (addresses $0478 through $047F). Just after the "ProDOS 8 V2.5.0a8" splash screen appeared one of the watchpoints was triggered by STA $0478 instruction at $223D. It then does some bit shifting of the value at $0478. (It ends up with the value $6E instead of its default value of $9E.) After that it finishes booting without any further manipulation of that byte (or any of the other documented //c aux mem screen holes.) BASIC.SYSTEM doesn't touch them either. (I booted once from a disk with BASIC.SYSTEM and one with a disk with QUIT.SYSTEM. The three accesses were the same in both cases, suggesting that they were in ProDOS itself. To verify I ran "BLOAD PRODOS,A$2000,TSYS" and then executed "223DL" in the monitor and sure enough, the STA $0478 at $223D, the ASL $0478 at $2241, and the LSR $0478 at $224A are all part of the PRODOS executable.

I next booted a copy of ProDOS 2.4.2 and saw the exact same sequence of access to $0478 in aux mem.

Next I booted a copy of ProDOS 2.0.3. It never touched any of the //c's serial port screen hole locations in aux mem.

So I'm guessing that's the problem. $0478 in aux mem is used by the //c for serial port 1 and ProDOS should probably not touch it. I didn't try to figure out what ProDOS 2.4/2.5 was supposed to be doing. (Someone with the source code should probably take a look.) I assume it's not meant to be messing with the serial ports. I don't think any other Apple II uses aux mem $0478 for anything special.