Detecting VDC size in 64 mode

  • Follow


Hello,

Sorry for the long post.

This is part of a basic ext. I'm working on. The code works
as posted. Is there a shorter way of doing the same ?

Bill
; --------------------------------------------------------
* = $C000
; ON EXIT
; .A $00 = REAL 64 $01 = 64 MODE
; .Y $00 = 16K VDC $01 = 64K VDC $FF = VDC NOT PRESENT
; --------------------------------------------------------
TEST_64 LDY #$02
LDA #$FE
STA $D02F
LDA $D02F
CMP #$FF
BNE MODE64
REAL64 DEY
MODE64 DEY
TYA
PHA
; --------------------------------------------------------
VDC_START BEQ VDC_DONE ; SKIP IF REAL 64
LDY #$00 ; 16K VDC
JSR VDC_SUB
LDA #$40
LDX #$1F
JSR SET_80
LDX #$12
JSR SET_80
TYA
INX
JSR SET_80
LDA #$10
LDX #$1F
JSR SET_80
JSR VDC_SUB
LDX #$1F
JSR READ_80
CMP #$10
BEQ VDC_EXIT
INY ; 64K VDC
VDC_EXIT .BYTE $2C ; SKIP 2 BYTES
VDC_DONE LDY #$FF ; NO VDC ON REAL C64
PLA
RTS
; --------------------------------------------------------
VDC_SUB TYA ; A SUB TO SAVE A FEW BYTES
LDX #$12
JSR SET_80
INX
; --------------------------------------------------------
SET_80 STX $D600 ; WRITE TO VDC
LOP1_80 BIT $D600
BPL LOP1_80
STA $D601
RTS
; --------------------------------------------------------
READ_80 STX $D600 ; READ FROM VDC
LOP2_80 BIT $D600
BPL LOP2_80
LDA $D601
RTS 


0
Reply wharp (2) 4/7/2006 11:36:59 PM

On Fri, 7 Apr 2006, Wilbert E. Harp Jr. wrote:

> Hello,
>
> Sorry for the long post.
>
> This is part of a basic ext. I'm working on. The code works
> as posted. Is there a shorter way of doing the same ?
>
> Bill
> ; --------------------------------------------------------
> * = $C000
> ; ON EXIT
> ; .A $00 = REAL 64 $01 = 64 MODE
> ; .Y $00 = 16K VDC $01 = 64K VDC $FF = VDC NOT PRESENT
> ; --------------------------------------------------------
> TEST_64 LDY #$02
> LDA #$FE
> STA $D02F
> LDA $D02F
> CMP #$FF
> BNE MODE64
> REAL64 DEY
> MODE64 DEY
> TYA
> PHA
> ; --------------------------------------------------------
> VDC_START BEQ VDC_DONE ; SKIP IF REAL 64
> LDY #$00 ; 16K VDC
> JSR VDC_SUB
> LDA #$40
> LDX #$1F
> JSR SET_80
> LDX #$12
> JSR SET_80
> TYA
> INX
> JSR SET_80
> LDA #$10
> LDX #$1F
> JSR SET_80
> JSR VDC_SUB
> LDX #$1F
> JSR READ_80
> CMP #$10
> BEQ VDC_EXIT
> INY ; 64K VDC
> VDC_EXIT .BYTE $2C ; SKIP 2 BYTES
> VDC_DONE LDY #$FF ; NO VDC ON REAL C64
> PLA
> RTS
> ; --------------------------------------------------------
> VDC_SUB TYA ; A SUB TO SAVE A FEW BYTES
> LDX #$12
> JSR SET_80
> INX
> ; --------------------------------------------------------
> SET_80 STX $D600 ; WRITE TO VDC
> LOP1_80 BIT $D600
> BPL LOP1_80
> STA $D601
> RTS
> ; --------------------------------------------------------
> READ_80 STX $D600 ; READ FROM VDC
> LOP2_80 BIT $D600
> BPL LOP2_80
> LDA $D601
> RTS
>

And heres a even simpler basic program you can type in. Just one
line of code.   type it in 128 basic and run it.

Type this in 128 basic then run it. If you truly have 64k vdc ram expansion
on your C128 you will see a clear screen and "ready".  If you dont
get "ready" and the screen fills up with garbage, you do not have the
64K ram expansion!!!

10 Poke DEC("D600"),28:POKE DEC("D601"),63:SYS DEC("FF62"):SCNCLR

(save the above as a prg file of course)

0
Reply Joseph 4/8/2006 11:22:07 PM


Joseph Fenn <jfenn@lava.net> writes:

> Type this in 128 basic then run it. If you truly have 64k vdc ram
> expansion on your C128 you will see a clear screen and "ready".

As pointed out before, it is not a very useful method if you want
to use it within another program and from software detect the VDC
size to determine how much data to load into it.

The one-liner you posted will either clear the screen or fill it
up with garbage, and then exit to Basic. Good for checking unknown
machines or for VDC diagnosis though.

-- 
Anders Carlsson
0
Reply Anders 4/9/2006 1:09:08 AM

I have a one-liner too:
1 INPUT"IS THIS A 64 OR 128";C

Voila! C contains 64 if it's a C64, or 128 if it's a 128. This routine
even detects VIC 20s, 116s, and 264s. Powerful stuff, use carefully.

0
Reply a7yvm109gf5d1 4/9/2006 2:06:31 AM

On Sat, 9 Apr 2006, Anders Carlsson wrote:

>
>> Type this in 128 basic then run it. If you truly have 64k vdc ram
>> expansion on your C128 you will see a clear screen and "ready".
>
> As pointed out before, it is not a very useful method if you want
> to use it within another program and from software detect the VDC
> size to determine how much data to load into it.
>
> The one-liner you posted will either clear the screen or fill it
> up with garbage, and then exit to Basic. Good for checking unknown
> machines or for VDC diagnosis though.
>
> -- 
> Anders Carlsson
>
Well Anders it depends on your aspect of what you want to do.
Why try loading something that requires the expansion just to
be advised (no way)!   Its simpler and quicker to use the
one line code then proceed in my opinion.

All that ml stuff takes longer to enter than the one liner!
                     Joe

0
Reply Joseph 4/9/2006 2:53:28 AM

On Sat, 8 Apr 2006 a7yvm109gf5d1@netzero.com wrote:

> I have a one-liner too:
> 1 INPUT"IS THIS A 64 OR 128";C
>
> Voila! C contains 64 if it's a C64, or 128 if it's a 128. This routine
> even detects VIC 20s, 116s, and 264s. Powerful stuff, use carefully.
>
>
Thats great.  Had'nt seen that un before
                       Joe

0
Reply Joseph 4/9/2006 3:00:24 AM

Joseph Fenn wrote:
> Well Anders it depends on your aspect of what you want to do.
> Why try loading something that requires the expansion just to
> be advised (no way)!   Its simpler and quicker to use the
> one line code then proceed in my opinion.

I'm thankful you don't design software for a living.  I've encountered 
programs using your "solution" before.  Then we call the vendor and 
demand they change it to something useful.

1 REM  Jim's mondo cool word processor.
10 REM WHY check to see if the user has enough space to write this document.
20 REM Just type:
30 REM 'open 1,8,2,"testfile,s,w":for1=1to10000:print#1,"a";:next:close1'
40 REM If the little light blinks, then you don't have enough room, so
50 REM sorry.  get another disk, you fool.
60 REM doing it this way save me, the programmer, the hassle of reading
70 REM the disk directory and checking blocks free, and it's all about
80 REM me, isn't it...  A few hours of development time saved by me is
90 REM worth hours of frustration by the end user.  Yep, good tradeoff.

Geesh

Jim


0
Reply Jim 4/9/2006 3:27:32 AM

"Jim Brain" <brain@jbrain.com> wrote in message 
news:Ea%Zf.915012$xm3.257240@attbi_s21...
> Joseph Fenn wrote:
>> Well Anders it depends on your aspect of what you want to do.
>> Why try loading something that requires the expansion just to
>> be advised (no way)!   Its simpler and quicker to use the
>> one line code then proceed in my opinion.
>
> I'm thankful you don't design software for a living.  I've encountered 
> programs using your "solution" before.  Then we call the vendor and demand 
> they change it to something useful.
>
> 1 REM  Jim's mondo cool word processor.
> 10 REM WHY check to see if the user has enough space to write this 
> document.
> 20 REM Just type:
> 30 REM 'open 1,8,2,"testfile,s,w":for1=1to10000:print#1,"a";:next:close1'
> 40 REM If the little light blinks, then you don't have enough room, so
> 50 REM sorry.  get another disk, you fool.
> 60 REM doing it this way save me, the programmer, the hassle of reading
> 70 REM the disk directory and checking blocks free, and it's all about
> 80 REM me, isn't it...  A few hours of development time saved by me is
> 90 REM worth hours of frustration by the end user.  Yep, good tradeoff.
>
> Geesh
>
> Jim
>

LOL. Best. Code. Ever.




0
Reply T 4/9/2006 3:47:00 AM

<a7yvm109gf5d1@netzero.com> wrote in message 
news:1144548391.088076.265130@u72g2000cwu.googlegroups.com...
>I have a one-liner too:
> 1 INPUT"IS THIS A 64 OR 128";C
>
> Voila! C contains 64 if it's a C64, or 128 if it's a 128. This routine
> even detects VIC 20s, 116s, and 264s. Powerful stuff, use carefully.
>

I've discovered that this program is so powerful it works on virtually -any- 
BASIC computer! Tried it out on a Yamaha MSX machine and guess what? It 
asked me if it was a 64 or 128. Poor computer must've had high aspirations. 


0
Reply T 4/9/2006 3:48:24 AM

a7yvm109gf5d1@netzero.com schrieb:
> I have a one-liner too:
> 1 INPUT"IS THIS A 64 OR 128";C
> 
> Voila! C contains 64 if it's a C64, or 128 if it's a 128. This routine
> even detects VIC 20s, 116s, and 264s. Powerful stuff, use carefully.

I've modified the program to use C$ instead of C. Now after answering 
the question I've typed

PRINT C$

and it gives me

YES

I'm confused, what machine do I have now?

/Steppe
0
Reply Stephan 4/9/2006 10:23:57 AM

To the original poster, I've done a little bit of experimentation along
those lines to let HyperLink 2.5e autodetect VDC size, and actually, yours
is probably the shortest functional implementation (mine is a bit longer,
but mostly because I'm paranoid about initializing the chip first since I
can't guarantee what mode they will start in).

--
      Cameron Kaiser * ckaiser@floodgap.com * posting with a Commodore 128
                personal page: http://www.armory.com/%7Espectre/
  ** Computer Workshops: games, productivity software and more for C64/128! **
                  ** http://www.armory.com/%7Espectre/cwi/ **
0
Reply Cameron 4/9/2006 2:54:10 PM

Joseph Fenn <jfenn@lava.net> writes:

> All that ml stuff takes longer to enter than the one liner!

But if it is already linked into the rest of the program, it will
come automatically when you load it. Besides, the original poster
wrote how to detect VDC size in 64 mode, and to my knowledge,
the DEC("") call and SCNCLR aren't even part of BASIC V2.

I get the feeling you don't understand why the programmer may want
to check which system environment the program executes in. Concepts
like flexibility and being compatible with all options maybe are
foreign to you?

-- 
Anders Carlsson
0
Reply Anders 4/9/2006 5:40:17 PM

"Cameron Kaiser" <ckaiser@floodgap.com> wrote in message 
news:44391fbd$0$14457$bb4e3ad8@newscene.com...
> To the original poster, I've done a little bit of experimentation along
> those lines to let HyperLink 2.5e autodetect VDC size, and actually, yours
> is probably the shortest functional implementation (mine is a bit longer,
> but mostly because I'm paranoid about initializing the chip first since I
> can't guarantee what mode they will start in).

Cameron,

First of all I want to say thank you for your kind words.

I try to make my code small as possable and reuseable.
I have run out tricks to make the code smaller. I know
that my progamming style is bad. I am not up to par
with most of the people in this group.

I was hoping that someone could help on getting
the set_80 and read_80 subs into 1 sub. Since
the code is 99% same. I hate having subs almost the
same but can't be combined. :(

I plan on initializing the vdc chip later on in the code.
Right now I only need to detect size and if present.

What I needed was a simple way to detect in other
areas of code to use of vdc.

LDA VDC
BMI  NOVDC ; SKIP OVER
BEQ 16KVDC ; SETUP FOR 16K VDC
; 64KVDC CODE



0
Reply Wilbert 4/9/2006 5:56:47 PM

"Stephan Schmid" wrote ...

> a7yvm109gf5d1@netzero.com schrieb:
>> I have a one-liner too:
>> 1 INPUT"IS THIS A 64 OR 128";C
>>
>> Voila! C contains 64 if it's a C64, or 128 if it's a 128. This routine
>> even detects VIC 20s, 116s, and 264s. Powerful stuff, use carefully.
>
> I've modified the program to use C$ instead of C. Now after answering the
> question I've typed
>
> PRINT C$
>
> and it gives me
>
> YES
>
> I'm confused, what machine do I have now?

Either a C64 or C128.  If you have a VIC-20 or Plus/4 C$ should return a
value of NO.

It should also return NO if you are running the program on an emulator using
either Windows, UNIX, or a Mac.

At this point, you should look for a data plate on either the rear or bottom
of the machine.  If there is no data plate, take the machine to the nearest
computer service shop and ask one of the technicians what kind of machine it
is.

If they can't tell you, or if they laugh at you, ask Joseph Fenn.  He has a
lot of little tricks to find out what machine a program is running on.    ;-)
-- 
Best regards,

Sam Gillett

If you make it idiot-proof,
someone will make a better idiot!



0
Reply Sam 4/9/2006 10:13:48 PM

>
> I'm thankful you don't design software for a living.  I've encountered 
> programs using your "solution" before.  Then we call the vendor and demand 
> they change it to something useful.
>
> 1 REM  Jim's mondo cool word processor.
> 10 REM WHY check to see if the user has enough space to write this document.
> 20 REM Just type:
> 30 REM 'open 1,8,2,"testfile,s,w":for1=1to10000:print#1,"a";:next:close1'
> 40 REM If the little light blinks, then you don't have enough room, so
> 50 REM sorry.  get another disk, you fool.
> 60 REM doing it this way save me, the programmer, the hassle of reading
> 70 REM the disk directory and checking blocks free, and it's all about
> 80 REM me, isn't it...  A few hours of development time saved by me is
> 90 REM worth hours of frustration by the end user.  Yep, good tradeoff.
>
> Geesh
>
> Jim
>
>
>
I'm thankful too that you dont mind going thru all that mess.
                       Joe

0
Reply Joseph 4/9/2006 11:09:53 PM

> But if it is already linked into the rest of the program, it will
> come automatically when you load it. Besides, the original poster
> wrote how to detect VDC size in 64 mode, and to my knowledge,
> the DEC("") call and SCNCLR aren't even part of BASIC V2.
>
> I get the feeling you don't understand why the programmer may want
> to check which system environment the program executes in. Concepts
> like flexibility and being compatible with all options maybe are
> foreign to you?
>
> -- 
> Anders Carlsson
>
I stick with what I said Anders.   The quickest way is the best way.
                                Joe

0
Reply Joseph 4/9/2006 11:16:17 PM

`


On Sun, 9 Apr 2006, Wilbert E. Harp Jr. wrote:

>
> "Cameron Kaiser" <ckaiser@floodgap.com> wrote in message
> news:44391fbd$0$14457$bb4e3ad8@newscene.com...
>> To the original poster, I've done a little bit of experimentation along
>> those lines to let HyperLink 2.5e autodetect VDC size, and actually, yours
>> is probably the shortest functional implementation (mine is a bit longer,
>> but mostly because I'm paranoid about initializing the chip first since I
>> can't guarantee what mode they will start in).
>
> Cameron,
>
> First of all I want to say thank you for your kind words.
>
> I try to make my code small as possable and reuseable.
> I have run out tricks to make the code smaller. I know
> that my progamming style is bad. I am not up to par
> with most of the people in this group.
>
> I was hoping that someone could help on getting
> the set_80 and read_80 subs into 1 sub. Since
> the code is 99% same. I hate having subs almost the
> same but can't be combined. :(
>
> I plan on initializing the vdc chip later on in the code.
> Right now I only need to detect size and if present.
>
> What I needed was a simple way to detect in other
> areas of code to use of vdc.
>
> LDA VDC
> BMI  NOVDC ; SKIP OVER
> BEQ 16KVDC ; SETUP FOR 16K VDC
> ; 64KVDC CODE


way to go man!!
            Joe

>
0
Reply Joseph 4/9/2006 11:20:10 PM

"Wilbert E. Harp Jr." <wharp@neo.rr.com> writes:

>I was hoping that someone could help on getting
>the set_80 and read_80 subs into 1 sub. Since
>the code is 99% same. I hate having subs almost the
>same but can't be combined. :(

Two ways come to mind, though both are a little kludgey. The first is
self-modifying code, something like this (untested), which will also
use the Y register:

set80	ldy #141
	sty vdcop
	jmp common
read80	ldy #173
	sty vdcop
common	stx $d600
lup0	bit $d600
	bpl lup0
vdcop	sta $d601
	rts

This should do what you want, but at the cost of the Y register and a little
weirdness in your code. Another alternative is to use carry as a flag, since
BIT doesn't change that (again untested):

set80	sec
	jmp common
read80	clc
common	stx $d600
lup0	bit $d600
	bpl lup0
	bcc cread80
	sta $d601
	rts		; optional
cread80	lda $d601
	rts

If you don't care about the accumulator, you can take the optional RTS out,
which saves a byte but may alter the accumulator depending on the register
in use.

Both of these are slower than having the routines called separately, though
only by a few cycles. Myself, I would go with the way you have it written.

>I plan on initializing the vdc chip later on in the code.
>Right now I only need to detect size and if present.

My only worry about this was that when I tried to do VDC RAM stores without
initializing the chip, the results were unreliable. I just copied the 128
Kernal's init routine out and used it for my purposes, a la what was done for
the 80-column version of Kermit-64. After init, it settled down.

This may be a difference between the 8563 and 8568, maybe? Or are you
starting up your system by booting into 128 mode, and then using GO 64
(which would initialize VDC because you booted into 128 mode first)? In
my case, the FastLoad cartridge causes it to skip 128 mode entirely.

--
      Cameron Kaiser * ckaiser@floodgap.com * posting with a Commodore 128
                personal page: http://www.armory.com/%7Espectre/
  ** Computer Workshops: games, productivity software and more for C64/128! **
                  ** http://www.armory.com/%7Espectre/cwi/ **
0
Reply Cameron 4/10/2006 1:42:04 AM

Joseph Fenn <jfenn@lava.net> wrote:
> And heres a even simpler basic program you can type in. Just one
> line of code.   type it in 128 basic and run it.
> 10 Poke DEC("D600"),28:POKE DEC("D601"),63:SYS DEC("FF62"):SCNCLR

Joe,

You fail to realize why a programmer needs to check for the amount of VDC
memory from within the program.

Let's incorporate your one-liner into a program that is being developed:

10 POKE DEC("D600"),28:POKE DEC("D601"),63:SYS DEC("FF62"):SCNCLR
20 INPUT"CAN YOU READ THIS? YES/NO";Y$
30 REM WE NOW KNOW HOW MUCH VDC RAM WE HAVE AND CAN ADJUST FOR IT
40 REM BECAUSE THE USER TYPED EITHER YES OR NO
.... rest of program continues here ...

Can you see where this program wouldn't be very good? It wouldn't work on
all machines because the text "CAN YOU READ THIS? YES/NO" would
not show up if the screen is filled with garbage. How can the programmer
adjust for the amount of video ram?

Here's the deal... your one-liner is only good for someone who wants
to check the VDC memory from "immediate" mode, not from "program" mode.

Doing so from program mode requires a different approach and generally
without user intervention, if possible.

-Maurice

-- 
** Maurice Randall - Click Here Software Co.
** High-Performance for your Commodore
** email: maurice@cmdrkey.com, support@cmdrkey.com
** web: http://cmdrkey.com
0
Reply Maurice 4/10/2006 5:48:06 PM

Maurice
I see your point however the one liner I put on here is the quickest
and easiest to do hence the preferble way.   It only takes a half
minute to determine the vdc expansion is there, then go for it.
So again as I said the quicker you know, if it is or not,
then you can proceed with stuff the requires the 64k VDC.
                   Joe



**********************************************************
* Ham KH6JF AARS/MARS ABM6JF QCWA WW2 VET WD RADIO SYSTEM*
* Army MARS PRECEDED by AARS (Army Amateur Radio System) * 
*       Hi State ARMY MARS COORDINATOR                   *
**********************************************************


0
Reply Joseph 4/10/2006 10:18:35 PM

"Cameron Kaiser" <ckaiser@floodgap.com> wrote in message 
news:4439b749$0$74447$bb4e3ad8@newscene.com...

> set80 sec
> jmp common
> read80 clc
> common stx $d600
> lup0 bit $d600
> bpl lup0
> bcc cread80
> sta $d601
> rts ; optional
> cread80 lda $d601
> rts

I like the above code. It can still be used in a crt.
May I have your permission to use it ?

> My only worry about this was that when I tried to do VDC RAM stores 
> without
> initializing the chip, the results were unreliable. I just copied the 128
> Kernal's init routine out and used it for my purposes, a la what was done 
> for
> the 80-column version of Kermit-64. After init, it settled down.

> This may be a difference between the 8563 and 8568, maybe? Or are you
> starting up your system by booting into 128 mode, and then using GO 64
> (which would initialize VDC because you booted into 128 mode first)? In
> my case, the FastLoad cartridge causes it to skip 128 mode entirely.

I was testing by booting to 128 mode then going to 64mode.
Will write a init routine and do more testing.

Thanks for the help.

Bill
>
> --
>      Cameron Kaiser * ckaiser@floodgap.com * posting with a Commodore 128
>                personal page: http://www.armory.com/%7Espectre/
>  ** Computer Workshops: games, productivity software and more for C64/128! 
> **
>                  ** http://www.armory.com/%7Espectre/cwi/ ** 


0
Reply Wilbert 4/10/2006 11:06:48 PM

"Wilbert E. Harp Jr." <wharp@neo.rr.com> writes:

>>set80		sec
>>		jmp common
>>read80	clc
>>common	stx $d600
>>lup0		bit $d600
>>		bpl lup0
>>		bcc cread80
>>		sta $d601
>>		rts ; optional
>>cread80	lda $d601
>>		rts

>I like the above code. It can still be used in a crt.
>May I have your permission to use it ?

Of course.

>>My only worry about this was that when I tried to do VDC RAM stores without
>>initializing the chip, the results were unreliable. I just copied the 128
>>Kernal's init routine out and used it for my purposes, a la what was done 
>>for the 80-column version of Kermit-64. After init, it settled down.
[...]
>>are you
>>starting up your system by booting into 128 mode, and then using GO 64
>>(which would initialize VDC because you booted into 128 mode first)? In
>>my case, the FastLoad cartridge causes it to skip 128 mode entirely.

>I was testing by booting to 128 mode then going to 64mode.
>Will write a init routine and do more testing.

That's probably the difference. If you have a cartridge installed that
forces you to 64 mode, you'll almost certainly need to do the init sequence
yourself. I'd advise doing it under all circumstances and then you're
guaranteed to have it work.

--
      Cameron Kaiser * ckaiser@floodgap.com * posting with a Commodore 128
                personal page: http://www.armory.com/%7Espectre/
  ** Computer Workshops: games, productivity software and more for C64/128! **
                  ** http://www.armory.com/%7Espectre/cwi/ **
0
Reply Cameron 4/11/2006 5:03:10 AM

Joseph Fenn wrote:
> Maurice
> I see your point however the one liner I put on here is the quickest
> and easiest to do hence the preferble way.   It only takes a half
> minute to determine the vdc expansion is there, then go for it.
> So again as I said the quicker you know, if it is or not,
> then you can proceed with stuff the requires the 64k VDC.
>                   Joe

By your reasoning, fixing a blown fuse by using a penny to short the 
terminals is the quickest and easiest way, hence the preferable way.

Checking to see if a gun is loaded by pulling the trigger is the 
quickest way, hence the preferable way.

Consider modern computers for a moment-
I'm sure there are short programs which can be entered ad DOS commands 
which will tell you the chipset, Video modes, Audio capabilities, NIC 
type, etc. According to the 128 one-liner thinking, it's quicker to type 
in a command (or two) to determine the configuration, then you go forth 
and load the various drivers/software based on the reported data.

Me, I'd rather type the extra code and have the computer handle 
configuration- It's all part of the boot process. (Autobooting is why I 
bought a 128 oh so long ago.)

The one liner is good to determine what you're working with as a 
programmer/user who is directly going to be working with the VDC 
registers, etc. It's not that useful when you are configuring a program 
to work with various hardware, making you an indirect user of the hardware.

-Urson Bear
0
Reply Papabear 4/11/2006 10:33:10 AM

Joseph Fenn <jfenn@lava.net> wrote:
> I see your point however the one liner I put on here is the quickest
> and easiest to do hence the preferble way.   It only takes a half

No, you don't see my point.

Look at it this way...

Let's say I just created the best 128 program ever, but it requires you
as the user to enter your one-liner command to determine if your 128 has
16K video ram or 64K video ram. Ok, so far, so good. Actually, you probably
don't even need the one-liner because you already know your 128 has 64K
of video ram. However, some people don't know, so they use the one-liner.

Most people will be thinking "Why is the software making me type in this
stuff, isn't the programmer smart enough to figure it out without me having
to do this?"

Next:

Now, you have to configure the software one way for 16K video and another
way for 64K video. With your theory, it's better for you to do it then
to have the software automatically set it up for you.

So, now we have an extensive configuration to perform. You have to do
all the configuring correctly or the software might not work. After all,
why have the programmer do it when you can do it yourself.

This software isn't looking so cool after all.

So, after thinking about it, don't you think it would be best if the
software determines what to do with the hardware? Generally, it's easier
for the user. And the amount of code needed isn't much and only needs
to be run during startup and the code space in memory can be overlaid
with something else, so the space it uses isn't wasted at all.

-Maurice

-- 
** Maurice Randall - Click Here Software Co.
** High-Performance for your Commodore
** email: maurice@cmdrkey.com, support@cmdrkey.com
** web: http://cmdrkey.com
0
Reply Maurice 4/11/2006 9:03:59 PM

Maurice Randall <maurice@cmdrkey.com> writes:

> Now, you have to configure the software one way for 16K video and
> another way for 64K video. [..] You have to do all the configuring
> correctly or the software might not work.

Or even the programmer has to make two separate versions, and the
users have to remember which version works with which expansion.
Some people will download (or buy!) the wrong version and complain
about it doesn't work. If someone has a 16K VDC and upgrades to the
bigger memory, the program won't work anymore. A new version needs
to be downloaded or bought. This may be appropriate behavior if a
16K VDC C128 and a 64K VDC C128 are considered two different types
of computers, fundamentally incompatible with eachother anyway.

-- 
Anders Carlsson
0
Reply Anders 4/11/2006 9:10:43 PM

"Cameron Kaiser" <ckaiser@floodgap.com> wrote in message 
news:443b3836$0$74424$bb4e3ad8@newscene.com...

>>I like the above code. It can still be used in a crt.
>>May I have your permission to use it ?
>
> Of course.

Thank you very much.

> That's probably the difference. If you have a cartridge installed that
> forces you to 64 mode, you'll almost certainly need to do the init 
> sequence
> yourself. I'd advise doing it under all circumstances and then you're
> guaranteed to have it work.
>
Will write some new code in a few days. Wife PO at me now.

Is it possable to hack the kernal c128 to force it 64 mode at turn on ?

Without pressing any keys.

Under winvice I tried to change the  system vector from FFF8: 24 E2
 to FFF8: 4D FF. That should work but it does not.

One more thing. Is it possable to have 64 mode use bank 1 ram insted of
bank 0 at startup ?

Bill



>      Cameron Kaiser * ckaiser@floodgap.com * posting with a Commodore 128
>                personal page: http://www.armory.com/%7Espectre/
>  ** Computer Workshops: games, productivity software and more for C64/128! 
> **
>                  ** http://www.armory.com/%7Espectre/cwi/ ** 


0
Reply Wilbert 4/11/2006 9:49:23 PM

"Wilbert E. Harp Jr." <wharp@neo.rr.com> writes:

>Will write some new code in a few days. Wife PO at me now.

My sympathies. o.O

>Is it possable to hack the kernal c128 to force it 64 mode at turn on ?
>Without pressing any keys.
>Under winvice I tried to change the  system vector from FFF8: 24 E2
> to FFF8: 4D FF. That should work but it does not.

Actually, it will work *if* you do this *after* the system has already
started up. The reason is a little weird; here's what the 128 does at
reset time.

- The Z80 does its business and hands control to the 8502 if the Commodore
key is not down.
- The 8502 starts up out of the hardware reset vector, which points to
$ff3d. This routine makes sure that bank 15 is enabled, and jumps to the
routine at $e000.
- Among its other tasks, this reset routine looks at locations 65525-65527
in bank 1 to see if the bytes C B M are already there. If not, then it puts
them there and *overwrites* whatever is in the soft reset vector with $e224
by *calling* $e224, which stores itself into the soft reset vector and placing
C B M into those locations.

So, if those bytes aren't already there, changing the soft reset vector just
gets ignored (because it is immediately overwritten when reset occurs). The
next obvious method is change the *hardware* reset vector to point to this
routine, but theoretically the MMU will not have been initialized yet, so
this may not work predictably.

This makes the vector seem otherwise useless, but it *is* handy for making
programs "uninterruptible" -- block or trap all the other IRQs and store your
routine here, and as long as C B M stays in those locations, short of turning
off the computer there's no way to stop the program. Mapping the 128 has a
routine for just this purpose, as memory serves.

>One more thing. Is it possable to have 64 mode use bank 1 ram insted of
>bank 0 at startup ?

Not without modification of the MMU or the chip connections. AFAIK you can't
do this in software.

--
      Cameron Kaiser * ckaiser@floodgap.com * posting with a Commodore 128
                personal page: http://www.armory.com/%7Espectre/
  ** Computer Workshops: games, productivity software and more for C64/128! **
                  ** http://www.armory.com/%7Espectre/cwi/ **
0
Reply Cameron 4/12/2006 1:04:03 AM

Wilbert E. Harp Jr. <wharp@neo.rr.com> wrote:
> Is it possable to hack the kernal c128 to force it 64 mode at turn on ?

Not sure if this is the method you're looking for, but you could
put a small program on a disk and have it autoboot from device 8.

> One more thing. Is it possable to have 64 mode use bank 1 ram insted of
> bank 0 at startup ?

Yes, this is possible, but I think you have to retain the first 1K of
bank 0 as common ram, but maybe not. If you want to experiment a little, this will
get you started:

Go into the MONITOR and enter the following little program into bank
1 ram:

A 12000 SEI
A 12001 LDA #$47
A 12003 STA $FF00
A 12006 LDA #$44
A 12008 STA $D506
A 1200B JMP $FF4D

Now, from the MONITOR do: J 12000
Or from BASIC: BANK1:SYS8192

You will now be in 64 mode. For proof that you are running in
BANK 1 ram, enter a small program:

10 PRINT"ARE WE IN BANK1?"

Now, press the reset button, re-enter the MONITOR and do:

M 10800

You should see your little program in the BANK 1 ram.

Take it from there and have fun.

-Maurice
 
-- 
** Maurice Randall - Click Here Software Co.
** High-Performance for your Commodore
** email: maurice@cmdrkey.com, support@cmdrkey.com
** web: http://cmdrkey.com
0
Reply Maurice 4/12/2006 1:58:12 PM

"Maurice Randall" <maurice@cmdrkey.com> wrote in message 
news:UH7%f.65164$H71.4069@newssvr13.news.prodigy.com...
>
>> One more thing. Is it possable to have 64 mode use bank 1 ram insted of
>> bank 0 at startup ?
>
> Yes, this is possible, but I think you have to retain the first 1K of
> bank 0 as common ram, but maybe not. If you want to experiment a little, 
> this will
> get you started:
>
> Go into the MONITOR and enter the following little program into bank
> 1 ram:
>
> A 12000 SEI
> A 12001 LDA #$47
> A 12003 STA $FF00
> A 12006 LDA #$44
> A 12008 STA $D506
> A 1200B JMP $FF4D
>
> Now, from the MONITOR do: J 12000
> Or from BASIC: BANK1:SYS8192

That is fracken cool. I was just reading in c128 programming secrets by 
William M. Wiese, Jr (pages 4 & 5)
About this he said it was possable by setting up the MMU then call c64 mode. 
But gave no code to do it.

Thanks for taking time to post about this.

Bill


0
Reply Wilbert 4/12/2006 10:57:42 PM

"Wilbert E. Harp Jr." <wharp@neo.rr.com> writes:

>>>One more thing. Is it possable to have 64 mode use bank 1 ram insted of
>>>bank 0 at startup ?
>>Yes, this is possible, but I think you have to retain the first 1K of
>>bank 0 as common ram, but maybe not. If you want to experiment a little, 
>>this will get you started: [code omitted]

>That is fracken cool.

Wow, I stand corrected. However, I would have thought that the GO64 routine
would have obliterated the MMU settings. Proves me wrong, I suppose.

--
      Cameron Kaiser * ckaiser@floodgap.com * posting with a Commodore 128
                personal page: http://www.armory.com/%7Espectre/
  ** Computer Workshops: games, productivity software and more for C64/128! **
                  ** http://www.armory.com/%7Espectre/cwi/ **
0
Reply Cameron 4/12/2006 11:46:08 PM

> A 12000 SEI
> A 12001 LDA #$47
> A 12003 STA $FF00
> A 12006 LDA #$44
> A 12008 STA $D506
> A 1200B JMP $FF4D

As long as 1K of BANK 0 ram is being used, the above code could
actually be placed anywhere below $0400 in BANK 0. That's easier
than copying it to BANK 1.

-Maurice

-- 
** Maurice Randall - Click Here Software Co.
** High-Performance for your Commodore
** email: maurice@cmdrkey.com, support@cmdrkey.com
** web: http://cmdrkey.com
0
Reply Maurice 4/13/2006 12:00:06 AM

30 Replies
19 Views

(page loaded in 0.458 seconds)


Reply: