Discussion:
CALL -151 disconnects DOS?
(too old to reply)
Jorge
2017-07-27 13:08:34 UTC
Permalink
Raw Message
Why does a CALL -151 from basic disconnect DOS (*) ? I want a "hello" program that jumps into the monitor and does not disconnect DOS, how can I do it?

(*) try this:

NEW
10 CALL -151
RUN
CATALOG
(nothing)
3D0G
]

Grrrr.
Michael 'AppleWin Debugger Dev'
2017-07-27 15:26:02 UTC
Permalink
Raw Message
Hmm, under ProDOS the CSW and KSW are still the same ...

]CALL-151

*36.39
0036- 5B B8
0038- 5E B8
*3D0G
]RUN

*36.39
0036- 5B B8
0038- 5E B8


and under DOS 3.3 as well...

]CALL-151

*36.39

0036- BD 9E
0038- 81 9E
*3D0G

]RUN

*36.39

0036- BD 9E
0038- 81 9E


Applesoft CALL is at $F1D5
http://jamtronix.com/files/applesoft.html#CALL

1D5- 20 67 DD CALL JSR FRMNUM EVALUATE EXPRESSION FOR CALL ADDRESS
F1D8- 20 52 E7 JSR GETADR CONVERT EXPRESSION TO 16-BIT INTEGER
F1DB- 6C 50 00 JMP (LINNUM) IN LINNUM, AND JUMP THERE.
*--------------------------------

Curiouser and curiouser ...
Anthony Ortiz
2017-07-27 16:24:23 UTC
Permalink
Raw Message
Post by Jorge
Why does a CALL -151 from basic disconnect DOS (*) ? I want a "hello" program that jumps into the monitor and does not disconnect DOS, how can I do it?
NEW
10 CALL -151
RUN
CATALOG
(nothing)
3D0G
]
Grrrr.
Wait a sec, if you run that you will be in the monitor, but then you type in CATALOG into the monitor?
Michael 'AppleWin Debugger Dev'
2017-07-27 16:26:32 UTC
Permalink
Raw Message
Post by Anthony Ortiz
Wait a sec, if you run that you will be in the monitor, but then you type in CATALOG into the monitor?
Yes, that is Jorge is doing -- and this is perfectly fine.

i.e.

]CALL-151
*CATALOG

The OP is asking the question -- why does doing it programmatically not work which is an interesting question!
Anthony Ortiz
2017-07-27 17:00:28 UTC
Permalink
Raw Message
Post by Michael 'AppleWin Debugger Dev'
Post by Anthony Ortiz
Wait a sec, if you run that you will be in the monitor, but then you type in CATALOG into the monitor?
Yes, that is Jorge is doing -- and this is perfectly fine.
i.e.
]CALL-151
*CATALOG
The OP is asking the question -- why does doing it programmatically not work which is an interesting question!
I didn't know you could execute dos commands from the monitor; is the asterisk needed for that?
qkumba
2017-07-27 17:09:28 UTC
Permalink
Raw Message
Because
A669:LDX $33
A66B:CPX #$DD ;']'
A66D:BEQ $A676
A66F:PLA
A670:CLC
A671:RTS

wrong prompt, no DOS support.
qkumba
2017-07-27 17:12:30 UTC
Permalink
Raw Message
And just before that:

A664:LDX $76 ;immediate mode?
A666:INX
A667:BEQ $A672 ;yes, don't check the prompt

which is why it works when a program is not running.
Jorge
2017-07-27 17:35:58 UTC
Permalink
Raw Message
Post by qkumba
A664:LDX $76 ;immediate mode?
A666:INX
A667:BEQ $A672 ;yes, don't check the prompt
which is why it works when a program is not running.
Yesss, it makes sense! So technically the Applesoft program is "still running" while in the monitor... wahaha, that's cool!

And is there an easy way to exit the system monitor to resume the basic program? Not that I need for anything, just for fun :-)
--
Jorge.
Jorge
2017-07-27 17:39:03 UTC
Permalink
Raw Message
Post by Jorge
Post by qkumba
A664:LDX $76 ;immediate mode?
A666:INX
A667:BEQ $A672 ;yes, don't check the prompt
which is why it works when a program is not running.
Yesss, it makes sense! So technically the Applesoft program is "still running" while in the monitor... wahaha, that's cool!
And is there an easy way to exit the system monitor to resume the basic program? Not that I need for anything, just for fun :-)
I don't have my Apple II here now to try, but... can somebody see if (as the program is still running) does a CTRL-D CATALOG work?
--
Jorge.
Michael 'AppleWin Debugger Dev'
2017-07-27 17:49:42 UTC
Permalink
Raw Message
Patch to make DOS 3.3 work from monitor when Applesoft running:

A664:EA A2 00
Post by Jorge
is there an easy way to exit the system monitor to resume the basic program?
D7D2G

to continue execution. NEWSTT = $D7D2
Michael 'AppleWin Debugger Dev'
2017-07-27 17:56:43 UTC
Permalink
Raw Message
Smaller patch to fix DOS 3.3:

A664:D0 10
Jorge
2017-07-27 21:09:07 UTC
Permalink
Raw Message
Post by Michael 'AppleWin Debugger Dev'
A664:D0 10
But that somehow breaks the DOS. For example this "hello":

NEW

10C$=CHR$(13):D$=C$+CHR$(4)
20?D$"OPENT"D$"WRITET"C$"CALL-151"D$"CLOSET"D$"EXECT"
30?"END"

SAVE TEST
RUN TEST

END

]

*CATALOG
(works)


Takes you to the monitor though the EXEC T, buuut, with the patch you propose it gives a "NOT DIRECT COMMAND" error.

?
--
Jorge.
g***@sasktel.net
2017-07-28 05:58:07 UTC
Permalink
Raw Message
Post by Jorge
Post by Michael 'AppleWin Debugger Dev'
A664:D0 10
NEW
10C$=CHR$(13):D$=C$+CHR$(4)
20?D$"OPENT"D$"WRITET"C$"CALL-151"D$"CLOSET"D$"EXECT"
30?"END"
SAVE TEST
RUN TEST
END
]
*CATALOG
(works)
Takes you to the monitor though the EXEC T, buuut, with the patch you propose it gives a "NOT DIRECT COMMAND" error.
?
--
Jorge.
The answer is in one of the NIbble magazines that allows DOS commands to be executed in immediate mode. IIRC, it has something to do with POKE 51,0
Jorge
2017-07-27 22:36:59 UTC
Permalink
Raw Message
Post by Michael 'AppleWin Debugger Dev'
Post by Jorge
is there an easy way to exit the system monitor to resume the basic program?
D7D2G
to continue execution. NEWSTT = $D7D2
That works fine, cool, thanks! What's "NEWSTT"? But I wonder if doing it that way, isn't it leaving orphaned a return address on the stack? I mean, surely a CALL (usually) ends via an RTS... or not?
--
Jorge.
Michael 'AppleWin Debugger Dev'
2017-07-27 23:00:08 UTC
Permalink
Raw Message
Post by Jorge
What's "NEWSTT"?
NEWSTT = (assembly) label for Next/New Statement. Read the source, Luke.

http://jamtronix.com/files/applesoft.html#NEWSTT

*--------------------------------
* PERFORM NEXT STATEMENT
*--------------------------------
D7D2- BA NEWSTT TSX REMEMBER THE STACK POSITION
D7D3- 86 F8 STX REMSTK

Or see Microsoft's original assembly
http://www.pagetable.com/docs/M6502.MAC.txt

NEWSTT
WHENEVER A STATEMENT FINISHES EXECUTION IT
DOES A "RTS" WHICH TAKES
EXECUTION BACK TO "NEWSTT". STATEMENTS THAT
CREATE OR LOOK AT SEMI-PERMANENT STACK ENTRIES
MUST GET RID OF THE RETURN ADDRESS OF "NEWSTT" AND
JMP TO "NEWSTT" WHEN DONE. "NEWSTT" ALWAYS
CHRGETS THE FIRST CHARACTER AFTER THE STATEMENT
NAME BEFORE DISPATCHING. WHEN RETURNING
BACK TO "NEWSTT" THE ONLY THING THAT
MUST BE SET UP IS THE TEXT POINTER IN
"TXTPTR". "NEWSTT" WILL CHECK TO MAKE SURE
"TXTPTR" IS POINTING TO A STATEMENT TERMINATOR.
IF A STATEMENT SHOULDN'T BE PERFORMED UNLESS
IT IS PROPERLY FORMATTED (I.E. "NEW") IT CAN
SIMPLY DO A RETURN AFTER READING ALL OF
ITS ARGUMENTS. SINCE THE ZERO FLAG
BEING OFF INDICATES THERE IS NOT
A STATEMENT TERMINATOR "NEWSTT" WILL
DO THE JMP TO THE "SYNTAX ERROR"
ROUTINE. IF A STATEMENT SHOULD BE STARTED
OVER IT CAN DO LDWD OLDTXT, STWD TXTPTR RTS SINCE THE TEXT PNTR
AT "NEWSTT" IS ALWAYS STORED IN "OLDTXT".
THE ^C CODE STORES [CURLIN] (THE
CURRENT LINE NUMBER) IN "OLDLIN" SINCE THE ^C CHECK
IS MADE BEFORE THE STATEMENT POINTED TO IS
EXECUTED. "STOP" AND "END" STORE THE TEXT POINTER
FROM "TXTPTR", WHICH POINTS AT THEIR TERMINATING
CHARACTER, IN "OLDTXT".
Jorge
2017-07-27 23:46:58 UTC
Permalink
Raw Message
Post by Michael 'AppleWin Debugger Dev'
Post by Jorge
What's "NEWSTT"?
NEWSTT = (assembly) label for Next/New Statement. Read the source, Luke.
http://jamtronix.com/files/applesoft.html#NEWSTT
*--------------------------------
* PERFORM NEXT STATEMENT
*--------------------------------
D7D2- BA NEWSTT TSX REMEMBER THE STACK POSITION
D7D3- 86 F8 STX REMSTK
Or see Microsoft's original assembly
http://www.pagetable.com/docs/M6502.MAC.txt
NEWSTT
WHENEVER A STATEMENT FINISHES EXECUTION IT
DOES A "RTS" WHICH TAKES
EXECUTION BACK TO "NEWSTT". STATEMENTS THAT
CREATE OR LOOK AT SEMI-PERMANENT STACK ENTRIES
MUST GET RID OF THE RETURN ADDRESS OF "NEWSTT" AND
JMP TO "NEWSTT" WHEN DONE. "NEWSTT" ALWAYS
CHRGETS THE FIRST CHARACTER AFTER THE STATEMENT
NAME BEFORE DISPATCHING. WHEN RETURNING
BACK TO "NEWSTT" THE ONLY THING THAT
MUST BE SET UP IS THE TEXT POINTER IN
"TXTPTR". "NEWSTT" WILL CHECK TO MAKE SURE
"TXTPTR" IS POINTING TO A STATEMENT TERMINATOR.
IF A STATEMENT SHOULDN'T BE PERFORMED UNLESS
IT IS PROPERLY FORMATTED (I.E. "NEW") IT CAN
SIMPLY DO A RETURN AFTER READING ALL OF
ITS ARGUMENTS. SINCE THE ZERO FLAG
BEING OFF INDICATES THERE IS NOT
A STATEMENT TERMINATOR "NEWSTT" WILL
DO THE JMP TO THE "SYNTAX ERROR"
ROUTINE. IF A STATEMENT SHOULD BE STARTED
OVER IT CAN DO LDWD OLDTXT, STWD TXTPTR RTS SINCE THE TEXT PNTR
AT "NEWSTT" IS ALWAYS STORED IN "OLDTXT".
THE ^C CODE STORES [CURLIN] (THE
CURRENT LINE NUMBER) IN "OLDLIN" SINCE THE ^C CHECK
IS MADE BEFORE THE STATEMENT POINTED TO IS
EXECUTED. "STOP" AND "END" STORE THE TEXT POINTER
FROM "TXTPTR", WHICH POINTS AT THEIR TERMINATING
CHARACTER, IN "OLDTXT".
NEW
10CALL-151:?"HI":GOTO10
RUN

* CTRL-E

A=98 X=87 Y=D8 P=00 S=B7
*D7D2G
HI

* CTRL-E

A=98 X=87 Y=D8 P=00 S=B7
*D7D2G
HI

* CTRL-E

A=98 X=87 Y=D8 P=00 S=B7
*D7D2G
HI

* CTRL-E

A=98 X=87 Y=D8 P=00 S=B7
*

And the stack is, indeed, well and good. Thanks!
--
Jorge.
Jorge
2017-07-28 00:38:09 UTC
Permalink
Raw Message
Post by Jorge
And the stack is, indeed, well and good.
Or perhaps not because...

NEW
10CALL8192:GOTO10

2000L
2000- BA TSX
2001- 20 44 F9 JSR $F944
2004- 4C D2 D7 JMP $D7D2

RUN

F6F4F2F0EEECEAE8E6E4E2E0DEDCDAD8D6D4D2D0
CECCCAC8C6C4C2C0BEBCBAB8B6B4B2B0AEACAAA8
A6A4A2A09E9C9A98969492908E8C8A8886848280
7E7C7A78767472706E6C6A68666462605E5C5A58
565452504E4C4A4846444240
?OUT OF MEMORY ERROR IN 10
]

But:

2000L
2000- BA TSX
2001- 20 44 F9 JSR $F944
2004- 60 RTS

RUN

Runs forever...
Jorge
2017-07-28 00:50:15 UTC
Permalink
Raw Message
Post by Jorge
Post by Jorge
And the stack is, indeed, well and good.
Or perhaps not because...
NEW
10CALL8192:GOTO10
2000L
2000- BA TSX
2001- 20 44 F9 JSR $F944
2004- 4C D2 D7 JMP $D7D2
RUN
F6F4F2F0EEECEAE8E6E4E2E0DEDCDAD8D6D4D2D0
CECCCAC8C6C4C2C0BEBCBAB8B6B4B2B0AEACAAA8
A6A4A2A09E9C9A98969492908E8C8A8886848280
7E7C7A78767472706E6C6A68666462605E5C5A58
565452504E4C4A4846444240
?OUT OF MEMORY ERROR IN 10
]
2000L
2000- BA TSX
2001- 20 44 F9 JSR $F944
2004- 60 RTS
RUN
Runs forever...
The moral of which is... can't trust the monitor's CTRL-E? Or what? ISTR something was wrong with it... but was it the S register? IDK...
Jorge
2017-07-28 02:31:53 UTC
Permalink
Raw Message
Post by Jorge
Post by Jorge
Post by Jorge
And the stack is, indeed, well and good.
Or perhaps not because...
NEW
10CALL8192:GOTO10
2000L
2000- BA TSX
2001- 20 44 F9 JSR $F944
2004- 4C D2 D7 JMP $D7D2
RUN
F6F4F2F0EEECEAE8E6E4E2E0DEDCDAD8D6D4D2D0
CECCCAC8C6C4C2C0BEBCBAB8B6B4B2B0AEACAAA8
A6A4A2A09E9C9A98969492908E8C8A8886848280
7E7C7A78767472706E6C6A68666462605E5C5A58
565452504E4C4A4846444240
?OUT OF MEMORY ERROR IN 10
]
2000L
2000- BA TSX
2001- 20 44 F9 JSR $F944
2004- 60 RTS
RUN
Runs forever...
The moral of which is... can't trust the monitor's CTRL-E? Or what? ISTR something was wrong with it... but was it the S register? IDK...
Look, this Beagle Bros poster has an example, the last one on the bottom right, "scan input buffer" that uses the same mechanism to resume execution (it jumps to $D823 which is a JMP $D7D2)... and it also gives an out of memory error if ran in a loop. Huh!

http://beagle.applearchives.com/Posters/Poster%203.pdf

10 A$ = "300:A9 C1 20 ED FD 18 69 01 C9 DB D0 F6 60 300G D823G"
20 FOR X = 1 TO LEN (A$): POKE 511 + X, ASC ( MID$ (A$,X,1)) + 128: NEXT
30 POKE 72,0: CALL - 144
40 GOTO 30
--
Jorge.
Brian Patrie
2017-07-28 06:24:48 UTC
Permalink
Raw Message
Post by Jorge
Look, this Beagle Bros poster has an example, the last one on the
bottom right, "scan input buffer" that uses the same mechanism to
resume execution (it jumps to $D823 which is a JMP $D7D2)...
and it also gives an out of memory error if ran in a loop. Huh!
http://beagle.applearchives.com/Posters/Poster%203.pdf
10 A$ = "300:A9 C1 20 ED FD 18 69 01 C9 DB D0 F6 60 300G D823G"
20 FOR X = 1 TO LEN (A$): POKE 511 + X, ASC(MID$(A$,X,1))+128:NEXT
30 POKE 72,0: CALL - 144
40 GOTO 30
Somewhere i picked up F328G, which does

LDX $DF
TXS
JMP $D7D2

and doesn't appear to leak stack.
Jorge
2017-07-28 09:07:45 UTC
Permalink
Raw Message
Post by Brian Patrie
Post by Jorge
Look, this Beagle Bros poster has an example, the last one on the
bottom right, "scan input buffer" that uses the same mechanism to
resume execution (it jumps to $D823 which is a JMP $D7D2)...
and it also gives an out of memory error if ran in a loop. Huh!
http://beagle.applearchives.com/Posters/Poster%203.pdf
10 A$ = "300:A9 C1 20 ED FD 18 69 01 C9 DB D0 F6 60 300G D823G"
20 FOR X = 1 TO LEN (A$): POKE 511 + X, ASC(MID$(A$,X,1))+128:NEXT
30 POKE 72,0: CALL - 144
40 GOTO 30
Somewhere i picked up F328G, which does
LDX $DF
TXS
JMP $D7D2
and doesn't appear to leak stack.
Doesn't leak but resets S to some wrong value:

10CALL8192:?" ";:GOTO10

2000L

2000- BA TSX
2001- 20 44 F9 JSR $F944
2004- A6 DF LDX $DF
2006- 20 44 F9 JSR $F944
2009- 68 PLA
200A- 68 PLA
200B- 4C D2 D7 JMP $D7D2

RUN

F600 F600 F600 F600 F600 F600...
--
Jorge.
Brian Patrie
2017-07-29 09:42:53 UTC
Permalink
Raw Message
Post by Jorge
Post by Brian Patrie
Post by Jorge
Look, this Beagle Bros poster has an example, the last one on the
bottom right, "scan input buffer" that uses the same mechanism to
resume execution (it jumps to $D823 which is a JMP $D7D2)...
and it also gives an out of memory error if ran in a loop. Huh!
http://beagle.applearchives.com/Posters/Poster%203.pdf
10 A$ = "300:A9 C1 20 ED FD 18 69 01 C9 DB D0 F6 60 300G D823G"
20 FOR X = 1 TO LEN (A$): POKE 511 + X, ASC(MID$(A$,X,1))+128:NEXT
30 POKE 72,0: CALL - 144
40 GOTO 30
Somewhere i picked up F328G, which does
LDX $DF
TXS
JMP $D7D2
and doesn't appear to leak stack.
10CALL8192:?" ";:GOTO10
2000L
2000- BA TSX
2001- 20 44 F9 JSR $F944
2004- A6 DF LDX $DF
2006- 20 44 F9 JSR $F944
2009- 68 PLA
200A- 68 PLA
200B- 4C D2 D7 JMP $D7D2
RUN
F600 F600 F600 F600 F600 F600...
According to the symbol table that comes with AppleWin, $DF is ERRSTK.
It doesn't seem to be a wrong value, as RETURN is successful after using
F328G to return from the Monitor--which is not true of using D7D2G or D823G.

Oh, i found where i got this entry point:
http://www.llx.com/~nparker/a2/shlam.html
(There is a warning, there, about using it inside an error trap.)
Jorge
2017-07-29 14:35:39 UTC
Permalink
Raw Message
Post by Brian Patrie
Post by Jorge
Post by Brian Patrie
Post by Jorge
Look, this Beagle Bros poster has an example, the last one on the
bottom right, "scan input buffer" that uses the same mechanism to
resume execution (it jumps to $D823 which is a JMP $D7D2)...
and it also gives an out of memory error if ran in a loop. Huh!
http://beagle.applearchives.com/Posters/Poster%203.pdf
10 A$ = "300:A9 C1 20 ED FD 18 69 01 C9 DB D0 F6 60 300G D823G"
20 FOR X = 1 TO LEN (A$): POKE 511 + X, ASC(MID$(A$,X,1))+128:NEXT
30 POKE 72,0: CALL - 144
40 GOTO 30
Somewhere i picked up F328G, which does
LDX $DF
TXS
JMP $D7D2
and doesn't appear to leak stack.
10CALL8192:?" ";:GOTO10
2000L
2000- BA TSX
2001- 20 44 F9 JSR $F944
2004- A6 DF LDX $DF
2006- 20 44 F9 JSR $F944
2009- 68 PLA
200A- 68 PLA
200B- 4C D2 D7 JMP $D7D2
RUN
F600 F600 F600 F600 F600 F600...
According to the symbol table that comes with AppleWin, $DF is ERRSTK.
It doesn't seem to be a wrong value, as RETURN is successful after using
F328G to return from the Monitor--which is not true of using D7D2G or D823G.
http://www.llx.com/~nparker/a2/shlam.html
(There is a warning, there, about using it inside an error trap.)
No no, ERRSTK is not for this. You can't poke some random value into the stack pointer as if nothing and pretend that everything will be fine...

Look:

*2000L

2000- A6 DF LDX $DF
2002- 9A TXS
2003- 4C D2 D7 JMP $D7D2

NEW
10CALL8192:?"1";:GOSUB20:GOTO10
20CALL8192:?"2":RETURN

RUN

?RETURN WITHOUT GOSUB ERROR IN 20

See why?
Jorge
2017-07-29 15:01:47 UTC
Permalink
Raw Message
Post by Brian Patrie
Post by Jorge
Post by Brian Patrie
Post by Jorge
Look, this Beagle Bros poster has an example, the last one on the
bottom right, "scan input buffer" that uses the same mechanism to
resume execution (it jumps to $D823 which is a JMP $D7D2)...
and it also gives an out of memory error if ran in a loop. Huh!
http://beagle.applearchives.com/Posters/Poster%203.pdf
10 A$ = "300:A9 C1 20 ED FD 18 69 01 C9 DB D0 F6 60 300G D823G"
20 FOR X = 1 TO LEN (A$): POKE 511 + X, ASC(MID$(A$,X,1))+128:NEXT
30 POKE 72,0: CALL - 144
40 GOTO 30
Somewhere i picked up F328G, which does
LDX $DF
TXS
JMP $D7D2
and doesn't appear to leak stack.
10CALL8192:?" ";:GOTO10
2000L
2000- BA TSX
2001- 20 44 F9 JSR $F944
2004- A6 DF LDX $DF
2006- 20 44 F9 JSR $F944
2009- 68 PLA
200A- 68 PLA
200B- 4C D2 D7 JMP $D7D2
RUN
F600 F600 F600 F600 F600 F600...
According to the symbol table that comes with AppleWin, $DF is ERRSTK.
It doesn't seem to be a wrong value, as RETURN is successful after using
F328G to return from the Monitor--which is not true of using D7D2G or D823G.
http://www.llx.com/~nparker/a2/shlam.html
(There is a warning, there, about using it inside an error trap.)
I think the problem is that there's a typo in

http://www.llx.com/~nparker/a2/shlam.html

Instead of LDX $DF it should be LDX $F8, then yes it all makes sense because it says "Applesoft saves the stack pointer in memory location 248 ($F8) at the beginning of every statement, and copies it to location 223 ($DF) whenever an error is trapped by ONERR GOTO"

!

So that one can "RTS" by restoring S from $F8 and JMPing to $D7D2 regardless of whatever else garbage got pushed onto the stack in the meantime.

2000L

2000- A6 F8 LDX $F8
2002- 9A TXS
2003- 4C D2 D7 JMP $D7D2

NEW
10CALL8192:?"1";:GOSUB20:GOTO10
20CALL8192:?"2":RETURN

RUN

12
12
12
12
...(forever)

Now, yes!
--
Jorge.
Brian Patrie
2017-07-31 00:45:47 UTC
Permalink
Raw Message
Post by Jorge
Post by Brian Patrie
According to the symbol table that comes with AppleWin, $DF is ERRSTK.
It doesn't seem to be a wrong value, as RETURN is successful after using
F328G to return from the Monitor--which is not true of using D7D2G or D823G.
http://www.llx.com/~nparker/a2/shlam.html
(There is a warning, there, about using it inside an error trap.)
I think the problem is that there's a typo in
http://www.llx.com/~nparker/a2/shlam.html
Instead of LDX $DF it should be LDX $F8, then yes it all makes sense because it says "Applesoft saves the stack pointer in memory location 248 ($F8) at the beginning of every statement, and copies it to location 223 ($DF) whenever an error is trapped by ONERR GOTO"
!
So that one can "RTS" by restoring S from $F8 and JMPing to $D7D2 regardless of whatever else garbage got pushed onto the stack in the meantime.
2000L
2000- A6 F8 LDX $F8
2002- 9A TXS
2003- 4C D2 D7 JMP $D7D2
Well, that's even better then.

10 C$ = "DF N F8 N 2FB:A6 F8 4C 2A F3 N 2FBG": GOSUB 50
20 GOTO 10
50 FOR C = 1 TO LEN(C$): POKE 511+C, ASC(MID$(C$,C))+128: NEXT
60 POKE 72,0: CALL - 144: RETURN

using

02FB- A6 F8 LDX $F8
02FD- 4C 2A F3 JMP $F32A

The fact that $DF & $F8 come up different leads me to puzzlement that
F328G has been working for me.
Post by Jorge
10CALL8192:?"1";:GOSUB20:GOTO10
20CALL8192:?"2":RETURN
RUN
12
12
12
12
....(forever)
Now, yes!
I prefer the System Monitor parser call test, as weird stack things
happen during it--especially on a IIgs. (In fact a call to a simple PLA
PLA RTS (which is available in ROM) is sufficient to return from the
Monitor on everything but the IIgs. (Damn you, Apple for throwing a
wrench in our works!))

Anyway, thanks for the refinement. :)
Jorge
2017-07-31 07:45:30 UTC
Permalink
Raw Message
Post by Brian Patrie
Anyway, thanks for the refinement. :)
Thank you too, that's been paleoentomology at its best... :-)
--
Jorge.
Jorge
2017-07-28 00:58:41 UTC
Permalink
Raw Message
Post by Michael 'AppleWin Debugger Dev'
Post by Jorge
What's "NEWSTT"?
NEWSTT = (assembly) label for Next/New Statement. Read the source, Luke.
http://jamtronix.com/files/applesoft.html#NEWSTT
*--------------------------------
* PERFORM NEXT STATEMENT
*--------------------------------
D7D2- BA NEWSTT TSX REMEMBER THE STACK POSITION
D7D3- 86 F8 STX REMSTK
Or see Microsoft's original assembly
http://www.pagetable.com/docs/M6502.MAC.txt
NEWSTT
I find it astonishing that (almost) 40 years later there is somebody (you) who 1) cares at all about this and 2) is even able to locate the source code of Applesoft with urls and all... and 3) bothers to reply to my (useless) posts on the interwebs... LOL, amazing, simply amazing.

Thanks, I appreciate it.
Michael 'AppleWin Debugger Dev'
2017-07-28 04:08:42 UTC
Permalink
Raw Message
Well, we're Apple 2 fans. Fan stands for fanatic. :-)

I love figuring out how all this stuff works/worked.

It is a nice break from dealing with modern slow, bloated, and broken Operating Systems that take MB of RAM and GB of disk space.
TommyGoog
2017-07-28 07:53:30 UTC
Permalink
Raw Message
Post by Michael 'AppleWin Debugger Dev'
Well, we're Apple 2 fans. Fan stands for fanatic. :-)
I love figuring out how all this stuff works/worked.
And to think just yesterday I was looking at p. 83 of "Apple II Reference Manual" to see how CSW/KSW Switches work in relationship with the COUT routines!

Tommy
Jorge
2017-07-28 10:06:35 UTC
Permalink
Raw Message
Post by Michael 'AppleWin Debugger Dev'
Well, we're Apple 2 fans. Fan stands for fanatic. :-)
Shhhh, fan sounds much better :-)
Post by Michael 'AppleWin Debugger Dev'
I love figuring out how all this stuff works/worked.
It amazes me how people like Woz was able grasp it all so well so fast and at such an early stage of the µPs. It took me years to understand enough to try to follow their steps. He excelled at hardware, that's why we have to suffer Applesoft :-) Or perhaps it was so because a person alone can only do so much given that the days have just 24h.
Post by Michael 'AppleWin Debugger Dev'
It is a nice break from dealing with modern slow, bloated, and broken Operating Systems that take MB of RAM and GB of disk space.
But I miss a proper shell, malloc, free, threads (*) and `gcc file.c -o prgm`... makes it all soooo much easier!

(*)Since always I've been obssesed with making it run more than one thing at once, first with interrupts (God bless 1978 and the Mountain Hardware Apple Clock!) on the II, then, when I switched to the Mac (there were many things of the IBM PCs I could not stand), with the vertical retrace interrupts, it was not until many years later that the Mac had support for "tasks" (the term "thread" was not even used yet in 1992!) built into the OS, then came Linux with all its goodnesses.
James Davis
2017-07-29 01:29:20 UTC
Permalink
Raw Message
Post by Jorge
(*)Since always I've been obssesed with making it run more than one thing at once, first with interrupts (God bless 1978 and the Mountain Hardware Apple Clock!) on the II, then, when I switched to the Mac (there were many things of the IBM PCs I could not stand), with the vertical retrace interrupts, it was not until many years later that the Mac had support for "tasks" (the term "thread" was not even used yet in 1992!) built into the OS, then came Linux with all its goodnesses.
The term "thread" has been used in computing at least since the invention of the "Forth" programming language; and since the invention of sewing!
Michael 'AppleWin Debugger Dev'
2017-07-29 02:13:42 UTC
Permalink
Raw Message
Indeed. The term "Threaded Code" has been around since at LEAST 1973.
https://en.wikipedia.org/wiki/Threaded_code

Denis Ritchie used the term back in 1972
https://www.bell-labs.com/usr/dmr/www/chist.html
The B compiler on the PDP-7 did not generate machine instructions, but instead `threaded code' [Bell 72], an interpretive scheme in which the compiler's output consists of a sequence of addresses of code fragments that perform the elementary operations. The operations typically—in particular for B—act on a simple stack machine.
Michael 'AppleWin Debugger Dev'
2017-07-29 02:30:15 UTC
Permalink
Raw Message
Copy of the PDF where it mentions Forth compilers generated threaded code.

Threaded Code
James Bell, DEC
http://home.claranet.nl/users/mhx/Forth_Bell.pdf
Michael J. Mahon
2017-07-29 06:21:10 UTC
Permalink
Raw Message
Post by Michael 'AppleWin Debugger Dev'
Indeed. The term "Threaded Code" has been around since at LEAST 1973.
https://en.wikipedia.org/wiki/Threaded_code
Denis Ritchie used the term back in 1972
https://www.bell-labs.com/usr/dmr/www/chist.html
The B compiler on the PDP-7 did not generate machine instructions, but
instead `threaded code' [Bell 72], an interpretive scheme in which the
compiler's output consists of a sequence of addresses of code fragments
that perform the elementary operations. The operations typically—in
particular for B—act on a simple stack machine.
The term "threaded code" was created to describe an interpretive execution
methodology, not a concurrent execution approach.

The "threads" the OP refers to are lightweight processes which run
concurrently, as permitted by the thread scheduler.

The "lightweight" refers to the shared address space of a process's
threads, making a processor switch between threads much less expensive than
a full process switch, which involves changing PC, privilege, and address
space.

Clearly, this makes inter-thread communication much less onerous than
inter-process communication.
--
-michael - NadaNet 3.1 and AppleCrate II: http://michaeljmahon.com
Michael 'AppleWin Debugger Dev'
2017-07-29 14:39:15 UTC
Permalink
Raw Message
Right, I was just pointing out how "overloaded" the term "thread" has become. i.e. Are you talking about processes or execution?
Jorge
2017-07-29 14:37:54 UTC
Permalink
Raw Message
OMG
Oliver Schmidt
2017-08-01 08:14:44 UTC
Permalink
Raw Message
On Thu, 27 Jul 2017 10:12:30 -0700 (PDT), qkumba
Post by qkumba
A664:LDX $76 ;immediate mode?
A666:INX
A667:BEQ $A672 ;yes, don't check the prompt
which is why it works when a program is not running.
... and which is what makes
https://github.com/cc65/cc65/blob/master/libsrc/apple2/read.s#L22
necessary if you want the opposite: Making it _not_ work ;-)

Michael 'AppleWin Debugger Dev'
2017-07-27 17:42:47 UTC
Permalink
Raw Message
Thanks Peter!

DOS3.3 source code in question:

265E:48 206 TSTRUN PHA
265F:AD B6 2A 207 LDA ASIBSW ; GET AS/INT BASIC SWITCH
2662:F0 0E 208 BEQ TR1 ; BR IF INT
2664:A6 76 209 LDX $76 ;CHECK APPLESOFT RUN FLAG ; magic number
2666:E8 210 INX ;(NOT RUN=0 AFTER INCREMENT)
2667:F0 0D 211 BEQ NOTRUN ;IF SAYS RUNNING MAKE SURE WITH PROMPT.
2669:A6 33 212 LDX PROMPT ;TEST APPLESOFT RUNNING.
266B:E0 DD 213 CPX #']'+$80
266D:F0 07 214 BEQ NOTRUN ; BR IF NOT RUN
266F:68 215 TR0 PLA
2670:18 216 CLC ;INDICATE PROGRAM RUNNING
2671:60 217 RTS
218 TR1 EQU *
2672:A5 D9 219 LDA $D9 ; GET INT RUN FLAG ; magic nummer
2674:30 F9 220 BMI TR0 ; BR IF RUN
2676:68 221 NOTRUN PLA ;INDICATE PROGRAM NOT RUNNING
2677:38 222 SEC ; WITH CARRY SET.
2678:60 223 RTS
David Schmidt
2017-07-27 17:28:41 UTC
Permalink
Raw Message
Post by Anthony Ortiz
I didn't know you could execute dos commands from the monitor
You can! Get on an emulator, boot a DOS (or ProDOS) disk and try it out!
D Finnigan
2017-07-27 17:32:27 UTC
Permalink
Raw Message
Post by Anthony Ortiz
I didn't know you could execute dos commands from the monitor; is the
asterisk needed for that?
As long as (Pro)DOS still has the input vector, you can give it commands
from any command prompt.
--
]DF$
Apple II 40th Anniversary User's Guide:
http://macgui.com/newa2guide/
Jorge
2017-07-27 21:33:57 UTC
Permalink
Raw Message
Post by D Finnigan
As long as (Pro)DOS still has the input vector, you can give it commands
from any command prompt.
Not really, not always, that's the problem, see Michael's post above !

(the vectors are set properly but DOS is not working)
--
Jorge.
Michael 'AppleWin Debugger Dev'
2017-07-27 18:00:22 UTC
Permalink
Raw Message
No asterisk is needed -- I included the prompt output for completeness.:-)
Marco Verpelli
2017-07-27 17:57:22 UTC
Permalink
Raw Message
AppleWin 1.26.2.4 Apple //e enanched
ProDOS 2.0.3 Basic.System 1.5

]NEW
]10 CALL-151
]RUN
*CTRL-B
]CAT
NO BUFFERS AVAILABLE
]

I can hear Mel Allen screaming from the booth: how about that?

Marco
g***@sasktel.net
2017-07-27 19:15:28 UTC
Permalink
Raw Message
Post by Marco Verpelli
AppleWin 1.26.2.4 Apple //e enanched
ProDOS 2.0.3 Basic.System 1.5
]NEW
]10 CALL-151
]RUN
*CTRL-B
]CAT
NO BUFFERS AVAILABLE
]
I can hear Mel Allen screaming from the booth: how about that?
Marco
Try CTRL-C instead of CTRL-B
Marco Verpelli
2017-07-27 19:45:44 UTC
Permalink
Raw Message
Post by g***@sasktel.net
Post by Marco Verpelli
AppleWin 1.26.2.4 Apple //e enanched
ProDOS 2.0.3 Basic.System 1.5
]NEW
]10 CALL-151
]RUN
*CTRL-B
]CAT
NO BUFFERS AVAILABLE
]
I can hear Mel Allen screaming from the booth: how about that?
Marco
Try CTRL-C instead of CTRL-B
Yes, also CTRL-Y works. I just wanted to emphasize the danger of the CALL command.

Marco
Jorge
2017-07-27 21:39:38 UTC
Permalink
Raw Message
Post by Marco Verpelli
]NEW
]10 CALL-151
]RUN
*CTRL-B
]CAT
NO BUFFERS AVAILABLE
]
That must be the shitty PRODOS :-) because in DOS it works perfectly. That and CTRL-C too to keep the program intact.
--
Jorge.
Antoine Vignau
2017-07-27 21:47:28 UTC
Permalink
Raw Message
ProDOS <> BASIC interpreter, please!
Jorge
2017-07-27 22:07:08 UTC
Permalink
Raw Message
Post by Antoine Vignau
ProDOS <> BASIC interpreter, please!
...but it is a part of PRODOS, isn't it? :-)
--
Jorge.
Steve Nickolas
2017-07-27 23:16:56 UTC
Permalink
Raw Message
Post by Jorge
Post by Antoine Vignau
ProDOS <> BASIC interpreter, please!
...but it is a part of PRODOS, isn't it? :-)
I wouldn't call basic.system part of ProDOS any more than I'd call bash a
part of Linux/OSX/Solaris/... ...

-uso.
Brian Patrie
2017-07-28 05:47:42 UTC
Permalink
Raw Message
Post by Antoine Vignau
ProDOS <> BASIC interpreter, please!
....but it is a part of PRODOS, isn't it? :-)
Strictly speaking, BASIC.system is just another ProDOS 8 app that
happens to be included on the ProDOS 8 System Disk (along with a few
utility apps), and with GS/OS.
Loading...