Jump to content

Photo

PMG Help - Thanks!

PMG

2 replies to this topic

#1 scitari OFFLINE  

scitari

    Chopper Commander

  • 150 posts
  • Keeping bit real
  • Location:Philadelphia

Posted Sun Mar 24, 2019 3:28 PM

I have been working on a simple player-missile graphics demo in BASIC using the VBI for fast player movement. The code below is modified from Chapter 5 of Compute's First Book of Atari Graphics (p164). Everything works fine except that when I set a Graphics mode (e.g. six or eight) I get a weird line on the screen that moves as the player moves up and down. This only happens when I specify a graphics mode. No graphics mode is fine. Graphics 0 is fine. I am stuck on why this is happening. I assume I am bleeding into a memory area. Here is the ATR file with the BASIC program. The code and a screenshot are below. Many thanks for your help!!!

 

PMGHelp.jpg

10 REM * DEMO OF PLAYER-MISSILE GRAPHICS USING THE VERTICAL *
20 REM * BLANK INTERRUPT FOR FAST PLAYER MOVEMENT           *
20 REM see CH5, p164 of Compute's First Book of Atari
30 REM for base code used to make this PM graphics demo
40 REM Modifications by Jason H. Moore, Ph.D.
50 REM March 24, 2019

100 REM * INITIALIZE PLAYER & MEMORY LOCATIONS
110 GRAPHICS 0
120 POKE 752,1:PRINT " ":REM TURN OFF CURSOR
130 SETCOLOR 2,0,0:REM BLACK BACKGROUND
140 PCOL0=216:REM PLAYER COLOR GREEN
150 POKE 704,PCOL0:REM SET PLAYER COLOR
160 PXMEM=53248:PYMEM=1780:PHMEM=1784
170 P0X=120:P0Y=80:REM INIT PLAYER POSITION VARIABLES

200 REM * INITIALIZE VBLANK PLAYER MOVEMENT ROUTINE *
210 FOR I=1536 TO 1706:READ A:POKE I,A:NEXT I
220 FOR I=1774 TO 1787:POKE I,0:NEXT I
230 PM=PEEK(106)-16:PMBASE=256*PM
240 FOR I=PMBASE+1023 TO PMBASE+2047:POKE I,0:NEXT I
250 FOR I=PMBASE+1025 TO PMBASE+1038:READ A:POKE I,A:NEXT I
260 POKE 559,62:POKE 623,1:POKE 1788,PM+4
270 POKE 53277,3:POKE 53256,1:POKE 54279,PM
300 X=USR(1696)

400 REM * SET PLAYER POSITION AND HEIGHT *
410 POKE PHMEM,14:REM HEIGHT
420 POKE PXMEM,P0X:POKE PYMEM,P0Y:REM POSITION
430 GOSUB 500
440 GOTO 400
450 END

500 REM * PLAYER MOVEMENT CALCULATIONS *
510 JOY = STICK(0):REM READ JOYSTICK VALUE
520 IF JOY=15 THEN RETURN:REM RETURN IF NOT PRESSED
530 IF JOY=11 THEN P0X=P0X-2:REM LEFT? DECREASE X
540 IF JOY=7 THEN P0X=P0X+2:REM RIGHT? INCREASE X
550 IF JOY=13 THEN P0Y=P0Y+2:REM UP? INCREASE Y
560 IF JOY=14 THEN P0Y=P0Y-2:REM DOWN? DECREASE Y
570 IF P0X>190 THEN P0X=50:REM SCREEN WRAP RIGHT
580 IF P0X<50 THEN P0X=190:REM SCREEN WRAP LEFT
590 IF P0Y>205 THEN P0Y=35:REM SCREEN WRAP DOWN
600 IF P0Y<35 THEN P0Y=205:REM SCREEN WRAP UP
610 RETURN 

1000 REM * VBLANK INTERRUPT ROUTINE *
1010 DATA 162,3,189,244,6,240,89,56,221,240,6,240,83,141,254,6,106,141
1020 DATA 255,6,142,253,6,24,169,0,109,253,6,24,109,252,6,133,204,133
1030 DATA 206,189,240,6,133,203,173,254,6,133,205,189,248,6,170,232,46,255
1040 DATA 6,144,16,168,177,203,145,205,169,0,145,203,136,202,208,244,76,87
1050 DATA 6,160,0,177,203,145,205,169,0,145,203,200,202,208,244,174,253,6
1060 DATA 173,254,6,157,240,6,189,236,6,240,48,133,203,24,138,141,253,6
1070 DATA 109,235,6,133,204,24,173,253,6,109,252,6,133,206,189,240,6,133
1080 DATA 205,189,248,6,170,160,0,177,203,145,205,200,202,208,248,174,253,6
1090 DATA 169,0,157,236,6,202,48,3,76,2,6,76,98,228,0,0,104,169
1100 DATA 7,162,6,160,0,32,92,228,96

2000 REM * PLAYER SHAPE DATA *
2010 DATA 66,129,129,153,153,255,255,255,255,153,153,129,129,66


Edited by scitari, Sun Mar 24, 2019 3:31 PM.


#2 Wrathchild OFFLINE  

Wrathchild

    River Patroller

  • 2,233 posts
  • Location:Reading, UK.

Posted Sun Mar 24, 2019 4:34 PM

Yes, your PM area is overlapping the graphics area, so in gr.8 the dlist is at $8050 and screen memory starts at $8150.

 

So you can force this to, say, $7800 by changing the line:

230 PM=7*16+8:PMBASE=256*PM


#3 scitari OFFLINE  

scitari

    Chopper Commander

  • Topic Starter
  • 150 posts
  • Keeping bit real
  • Location:Philadelphia

Posted Mon Mar 25, 2019 7:14 PM

I updated the code with the correct memory allocations for GRAPHICS 0-5. I made a number of other edits and then did a blog post about PM graphics using a vertical blank interrupt movement routine. Here is the text file with the code and the ATR file. Hope this is helpful for others learning to program PM graphics for the first time. Feedback welcome!

 

PM-Graphics-VBLANK-Demo-Screenshot.jpg


Edited by scitari, Mon Mar 25, 2019 7:16 PM.






Also tagged with one or more of these keywords: PMG

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users