Assembler: How to print on selected position in VDC mode?

Started by MIRKOSOFT, March 14, 2010, 12:42 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MIRKOSOFT

Hi!

I tried to use KERNAL PLOT routine ($FFF0) to set cursor position.
All works correctly until I select position greater than 39th column - this works in both modes VIC-II and VDC.
When I select column position e.g. #41, all the settings are ignored.

Is possible to use KERNAL PLOT routine in full range of VDC?
Or I must to use other routine?

Thanks for every help.

Miro
MIRKOSOFT of megabytes

Commodore 64 was great, Commodore 128 is bigger, better, faster and more!!!

http://www.mirkosoft.sk

BigDumbDinosaur

PLOT works for the full range of the VDC.  Maximum column is 79 ($4f).
x86?  We ain't got no x86.  We don't need no stinking x86!

MIRKOSOFT

Ok.


But when I set position row $0A column $2D and call $FFF0 (before calling CLC), then JSR BSOUT and enter SYS8192 (routine is on $2000) it writes character one line below SYS8192...?!?!


Miro
MIRKOSOFT of megabytes

Commodore 64 was great, Commodore 128 is bigger, better, faster and more!!!

http://www.mirkosoft.sk

BigDumbDinosaur

Can you provide an example of the machine code you are using?  Your explanation doesn't make a lot of sense to me.
x86?  We ain't got no x86.  We don't need no stinking x86!

MIRKOSOFT

Hi!
So here's bit a code:
.pc=$2000 "WRITE ON X & Y"

   ldx #$0a   // row 10
   ldy #$2d   // column 45
   clc
   jst $fff0   // call plot
   lda #$41   // char "A" to write
   jsr$ffd2   // call BSOUT
   rts



Thanks.


Miro[/code]
MIRKOSOFT of megabytes

Commodore 64 was great, Commodore 128 is bigger, better, faster and more!!!

http://www.mirkosoft.sk

BigDumbDinosaur

Quote from: MIRKOSOFT on March 20, 2010, 08:32 PM
Hi!
So here's bit a code:
.pc=$2000 "WRITE ON X & Y"

   ldx #$0a   // row 10
   ldy #$2d   // column 45
   clc
   jst $fff0   // call plot
   lda #$41   // char "A" to write
   jsr$ffd2   // call BSOUT
   rts

I'd code it thusly:

mmuhi    =$ff00                ;MMU config
bsout    =$ffd2                ;output primitive
plot     =$fff0                ;position cursor
;
        *=$2000                ;assemble at 8192
;
         lda #%00001110
         sta mmuhi             ;map in kernel ROM
         ldx #10               ;row
         ldy #45               ;column
         clc
         jsr plot              ;position
         bcs error             ;coordinates out of range
;
         lda #'A'
         jsr bsout             ;print char
         rts


Something to note: you can't position beyond column 39 unless the 80 column side is the active display.  If you attempt to position out of range, PLOT will set carry to indicate this.  You weren't checking for this error.

Also, note that the above explicitly maps in the kernal ROM.  You can't assume that the ROMs will be in when you SYS unless you specify BANK 15:SYS 8192.

Lastly, it's the mark of an amateur programmer when "magic numbers" such as $FFF0 are buried in the code.  Proper practice is to assign labels to such numbers and use the labels in the code.  Commodore has official labels for all the kernal routines, which you should use.
x86?  We ain't got no x86.  We don't need no stinking x86!

MIRKOSOFT

Hi!


Thanks, this really works.
My problem is for only one thing - C64 user - very long time and I used never this PLOT routine on C128...


Really, thank you very much.


Miro
MIRKOSOFT of megabytes

Commodore 64 was great, Commodore 128 is bigger, better, faster and more!!!

http://www.mirkosoft.sk

Hydrophilic

I am glad BigDumbDinosaur was able to help you, but I am not sure what the problem was... PLOT works fine for either 40- or 80-column screen IF correct video mode is already set.

You can test video mode with BIT $D7... this will set Negative flag in CPU if 80-column is active... if 40-column is active, you will not get correct results unless you first call Swapper ($c02a) to change into 80-column display.
I'm kupo for kupo nuts!

BigDumbDinosaur

#8
Quote from: Hydrophilic on May 06, 2010, 09:07 PM
I am glad BigDumbDinosaur was able to help you, but I am not sure what the problem was... PLOT works fine for either 40- or 80-column screen IF correct video mode is already set.

You can test video mode with BIT $D7... this will set Negative flag in CPU if 80-column is active... if 40-column is active, you will not get correct results unless you first call Swapper ($c02a) to change into 80-column display.

mode     =$D7

testmode bit mode
         bmi in80          ;80 col is active
;
         bpl in40          ;40 col is active


Nothing to it.  :)
x86?  We ain't got no x86.  We don't need no stinking x86!