[comp.sys.cbm] C128 Programming question

sd05@terre.DMI.USherb.CA (Sylvain Tremblay / Eric Trepanier) (11/13/90)

Hello all!

I have a technical question here.  I'm writing an assembler input routine
wich needs to work on either the 40 or 80 column screens.  To filter out
unwanted characters, I use the GETIN Kernal subroutine ($FFE4).  As you
probably know, this routine dos not provide any kind of cursor.  It's easy
to turn the cursor on in 80 columns using the ESCAPE F sequence.  But I'm
clueless as to how to turn on the 40 column cursor...

Anybody has a suggestion?

Thanks in advance!

Eric Trepanier

-- 
+-----------------------------------------------------------------///------+
|  Sylvain Tremblay        INTERNET: sd05@terre.USherb.CA    __  ///   /|  |
|  Eric Trepanier               CIS: 71640,666               \\\///  #  |  |
|  Sherbrooke, Qc, Can          TEL: (819) 820-0976           \XX/     _|_ |

mat@emcard.UUCP (W Mat Waites) (11/13/90)

In article <1990Nov13.043708.23063@DMI.USherb.CA> sd05@terre.DMI.USherb.CA (Sylvain Tremblay / Eric Trepanier) writes:
>It's easy
>to turn the cursor on in 80 columns using the ESCAPE F sequence.  But I'm
>clueless as to how to turn on the 40 column cursor...
>
>Anybody has a suggestion?
>
>|  Eric Trepanier               CIS: 71640,666               \\\///  #  |  |

There is no 40 column cursor. The one you see in basic is software generated
by flipping the high bit on the character at the cursor position to change it
into the inverse video version of that character.

Cheesy BASIC terminal programs output "backspace, select inverse, space,
select non-inverse, backspace" in loop to imitate the blinking cursor.

I wrote a terminal program in C in which I generated a cursor using a sprite.

In other words, you've gotta generate it yourself somehow.

Mat

-- 
W Mat Waites              |  Unlike most of you, I am not a nut.
{gatech,emory}!emcard!mat |             -H. Simpson

hh2x@vax5.cit.cornell.edu (11/14/90)

In article <1990Nov13.043708.23063@DMI.USherb.CA>,
sd05@terre.DMI.USherb.CA (Sylvain Tremblay / Eric Trepanier) writes:
> Hello all!
>
> I have a technical question here.  I'm writing an assembler input routine
> wich needs to work on either the 40 or 80 column screens.  To filter out
> unwanted characters, I use the GETIN Kernal subroutine ($FFE4).  As you
> probably know, this routine dos not provide any kind of cursor.  It's easy
> to turn the cursor on in 80 columns using the ESCAPE F sequence.  But I'm
> clueless as to how to turn on the 40 column cursor...
>
> Anybody has a suggestion?
>
> Thanks in advance!
>
> Eric Trepanier

It's simple... just POKE 2599, 0 to turn on the cursor. Any other value turns
it off.

LDA #0
STA +2599 ; Cursor on

LDA #1
STA 2599  ; Cursor off

Courtesy Compute's _Mapping the Commodore 128_ by Ottis R. Cowper.
Good luck with your programming project.

Aaron Peromsik               !       (Insert world-class
hh2x@vax5.cit.cornell.edu    !       ultra-nifty tag line
Fido 1:260/420               !              here)

c0037544@cc.nu.oz.au (David Williams) (11/16/90)

> I have a technical question here.  I'm writing an assembler input routine
> which needs to work on either the 40 or 80 column screens.  To filter out
> unwanted characters, I use the GETIN Kernal subroutine ($FFE4).  As you
> probably know, this routine dos not provide any kind of cursor.  It's easy
> to turn the cursor on in 80 columns using the ESCAPE F sequence.  But I'm
> clueless as to how to turn on the 40 column cursor...
> Anybody has a suggestion?
> Thanks in advance!
> Eric T 

The escape character (ascii 27) followed by any of the cursor escape sequences
(u,s,e,f) will turn the cursor on in a program on the 80 column screen. As the
cursor may only be a block on the 40 column screen, the u and s sequences are
invalid, but the e and f sequences will still work. Just send these to the
Kernel routine at $ffd2 at the start of the program, and there you are!

-------------------------------------------------------------------------------
| David Williams       | University of Newcastle 		              |
| c0037544@cc.nu.oz.au | Department of Computer Science  (Undergrad)	      |
|-----------------------------------------------------------------------------|
|   "The decision of Random Numbers is too important to be left to chance !"  |
-------------------------------------------------------------------------------

cs4344af@evax.arl.utexas.edu (Fuzzy Fox) (11/17/90)

In article <4125.27440883@cc.nu.oz.au> c0037544@cc.nu.oz.au (David Williams) writes:
>The escape character (ascii 27) followed by any of the cursor escape sequences
>(u,s,e,f) will turn the cursor on in a program on the 80 column screen. As the
>cursor may only be a block on the 40 column screen, the u and s sequences are
>invalid, but the e and f sequences will still work. Just send these to the
>Kernel routine at $ffd2 at the start of the program, and there you are!

There are some ROM routines in the Kernel devoted to cursor control on
the C128.  Compute!'s "Mapping the Commodore 128" lists these routines:

	CURSORON	$CD6F
	CURSOROFF	$CD9F

These routines will turn the cursor on or off, accordingly.  They will
work no matter which screen (40 or 80) is active.  When using these
routines, you should turn the cursor on, wait for a keypress, then turn
the cursor off before printing any characters.  For example:

GETCHAR:
	JSR  CURSORON
LOOP:	JSR  GETCHAR
	BEQ  LOOP
	PHA
	JSR  CURSOROFF
	PLA
	RTS

Happy computing!
						Fuzzy Fox

sd05@terre.DMI.USherb.CA (Sylvain Tremblay / Eric Trepanier) (11/18/90)

A couple of days ago, I've asked how one could make use of the 40 column
cursor on the C128.  Since then, I've received douzains of reply, some of
them, like the one listed below, were posted on the Newsgroup.  Others
were mailed directly to me.

>
>There are some ROM routines in the Kernel devoted to cursor control on
>the C128.  Compute!'s "Mapping the Commodore 128" lists these routines:
>
>	CURSORON	$CD6F
>	CURSOROFF	$CD9F
>
>These routines will turn the cursor on or off, accordingly.  They will
>work no matter which screen (40 or 80) is active.  When using these
>routines, you should turn the cursor on, wait for a keypress, then turn
>the cursor off before printing any characters.  For example:
>

[STUFF DELETED]

>
>Happy computing!
>						Fuzzy Fox

First of all, I want to thank everybody who replied.  It's quite encouraging
to have such an overwhelming feedback on such a minor little questions.

It's quite funny.  Almost all the replies had different methods of solving the
problems.  Some said it couldn't be done, some said I would have to write my
own interrupt routine to implement a flashing cursor, some have given me an
Operating System variable ($0A27) which when cleared, allowed the 40 column
cursor to flash...  Well after compiling all those suggestions, I have come
up with the solution that best suits me.


Again, I'm very greatful for your collaboration!!!

Eric Trepanier

-- 
+-----------------------------------------------------------------///------+
|  Sylvain Tremblay        INTERNET: sd05@terre.USherb.CA    __  ///   /|  |
|  Eric Trepanier               CIS: 71640,666               \\\///  #  |  |
|  Sherbrooke, Qc, Can          TEL: (819) 820-0976           \XX/     _|_ |