IIe howto create 80 col windows and restore desktop on window close

5 posts / 0 new
Last post
Offline
Last seen: 2 months 5 days ago
Joined: Oct 27 2020 - 02:21
Posts: 18
IIe howto create 80 col windows and restore desktop on window close

The question is not so much related to how to create a window, it is related to how to restore the underlying desktop screen when the window closes , which in this case means that the active cursor moves out of the window and back to the full screen desktop.

This code example shows one way a 'scrolling window' can be created.  Please view the attached 'wintest2' file to see what this does.

The goal is to understand how to quit the window, probably with a 'hotkey' yet to be determined (esc, oa-q or something like that) such that the underlying text reveals itself after the window closes as one might expect in a modern computing environment. It seems that the way to do this is to save the contents of the screen before creating the window and restoring  the full screen when the window closes. Any help is sincerely appreciated.

Offline
Last seen: 3 days 17 hours ago
Joined: Jun 25 2020 - 17:00
Posts: 224
Interesting question. In 80

Interesting question.

 

In 80-col mode, your code is essentially overwriting a smaller rectangular section of the Apple's Text Pg1 ($400-7ff) in main memory and also in the same locations in 80-col card's mapped memory.

You would need to first preserve (temporarily store) a copy of the memory array defined by your smaller text window from both main memory and the 80 col card memory, run your program, and at the end of your program, restore the memory array copies, like with a GOSUB command, back to their original memory array locations prior to invoking the "TEXT" command.

 

At least, that's the way I see it.

 

Good luck, keep us posted.

 

 

mmphosis's picture
Offline
Last seen: 2 weeks 2 days ago
Joined: Aug 18 2005 - 16:26
Posts: 434
save&restore 80col

 0  IF  PEEK (863) <  > 96 THEN  READ L$,H$: FOR I = 1 TO 96: POKE I + 767,( ASC ( MID$ (H$,I)) - 65) * 16 +  ASC ( MID$ (L$,I)) - 65: NEXT : CLEAR : HIMEM:  PEEK (115) +  PEEK (116) * 256 - 2048

 1  DATA "ELALEMEOFMFCFNFDCEGNABDJEEMGDAJFMFMFOFNFNAAECCEGDABDFNCEFNIJEFPECGDJANKANAAFLKMBDBMBCIAJGNGDKACAELALEMEOFMFCFNFDCEGNABDJEEMGDAJFMFMFOFNFNAAECCEGDABDFNCEFNIJEFPECGDJANKANAAFLKMBDBMBCIAJGNGDKACA"

 2  DATA "KONBIDIDKOIEKOIEKAIDCFAKAKOKENBKOIDIDKOIDKAIEKAIECFAKDKAIDBGAIDIEIEKAIAMIAMKOEEBMLDJEMNPODOEMNPGKONBIDIDKOIEKOIEKAIDCFAKAKOKENBKOIDIDKOIDKAIEKAIECFAKDKAIDBGAIDIEIEKAIAMIAMKOEEBMLDJEMNPODOEMNPG"

 3  POKE 235,0: POKE 236, PEEK (115): POKE 237, PEEK (116): CALL 768:V =  PEEK (37) + 1

 20 L = 20:W = 40:T = 10:B = 20

 30 H$ =  CHR$ (95):H$ = H$ + H$ + H$ + H$ + H$: FOR I = 1 TO 4:H$ = H$ + H$: NEXT

 40 V$ =  CHR$ (124) +  CHR$ (8) +  CHR$ (10):V$ = V$ + V$ + V$: FOR I = 1 TO 3:V$ = V$ + V$: NEXT : PRINT  MID$ ("",1,0 *  FRE (0));

 50 R = L + W

 60  VTAB T: POKE 36,L: PRINT  LEFT$ (H$,W)

 70  POKE 36,L - 1: PRINT  LEFT$ (V$,3 * (B - T) + 1) LEFT$ (H$,W);

 80  VTAB T + 1: POKE 36,R: PRINT  LEFT$ (V$,3 * (B - T) + 1);

 90  POKE 32,L: POKE 33,W: POKE 34,T: POKE 35,B

 100  VTAB T + 1

 110  HOME

 120  PRINT "TYPE CONT TO CLOSE THE WINDOW!": END : TEXT : VTAB V: POKE 235,1: CALL 768

 

Offline
Last seen: 3 days 17 hours ago
Joined: Jun 25 2020 - 17:00
Posts: 224
mmphosis, it would nice to

mmphosis, it would nice to see all of lines 1 and 2.

 

hmm, these whole lines don't show on my browser but they do in the applefritter notification email, so never mind.

mmphosis's picture
Offline
Last seen: 2 weeks 2 days ago
Joined: Aug 18 2005 - 16:26
Posts: 434
LaserMaster wrote:mmphosis,
LaserMaster wrote:

mmphosis, it would nice to see all of lines 1 and 2

It would be nice but posting code can be a challenge. I am cross-posting to our friends over on 68kmla.org

Here is the actual machine code that is embedded in the Applesoft BASIC program. Rather than all of my POKE gymnastics instead you could simply BLOAD this in as needed:

 

300:

:A4 EB D0 1B 84 3C 84 3E A5 EC 85 42 A5

:ED 85 43 A2 4 86 3D 20 51 3 A9 4 A4 EC

:A6 43 D0 19 A5 EC 85 3C 85 3E A5 ED 85

:3D A0 0 84 42 A2 4 86 43 20 51 3 A5 3D

:A2 4 85 3D 18 69 4 85 3F 84 42 86 43

:A9 0 8D A C0 8D 0 C0 A5 EB 4A 4C 11 C3

:B1 3C 91 42 C8 D0 F9 E6 3D E6 43 CA D0

:F2 60

BSAVE 80COL,A$300,L$60

 

Log in or register to post comments