Author Topic: DEVICE NUMBER CHECK problem  (Read 716 times)

0 Members and 1 Guest are viewing this topic.

Offline Hershey

  • KIM-1 user
  • **
  • Posts: 33
  • Age: 51
  • Location: Strathclair, Manitoba
  • Activity:
    0%
  • Country: ca
  • Reputation: 6
  • Gender: Male
  • With us since: 04/06/2006
    YearsYearsYearsYearsYearsYearsYears
    • View Profile
    • elitebbs
DEVICE NUMBER CHECK problem
« on: May 25, 2010, 07:13 AM »
This program hangs at line 70 in winvice c128, except if you turn on tron , then it works or if you put in a print d command in side loop (line 70)
 
Have not tried it on a real c128 yet
 
10 CLR:FAST
20 PRINT CHR$(147)
30 PRINT "DEVICE NUMBER CHECK": PRINT
40 DN=PEEK(186):PRINT "DEVICE NUMBER";DN;":ACCESSED LAST":PRINT
50 FOR DV=8 TO 15:OPEN 1,DV,15:CLOSE 1
60 PRINT"DEVICE NUMBER";DV;": ";:A$="NOT PRESENT":IF ST<0 THEN 90
70 OPEN1,DV,15,"UJ":FOR D= 1 TO 1000:NEXT:INPUT#1,A,A$:CLOSE1
80 A$=RIGHT$(A$,4):IF LEFT$(A$,1)<>"1" THEN A$="DRIVE UNKNOWN"
90 PRINT A$:NEXT
 
Try it out see if it works for you
Hershey
Hershey

Offline Hydrophilic

  • 128D user
  • *******
  • Posts: 1214
  • Age: 41
  • Location: Earth... still!
  • Activity:
    0%
  • Reputation: 232
  • Gender: Male
  • With us since: 25/01/2007
    YearsYearsYearsYearsYearsYears
    • View Profile
    • H2Obsesson
Re: DEVICE NUMBER CHECK problem
« Reply #1 on: May 26, 2010, 01:37 PM »
Trying it on my latest version of VICE (WinVICE v2.2) gives no problem, no matter what type of device I have setup (I tried 1541, 1541-II, 1571, and 1581)... this is with True Drive Emulation but without either TRON or PRINT D.
 
Because you are resetting the device, it might work better if you do the command seperate from OPEN.  For example
Code: [Select]
OPEN 1,DV,15:PRINT#1,"UJ":FOR D=1TO1000:NEXT:INPUT #1,A,A$:CLOSE1
Just a guess, because I have no problem with your original code...
 
I also tried it in VICE using file-system "device" and there was no crash/hang (although it did report SYNTAX ERROR instead of CBM DOS xxx).
I'm kupo for kupo nuts!

Offline wte

  • C64 user
  • *****
  • Posts: 342
  • Location: Frankfurt
  • Activity:
    0%
  • Country: de
  • Reputation: 10
  • Gender: Male
  • With us since: 18/03/2007
    YearsYearsYearsYearsYearsYears
    • View Profile
    • http://blog.c128.net
Re: DEVICE NUMBER CHECK problem
« Reply #2 on: May 27, 2010, 05:22 AM »
In my programms I avoid the sec. address to prevent problems with the drive check.

I always use this subroutine:

10000 close15:open15,un:sysdec("e33e"),un:de=st:ifdethenclose15:return
10010 sysdec("e4d2"),un:de=128andst:close15:return

If I remember correctly the first line catches the "drive physically not present" error. The second one everything else. This works on a real C128!

Use the subroutine like this:

rem un = Unit
rem de = Disk Error
for un = 8 to 31
gosub 10000
if de then print "Drive"un": access fails. Error:"de
next
end

Regards WTE

PS: Don't ask me for more details, I programmed this routine more than 20 years ago  ;D

Offline Hershey

  • KIM-1 user
  • **
  • Posts: 33
  • Age: 51
  • Location: Strathclair, Manitoba
  • Activity:
    0%
  • Country: ca
  • Reputation: 6
  • Gender: Male
  • With us since: 04/06/2006
    YearsYearsYearsYearsYearsYearsYears
    • View Profile
    • elitebbs
Re: DEVICE NUMBER CHECK problem
« Reply #3 on: May 28, 2010, 12:46 AM »
Thanks for the replies.
   
Now I know the code works in other vice systems.
Tried the code on my desktop and got the same responce, also tried wte's code and it stopped too,  at the end of prg no ready prompt. Which leaves me wondering what setting in vice I have to Change?
 
I just ran the code in vice c64 and it worked correctly. Now I really have to check setting in vice 128

 
Hershey
« Last Edit: May 28, 2010, 01:05 AM by Hershey »
Hershey

Offline wte

  • C64 user
  • *****
  • Posts: 342
  • Location: Frankfurt
  • Activity:
    0%
  • Country: de
  • Reputation: 10
  • Gender: Male
  • With us since: 18/03/2007
    YearsYearsYearsYearsYearsYears
    • View Profile
    • http://blog.c128.net
Re: DEVICE NUMBER CHECK problem
« Reply #4 on: May 28, 2010, 08:27 AM »
... also tried wte's code and it stopped too ...
OK, it also stopps on my Emulator.
But with "for un = 8 to 30" instead of "for un = 8 to 31" it is working in x128 Vice 2.0 (on my PC).
Vice does not love unit# 31.

Regards WTE

Offline gsteemso

  • PET user
  • ***
  • Posts: 91
  • Age: 36
  • Location: Near Seattle
  • Activity:
    0%
  • Country: us
  • Reputation: 24
  • Gender: Male
  • C128 & Mac user
  • With us since: 31/01/2008
    YearsYearsYearsYearsYears
    • View Profile
Re: DEVICE NUMBER CHECK problem
« Reply #5 on: May 29, 2010, 04:00 PM »
Commodores (and VICE) don't like unit #31 because it's an invalid address. The Commodore serial bus is based on the IEEE-488 bus used in PETs, which uses commands with a 3-bit command field and a 5-bit address field. Should allow addresses from 0-31, right? well, sort of… address 31 is used as a broadcast address to tell all devices to stop doing whatever the command field specifies. The Kernal does little or no internal sanity checking on the numbers you try to use, so you can easily make it very confused by telling everything to stop talking when you actually meant to tell the nonexistent device #31 to do the opposite.
The world’s only gsteemso

Offline wte

  • C64 user
  • *****
  • Posts: 342
  • Location: Frankfurt
  • Activity:
    0%
  • Country: de
  • Reputation: 10
  • Gender: Male
  • With us since: 18/03/2007
    YearsYearsYearsYearsYearsYears
    • View Profile
    • http://blog.c128.net
Re: DEVICE NUMBER CHECK problem
« Reply #6 on: May 31, 2010, 06:54 AM »
... address 31 is used as a broadcast address to tell all devices to stop doing whatever the command field specifies. ...
Wow! Thank's a lot. I didn't ever heard this before. (Maybe, because I've never asked  ;D ). I'm working since more than 30 years with Commodore Computers but I'm learning new things every year.

Regards WTE

 



Back to top