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
PLOT works for the full range of the VDC. Maximum column is 79 ($4f).
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
Can you provide an example of the machine code you are using? Your explanation doesn't make a lot of sense to me.
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]
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
rtsSomething 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.
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
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.
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 activeNothing to it. :)