Jump to content
IGNORED

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


jrhodes

Recommended Posts

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?

 

100 REM  **************  
110 REM  * LIGHT RACE * 
120 REM  ************** 
130 REM   
140 REM  BY J. R. DEW   
150 REM  99'ER VERSION 2.11.1MM  
160 REM  
170 REM  REQUIRES MINI-MEMORY MODULE   
180 RANDOMIZE
190 DEF RI(N)=INT(RND*N)
200 SC=0
210 HSC=0
220 GOTO 1500
230 PRINT "THIS IS LIGHTRACE.": :"IN THIS GAME, YOU ARE":"DRIVING A LIGHT RACER BUT":"YOU CANNOT CONTROL THE"
240 PRINT "SPEED. AHEAD OF YOU IS A":"BLACK WALL. THERE IS A RED":"HOLE IN THE BLACK WALL-YOU"
250 PRINT "MUST DRIVE YOUR RACER":"THROUGH THE RED HOLE & TO":"SAFETY. IF YOU HIT THE BLACK"
260 PRINT "WALL OR YOUR OWN TRAIL, YOU DIE!": :"SELECT KEYBOARD OR JOYSTICKSBY TOUCHING K OR J KEY": : : :
270 CALL CHAR(96,X$)
280 CALL COLOR(9,15,15)
290 GOSUB 1940
300 CALL KEY(0,JS,S)
310 IF JS*S=0 THEN 300
320 IF JS=74 THEN 370
330 IF JS=106 THEN 370
340 IF JS=75 THEN 360
350 IF JS<>107 THEN 300
360 JS=0
370 CALL VCHAR(1,1,32,768)
380 CALL POKEV(784,78,78,78,78,78,78,78,78)
390 CALL SCREEN(16)
400 RESTORE 410
410 READ A(0),A(1),A(2),A(3),A(4),A(5)
420 DATA 32,0,-1,1,0,-32
430 READ J(0,0),J(0,1),J(0,2),J(1,0),J(1,1),J(1,2),J(2,0),J(2,1),J(2,2)
440 DATA 0,-1,0,32,0,-32,0,1,0
450 CALL CHAR(32,BL$)
460 CALL COLOR(1,13,15)
470 FOR TU=1 TO 4
480 ON RI(4)+1 GOTO 670,490,550,610
490 L=RI(25)+4
500 D=32
510 N=L+32
520 CALL HCHAR(22,1,152,96)
530 CALL VCHAR(22,RI(25)+4,144,2)
540 GOTO 730
550 L=(RI(20)+2)*32+30
560 D=-1
570 N=L-1
580 CALL VCHAR(1,1,152,72)
590 CALL HCHAR(RI(20)+2,2,144,2)
600 GOTO 730
610 L=RI(25)+746
620 D=-32
630 N=L-32
640 CALL HCHAR(1,1,152,96)
650 CALL VCHAR(2,RI(25)+4,144,2)
660 GOTO 730
670 X=RI(20)+2
680 L=X*32+1
690 D=1
700 N=L+1
710 CALL VCHAR(1,29,152,72)
720 CALL HCHAR(RI(20)+2,29,144,2)
730 IF OB=0 THEN 800
740 FOR Q=1 TO OB*3
750 CALL HCHAR(RI(15)+6,RI(10)+6,128,6)
760 CALL SOUND(50,440,0)
770 CALL VCHAR(RI(12)+4,RI(20)+6,128,6)
780 CALL SOUND(50,440,0)
790 NEXT Q
800 IF JS>0 THEN 870
810 CALL KEY(1,K,S)
820 IF S<>1 THEN 920
830 IF K>5 THEN 920
840 IF A(K)=0 THEN 920
850 D=A(K)
860 GOTO 920
870 CALL JOYST(1,JX,JY)
880 JX=JX/4+1
890 JY=JY/4+1
900 IF J(JX,JY)=0 THEN 920
910 D=J(JX,JY)
920 N=L+D
930 CALL PEEKV(N,X)
940 CALL POKEV(L,232,"",N,240)
950 IF X<>128 THEN 980
960 L=N
970 GOTO 800
980 IF X=240 THEN 1150
990 FOR Y=1 TO 4
1000 CALL POKEV(642,164,169,179,161,179,180,165,178)
1010 CALL SOUND(450,110,3,-6,0)
1020 CALL POKEV(642,128,128,128,128,128,128,128,128)
1030 NEXT Y
1040 IF SC<=HSC THEN 1060
1050 HSC=SC
1060 CALL CLEAR
1070 CALL SCREEN(12)
1080 PRINT "PRESS ENTER TO PLAY AGAIN ORCLEAR TO STOP."
1090 GOSUB 1730
1100 GOSUB 1890
1110 INPUT X$
1120 SC=0
1130 OB=0
1140 GOTO 370
1150 CALL CLEAR
1160 GOSUB 1720
1170 GOSUB 1410
1180 NEXT TU
1190 IF OB=4 THEN 1330
1200 IF OB>0 THEN 1290
1210 CALL CLEAR
1220 CALL CHAR(32,"0")
1230 CALL SCREEN(15)
1240 PRINT "PRETTY GOOD......":"NOW LET'S TRY WITH SOME":"OBSTACLES IN THE WAY!": :"DON'T HIT THEM!!!": : : : : : : :
1250 GOSUB 1940
1260 FOR X=440 TO 550 STEP 10
1270 CALL SOUND(200,X,0)
1280 NEXT X
1290 OB=OB+1
1300 CALL CLEAR
1310 CALL CHAR(32,BL$)
1320 GOTO 470
1330 CALL CLEAR
1340 PRINT "CONGRATULATIONS": : : :"YOU'VE WON THE LIGHT RACE!"
1350 GOSUB 1940
1360 GOSUB 1720
1370 FOR I=1 TO 400
1380 NEXT I
1390 STOP
1400 GOSUB 1890
1410 FOR X=1 TO 4
1420 CALL SOUND(100,880,0)
1430 CALL SOUND(100,110,0)
1440 NEXT X
1450 GOSUB 1730
1460 FOR I=1 TO 32
1470 CALL POKEV(I,128)
1480 NEXT I
1490 RETURN
1500 BL$="FF818181818181FF"
1510 X$="FFFFFFFFFFFFFFFF"
1520 CALL CHAR(152,X$)
1530 CALL CHAR(144,X$)
1540 CALL CHAR(136,X$)
1550 CALL CHAR(128,X$)
1560 CALL CLEAR
1570 CALL POKEV(784,245,245,245,245,245,245,245,245,"",796,208,160,128,16)
1580 CALL POKEV(34,183,165,172,163,175,173,165,128,180,175)
1590 CALL POKEV(130,172,169,167,168,180,128,178,161,163,165)
1600 FOR X=639 TO 665
1610 CALL POKEV(X,232,240)
1620 NEXT X
1630 FOR X=665 TO 0 STEP-32
1640 Y=X-32
1650 CALL POKEV(X,232,"",Y,240)
1660 NEXT X
1670 CALL SOUND(999,110,0)
1680 CALL CLEAR
1690 CALL POKEV(784,206,206,206,206,206,206,206,206)
1700 CALL CLEAR
1710 GOTO 230
1720 SC=SC+100+150*OB
1730 V=SC
1740 P=7
1750 CALL POKEV(2,179,163,175,178,165)
1760 GOSUB 1820
1770 V=HSC
1780 P=25
1790 CALL POKEV(15,168,169,167,168,128,179,163,175,178,165)
1800 GOSUB 1820
1810 RETURN
1820 V$=STR$(V)
1830 LN=LEN(V$)
1840 FOR I=1 TO LN
1850 A$(I)=SEG$(V$,I,1)
1860 CALL POKEV(I+P,ASC(A$(I))+96)
1870 NEXT I
1880 RETURN
1890 FOR I=1 TO 2
1900 CALL VCHAR(22,I,32,3)
1910 CALL VCHAR(22,I+30,32,3)
1920 NEXT I
1930 RETURN
1940 FOR I=1 TO 2
1950 CALL VCHAR(1,I,96,24)
1960 CALL VCHAR(1,I+30,96,24)
1970 NEXT I
1980 RETURN

 

 

LITERACE_M.zip

Edited by jrhodes
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.com/emulators/pc99/pc99%20dsk%20collection/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

Link to comment
Share on other sites

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.

 

 

1 CALL VDPUTIL2
100 REM     **************
110 REM     * LIGHT RACE *
120 REM     **************
130 REM
140 REM    ORIGINALLY BY J.W. DEW
150 REM    99'ER VERSION 2.11.1MM
160 REM    REQUIRES XB+32K
170 REM    MODIFIED BY JRHODES
172 CALL LOAD(16368,80,79,75,69,86,32,48,52,80,69,69,75,86,32,48,32)
173 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)
174 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)
175 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)
176 CALL LOAD(8196,63,240)
180 RANDOMIZE
190 DEF RI(N)=INT(RND*N)
200 SC=0
210 HSC=0
220 GOTO 1500
230 PRINT "THIS IS LIGHTRACE ": :"IN THIS GAME, YOU ARE":"DRIVING A LIGHT RACER BUT":"YOU CANNOT CONTROL THE"
240 PRINT "SPEED. AHEAD OF YOU IS A":"HOLE IN THE BLACK WALL-YOU"
250 PRINT "MUST DRIVE YOUR RACER":"THROUHG THE RED HOLE & TO":"SAFETY. IF YOU HIT THE BLACK"
260 PRINT "WALL OR YOUR OWN TRAIL, YOU DIE!": :"SELECT KEYBOARD OR JOYSTICKSBY TOUCHING K OR J KEY": : : :
270 CALL CHAR(96,X$)
280 CALL COLOR(9,15,15)
290 GOSUB 1940
300 CALL KEY(0,JS,S)
310 IF JS*S=0 THEN 300
320 IF JS=74 THEN 370
330 IF JS=106 THEN 370
340 IF JS=75 THEN 360
350 IF JS<>107 THEN 300
360 JS=0
370 CALL VCHAR(1,1,32,768)
371 POKEADD=784 :: POKEVAL=78
372 FOR [=1 TO 8
380 GOSUB 2000
381 NEXT [
390 CALL SCREEN(16)
400 RESTORE 410
410 READ A(0),A(1),A(2),A(3),A(4),A(5)
420 DATA 32,0,-1,1,0,-32
430 READ J(0,0),J(0,1),J(0,2),J(1,0),J(1,1),J(1,2),J(2,0),J(2,1),J(2,2)
440 DATA 0,-1,0,32,0,-32,0,1,0
450 CALL CHAR(32,BL$)
460 CALL COLOR(1,13,15)
470 FOR TU=1 TO 4
480 ON RI(4)+1 GOTO 670,490,550,610
490 L=RI(25)+4
500 D=32
510 N=L+32
520 CALL HCHAR(22,1,152,96)
530 CALL VCHAR(22,RI(25)+4,144,2)
540 GOTO 730
550 L=(RI(20)+2)*32+30
560 D=-1
570 N=L-1
580 CALL VCHAR(1,1,152,72)
590 CALL HCHAR(RI(20)+2,2,144,2)
600 GOTO 730
610 L=RI(25)+746
620 D=-32
630 N=L-32
640 CALL HCHAR(1,1,152,96)
650 CALL VCHAR(2,RI(25)+4,144,2)
660 GOTO 730
670 X=RI(20)+2
680 L=X*32+1
690 D=1
700 N=L+1
710 CALL VCHAR(1,29,152,72)
720 CALL HCHAR(RI(20)+2,29,144,2)
730 IF OB=0 THEN 800
740 FOR Q=1 TO OB*3
750 CALL HCHAR(RI(15)+6,RI(10)+6,128,6)
760 CALL SOUND(50,440,0)
770 CALL VCHAR(RI(12)+4,RI(20)+6,128,6)
780 CALL SOUND(50,440,0)
790 NEXT Q
800 IF JS>0 THEN 870
810 CALL KEY(1,K,S)
820 IF S<>1 THEN 920
830 IF K>5 THEN 920
840 IF A(K)=0 THEN 920
850 D=A(K)
860 GOTO 920
870 CALL JOYST(1,JX,JY)
880 JX=JX/4+1
890 JY=JY/4+1
900 IF J(JX,JY)=0 THEN 920
910 D=J(JX,JY)
920 N=L+D
921 PEEKADD=N :: PEEKVAL=X
930 GOSUB 2001
931 POKEADD=L :: POKEVAL=232 :: GOSUB 2000
940 POKEADD=N :: POKEVAL=240 :: GOSUB 2000
950 IF X<>128 THEN 980
960 L=N
970 GOTO 800
980 IF X=240 THEN 1150
990 FOR Y=1 TO 4
991 RESTORE 994 :: POKEADD=642
992 FOR [=1 TO 8
993 READ POKEVAL
994 DATA 164,169,179,161,179,180,165,178
1000 GOSUB 2000
1001 NEXT [
1010 CALL SOUND(450,110,3,-6,0)
1011 POKEADD=642 :: POKEVAL=128
1012 FOR [=1 TO 8
1020 GOSUB 2000
1021 NEXT [
1030 NEXT Y
1040 IF SC<=HSC THEN 1060
1050 HSC=SC
1060 CALL CLEAR
1070 CALL SCREEN(12)
1080 PRINT "PRESS ENTER TO PLAY AGAIN ORCLEAR TO STOP"
1090 GOSUB 1730
1100 GOSUB 1890
1110 INPUT X$
1120 SC=0
1130 OB=0
1140 GOTO 370
1150 CALL CLEAR
1160 GOSUB 1720
1170 GOSUB 1410
1180 NEXT TU
1190 IF OB=4 THEN 1330
1200 IF OB>0 THEN 1290
1210 CALL CLEAR
1220 CALL CHAR(32,"0")
1230 CALL SCREEN(15)
1240 PRINT "PRETTY GOOD......":"NOW LETS TRY WITH SOME":"OBSTACLES IN THE WAY!": :"DON'T HIT THEM!!!": : : : : : : :
1250 GOSUB 1940
1260 FOR X=440 TO 550 STEP 10
1270 CALL SOUND(200,X,0)
1280 NEXT X
1290 OB=OB+1
1300 CALL CLEAR
1310 CALL CHAR(32,BL$)
1320 GOTO 470
1330 CALL CLEAR
1340 PRINT "CONGRATULATIONS": : : :"YOU'VE WON THE LIGHT RACE!"
1350 GOSUB 1940
1360 GOSUB 1720
1370 FOR I=1 TO 400
1380 NEXT I
1390 STOP
1400 GOSUB 1890
1410 FOR X=1 TO 4
1420 CALL SOUND(100,880,0)
1430 CALL SOUND(100,110,0)
1440 NEXT X
1450 GOSUB 1730
1460 FOR I=1 TO 32
1461 POKEADD=I :: POKEVAL=128
1470 GOSUB 2000
1480 NEXT I
1490 RETURN
1500 BL$="FF818181818181FF"
1510 X$="FFFFFFFFFFFFFFFF"
1520 CALL CHAR(152,X$)
1530 CALL CHAR(144,X$)
1540 CALL CHAR(136,X$)
1550 CALL CHAR(128,X$)
1560 CALL CLEAR
1561 POKEADD=784 :: POKEVAL=245
1562 GOSUB 2000
1563 RESTORE 1566 :: POKEADD=796
1564 FOR [=1 TO 4
1565 READ POKEVAL
1566 DATA 208,160,128,16
1570 GOSUB 2000
1571 NEXT [
1572 RESTORE 1575 :: POKEADD=34
1573 FOR [=1 TO 10
1574 READ POKEVAL
1575 DATA 183,165,172,163,175,173,165,128,180,175
1580 GOSUB 2000
1581 NEXT [
1582 POKEADD=130 :: RESTORE 1585
1583 FOR [=1 TO 10
1584 READ POKEVAL
1585 DATA 172,169,167,168,180,128,178,161,163,165
1590 GOSUB 2000
1591 NEXT [
1600 FOR X=639 TO 665
1601 POKEADD=X :: RESTORE 1604
1602 FOR [=1 TO 2
1603 READ POKEVAL
1604 DATA 232,240
1610 GOSUB 2000
1611 NEXT [
1620 NEXT X
1630 FOR X=665 TO 32 STEP-32
1640 Y=X-32
1641 POKEADD=X :: POKEVAL=232 :: GOSUB 2000
1650 POKEADD=Y :: POKEVAL=204 :: GOSUB 2000
1660 NEXT X
1670 CALL SOUND(999,110,0)
1680 CALL CLEAR
1681 POKEADD=784 :: POKEVAL=206
1682 FOR [=1 TO 8
1690 GOSUB 2000
1691 NEXT [
1700 CALL CLEAR
1710 GOTO 230
1720 SC=SC+100+150*OB
1730 V=SC
1740 P=7
1741 RESTORE 1744 :: POKEADD=2
1742 FOR [=1 TO 5
1743 READ POKEVAL
1744 DATA 179,163,175,178,165
1750 GOSUB 2000
1751 NEXT [
1760 GOSUB 1820
1770 V=HSC
1780 P=25
1781 RESTORE 1784 :: POKEADD=15
1782 FOR [=1 TO 10
1783 READ POKEVAL
1784 DATA 168,169,167,168,128,179,163,175,178,165
1790 GOSUB 2000
1791 NEXT [
1800 GOSUB 1820
1810 RETURN
1820 V$=STR$(V)
1830 LN=LEN(V$)
1840 FOR I=1 TO LN
1850 A$(I)=SEG$(V$,I,1)
1851 POKEADD=I+P :: POKEVAL=ASC(A$(I))+96
1860 GOSUB 2000
1870 NEXT I
1880 RETURN
1890 FOR I=1 TO 2
1900 CALL VCHAR(22,I,32,3)
1910 CALL VCHAR(22,I+30,32,3)
1920 NEXT I
1930 RETURN
1940 FOR I=1 TO 2
1950 CALL VCHAR(1,I,96,24)
1960 CALL VCHAR(1,I+30,96,24)
1970 NEXT I
1980 RETURN
2000 ADD=POKEADD/256 :: MSB=INT(ADD) :: LSB=(ADD-MSB)*256 :: CALL LOAD(-3,POKEVAL,MSB,LSB) :: CALL LINK("POKEV") :: RETURN
2001 ADD=PEEKADD/256 :: MSB=INT(ADD) :: LSB=((ADD-MSB)*256) :: CALL LOAD(-2,MSB,LSB) :: CALL LINK("PEEKV") :: CALL PEEK(-3,PEEKVAL) :: RETURN
32714 SUB VDPUTIL2
32715 CALL CLEAR :: CALL INIT :: CALL LOAD(8196,63,232)
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)
32717 CALL LOAD(9491,100)
32718 CALL LOAD(9508,2,224,37,20,3,0,0,0,2,0,0,100,200,0,37,18,4,192,2,1,0,1,4,32,32,12,4,32)
32719 CALL LOAD(9536,32,24,18,184,192,32,131,74,2,1,37,0,208,160,131,18,9,130,2,34,255,255,4,32,32,44)
32720 CALL LOAD(9562,4,197,209,34,36,255,9,132,19,21,4,195,60,224,37,18,200,5,131,76,200,5,131,78,200,5)
32721 CALL LOAD(9588,131,80,2,5,64,0,161,68,2,131,0,1,17,6,2,5,65,0,161,67,6,196,200,4,131,76)
32722 CALL LOAD(9614,200,5,131,74,4,192,192,66,5,129,4,37,254)
32723 CALL LOAD(9636,2,224,37,20,3,0,0,0,4,192,2,1,0,1,200,1,37,18,4,32,32,12,4,32,32,24,18,184)
32724 CALL LOAD(9664,200,32,131,74,37,0,184,32,131,18,37,19,2,3,0,2)
32725 CALL LOAD(9680,4,192,192,67,4,32,32,12,4,32,32,24,18,184,216,224,131,75,37,0,5,131,136,3)
32726 CALL LOAD(9704,37,18,22,242,192,32,37,0,2,1,37,2,192,131,2,34,255,254,4,32,32,36)
32727 CALL LOAD(9726,4,192,216,0,131,124,2,224,131,224,4,96,0,112)
32728 CALL LOAD(9740,3,0,0,0,4,192,2,1,0,1,4,32,32,12,200,32,131,74,37,18,2,1,0,2,4,32,32,12,4,32)
32729 CALL LOAD(9770,32,24,18,184,192,32,131,744,208,32,37,19,4,32,32,48,4,91)
32730 CALL LOAD(8194,39,04)
32731 SUBEND
32732 SUB CHAR(A,A$) :: L=LEN(A$)
32733 A$=A$&RPT$("0",16-L)
32734 FOR I=1 TO 16 STEP 2
32735 A1$=SEG$(A$,I,1)
32736 A2$=SEG$(A$,I+1,1)
32737 IF A1$<":" THEN A1=VAL(A1$)*16 ELSE A1=(ASC(A1$)-55)*16
32738 IF A2$<":" THEN A1=A1+VAL(A2$)ELSE A1=A1+ASC(A2$)-55
32740 CALL LINK("VPOKE",767+8*A+(I+1)/2,A1)
32741 NEXT I
32742 SUBEND
32743 SUB COLOR(A,B,C)
32744 CALL LINK("VPOKE",2063+A,(B-1)*16+C-1)
32745 SUBEND

 

 

Edited by jrhodes
  • Like 1
Link to comment
Share on other sites

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.

GW-VPOKE.zip

Edited by jrhodes
Link to comment
Share on other sites

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.

 

post-25753-0-34029800-1532266544_thumb.jpg

  • Like 1
Link to comment
Share on other sites

  • 8 months later...

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?

 

 

 

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

 

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.com/emulators/pc99/pc99%20dsk%20collection/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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...