PLOT $FFF0 (x,y) with vpoke?

All aspects of programming on the Commander X16.
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

PLOT $FFF0 (x,y) with vpoke?

Post by funkheld »

Hi good afternoon.

Which poke command can I use read and write x and y screen $80?
PLOT $FFF0 Video Read/write cursor position A X Y

Thanks.
greeting

position x und y?
VPoke(1,$b000,0);
VPoke(1,$b000+1,0*16+2);
Last edited by funkheld on Wed Apr 03, 2024 8:34 pm, edited 1 time in total.
Edmond D
Posts: 489
Joined: Thu Aug 19, 2021 1:42 am

Re: Which poke command can I use on the screen please $80 Set x and y position of a char?

Post by Edmond D »

If using the built in BASIC you can use the locate command - https://github.com/X16Community/x16-doc ... .md#locate

Based on what you've provided mode $80 (https://github.com/X16Community/x16-doc ... r-3-editor) via a SCREEN $80 the example works:
10 SCREEN $80
20 LOCATE 10,20
30 PRINT "X"
This method avoids having to VPOKE and do math :), plus is very easy to read and figure out where X marks the spot.
kelli217
Posts: 531
Joined: Sun Jul 05, 2020 11:27 pm

Re: PLOT $FFF0 (x,y) with poke?

Post by kelli217 »

In BASIC, the command to set the position of the cursor is LOCATE, as Edmond describes. However, this will not serve to tell you the current location of the cursor. For that you do need the PLOT kernal routine.

Its behavior is different according to the setting or clearing of the carry bit in the processor. If the carry bit (bit 0, the least significant bit in the status register) is clear, then it will behave as the LOCATE command does, to set the position of the cursor to the horizontal position that it reads from the Y register and the vertical position from the X register.

(Yes, this is the opposite of the Cartesian coordinate system. It is a well-known issue.)

If the carry bit is set, then the behavior is to read back what position the cursor is in. The values are returned in the X and Y registers (again, horizontal in Y and vertical in X).

This second usage case is not accessible from a BASIC command, but it can be used by calling it via SYS $FFF0.

To use it in this way, you must use the memory locations provided for you by the BASIC SYS interface.

Any machine language routine that uses only the built-in registers of the processor (A, X, Y, and the processor status register) can be invoked from BASIC by setting the memory location 780 ($030C) through 783 ($030F). Return values from such routines can be read from those locations after the routine returns, as well.

780 ($030C) - A
781 ($030D) - X
782 ($030E) - Y
783 ($030F) - Processor Status

So, as an example, if you wanted to use this routine from within a BASIC program, to read the current cursor location, you would write the following code in BASLOAD format:


READCURSOR: POKE $030F, 1:REM SET CARRY BIT OF PROCESSOR STATUS SYS $FFF0 ROW = PEEK($030D) COLUMN = PEEK($030E)
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: PLOT $FFF0 (x,y) with poke?

Post by funkheld »

Thanks for the info.

I play with madpascal
it goes over tile address $1b000 with screen $80.
screen is 128x62 tile.

basic cannot perform locate for 128x62: is error.

goes via vpoke.

control scrollchar2.prg with the q/w/e/s keys.
scrolls 128 tiles in x and 62 tiles in y direction.
at 129 tile x the @ starts again.

Thanks.
greeting.
Attachments
scrollchar2.prg
(1.19 KiB) Downloaded 176 times
Edmond D
Posts: 489
Joined: Thu Aug 19, 2021 1:42 am

Re: PLOT $FFF0 (x,y) with poke?

Post by Edmond D »

funkheld wrote: Wed Apr 03, 2024 8:09 pm I play with madpascal
I've not played with madpascal at all, nor have I really dived into understanding VERA, so I can only give advice in what I know in BASIC.

My emulator is quite outdated, R38 so your sample program doesn't run (note that I expected it would not work.) I just got my X-16 hardware today, and expect that it might be Christmas when I can get it running, despite wanting to use it sooner.

So I'm unsure of how madpacsal's Vpoke compares with the command in BASIC.

kelli217 has provided how to use the system calls to get the current location in a BASIC example; you'll need to recode it in madpascal to use it. I don't know of others who are using the language on the X16, so it might be a small portion of this community. Hopefully they will jump in if you need help.
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: PLOT $FFF0 (x,y) with vpoke?

Post by funkheld »

Hi good afternoon.

There is also vpoke/vpeek on the cc65, prog8 and other nice things in the languages to get to know the x16 in the system. you then create these in the language.
You have to rethink the x16, otherwise you can also buy a c64.

With the basic of the x16 you can also use Vpoke/VPeek, VERA and other exciting things.
This sys also does the basic slowly.

At 75 years old, it's fun for me to see this depth of the x16.
Unfortunately I can't get an x16 from Germany that quickly,
otherwise I would already have the x16.

There are also few basic programmers for the x16.
Pity.

Have fun with your x16.
Why does x16 hardware take so long to get up and running?
How do you update the hardware on the x16?

the latest x16 system from x16:
https://github.com/X16Community/x16-emu ... #artifacts

greeting
Accordster
Posts: 8
Joined: Thu Sep 07, 2023 4:11 am

Re: PLOT $FFF0 (x,y) with vpoke?

Post by Accordster »

funkheld wrote: Thu Apr 04, 2024 6:45 am Hi good afternoon.

There is also vpoke/vpeek on the cc65, prog8 and other nice things in the languages to get to know the x16 in the system. you then create these in the language.
You have to rethink the x16, otherwise you can also buy a c64.

With the basic of the x16 you can also use Vpoke/VPeek, VERA and other exciting things.
This sys also does the basic slowly.

At 75 years old, it's fun for me to see this depth of the x16.
Unfortunately I can't get an x16 from Germany that quickly,
otherwise I would already have the x16.

There are also few basic programmers for the x16.
Pity.

Have fun with your x16.
Why does x16 hardware take so long to get up and running?
How do you update the hardware on the x16?

the latest x16 system from x16:
https://github.com/X16Community/x16-emu ... #artifacts

greeting
I'm planning to travel to Germany in October (have to do abmeldung at a small town Standesamt). I don't mind bringing an X16 with me for you from the USA, if you're interested. That is, if any are still left to purchase from the production run.
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: PLOT $FFF0 (x,y) with vpoke?

Post by funkheld »

Hello thanks for the information.
I'm interested.

I still have to figure out how to update the x16's ROM programs when improvements or expansions are made.
Are they done from the SD card or do you have to burn them yourself?

Your question was: if any of the production ones are still there.
Will a new production be made?

Thanks.
greeting
Edmond D
Posts: 489
Joined: Thu Aug 19, 2021 1:42 am

Question

Post by Edmond D »

Hi Funkhead,

There is a thread on this topic - see viewtopic.php?p=32594&hilit=ROM+Update#p32594
which covers the emulator and the hardware.

Consider posting any follow up questions in that thread to avoid everything blending together in this one about VPoke.

I'll have to respond to your post from yesterday later, perhaps on the weekend.
DragWx
Posts: 342
Joined: Tue Mar 07, 2023 9:07 pm

Re:

Post by DragWx »

Edmond D wrote: Thu Apr 04, 2024 4:55 pm There is a thread on this topic - see viewtopic.php?p=32594&hilit=ROM+Update#p32594
which covers the emulator and the hardware.

Consider posting any follow up questions in that thread to avoid everything blending together in this one about VPoke.
It seems to be impossible to post or reply in the "Official Software" forum, sadly. Further discussion on the r47 release would need to take place in a new thread somewhere else.
Post Reply