Discussion:
Turning on/off 80-column firmware in ProDOS under ML
(too old to reply)
f***@hotmail.com
2018-01-16 05:51:39 UTC
Permalink
Hello All!

I'm having trouble turning on and off the 80-column firmware within my machine language programs. The ProDOS 8 tech ref suggests this will work to turn the firmware off...

LDA #$15 ;Character that turns off video firmware
JSR $C300 ;Print it to the video firmware

It doesn't work. $C300 will start 80-column mode but disconnects ProDOS and messes up some vectors so that TRACE is on when you return to applesoft.


OK, so lets pass it to the command buffer instead...

ORG $1000
LDA #$D0
STA $200
LDA #$D2
STA $201
LDA #$A3
STA $202
LDA #$B3
STA $203
LDA #$8D
STA $204
JSR $BE03 ; DOSCMD "PR#3<Return>"

It doesn't work.


I looked at some other programs like Bitsy Bye and noticed they don't do any calls to ProDOS and just hit some softswitches during their init routines (to turn things off).

STA $C00C ; Turn off 80-column Display
STA $C000 ; Turn off AUX memory mode
JSR $FE93 ; F8ROM:SETVID
JSR $FE89 ; F8ROM:SETKBD
JSR $FB2F ; Set TEXT mode
JSR $FC58 ; Clear screen (HOME)

OK seems good but doesn't exit cleanly back to BASIC unless I call PR#3 before running my ML routine. The initial $c300 call messes up the vectors.

I would like to start 80 col in ML, run my program, and then have it exit cleanly back to BASIC in 40 column mode. What am I doing wrong here?

Frank
f***@hotmail.com
2018-01-16 06:46:13 UTC
Permalink
LDA #$03
JSR $FE95 ; F8ROM:OUTPORT
JSR $FD8E ; F8ROM:CROUT

This also works to start 80-col mode, but still scrambles all the ProDOS vectors.
I am Rob
2018-01-16 16:13:52 UTC
Permalink
This post might be inappropriate. Click to display it.
Antoine Vignau
2018-01-16 16:50:12 UTC
Permalink
I don't have my useful books handy but:
- you are talking about the basic interpreter, not Prodos.

What about a call to BE00 after disconnecting the C300 firmware?

av
f***@hotmail.com
2018-01-17 00:50:32 UTC
Permalink
BE00 and 3D0 both do a reset to the BASIC command line, and don't return cleanly to my running BASIC program.

Now that I think about it, I've never seen a small ML program call 80-column and then exit back to 40. My usual method is to tear apart pieces from existing programs that work. Kind of hard to do when there's no preexisting program. :)

Still not sure I understand how to properly call 80-col, but I found out my ML routine is adding too much to the stack, which I think was causing the problem with TRACE and disconnecting ProDOS, not the calls to 80-col. I'll have to run some test to figure out the best way to call it. For now I just just use CHR($)"PR#3" in the BASIC program, which feels like cheating.
f***@hotmail.com
2018-01-17 01:03:16 UTC
Permalink
CALL-151
!
300:LDA #$12
JSR $FDED ; F8ROM:COUT
JSR $FD8E ; F8ROM:CROUT
RTS

300G

...doesn't work. just prints an inverse 'R'. Tried other characters to similar effect. How do I set it up?

f
Post by I am Rob
Post by f***@hotmail.com
LDA #$03
JSR $FE95 ; F8ROM:OUTPORT
JSR $FD8E ; F8ROM:CROUT
This also works to start 80-col mode, but still scrambles all the ProDOS vectors.
You can either send the codes through $FDED (COUT)
$0E - turn off inverse chars
$0F - turn on inverse chars
$11 - enter 40 col display without disabling 80-col Control Char commands
(allows mousetext in 40-col display
$12 - re-enter 80-col display
$15 - disable 80-col mode
$18 - turn mousetext display off
$1B - turn mousetext display on
or use
JSR $FE89 ; resets input to keyboard
JSR $FE93 ; resets output to 40-col mode
Steve Nickolas
2018-01-17 01:17:02 UTC
Permalink
If you want to turn off pr#3 properly, isn't what you want this?

lda #$95 ; remember to OR with $80 first
jsr $FDED

The command "PR#3" would probably need to be stored with the 128 bit on
too (i.e., D0 D2 A3 B3 [8D])?

-uso.
f***@hotmail.com
2018-01-17 02:27:45 UTC
Permalink
Thank you all!

This is what I was looking for. The $FDED routine only works if you don't accidentally disconnect ProDOS first by using $C300. Seems strange the ProDOS 8 tech ref (page 99) says to JSR $C300 to turn 80-col off after doing LDA #$15. Can only assume that is a typo based on everything else I've read today, but it seems to be in all versions of the document I've seen instead of JSR $FDED as it should be.


!
300:LDA #$D0 ; Turn on 80-col in ProDOS
STA $200 ; store command in input buffer
LDA #$D2
STA $201
LDA #$A3
STA $202
LDA #$B3
STA $203
LDA #$8D
STA $204
JSR $BE03 ; DOSCMD "PR#3<Return>" (high bit must be on)
RTS
LDA #$15 ; Turn off 80-col in ProDOS
JSR $FDED
RTS


now to fix all my other errors!
f
f***@hotmail.com
2018-01-17 02:32:45 UTC
Permalink
As a side note, I'm not sure why, but I find it unsettling that the ProDOS 8 Tech Ref is only available as formatted text. Something about old-looking PDF scans that I like that HTML formatted text just doesn't have.
f***@hotmail.com
2018-01-17 03:10:52 UTC
Permalink
Nevermind, the code to turn off works, but the calling code only works from the command line "300G". Still doesn't work inside my program. Seriously, how do i turn 80-col on?!?
I am Rob
2018-01-17 03:53:44 UTC
Permalink
This post might be inappropriate. Click to display it.
f***@hotmail.com
2018-01-17 04:35:47 UTC
Permalink
Try doing a CAT right after 300G. You'll get an error which proves it only works in immediate mode and at the price of disconnecting PD. ProDOS commands won't work again until you 3D0G or BE00G (both seem to have the same effect). But reconnecting exits out of your running BASIC program rather than exiting clean, dropping you to a BASIC command prompt.
f***@hotmail.com
2018-01-17 04:59:00 UTC
Permalink
Restoring the vectors also doesn't seem to work.


CALL-151
!
300:JSR $C300 ; setup 80-column firmware
LDA $36 ; process I/O vector changes
STA $BE30 ; zero-page back to ProDOS
LDA $37
STA $BE31
LDA $38
STA $BE32
LDA $39
STA $BE33
RTS

300G
CAT
f***@hotmail.com
2018-01-17 08:53:36 UTC
Permalink
Well just hitting the following switch works I guess...

STA $C00D ; setup 80-column firmware

Had it as LDA $C00D which does not work. ugh. Not sure how to fix the window size and clear the AUX mem portion of the screen, but ProDOS is still connected. Does't really matter for my application but I would be curious to know how to fix that.


Also, I think it was these routines which I was using to restore text mode were actually disconnecting ProDOS...
JSR $FE93 ; F8ROM:SETVID
JSR $FE89 ; F8ROM:SETKBD


Now my ML program runs cleanly from my BASIC program with expected behavior, but exits with a SYNTAX ERROR if I just CALL it from the BASIC prompt. Can't say I've seen that before.

f
I am Rob
2018-01-17 16:27:49 UTC
Permalink
Post by f***@hotmail.com
Well just hitting the following switch works I guess...
STA $C00D ; setup 80-column firmware
Had it as LDA $C00D which does not work. ugh. Not sure how to fix the window size and clear the AUX mem portion of the screen, but ProDOS is still connected. Does't really matter for my application but I would be curious to know how to fix that.
Also, I think it was these routines which I was using to restore text mode were actually disconnecting ProDOS...
JSR $FE93 ; F8ROM:SETVID
JSR $FE89 ; F8ROM:SETKBD
Now my ML program runs cleanly from my BASIC program with expected behavior, but exits with a SYNTAX ERROR if I just CALL it from the BASIC prompt. Can't say I've seen that before.
f
To keep the two calls listed above from disconnecting Prodos totally, you can only call one at a time, then call $BE03 to reconnect Prodos. As long as either the input, or, the output is connected, Prodos doesn't get fully disconnected and can reconnect itself.

The syntax error at the prompt is because some applesoft commands don't exit with an end-of-line character such as a colon or a zero.

The CALL that your ML program should exit with is a JMP $D995 to find that end-of-line marker.

If you want your routine to be compatible from all 3 situations, a CALL from the prompt, a CALL from a basic program or a CALL from another ML program, then something slightly different yet again has to be done.
f***@hotmail.com
2018-01-17 16:45:22 UTC
Permalink
I'd be curious to know, but for now just running a JSR $D995 at the end fixes my problem.
F
Post by I am Rob
If you want your routine to be compatible from all 3 situations, a CALL from the prompt, a CALL from a basic program or a CALL from another ML program, then something slightly different yet again has to be done.
f***@hotmail.com
2018-01-17 23:07:02 UTC
Permalink
Something like this?


LDA $BE42 ; 0 if immediate, >0 if definite
BEQ $D995


Frank
Post by I am Rob
The CALL that your ML program should exit with is a JMP $D995 to find that end-of-line marker.
I am Rob
2018-01-18 02:36:01 UTC
Permalink
Post by f***@hotmail.com
Something like this?
LDA $BE42 ; 0 if immediate, >0 if definite
BEQ $D995
Not quite. I will give you a little hint, but let you play with it some more. When calling from another ML program, you don't want this routine to end with the call to $D995, but when a call is made from either immediate mode or deferred mode you always do.
f***@hotmail.com
2018-01-18 14:56:36 UTC
Permalink
I have 4 gigs of A2 documentation in a folder, and found one reference in "Inside the Apple IIe" to $D995 pointing to the applesoft DATA command.

If my program was called from ML I wouldn't need to do anything on exit. If it was called from a BASIC program it should also exit cleanly. If it was called from command line I would need to check prompt location $32 for a "]" and exit to $D995? Seems like you would need to process the rest of the input buffer to exit cleanly.

LDA $32
CMP #$DD ; ASCII "]" char
BEQ $D995


Also, looking back at this thread, seems like any call to $BE03 or SETVID/SETKBD should really be avoided if you want to turn 80-col on/off correctly under prodos.

ON - JSR $C300 + update 2 vectors
OFF - LDA #$15 + JSR $FDED

Frank
Post by I am Rob
Post by f***@hotmail.com
Something like this?
LDA $BE42 ; 0 if immediate, >0 if definite
BEQ $D995
Not quite. I will give you a little hint, but let you play with it some more. When calling from another ML program, you don't want this routine to end with the call to $D995, but when a call is made from either immediate mode or deferred mode you always do.
f***@hotmail.com
2018-01-18 17:13:26 UTC
Permalink
Maybe something like this?

LDA $BE42 ; 0=immediate (prompt), >0=definite (BASIC program)
BNE EXIT
LDA $32 ; is immediate mode applesoft?
CMP #$DD ; look for "]" at current applesoft line pointer
BEQ $D995 ; jump to DATA to process rest of line
EXIT RTS ; we are in ML or definite mode


Noticing a serious lack of documentation regarding some of this stuff. Haven't seen either of these books below in PDF, which would have probably answered a lot of my questions.


Mastering ProDOS – April, 1986 by T. Rice (Author),‎ K. Rice (Author)

Exploring Apple GS/OS and ProDOS 8 - Jan 1, 1989 by Gary B. Little


Gary Little's other book "Inside the IIe" was the only place I found those Applosoft pointers listed ($D995).

Frank
I am Rob
2018-01-19 00:50:57 UTC
Permalink
Post by f***@hotmail.com
Maybe something like this?
LDA $BE42 ; 0=immediate (prompt), >0=definite (BASIC program)
BNE EXIT
LDA $32 ; is immediate mode applesoft?
CMP #$DD ; look for "]" at current applesoft line pointer
BEQ $D995 ; jump to DATA to process rest of line
EXIT RTS ; we are in ML or definite mode
Noticing a serious lack of documentation regarding some of this stuff. Haven't seen either of these books below in PDF, which would have probably answered a lot of my questions.
Mastering ProDOS – April, 1986 by T. Rice (Author),‎ K. Rice (Author)
Exploring Apple GS/OS and ProDOS 8 - Jan 1, 1989 by Gary B. Little
Gary Little's other book "Inside the IIe" was the only place I found those Applosoft pointers listed ($D995).
Frank
An FYI, the routine at $D995 is just named DATA and pertains to more than just the applesoft DATA command. It is used to find the end-of-line marker or the next statement marker in an applesoft program line. In doing so it can skip past REM's, find the closing quotation mark (I think) and even skip past DATA statements that are in the middle of your program when the program is executing.

I just want to say, "kudos" for doing your research. You did what most programmers have already done, which is search for your own answers instead of expecting an answer given to them, and it took a lot of reading.

I think most of my knowledge came from reading Nibble magazine where you can see the disassembled listings, more than it came from thick books of long-winded, redundant information. The best article for me was "Disassembly Lines" that showed the disassembly of Basic.system.

I don't think there are any books dedicated to Basic.system itself.
I will try to summarize what I have learned with what you are doing.
On to the main subject.

There are 4 ways in which you can initialize the 80-col card from.

1) from the prompt
2) from an applesoft program
3) from a binary program
4) from a system program

The first 3 require Basic.system to be in memory. The 4th doesn't and can be ignored.

The first 3 also have to deal with applesoft ROM linked through Basic.systems input/ouput vectors. Even though calls may not be made to applesoft, calls made to input/output devices and not telling Basic.system about them, can mess up Basic.system's vectors when exiting your program and, can leave Basic.system in a state no longer linked to applesoft. Applesoft ROM is where the prompt is being displayed and a running applesoft program passes code through Basic.system.

Commands to initialize input/output devices at the prompt are intercepted by Basic.system and its vectors are updated accordingly.

When running applesoft programs, Basic.system intercepts each character and looks for the CTRL-D character and when used with PR# and IN#, B.S. will update its I/O vectors.

Binary programs though are not expected to send a CTRL character to signal Basic.system to update its vectors and there are some special use cases with which to watch out for.

- binary programs can be either called from the prompt or an applesoft program
which can be in conflict if user would like to use the routine for both cases
- binary programs can make applesoft calls, some of which don't leave the
end-of-line set properly, and can cause an error on exit
- binary programs can initialize input/output devices and can leave
Basic.system unhooked

I find that the applesoft commands that don't exit with the end-of-line marker are the commands without expressions.

Hope this helps in your programming efforts.
f***@hotmail.com
2018-01-19 16:10:20 UTC
Permalink
Lucky me! I've hit a trifecta! Probably better buy a Powerball ticket today.

Before I found the "AppleSoft Commented.txt" file last night I did a memory dump in my emulator and found "95 D9" at $E33C (they used a JSR there not a JMP). Figured it had something to do with not parsing the input correctly. Based on what you said I thought it was the "TEXT" and "HOME" calls near exit so I just took them out, but still getting the error when doing "CALL 4096" from the command line. Can only assume this Syntax Error is because the $C300 call is messing up the input buffer pointers as well as loading I/O vectors which don't point to ProDOS.

Frank


On Thursday, January 18, 2018 at 4:50:59 PM UTC-8, I am Rob wrote:

- binary programs can be either called from the prompt or an applesoft program
which can be in conflict if user would like to use the routine for both cases
- binary programs can make applesoft calls, some of which don't leave the
end-of-line set properly, and can cause an error on exit
- binary programs can initialize input/output devices and can leave
Basic.system unhooked
f***@hotmail.com
2018-01-19 20:21:21 UTC
Permalink
LDY $76 ; CURLIN+1, $FF if in direct mode
INY
BEQ DATA
RTS ; exit clean to program
DATA JSR $D995 ; update TXTPTR to next colon or EOL
RTS ; exit clean to direct mode


This works to kill the SYNTAX ERROR but seems to disregard anything after CALL 4096, however.

CALL 4096:LIST just exits to prompt without doing the LIST

Frank
Antoine Vignau
2018-01-19 21:25:03 UTC
Permalink
Memory on the Apple II and switched (double) banks...
I am Rob
2018-01-19 23:29:29 UTC
Permalink
Post by f***@hotmail.com
LDY $76 ; CURLIN+1, $FF if in direct mode
INY
BEQ DATA
RTS ; exit clean to program
DATA JSR $D995 ; update TXTPTR to next colon or EOL
RTS ; exit clean to direct mode
This works to kill the SYNTAX ERROR but seems to disregard anything after CALL 4096, however.
CALL 4096:LIST just exits to prompt without doing the LIST
Frank
This routine branches to $D995 if only in immediate mode, but you would also want to call $D995 when in deferred mode (an applesoft program is running). Come to think of it, it shouldn't hurt the instances when a binary program is called either from applesoft or from the prompt.

Try this in all scenarios of running binary programs.

L0300 LDA #8E
JSR C300
LDX #03
L0307 LDA 36,X
STA BE30,X
LDA BE34,X
STA 36,X
DEX
BPL L0307

... your binary program would go here, but try it without the program
JMP $D995
f***@hotmail.com
2018-01-20 06:04:12 UTC
Permalink
A little confused, if I had a program that was just LDA #00 and RTS it would exit cleanly under all 3 scenarios. This does not work with my current program.


Apple //e

]CALL-151

*!

0300- A9 00 LDA #$00
0302- 60 RTS
!

*

]10 HOME

]CALL768:LIST

10 HOME

]


Also, why a JMP rather than a JSR? How does it come back to my program to run the RTS and exit cleanly back to where it was called?
I am Rob
2018-01-20 07:32:51 UTC
Permalink
Post by f***@hotmail.com
A little confused, if I had a program that was just LDA #00 and RTS it would exit cleanly under all 3 scenarios. This does not work with my current program.
Apple //e
]CALL-151
*!
0300- A9 00 LDA #$00
0302- 60 RTS
!
*
]10 HOME
]CALL768:LIST
10 HOME
]
Also, why a JMP rather than a JSR? How does it come back to my program to run the RTS and exit cleanly back to where it was called?
A JMP is the same as a JSR - RTS combo. The return at the end of the jumped-to-routine will return to the same place as the RTS with the JSR-RTS combo does.

To answer the first question, just doing a LDA #0 - RTS doesn't call any applesoft commands or pass any parameters to the ML program. You will rarely call an ML program from applesoft unless you can pass some parameters to it and maybe receive data back from it.

You can pass parameters with the & (ampersand), the USR() and with a CALL as in CALL768,X,Y.

Also keep in mind that initializing any input/output devices (such as the 80-col card) from an ML program can disconnect applesoft, and although it may not be obvious, entering commands at the prompt is part of applesoft.
f***@hotmail.com
2018-01-23 07:39:34 UTC
Permalink
I did a disassembly of C300-C3FF & C800-CFFF to see what was going on. Not only is JSR $C300 changing the I/O vectors at $36-39, but it's also doing some scanning of the input buffer at $200. I wonder if there's a way to just save the input buffer before the call $C300 and restore it afterwards to call it cleanly from wherever, avoiding the call to DATA at $D995 altogether.

Also, it seems the area from C800-CFFF is switched in by accessing C3xx range. It seems to default to slot 7 and only shows the 80-col firmware if you PEEK $C3xx first (switching it to slot 3). Did not know that's how it worked.

Further, the $C300 call uses 10 different screen hole locations to store data while it's running. Can only assume those get used while the card is initializing, and are unneeded after.

Frank


CF95- A4 34 LDY $34
CF97- 98 TYA
CF98- AA TAX
CF99- 4C D2 FC JMP $FCD2
CF9C- 20 C7 FF JSR $FFC7 F8ROM:ZMODE
CF9F- AD 00 02 LDA $0200 ; read input buffer
CFA2- C9 A0 CMP #$A0 ; do we have a space?
CFA4- F0 12 BEQ $CFB8
CFA6- C9 8D CMP #$8D ; do we have a carriage return?
CFA8- D0 01 BNE $CFAB
CFAA- 60 RTS
CFAB- 20 A7 FF JSR $FFA7 F8ROM:GETNUM
CFAE- C9 93 CMP #$93
CFB0- D0 E5 BNE $CF97
CFB2- 8A TXA
CFB3- F0 E2 BEQ $CF97
CFB5- 20 78 FE JSR $FE78
CFB8- A9 03 LDA #$03
CFBA- 85 3D STA $3D
CFBC- 20 13 FF JSR $FF13
CFBF- 0A ASL
CFC0- E9 BE SBC #$BE
CFC2- C9 C2 CMP #$C2
CFC4- 90 D1 BCC $CF97
CFC6- 0A ASL
CFC7- 0A ASL
CFC8- A2 04 LDX #$04
CFCA- 0A ASL
CFCB- 26 42 ROL $42
CFCD- 26 43 ROL $43
CFCF- CA DEX
CFD0- 10 F8 BPL $CFCA
CFD2- C6 3D DEC $3D
CFD4- F0 F4 BEQ $CFCA
CFD6- 10 E4 BPL $CFBC
CFD8- A2 05 LDX #$05
CFDA- 20 C8 C4 JSR $C4C8
CFDD- A5 44 LDA $44
CFDF- 0A ASL
CFE0- 0A ASL
CFE1- 05 35 ORA $35
CFE3- C9 20 CMP #$20
CFE5- B0 06 BCS $CFED
CFE7- A6 35 LDX $35
CFE9- F0 02 BEQ $CFED
CFEB- 09 80 ORA #$80
CFED- 85 44 STA $44
CFEF- 84 34 STY $34
CFF1- B9 00 02 LDA $0200,Y ; read input buffer at Y
CFF4- C9 BB CMP #$BB ; do we have a semi-colon?
CFF6- F0 04 BEQ $CFFC
CFF8- C9 8D CMP #$8D ; do we have a carriage return?
CFFA- D0 B4 BNE $CFB0
CFFC- 4C 6B CF JMP $CF6B
CFFF- 00 BRK
James Davis
2018-01-23 08:56:46 UTC
Permalink
Post by f***@hotmail.com
I did a disassembly of C300-C3FF & C800-CFFF to see what was going on. Not only is JSR $C300 changing the I/O vectors at $36-39, but it's also doing some scanning of the input buffer at $200. I wonder if there's a way to just save the input buffer before the call $C300 and restore it afterwards to call it cleanly from wherever, avoiding the call to DATA at $D995 altogether.
Also, it seems the area from C800-CFFF is switched in by accessing C3xx range. It seems to default to slot 7 and only shows the 80-col firmware if you PEEK $C3xx first (switching it to slot 3). Did not know that's how it worked.
Further, the $C300 call uses 10 different screen hole locations to store data while it's running. Can only assume those get used while the card is initializing, and are unneeded after.
Frank
CF95- A4 34 LDY $34
CF97- 98 TYA
CF98- AA TAX
CF99- 4C D2 FC JMP $FCD2
CF9C- 20 C7 FF JSR $FFC7 F8ROM:ZMODE
CF9F- AD 00 02 LDA $0200 ; read input buffer
CFA2- C9 A0 CMP #$A0 ; do we have a space?
CFA4- F0 12 BEQ $CFB8
CFA6- C9 8D CMP #$8D ; do we have a carriage return?
CFA8- D0 01 BNE $CFAB
CFAA- 60 RTS
CFAB- 20 A7 FF JSR $FFA7 F8ROM:GETNUM
CFAE- C9 93 CMP #$93
CFB0- D0 E5 BNE $CF97
CFB2- 8A TXA
CFB3- F0 E2 BEQ $CF97
CFB5- 20 78 FE JSR $FE78
CFB8- A9 03 LDA #$03
CFBA- 85 3D STA $3D
CFBC- 20 13 FF JSR $FF13
CFBF- 0A ASL
CFC0- E9 BE SBC #$BE
CFC2- C9 C2 CMP #$C2
CFC4- 90 D1 BCC $CF97
CFC6- 0A ASL
CFC7- 0A ASL
CFC8- A2 04 LDX #$04
CFCA- 0A ASL
CFCB- 26 42 ROL $42
CFCD- 26 43 ROL $43
CFCF- CA DEX
CFD0- 10 F8 BPL $CFCA
CFD2- C6 3D DEC $3D
CFD4- F0 F4 BEQ $CFCA
CFD6- 10 E4 BPL $CFBC
CFD8- A2 05 LDX #$05
CFDA- 20 C8 C4 JSR $C4C8
CFDD- A5 44 LDA $44
CFDF- 0A ASL
CFE0- 0A ASL
CFE1- 05 35 ORA $35
CFE3- C9 20 CMP #$20
CFE5- B0 06 BCS $CFED
CFE7- A6 35 LDX $35
CFE9- F0 02 BEQ $CFED
CFEB- 09 80 ORA #$80
CFED- 85 44 STA $44
CFEF- 84 34 STY $34
CFF1- B9 00 02 LDA $0200,Y ; read input buffer at Y
CFF4- C9 BB CMP #$BB ; do we have a semi-colon?
CFF6- F0 04 BEQ $CFFC
CFF8- C9 8D CMP #$8D ; do we have a carriage return?
CFFA- D0 B4 BNE $CFB0
CFFC- 4C 6B CF JMP $CF6B
CFFF- 00 BRK
Antoine Vignau
2018-01-23 21:56:34 UTC
Permalink
Why disassemble some code I gave the original source code of?
av
f***@hotmail.com
2018-01-23 22:21:17 UTC
Permalink
Post by Antoine Vignau
Why disassemble some code I gave the original source code of?
av
Thanks for the reply Antoine. I would be very interested to see the source! I'm not sure where to find it, though. Looked on your site but didn't see anything that seemed relevant.

Frank
Antoine Vignau
2018-01-24 05:41:04 UTC
Permalink
Post by f***@hotmail.com
Post by Antoine Vignau
Why disassemble some code I gave the original source code of?
av
Thanks for the reply Antoine. I would be very interested to see the source! I'm not sure where to find it, though. Looked on your site but didn't see anything that seemed relevant.
Frank
Sorry Frank, I thought the link was in that thread but it is not.
You can find the IIe and IIc firmware source code at http://www.brutaldeluxe.fr/public/appleiieiicfirmwaresourcecode.zip

Antoine
f***@hotmail.com
2018-01-24 21:02:24 UTC
Permalink
Great resource!! Thank you. That answers a ton of questions.

Looks like I'm staring at the mini-assembler code and not the 80-col I/O routines which are in "PASCAL", and use a screen hole to store keystrokes. :)

F
MG
2018-01-25 08:36:31 UTC
Permalink
Post by f***@hotmail.com
Further, the $C300 call uses 10 different screen hole locations to store data while it's running. Can only assume those get used while the card is initializing, and are unneeded after.
That is a bad assumption that is countered by the Apple IIe Technical Reference Manual. For instance, $57B has the cursor horizontal position in 80-column mode.

http://www.applelogic.org/files/AIIETECHREF4.pdf

MG
Brian Patrie
2018-01-19 13:43:49 UTC
Permalink
Post by f***@hotmail.com
Well just hitting the following switch works I guess...
STA $C00D ; setup 80-column firmware
But not on an unenhanced IIe.
f***@hotmail.com
2018-01-19 22:23:49 UTC
Permalink
Post by Brian Patrie
Post by f***@hotmail.com
Well just hitting the following switch works I guess...
STA $C00D ; setup 80-column firmware
But not on an unenhanced IIe.
I'd be curious to know how ProDOS 2.4.2 handles this on the ][+ with a videx or an unenhanced IIe. The regular 80-col firmware hits $C00D at $C81B.

Does the videx allow double-lores graphics mode?

F
I am Rob
2018-01-19 23:36:46 UTC
Permalink
Post by f***@hotmail.com
Post by Brian Patrie
Post by f***@hotmail.com
Well just hitting the following switch works I guess...
STA $C00D ; setup 80-column firmware
But not on an unenhanced IIe.
I'd be curious to know how ProDOS 2.4.2 handles this on the ][+ with a videx or an unenhanced IIe. The regular 80-col firmware hits $C00D at $C81B.
Does the videx allow double-lores graphics mode?
F
No. From what I could see of the videx code, it just displays text. It uses 3 data latches to store values. One for the htab, one for vtab and one for the character.
Brian Patrie
2018-01-16 10:13:22 UTC
Permalink
Post by f***@hotmail.com
I'm having trouble turning on and off the 80-column firmware within my machine language programs. The ProDOS 8 tech ref suggests this will work to turn the firmware off...
LDA #$15 ;Character that turns off video firmware
JSR $C300 ;Print it to the video firmware
It doesn't work. $C300 will start 80-column mode but disconnects ProDOS and messes up some vectors so that TRACE is on when you return to applesoft.
Why not send that $15 to COUT ($FDED)?
(That's how $C300 & $C307 expect to be called--not directly.)
f***@hotmail.com
2018-01-16 15:53:53 UTC
Permalink
Post by f***@hotmail.com
LDA #$15 ;Character that turns off video firmware
JSR $C300 ;Print it to the video firmware
That's verbatim from the Prodos 8 tech ref (page 99). It does work to start 80-column mode but disconnects prodos.


I tried the following which just prints a inverse "U".

LDA #$14
JSR $FDED
RTS
Brian Patrie
2018-01-17 08:55:23 UTC
Permalink
Post by f***@hotmail.com
Post by f***@hotmail.com
LDA #$15 ;Character that turns off video firmware
JSR $C300 ;Print it to the video firmware
That's verbatim from the Prodos 8 tech ref (page 99).
It does work to start 80-column mode but disconnects prodos.
I tried the following which just prints a inverse "U".
LDA #$14
JSR $FDED
RTS
I forgot myself for a moment. It should be #$95--high bit set.
(You could also JMP $FDED, and forego the RTS.)
f***@hotmail.com
2018-01-17 09:27:12 UTC
Permalink
All of these methods with JSR $C300 disconnect ProDOS (as the tech ref states). By pointing to the correct I/O vectors now it works! You can run a CAT after calling $C300. Actually more than I needed, but good to know what it's really doing.




CALL-151
!
300:JSR $C300 ; Frank's ProDOS PR#3
LDA #$5B ; change I/O vectors
STA $36
LDA #$B8 ; to 80-col card
STA $37
LDA #$5E ; (zero page)
STA $38
LDA #$B8
STA $39
LDA #$07 ; change I/O vectors
STA $BE30
LDA #$C3 ; to 80-col card
STA $BE31
LDA #$05 ; (ProDOS)
STA $BE32
LDA #$C3
STA $BE33
JSR $FC58 ; clear screen
RTS
Tom Porter
2018-01-17 14:10:54 UTC
Permalink
I had great difficulty doing this with my Idiot Compiler... but I finally managed to get PR#3 working, this is what I used...

JSR 49920
JSR 64600
JSR 1002 (This is done under DOS, not sure about Prodos

I would post the 40Col switch, but it doesn't seem to work now,
its really odd, I could have sworn it was working at one point...
(BIT 49164- JSR 64600)... -Tom
Tom Porter
2018-01-17 14:26:40 UTC
Permalink
I looked (way) back into early compiler code, I was trying to be clever but I guess I wasn't...

PR#0

LDA #0
STA 49164
JSR 64600
f***@hotmail.com
2018-01-17 15:37:32 UTC
Permalink
This is for ProDOS only.


IICSWITCH = PEEK(49248)

I thought the switch was never actually used in a program, but i scanned Merlin and sure enough it polls the switch and sets the display mode accordingly.
I am Rob
2018-01-17 16:51:37 UTC
Permalink
Post by f***@hotmail.com
All of these methods with JSR $C300 disconnect ProDOS (as the tech ref states). By pointing to the correct I/O vectors now it works! You can run a CAT after calling $C300. Actually more than I needed, but good to know what it's really doing.
CALL-151
!
300:JSR $C300 ; Frank's ProDOS PR#3
LDA #$5B ; change I/O vectors
STA $36
LDA #$B8 ; to 80-col card
STA $37
LDA #$5E ; (zero page)
STA $38
LDA #$B8
STA $39
LDA #$07 ; change I/O vectors
STA $BE30
LDA #$C3 ; to 80-col card
STA $BE31
LDA #$05 ; (ProDOS)
STA $BE32
LDA #$C3
STA $BE33
JSR $FC58 ; clear screen
RTS
I don't know how you got this working, there is nothing at the addressses $B85B and $B85E unless you put something there.

This is what you want

L0300 LDA #8E
JSR C300
LDX #03
L0307 LDA 36,X
STA BE30,X
LDA BE34,X
STA 36,X
DEX
BPL L0307
RTS
f***@hotmail.com
2018-01-17 19:24:56 UTC
Permalink
ProDOS must be loaded. I use 2.4.1 and can only guess it works in the others as well. The I/O vectors are listed in the ProDOS 8 tech ref.

Also, I looked at those vectors and can confirm you can't do it by copying from zero page. Here's how they change before and after $C300, and after reconnecting ProDOS using $BE00.


36:5b b8 5e b8 (40-col, PD connected)
36:07 c3 05 c3 (80-col, PD disconnected) - post JSR $C300
36:5b b8 5e b8 (80-col, PD connected) - post JSR $C300 & JMP $BE00

BE30:f0 fd 1b fd (40-col, PD connected)
BE30:f0 fd 1b fd (80-col, PD disconnected) - post JSR $C300
BE30:07 c3 05 c3 (80-col, PD connected) - post JSR $C300 & JMP $BE00


Looks like when it's properly connected the calls would run zero page-->ProDOS-->80-col card firmware.
I am Rob
2018-01-17 21:16:24 UTC
Permalink
Post by f***@hotmail.com
ProDOS must be loaded. I use 2.4.1 and can only guess it works in the others as well. The I/O vectors are listed in the ProDOS 8 tech ref.
Also, I looked at those vectors and can confirm you can't do it by copying from zero page. Here's how they change before and after $C300, and after reconnecting ProDOS using $BE00.
36:5b b8 5e b8 (40-col, PD connected)
36:07 c3 05 c3 (80-col, PD disconnected) - post JSR $C300
36:5b b8 5e b8 (80-col, PD connected) - post JSR $C300 & JMP $BE00
BE30:f0 fd 1b fd (40-col, PD connected)
BE30:f0 fd 1b fd (80-col, PD disconnected) - post JSR $C300
BE30:07 c3 05 c3 (80-col, PD connected) - post JSR $C300 & JMP $BE00
Looks like when it's properly connected the calls would run zero page-->ProDOS-->80-col card firmware.
The addresses you are using are Basic.systems pointers to the Prodos character intercepts and should not be used directly. These change with the version of Basic.system someone may have.

The correct way to get the input/ouput vectors is by reading them from $BE34.BE37. Yours says $B858. Another version of Basic.system will say something different, so to be compatible for everyone, use the code I posted earlier.

Also, read about the Basic.system global page in the Prodos reference manual. This may help with future programming efforts.
f***@hotmail.com
2018-01-17 21:59:46 UTC
Permalink
I think you mean this...

L0300 LDA #8E
JSR C300
LDX #03
L0307 LDA 36,X
STA BE34,X
LDA BE37,X
STA 36,X
DEX
BPL L0307
RTS


I suspected I was using the wrong vectors as the addresses didn't match. This seems to make more sense...

BE34:5b b8 5e b8 (40-col, PD connected)
BE34:5b b8 5e b8 (80-col, PD disconnected) - post JSR $C300
BE34:5b b8 5e b8 (80-col, PD connected) - post JSR $C300 & JMP $BE00


Wow. that was a lot of work to remove one line from my program :)

10 PRINT CHR$(4)"PR#3"

Frank
f***@hotmail.com
2018-01-17 22:22:29 UTC
Permalink
Nevermind, I see you have to update *both* sets of vectors. ugh
MG
2018-01-25 08:41:42 UTC
Permalink
Post by f***@hotmail.com
Hello All!
I'm having trouble turning on and off the 80-column firmware within my machine language programs. The ProDOS 8 tech ref suggests this will work to turn the firmware off...
LDA #$15 ;Character that turns off video firmware
JSR $C300 ;Print it to the video firmware
It doesn't work. $C300 will start 80-column mode but disconnects ProDOS and messes up some vectors so that TRACE is on when you return to applesoft.
OK, so lets pass it to the command buffer instead...
ORG $1000
LDA #$D0
STA $200
LDA #$D2
STA $201
LDA #$A3
STA $202
LDA #$B3
STA $203
LDA #$8D
STA $204
JSR $BE03 ; DOSCMD "PR#3<Return>"
It doesn't work.
I looked at some other programs like Bitsy Bye and noticed they don't do any calls to ProDOS and just hit some softswitches during their init routines (to turn things off).
STA $C00C ; Turn off 80-column Display
STA $C000 ; Turn off AUX memory mode
JSR $FE93 ; F8ROM:SETVID
JSR $FE89 ; F8ROM:SETKBD
JSR $FB2F ; Set TEXT mode
JSR $FC58 ; Clear screen (HOME)
OK seems good but doesn't exit cleanly back to BASIC unless I call PR#3 before running my ML routine. The initial $c300 call messes up the vectors.
I would like to start 80 col in ML, run my program, and then have it exit cleanly back to BASIC in 40 column mode. What am I doing wrong here?
Frank
I know I am a late arrival to this thread, but personally I would use the Pascal interface as it does not do anything with the CSW/KSW vectors and switching it off is as simple as "stop using it and set the soft switches to their 40-column conditions."

A complete solution would check to see if the 80-column card is already in use and make sure to re-initialize it with an LDA #$00 JSR $C300 if it was, followed by a JMP $3D0 to get back to whatever DOS was running, if you insist on having your program not be a SYS file in its own right.

MG
f***@hotmail.com
2018-01-26 21:26:14 UTC
Permalink
I read this and didn't want to rework the code *another* time, preferring to just finish implementing the rest of the features I want. Then I tried my code out on a //c and it didn't work. The send '$15 to $FDED' left everything in 80-col mode with the windows width settings scrambled.

Just wrote a version only hitting the C00C/C00D switches and removing all this ProDOS hook stuff and it works great, so thanks for chiming in! I guess I assumed I had to use JSR $C300.

Frank
Post by MG
I know I am a late arrival to this thread, but personally I would use the Pascal interface as it does not do anything with the CSW/KSW vectors and switching it off is as simple as "stop using it and set the soft switches to their 40-column conditions."
A complete solution would check to see if the 80-column card is already in use and make sure to re-initialize it with an LDA #$00 JSR $C300 if it was, followed by a JMP $3D0 to get back to whatever DOS was running, if you insist on having your program not be a SYS file in its own right.
MG
f***@hotmail.com
2018-01-26 21:41:08 UTC
Permalink
Avoiding ProDOS also cleans up some other problems I was having with the Floppy Emu on my //c.
Loading...