Jump to content
IGNORED

How to use paths on Smartport Hard Drive within programs?


thorr

Recommended Posts

Hello,

 

I have copied all of my Basic programs to a smartport hard drive on my Floppy Emu. I have just started testing it and many programs that load programs try to load them from the floppy drive, such as when I try to BLOAD double hires pictures. How can I modify my code to load them from the smartport hard drive including any subdirectories instead of trying to read them from the internal drive?

 

Thanks for your help!

Mike

Link to comment
Share on other sites

You would use the PREFIX command. You can use the slot and drive method or the volumename and directories method.

 

D$=CHR$(4)

PRINT D$"PREFIX,Sx,Dy"

PRINT D$"PREFIX /volumename/directory [/directory]"

 

change X and Y to your slot and drive of the floppy Emu, or volumename and directories to your floppy Emu names.

 

Rob

Link to comment
Share on other sites

Hi Rob, thanks! I will try it again when I get home. I tried the second Prefix line you mentioned, but it searched on the floppy for that path. Perhaps doing both will do the trick. I assume the volume name is the name of the hard drive like :HD in Ciderpress or /HD on the drive. Theoretically the volume name could be the same on both the floppy and the hard drive, so I think the prefix,s5,d1 is what will make the difference. It would be nice if it would just look in the current directory for the file so I don't have to hard code everything and then if I share it, I wouldn't have to go back and change it so it works on floppies.

 

Thanks again,
Mike

Link to comment
Share on other sites

I tried it and it is still not working. Here is what the program looks like:

 

6 PRINT CHR$ (4);"PR#3"
10 N$ = "TITLE.SCREEN"
20 PRINT CHR$ (4);"PREFIX,S5,D1"
30 PRINT CHR$ (4);"PREFIX /HD/MIKES"
100 POKE 49153,0: POKE 49165,0
110 POKE 49232,0: POKE 49234,0: POKE 49239,0: POKE 49246,0
120 POKE 49237,0
130 PRINT CHR$ (4);"BLOAD ";N$;",A$2000,L$2000
When it gets to this point, it reads from the internal drive and fails. I tried it with and without the semicolon in lines 20 and 30 and also tried just one or the other. No matter what I do, it tries to use the floppy. If I copy line 20 to line 125, it says "BREAK IN 125". Something in the POKE's is messing it up. If I add line 40: 40 PRINT CHR$(4)"CAT" then it catalogs the correct directory at this point. It is after the pokes that it goes haywire and tries to use the internal drive.
Thanks,
Mike
Link to comment
Share on other sites

You have a lot going on with your program that you don't need.

 

Are you trying to view a double hi-res picture or just a normal hi-res?

With normal hi-res lines 6, 20, 100 and 120 are not needed, and remove the POKE 49246,0 in line 110.

 

To view a double hi-res picture try this.

 

5 D$=CHR$(4) : PRINT D$"PR#3"

10 HGR : POKE 49237,0: CALL 62450 : POKE 49246,0

15 PRINT D$ "PREFIX /HD/MIKES"

20 N$ = "TITLE.SCREEN"

25 POKE 49237,0 : PRINT D$ "BLOAD "N$",A$2000,B$2000"

30 POKE 49236,0 : PRINT D$ "BLOAD "N$",A$2000,L$2000"

Link to comment
Share on other sites

Thanks! I hate how this site has a "Reply to this topic" at the bottom that doesn't work if you are not logged in. I typed up a big reply and lost everything because I wasn't logged in. When I went back, it was gone.

 

I tried your code and am still having the same issues. It still tries to use the internal floppy even though I am sitting in the /HD/MIKES folder with all files there. After accessing the floppy it says "PATH NOT FOUND" followed by "BREAK IN 25". If I add the line: 12 PRINT D$ "PREFIX,S5,D1", I get "NO DEVICE CONNECTED" followed by "BREAK IN 12". If I type PREFIX,S5,D1 from the command line it works fine.

 

Also, I found this interesting but not very helpful (makes my head spin a bit):

http://www.appleoldies.ca/bmp2dhr/basic/#_Toc410744126

 

"Forbidden Areas

 

One important difference between the ProDOS 8 and DOS 3.3 BLOAD command which does not apply to DHGR mode but applies to “BLOADing” of Lo-Res and Double Lo-Res graphics is because memory was scarce on the Apple II, and the text screen “memory holes” were used to store hardware information for disk controllers, ProDOS 8 is protected from “BLOADing” to this memory area. Another consideration is ProDOS comes with a RAM disk that uses Auxiliary Memory in the same memory area as the Apple II double-resolution graphics modes. So it’s a good idea when using the text screen area in any Apple II program, to address only the normally visible memory area, and when using double-res graphics, do not use the RAM disk."

Link to comment
Share on other sites

This is also interesting: http://www.1000bit.it/support/manuali/apple/technotes/pdos/tn.pdos.23.html

Known ProDOS 8 V2.0.1 Bugs
  • ProDOS 8 still doesn't behave perfectly when 14 or more devices are present. Specifically, the /RAM driver tends to install itself without checking to see whether or not there's room in the device table.

Caution:
ProDOS 8's remapping of SmartPort devices may interfere with intelligent SmartPort peripherals that were already doing their own remapping. ProDOS 8 remaps additional SmartPort devices, even if the SmartPort firmware already did this on its own, and this can cause problems. We never said this would work, but we never said it wouldn't -- ProDOS 8 has no way to determine what remapping has already been done. If you make such a card and your customers have problems, tell them to disable your SmartPort remapping and let ProDOS 8 do it all.

Link to comment
Share on other sites

Thanks! I hate how this site has a "Reply to this topic" at the bottom that doesn't work if you are not logged in. I typed up a big reply and lost everything because I wasn't logged in. When I went back, it was gone.

 

I tried your code and am still having the same issues. It still tries to use the internal floppy even though I am sitting in the /HD/MIKES folder with all files there. After accessing the floppy it says "PATH NOT FOUND" followed by "BREAK IN 25". If I add the line: 12 PRINT D$ "PREFIX,S5,D1", I get "NO DEVICE CONNECTED" followed by "BREAK IN 12". If I type PREFIX,S5,D1 from the command line it works fine.

 

Also, I found this interesting but not very helpful (makes my head spin a bit):

http://www.appleoldies.ca/bmp2dhr/basic/#_Toc410744126

 

"Forbidden Areas

 

One important difference between the ProDOS 8 and DOS 3.3 BLOAD command which does not apply to DHGR mode but applies to “BLOADing” of Lo-Res and Double Lo-Res graphics is because memory was scarce on the Apple II, and the text screen “memory holes” were used to store hardware information for disk controllers, ProDOS 8 is protected from “BLOADing” to this memory area. Another consideration is ProDOS comes with a RAM disk that uses Auxiliary Memory in the same memory area as the Apple II double-resolution graphics modes. So it’s a good idea when using the text screen area in any Apple II program, to address only the normally visible memory area, and when using double-res graphics, do not use the RAM disk."

 

 

You can ignore this as the hi-res/dbl hi-res screen is in a different part of memory than the text/lo-res/dbl lo-res screen. This is why if you directly load a lo-res graphic to view, you will have to reboot your computer. There are methods to put the lo-res and dbl lo-res graphics into place.

Link to comment
Share on other sites

 

This is also interesting: http://www.1000bit.it/support/manuali/apple/technotes/pdos/tn.pdos.23.html

Known ProDOS 8 V2.0.1 Bugs
  • ProDOS 8 still doesn't behave perfectly when 14 or more devices are present. Specifically, the /RAM driver tends to install itself without checking to see whether or not there's room in the device table.

Caution:
ProDOS 8's remapping of SmartPort devices may interfere with intelligent SmartPort peripherals that were already doing their own remapping. ProDOS 8 remaps additional SmartPort devices, even if the SmartPort firmware already did this on its own, and this can cause problems. We never said this would work, but we never said it wouldn't -- ProDOS 8 has no way to determine what remapping has already been done. If you make such a card and your customers have problems, tell them to disable your SmartPort remapping and let ProDOS 8 do it all.

 

 

 

For the most part I think you can ignore this as I believe the Floppy Emu only takes up 4 device slots by the smartport which are mapped to S5D1, S5D2, S2D1, S2D2, in that order.

Link to comment
Share on other sites

Thanks! I hate how this site has a "Reply to this topic" at the bottom that doesn't work if you are not logged in. I typed up a big reply and lost everything because I wasn't logged in. When I went back, it was gone.

 

I tried your code and am still having the same issues. It still tries to use the internal floppy even though I am sitting in the /HD/MIKES folder with all files there. After accessing the floppy it says "PATH NOT FOUND" followed by "BREAK IN 25". If I add the line: 12 PRINT D$ "PREFIX,S5,D1", I get "NO DEVICE CONNECTED" followed by "BREAK IN 12". If I type PREFIX,S5,D1 from the command line it works fine.

 

 

I got into the habit of copying my reply to the clipboard before clicking on POST. It has saved me from retyping a few times.

 

 

And if you type: 12 PRINT D$ "CAT" - it works fine and catalogs your directory?

Link to comment
Share on other sites

It works if I type 7 PRINT D$"CAT"

 

If I put it at 12 or 17, it says "PATH NOT FOUND" BREAK IN 12 or 17. After this at the command prompt, if I type CAT, it works again.

 

I next retyped it all so each line had its own command and surrounded each line with lines that had PRINT D$"CAT". As soon as I type POKE 49237,0 it stops working and tries to use the floppy.

 

I saw in another thread that a new compiler was made and that lead me to a page that showed me that Beagle is another compiler that is supposed to be compatible and much faster. I will see if I can get it to work with that.

 

Thanks!

Link to comment
Share on other sites

I got stuck trying to use Beagle Basic. I have no clue how to use it and it doesn't even support Apple IIc's it seems. Also it is for DOS 3.3. I think I would rather focus my energy on learning Assembly. It is an itch I always wanted to scratch on the Apple II. I learned Assembly on the Motorola 6809, MIPS, and a bit of x86 back in my college days and I found it pretty easy to learn and use. I saw that thread on Double Hi-res and I would love to learn to use Assembly with Double Hi-res, so maybe I will see what they have going on over there. I want to learn the assembler they are using so it will be a smooth learning curve when I tackle the DHR portion. At the end of the day, I will probably still run into issues trying to use the Smart Port HD, but who knows. I also thought about BLOADING the files first, then doing the POKE commands, but I am not sure if that would work. Also it may only work for one file and fail when I tried the second file.

Link to comment
Share on other sites

Ok, so I started reading the tutorial on DHR graphics, and learned that I am doing 64K memory bank switching when I poke 49237,0. At this point, it is like the whole memory of the Apple II gets "replaced" with this new block. While in this mode, the AUX memory does not know that there is an S5,D1 connected. I am not sure where that code is in memory, but theoretically, I could update the memory to match the first main 64K in this area and it would find and use the S5,D1 that is there. A much less efficient method would be to load the Page 2 stuff from the HD into Page 1, then write code to copy this to Page 2 in memory, then load the Page 1 stuff into Page 1. I could use a For loop with Peeks and Pokes with bank switching in between and after those steps.

 

Update, if I take out the POKE 49237,0 and the first BLOAD, the second one works fine as predicted. It's all about the AUX memory not knowing about the Smartport HD. If I can do some pokes to fix that, I will be golden.

Edited by thorr
Link to comment
Share on other sites

I tested my super slow method and it worked. I first loaded the aux stuff into the main memory, then wrote a For loop to peek the data from 8192 to 16383 and poke it to aux memory. Five minutes later it was finished then I bloaded the other half and my image was there, all from the smartport HD.

Link to comment
Share on other sites

When doing a POKE 49237,0 - not all of Aux memory is switched in. Only the memory between $2000.3FFF is switched in, which is the graphics display.

 

It is curious why the Floppy Emu doesn't like this configuration when loading a file. But this still doesn't fix the issue with the PREFIX command.

 

There are other ways to transfer the Aux memory part over using machine language that is much faster.

 

Type this in the monitor:

 

300:A9 20 85 43 85 3D A9 3F 85 3F A0 FF 84 3E C8 84

310:3C 84 42 38 20 11 C3 46 43 A9 5F 85 3F 4C 2C FE

 

 

Now enter your applesoft program

 

5 D$=CHR$(4) : PRINT D$"PR#3"

10 HGR : POKE 49237,0: CALL 62450 : POKE 49236,0 : POKE 49246,0

15 PRINT D$ "PREFIX /HD/MIKES"

25 PRINT D$ "BLOAD TITLE.SCREEN"

30 CALL 768

 

 

This should be much faster

Link to comment
Share on other sites

Thanks! It's close but has a bug. It loads the two halves on top of each other, so at the end it looks like a bunch of vertical stripes.

Also, for the part I put into the monitor, I could use pokes for that or BSAVE it once and BLOAD it as part of the program.

 

I read all of the articles in the DHR programming thread and I am very excited about it. I was able to follow along and understand the code pretty well up to this point. I am looking forward to learning how to program entire programs into assembly. In one of the articles, he made it sound like you could manipulate all of the AUX memory even outside of the DHR range, so I am not sure if it is limited or not when you do the POKE 49237,0. However it would make sense that not all of it is switched in otherwise you would effectively stomp on all of your code as soon as you switched it over.

Link to comment
Share on other sites

No. There's no bug. It works fine on my computer. The vertical stripes means the Auxiliary part of memory is not being written to properly on your computer.

 

After some testing Applewin seems to have some issues with the move routine at $C311.

 

Insert and use this code instead.

 

300:A9 20 85 43 85 3D A9 3F 85 3F A0 FF 84 3E C8 84
310:3C 84 42 A2 20 B1 3C 2C 55 C0 91 42 2C 54 C0 C8
320:D0 F3 E6 3D E6 43 CA D0 EC 46 43 A9 5F 85 3F 4C
330:2C FE 00 00

Link to comment
Share on other sites

* Notes:
* $3C.3D - start of source
* $3E.3F - end of source
* $42.43 - start of destination
* $FE2C - monitor Roms move routine

* $C054 - reads and writes to Main memory - only affects address range $2000.3FFF

* $C055 - reads and writes to Aux memory - only affects address range $2000.3FFF

* Dbl hi-res uses $2000.3FFF of Main memory and $2000.3FFF of Aux memory
* A dbl hi-res file stores the Aux memory portion first
* Move MainMem $2000.3FFF to AuxMem $2000.3FFF first
* then move MainMem $4000.5FFF to MainMem $2000.3FFF

0300- A9 20 LDA #$20 ; set source and destination to $2000
0302- 85 43 STA $43 ; dest start hi byte
0304- 85 3D STA $3D ; source start hi byte
0306- A9 3F LDA #$3F ; set end of source to $3FFF - not needed here but was needed if the move routine at $C311 was being used
0308- 85 3F STA $3F ; source end hi byte
030A- A0 FF LDY #$FF
030C- 84 3E STY $3E ; source end lo byte
030E- C8 INY
030F- 84 3C STY $3C ; source start lo byte
0311- 84 42 STY $42 ; dest start lo byte
0313- A2 20 LDX #$20 ; move 32 pages ($20)
0315- B1 3C LDA ($3C),Y ; load byte from main memory
0317- 2C 55 C0 BIT $C055 ; store byte to Aux memory
031A- 91 42 STA ($42),Y
031C- 2C 54 C0 BIT $C054 ; return to read/write of main memory
031F- C8 INY
0320- D0 F3 BNE $0315 ; 256 bytes moved yet? branch if no
0322- E6 3D INC $3D ; increment high byte of source
0324- E6 43 INC $43 ; increment high byte of destination
0326- CA DEX ; 32 ($20) pages moved yet? branch if no
0327- D0 EC BNE $0315
0329- 46 43 LSR $43 ; make dest address from $4000 to $2000
032B- A9 5F LDA #$5F ; source end address $5FFF - ending address of source is needed for the monitor Rom move routine
032D- 85 3F STA $3F
032F- 4C 2C FE JMP $FE2C ; monitor Rom move routine for main memory
; moves $4000.5FFF to $2000.3FFF

Link to comment
Share on other sites

Awesome! Thanks! I am looking forward to learning more assembly language programming. Much of what you wrote makes sense and I can use that as a learning tool with a real world scenario.

 

I am already converting some of my old programs to work from the smartport hard drive. The DHR pics load much faster than they do from the floppy (comparing both ways on the Floppy Emu). I am re-learning a lot about how to program on the Apple II and have lots of exciting plans for new stuff.

 

Thanks again for all of your help!

Link to comment
Share on other sites

Learning Assembly Language is the way to get Full Control of your System...

 

 

Top Porter is working on an AppleSoft Compiler that looks like it generates pretty fast code..

 

I am a long time Apple ][ user, ( since JAN-1982 ) and have just started getting into the Tandy Color Computer, which has the Motorola MC6809 ( or the Hitachi HD6309 ).

 

 

MarkO

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...