Jump to content

Photo

Using PEEKV and POKEV to covert MiniMem game Light Race to T.I. XB

W.I.P. Help needed

18 replies to this topic

#1 jrhodes OFFLINE  

jrhodes

    Moonsweeper

  • 330 posts

Posted Sat Jul 14, 2018 6:34 AM

I have this minimem program, and apart from the use of PEEKV and POKEV, it looks like plain basic.

I think i can insert the BXB routine to get the characters it needs in XB, but PEEKV and POKEV would still be missing.

Which brings me to this question:
Is there a sub routine i can insert in XB to take the place of PEEKV and POKEV?

Spoiler

Attached File  LITERACE_M.zip   2.67KB   10 downloads


Edited by jrhodes, Mon Apr 1, 2019 3:49 AM.


#2 ti99iuc OFFLINE  

ti99iuc

    Stargunner

  • 1,665 posts
  • Location:Italy

Posted Sat Jul 14, 2018 6:48 AM

oh yes, i like it too, a nice funny game.

 

i also just catalogued e bug fixed version (compared to the one present in the GameBase v2.1)

 

here is it:


Edited by ti99iuc, Sat Jul 14, 2018 6:49 AM.


#3 jrhodes OFFLINE  

jrhodes

    Moonsweeper

  • Topic Starter
  • 330 posts

Posted Sat Jul 14, 2018 7:37 AM

Thanks for the updated version.

But i still wonder about the original question:

Is there a sub routine i can use from XB in place of PEEKV and POKEV?



#4 TheBF OFFLINE  

TheBF

    Stargunner

  • 1,048 posts
  • Location:The Great White North

Posted Sat Jul 14, 2018 7:58 AM

I have not run the game to check my assumptions, but it looks like they are using POKEV and PEEKV for faster access to the screen by reading and writing directly to the video screen VDP RAM.

 

To emulate POKEV in BASIC you can use HCHAR in a FOR/NEXT loop to write characters but it will be slower.

But where it is writing the same character repeated into screen position, HCHAR or VCHAR will work very well.

For PEEKV you would have to use GCHAR to read the screen which is also slower.

 

I don't use MINI-MEMORY but it appears the the screen memory is the same as the E/A cartridge switched to Graphics mode.

It starts at VDP address 0 and ends at VDP address 768.

 

Disclaimer: These are assumptions at this point in  time. 



#5 jrhodes OFFLINE  

jrhodes

    Moonsweeper

  • Topic Starter
  • 330 posts

Posted Thu Jul 19, 2018 4:19 PM

I just discovered this, have not had a chance yet to play with it.

Implementation of PEEKV and POKEV in XB: (found here: http://ftp.whtech.co...ion/U_1/UP1.ZIP)

100 REM  ******************
110 REM  * EXTENDED BASIC *
120 REM  * POKEV AND PEEKV*
130 REM  * BY BILL PROTHRO*
140 REM  ******************
150 REM  This program allows you to poke values into vdp ram and peek values from the vdp ram within a running program in extended basic.
160 REM  To poke successive bytes you will have to use data statements and a for next loop.
170 REM  To peek successive bytes a for next loop is all that is needed.
180 REM  32K memory expansion is required to use this utility.
190 CALL INIT
200 CALL CLEAR
210 REM  These load statements load a machine code program into the memory expansion that can be accessed with extended basic.
220 CALL LOAD(16368,80,79,75,69,86,32,48,52,80,69,69,75,86,32,48,32)
230 CALL LOAD(12320,2,224,48,0,192,32,255,254,6,160,48,88,216,32,136,0,255,253,16,11,2,224,48,0,192,32)
240 CALL LOAD(12346,255,254,2,32,64,0,6,160,48,88,216,32,255,253,140,0,4,192,216,0,131,124)
250 CALL LOAD(12368,2,224,131,224,4,96,0,112,6,192,216,0,140,2,6,192,216,0,140,2,4,91)
260 CALL LOAD(8196,63,240)
270 REM  In a free running program equate pokeadd to the address you want to poke in VDP ram.
280 INPUT "WHICH ADDRESS? ":POKEADD
290 REM  Equate pokeval to the value you want to poke.
300 INPUT "VALUE TO POKE ":POKEVAL
310 GOSUB 390
320 REM  Equate peekadd to the address you want to peek.
330 INPUT "ADDRESS TO PEEK? ":PEEKADD
340 GOSUB 400
350 REM  The value you peek is returned in peekval.
360 PRINT PEEKVAL
370 STOP
380 REM  These subroutines divide the address into msb and lsb values and link to the machine code program.
390 ADD=POKEADD/256 :: MSB=INT(ADD) :: LSB=(ADD-MSB)*256 :: CALL LOAD(-3,POKEVAL,MSB,LSB) :: CALL LINK("POKEV") :: RETURN
400 ADD=PEEKADD/256 :: MSB=INT(ADD) :: LSB=((ADD-MSB)*256) :: CALL LOAD(-2,MSB,LSB) :: CALL LINK("PEEKV") :: CALL PEEK(-3,PEEKVAL)
410 RETURN



#6 RXB OFFLINE  

RXB

    River Patroller

  • 3,603 posts
  • Location:Vancouver, Washington, USA

Posted Thu Jul 19, 2018 6:02 PM

Many alternate XB carts like RXB, XB 2.7 and Superbasic have built in VPOKE or VPEEK



#7 jrhodes OFFLINE  

jrhodes

    Moonsweeper

  • Topic Starter
  • 330 posts

Posted Thu Jul 19, 2018 6:28 PM

Indeed, that is why i intend on getting a physical RXB cartridge some day.

Until  then i will keep goodies like this handy for playing around with.


Edited by jrhodes, Thu Jul 19, 2018 6:46 PM.


#8 Vorticon OFFLINE  

Vorticon

    River Patroller

  • 3,793 posts
  • Location:Eagan, MN, USA

Posted Fri Jul 20, 2018 6:06 AM

oh yes, i like it too, a nice funny game.

 

i also just catalogued e bug fixed version (compared to the one present in the GameBase v2.1)

 

here is it:

 

I can't get it to run with the MM module option 1(LOAD AND RUN). How do you run it?



#9 jrhodes OFFLINE  

jrhodes

    Moonsweeper

  • Topic Starter
  • 330 posts

Posted Fri Jul 20, 2018 6:27 AM

OK, here is what i have so far.
This is a modified version of Lightrace that uses the above PEEKV and POKEV routines, but is right now still incomplete and not working yet.
I need to somehow modify a version of BXB/VDPUtil so that both it and the above PEEKV and POKEV routines can be used in the same program.
I attempted to change the name of the assembly routine from POKEV to VPOKE by changing

32716 CALL LOAD(16360,80,79,75,69,82,32,38,12,80,79,75,69,86,32,37,164,80,69,69,75,86,32,37,36)

to

32716 CALL LOAD(16360,80,79,75,69,82,32,38,12,86,80,79,75,69,32,37,164,80,69,69,75,86,32,37,36)

I think if i can get BXB or something that works like it put in its place to redefine the higher character sets, it might work.

Spoiler

Edited by jrhodes, Fri Jul 20, 2018 10:27 PM.

  • RXB likes this

#10 jrhodes OFFLINE  

jrhodes

    Moonsweeper

  • Topic Starter
  • 330 posts

Posted Fri Jul 20, 2018 8:04 AM

I don't get it. I keep getting

 

SUBPROGRAM NOT FOUND

IN 32740

IN CHAR

CALLED FROM 1520

I know this VDPUTIL2 is used by other programs, and works fine. All i did was swap out the name POKEV for VPOKE so the other routine could use POKEV as a name.

 

Can anyone please help me get this working?

 

As proof that changing the name from POKEV to VPOKE should not be a error on my part, here is galactic war, which used BXB, using my new VPOKE name.

I can also confirm that the POKEV and PEEKV routines listed in this thread earlier work, as it includes a demo program which works as expected.

Nothing was changed in the POKEV or PEEKV routines, only in BXB/VDPUTIL.

Attached File  GW-VPOKE.zip   2.99KB   4 downloads


Edited by jrhodes, Fri Jul 20, 2018 9:28 AM.


#11 ti99iuc OFFLINE  

ti99iuc

    Stargunner

  • 1,665 posts
  • Location:Italy

Posted Fri Jul 20, 2018 10:30 AM

 

I can't get it to run with the MM module option 1(LOAD AND RUN). How do you run it?

 

yes, you can load it in TI-BASIC with MM inserted.



#12 Vorticon OFFLINE  

Vorticon

    River Patroller

  • 3,793 posts
  • Location:Eagan, MN, USA

Posted Sun Jul 22, 2018 7:35 AM

Fun little game, but there is a bug... Apparently it fails to check for an open path to the exit, and therefore one can end up with a situation where an obstacle blocks the exit and there is no way to continue. Path checking is actually pretty complex, so I can imagine why this was not implemented. 

 

Attached File  Light Race.jpg   218.06KB   2 downloads



#13 FarmerPotato OFFLINE  

FarmerPotato

    Moonsweeper

  • 361 posts
  • Location:Austin, TX

Posted Fri Mar 29, 2019 7:49 AM

I have this minimem program, and apart from the use of POKEV and POKEV, it looks like plain basic.

I think i can insert the BXB routine to get the characters it needs in XB, but PEEKV and POKEV would still be missing.

Which brings me to this question:
Is there a sub routine i can insert in XB to take the place of PEEKV and POKEV?[spoiler]

 

 

Hi! I found the BXB routine inside Sam Moore Jr's port of CARS AND CARCASSES to XB. This game uses the color groups 15 and 16 (but not 12, 13 or 14!).

 

How does BXB enable XB to use CALL CHAR(152, "1C1C1C141C1C1C00")  ?

 

I found this version on Stainless Software Volume 6. Some years ago I downloaded the original from whtech  but it is no longer there.

BXB
Cars and Carcasses II by Not Polyoptics
Cars and Carcasses II by Not Polyoptics


#14 jrhodes OFFLINE  

jrhodes

    Moonsweeper

  • Topic Starter
  • 330 posts

Posted Fri Mar 29, 2019 1:45 PM

I forgot about this... I tried and did not really get anywhere.

Anyone else think they could try, would love to see this done and have a version of this playable without a mini-memory that works from a standard ti-xb cart.


Edited by jrhodes, Fri Mar 29, 2019 1:46 PM.


#15 FarmerPotato OFFLINE  

FarmerPotato

    Moonsweeper

  • 361 posts
  • Location:Austin, TX

Posted Fri Mar 29, 2019 2:12 PM

I forgot about this... I tried and did not really get anywhere.

Anyone else think they could try, would love to see this done and have a version of this playable without a mini-memory that works from a standard ti-xb cart.

 

This adds CALL POKEV to BXB:

30007 SUB POKEV(A,B) :: CALL LOAD(9492,INT(A/256),A AND 255,B) :: CALL LINK("POKEV") :: SUBEND

I don't think BXB has PEEKV. The author seems averse to accessing numbers from assembly.



#16 FarmerPotato OFFLINE  

FarmerPotato

    Moonsweeper

  • 361 posts
  • Location:Austin, TX

Posted Fri Mar 29, 2019 2:39 PM

 

I just discovered this, have not had a chance yet to play with it.

Implementation of PEEKV and POKEV in XB: (found here: http://ftp.whtech.co...ion/U_1/UP1.ZIP)

100 REM  ******************
110 REM  * EXTENDED BASIC *
120 REM  * POKEV AND PEEKV*
130 REM  * BY BILL PROTHRO*
140 REM  ******************
150 REM  This program allows you to poke values into vdp ram and peek values from the vdp ram within a running program in extended basic.
160 REM  To poke successive bytes you will have to use data statements and a for next loop.
170 REM  To peek successive bytes a for next loop is all that is needed.
180 REM  32K memory expansion is required to use this utility.
190 CALL INIT
200 CALL CLEAR
210 REM  These load statements load a machine code program into the memory expansion that can be accessed with extended basic.
220 CALL LOAD(16368,80,79,75,69,86,32,48,52,80,69,69,75,86,32,48,32)
230 CALL LOAD(12320,2,224,48,0,192,32,255,254,6,160,48,88,216,32,136,0,255,253,16,11,2,224,48,0,192,32)
240 CALL LOAD(12346,255,254,2,32,64,0,6,160,48,88,216,32,255,253,140,0,4,192,216,0,131,124)
250 CALL LOAD(12368,2,224,131,224,4,96,0,112,6,192,216,0,140,2,6,192,216,0,140,2,4,91)
260 CALL LOAD(8196,63,240)
270 REM  In a free running program equate pokeadd to the address you want to poke in VDP ram.
280 INPUT "WHICH ADDRESS? ":POKEADD
290 REM  Equate pokeval to the value you want to poke.
300 INPUT "VALUE TO POKE ":POKEVAL
310 GOSUB 390
320 REM  Equate peekadd to the address you want to peek.
330 INPUT "ADDRESS TO PEEK? ":PEEKADD
340 GOSUB 400
350 REM  The value you peek is returned in peekval.
360 PRINT PEEKVAL
370 STOP
380 REM  These subroutines divide the address into msb and lsb values and link to the machine code program.
390 ADD=POKEADD/256 :: MSB=INT(ADD) :: LSB=(ADD-MSB)*256 :: CALL LOAD(-3,POKEVAL,MSB,LSB) :: CALL LINK("POKEV") :: RETURN
400 ADD=PEEKADD/256 :: MSB=INT(ADD) :: LSB=((ADD-MSB)*256) :: CALL LOAD(-2,MSB,LSB) :: CALL LINK("PEEKV") :: CALL PEEK(-3,PEEKVAL)
410 RETURN

 

This might work, using the Bill Prothro routine. I did not test it yet...

SUB POKEV(A,B) :: C=A/256 :: CALL LOAD(-3,B,INT(A/256),B AND 255) :: CALL LINK("POKEV") :: SUBEND
SUB PEEKV(A,B) :: C=A/256 :: CALL LOAD(-2,INT(A/256),B AND 255) :: CALL LINK("PEEKV") :: CALL PEEK(-3,B) :: SUBEND

SUB COLORHI(A,B,C) :: CALL LOAD(-3,(B-1)*16+C-1,8,15+A) :: CALL LINK("POKEV") :: SUBEND

SUB CHARHI(A,A$) :: HEX$ = "123456789ABCDEF" :: MSB = 3+INT(A/32) :: LSB = (A AND 31)*8 :: FOR I=1 TO LEN(A$) STEP 2 :: B = POS(HEX$,SEG$(A$,I,1))*16 + POS(HEX$,SEG$(A$,I+1,1)) :: CALL LOAD(-3,B,MSB,LSB+INT((I-1)/2)) :: CALL LINK("POKEV") :: NEXT I :: SUBEND

I call it CHARHI , it is going to be slower than CHAR, so you could rename just some of the CALL CHAR statements where needed.

Similarly COLORHI though the slowdown is much less.

 

CHAR definitions 144-159 overlap the sprite motion table in Extended Basic. 

One thing missing here: turning off sprite motion by setting the status byte at >83C2. I think it's off by default.



#17 senior_falcon ONLINE  

senior_falcon

    Stargunner

  • 1,516 posts
  • Location:Lansing, NY, USA

Posted Fri Mar 29, 2019 3:02 PM

I think you are obsessing too much over PEEKV and POKEV. As noted above, it appears this is just used to write to or read from the screen, except for line 1570 which I believe is writing to the color table.

For example, line 1580:

CALL POKEV(34,183,165,172,163,175,173,165,128,180,175)

There is some conversion stuff you have to do. VRAM 0 is row1, column 1; VRAM 32 is row2, column 1 so VRAM 34 is row 2 column 3, and then you have to subtract the screen offset of 96 from the characters being printed to screen.

When you do that you can see that this displays the text "WELCOME TO" at row 2, column 3

You can do this task easily in XB with

1580 DISPLAY AT(2,1):"WELCOME TO"  (remember that for DISPLAY AT column 1 is really column 3 because of the 2 blank columns on each side of the screen.) You might need to use SIZE here.

As TheBF pointed out, "For PEEKV you would have to use GCHAR to read the screen which is also slower," but I would bet that in XB CALL GCHAR is faster than PEEKV in TI BASIC.

The advantage to doing it this way is that no memory expansion is required.

 

(edit) I see that character sets 15 and 16 are used which is a bit of a problem for XB. And yes, Rich, I know that RXB can define those.


Edited by senior_falcon, Fri Mar 29, 2019 3:10 PM.


#18 senior_falcon ONLINE  

senior_falcon

    Stargunner

  • 1,516 posts
  • Location:Lansing, NY, USA

Posted Sun Mar 31, 2019 6:23 PM

It turns out that in this case you don't even need character sets 15 and 16. Here is the code to define those characters:

1510 X$="FFFFFFFFFFFFFFFF"
1520 CALL CHAR(152,X$)
1530 CALL CHAR(144,X$)
1540 CALL CHAR(136,X$)
1550 CALL CHAR(128,X$)
This just makes 4 solid blocks.
But if you did this:
1510 X$="FFFFFFFFFFFFFFFF0"
1540 CALL CHAR(136,X$)
1550 CALL CHAR(128,X$)
then 128 and 136 are solid blocks and 129 and 137 are blank blocks. CALL COLOR(13,FG,BG,14,FG,BG) would give you 4 solid blocks without using character sets 15 and 16. 
There are POKEV's that move the player and if you converted them to row and column you could use HCHAR or VCHAR to do the same thing.
The performance might even be better because CALLs in XB are considerably faster than in BASIC.
This would run in XB without memory expansion.


#19 RXB OFFLINE  

RXB

    River Patroller

  • 3,603 posts
  • Location:Vancouver, Washington, USA

Posted Sun Mar 31, 2019 7:13 PM

Except for EA support RXB can run TI Basic Programs, so far only 1 program has been produced that did not work in RXB.

But a simple 1 line fix solved the issue.

 

RXB  would be another solution that is faster then Basic, but compatible too.


Edited by RXB, Sun Mar 31, 2019 7:13 PM.






Also tagged with one or more of these keywords: W.I.P., Help needed

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users