Newsgroups: comp.sys.apple2.programmer Path: news.weeg.uiowa.edu!news.uiowa.edu!uunet!munnari.oz.au!comp.vuw.ac.nz!actrix!dempson From: dempson@swell.actrix.gen.nz (David Empson) Subject: Re: Is there a //e, //c DHR viewing program??????? Organization: Actrix Information Exchange Date: Mon, 14 Jun 1993 15:01:16 GMT Message-ID: <1993Jun14.150116.15809@actrix.gen.nz> References: <1993Jun13.122916.19487@mnemosyne.cs.du.edu> Sender: dempson@actrix.gen.nz (David Empson) Lines: 107 In article ddkilzer@iastate.edu (David D Kilzer) writes: > jchappel@nyx.cs.du.edu (Jeanne Chappell) writes: > > >I am looking for a PD, shareware, freeware ... program for NON-IIGS users > >to view DHR pictures. Are all of the viewers out for the IIGS? I have a > >IIGS but want to put a program on our upcoming users group disk-of-the-month > >so that the //e, //c people can view DHR pictures. > > There is a way to do this from BASIC. You just have to load the file > into memory, move the second page to aux memory, and POKE a couple soft > switches to turn on DHR. Depending on whether it's in Dazzle Draw > format or Beagle Bros. format, you either load the file straight into > memory (DD format) or load the pages in reverse order (BB format). It's > safe (99% of the time) to assume the picture is in DD format. > > I don't remember exactly how to move the second page to auxmem or which > softswitches to use. Can someone provide some BASIC code to do this? There are two ways of going about this. In both cases, the picture is loaded into main memory, with the main half at $2000 and the auxiliary half at $4000. The first method involves fiddling with the 80-column and double hi-res softswitches so that the auxiliary hi-res buffer appears in main memory starting at $2000 (the same location as the normal hi-res screen, page 1). You can then call a machine language routine to copy the auxiliary half of the picture from $4000 to $2000, switch the memory configuration back, then display it. The second method doesn't require any soft-switch fiddling. Instead of arranging for the auxiliary page to be in main memory, you use the AUXMOVE routine (in the ROM) to copy data directly from main memory to auxiliary memory. I'll use the second method. 10 LOMEM: 24576 20 D$=CHR$(4): FN$="my.picture" 30 PRINT D$;"PR#3": REM Need 80-column mode 40 I=768 50 READ J: IF J <> -1 THEN POKE I,J: I = I + 1: GOTO 50 60 DATA 160,0,132,60,132,66,169,32,133,67,169,64,133,61 70 DATA 169,255,133,62,169,95,133,63,56,32,17,195,96,-1 80 PRINT D$;"BLOAD ";FN$;",A$4000,L$2000,B$0000": REM Auxiliary half 90 PRINT D$;"BLOAD ";FN$;",A$2000,L$2000,B$2000": REM Main half 100 CALL 768: REM Move half of picture into auxiliary memory 100 POKE -16290,0: REM Enable double resolution graphics 110 POKE -16297,0: REM Select hi-res graphics 120 POKE -16302,0: REM Full-screen graphics 130 POKE -16304,0: REM Enable graphics mode I'm not sure which way around the two halves of the picture go in the file. If I have them back to front, them swap over the B$0000 and B$2000 parameters in the BLOADs above. As written here, the program assumes that the auxiliary half of the picture comes first. To disable double-resolution graphics mode, use: POKE -16289,0 If you want to develop this into a slide show, I'd recommend returning to text mode between pictures, otherwise you'll see half of the picture loading in, then the other half, interleaved in vertical stripes! You can use POKE -16303,0 to turn off graphics mode. To get out of 80-column mode, use PRINT CHR$(21); Assuming I didn't make any typing mistakes, this program should work - I tried it out on my IIgs, and it seems to load the right rubbish onto my screen (I don't have a double hi-res picture handy to test it with). The machine language routine poked in is as follows: 0300- A0 00 LDY #$00 0302- 84 3C STY $3C Low byte of source start 0304- 84 42 STY $42 Low byte of dest address 0306- A9 20 LDA #$20 0308- 85 43 STA $43 High byte of dest address 030A- A9 40 LDA #$40 030C- 85 3D STA $3D High byte of source start 030E- A9 FF LDA #$FF 0310- 85 3E STA $3E Low byte of source end 0312- A9 5F LDA #$5F 0314- 85 3F STA $3F High byte of source end 0316- 38 SEC Direction = MAIN to AUXILIARY 0317- 20 11 C3 JSR $C311 Call AUXMOVE 031A- 60 RTS Return to caller The SEC instruction tells the AUXMOVE routine to move from main memory to auxiliary memory. If you use CLC, then it moves data the other way. If you wanted to adapt this routine to make it move the auxiliary half of the picture back to main memory, you need to change four bytes: 0307 should be changed from $20 to $40 (destination address hibyte) 030B should be changed from $40 to $20 (source start hibyte) 0313 should be changed from $5F to $3F (source end hibyte) 0316 should be changed from $38 to $18 (CLC instead of SEC) I hope this help someone... -- David Empson dempson@swell.actrix.gen.nz Snail mail: P.O. Box 27-103, Wellington, New Zealand