IGNORED

# Pulsing characters.

## Recommended Posts

I wrote the following progam in Action! so that I could determine the exact coordinates of the screen in the Breakout-clone I'm writing to learn the system.

Whenever the x or y coordinates are less than 100 the third digit switches between several different values, always in the same order. I'm not quite sure what causes this, but it reminds me of the energizers in Jawbreaker. Anyone have a clue on this?

Also, does anyone have a better way of converting the byte values so they display correctly on the screen?

BYTE PMBASE=\$D407,
RAMTOP=\$6A,
SDMCTL=\$22F,
GRACTL=\$D01D,
P0H=\$D000,
P0C=\$2C0,
P1C=\$2C1,
SP0=\$D008,
CHBAS = \$2F4
CARD SAVMSC=\$58
CARD POINTER MYPMBASE
BYTE ARRAY CROSSHAIR = [56 16 56 16 56]
BYTE XPOS, YPOS

PROC SLEEP(BYTE ITS)
BYTE I,J,K
FOR I = 0 TO ITS
DO
FOR J=0 TO 10
DO
K = 100/20
OD
OD
RETURN

PROC init()
;variable declarations
CARD PMTOP

;code
PMTOP = RAMTOP - 8
PMBASE = PMTOP
MYPMBASE = PMTOP * 256
GRAPHICS(1)
SETCOLOR(0,5,7)
SETCOLOR(1,1,10)
SETCOLOR(2,10,5)
SETCOLOR(3,13,2)
SETCOLOR(4,0,0)
SDMCTL = 46
GRACTL = 3
XPOS = 100
YPOS = 100
P0H = XPOS
P0C=88
RETURN

PROC SETUP_PMGRAPHICS()

Zero(MYPMBASE+512,128)
MoveBlock(MYPMBASE+512+YPOS,CROSSHAIR,5)

RETURN

PROC CHANGE_CHARSET()
CARD MEMTOP = MYPMBASE
BYTE ARRAY NC1 = [255 128 128 128 128 128 128 255]
BYTE ARRAY NC2 = [255 1 1 1 1 1 1 255 ]
ZERO(MEMTOP,512)
MOVEBLOCK(MEMTOP,57344,512)
MOVEBLOCK(MEMTOP+2*8,NC1,8)
MOVEBLOCK(MEMTOP+3*8,NC2,8)
CHBAS = MEMTOP/256
RETURN

PROC DRAW_BRICKS()
BYTE I
FOR I = 0 to 119 STEP 2
DO
POKE(SAVMSC+I,2)
POKE(SAVMSC+I+1,3)
OD
RETURN

PROC MAIN()
BYTE STVAL,I
CHAR ARRAY XCORD(4),YCORD(4)
INIT()
CHANGE_CHARSET()
SETUP_PMGRAPHICS()
DRAW_BRICKS()
DO
STVAL=STICK(0)
IF STVAL=11 THEN
XPOS = XPOS -1
FI
IF STVAL=7 THEN
XPOS = XPOS + 1
FI
IF STVAL=14 THEN
ZERO(MYPMBASE+512+YPOS,5)
YPOS = YPOS - 1
MoveBlock(MYPMBASE+512+YPOS,CROSSHAIR,5)
FI
IF STVAL=13 THEN
ZERO(MYPMBASE+512+YPOS,5)
YPOS = YPOS + 1
MOVEBLOCK(MYPMBASE+512+YPOS,CROSSHAIR,5)
FI

P0H=XPOS
STRB(XPOS,XCORD)
STRB(YPOS,YCORD)
FOR I=0 TO 3
DO
XCORD(I) = XCORD(I) - \$20
YCORD(I) = YCORD(I) - \$20
OD
MOVEBLOCK(SAVMSC+600,XCORD+1,3)
MOVEBLOCK(SAVMSC+605,YCORD+1,3)
SLEEP(5)
OD
RETURN

##### Share on other sites

I don't know ACTION, but usually Player data has at least one 0 byte at each end to make sure movement

does not leave any data behind , this may not be your problem but you never know.

##### Share on other sites

I suppose what you see as the flashing right digit is some undefined byproduct of the StrB function for values below 100. You could maybe use a Print function instead and reposition the cursor before you use it.

BTW, have a look at Atariwiki for some Action! coding tips. Using the Poke() function is rather unnecessary. It's faster and more elegant to define a variable located at the address you want to poke and then manipulate that variable. Same goes for Setcolor which can be replaced by declaring an array at the address for Color 0 and then storing into that array.

##### Share on other sites

• 2 weeks later...

The manual states STRB outputs a <string<. In ACTION! Strings have the for <length byte>, char1, char2, but you assume a CHAR ARRAY. Also I thing that a simple "PrintB" should be Ok to print the number directly.

##### Share on other sites

10 hours ago, JAC! said:

Also I thing that a simple "PrintB" should be Ok to print the number directly.

Just started playing with Action, too many "PRINT" versions (although I can see why)

pity the manual is a "bit all over the place", it's all there, but you have to trawl

though it to find what your looking for.

##### Share on other sites

6 hours ago, TGB1718 said:

Just started playing with Action, too many "PRINT" versions (although I can see why)

pity the manual is a "bit all over the place", it's all there, but you have to trawl

though it to find what your looking for.

I think the lack of a "beginner friendly" manual or book like the many introductory books for BASIC was one of the major stumbling blocks for Action! to rule the world. The documentation IMHO assumes quite a high level of knowledge and doesn't "take you by the hand". The inclusion of BASIC-like functions might ease transition from BASIC but doesn't really lead to optimum "Action!ic" code.

## 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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.