The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
[HP42] bounching ball
09-30-2024, 07:41 PM
Post: #1
[HP42] bounching ball
Hi all,

just to share an amusement program I've done to learn a bit of HP42 programming, in particular for the PIXEL function. It's just a 3 pixels diameter ball bounching in the screen.

I've tested on Free42 and Plus42.
For Plus42 the number of pixels available in Y direction should be changed from 16 to 64 to span all the display area (row 05).
The number in row 02 should be changed, increased or decreased, to let the ball moving faster or slower.

Bye,
Davide


Code:

00 { 326-Byte Prgm }
01▸LBL "BNG2"
02 2ᴇ3
03 STO "CDS"
04 STO "CD"
05 16
06 STO "MAXY"
07 131
08 STO "MAXX"
09 1
10 STO "dY"
11 STO "dX"
12 FIX 00
13 RAN
14 RCL "MAXY"
15 2
16 -
17 ×
18 1
19 +
20 RND
21 STO "Y"
22 RAN
23 RCL "MAXX"
24 2
25 -
26 ×
27 1
28 +
29 RND
30 STO "X"
31 CLLCD
32▸LBL "START"
33 RCL "Y"
34 RCL "X"
35 XEQ "PUTB"
36▸LBL "COUNT"
37 DSE "CD"
38 GTO "COUNT"
39 RCL "CDS"
40 STO "CD"
41 CLLCD
42 RCL "MAXY"
43 1
44 -
45 RCL "Y"
46 X=Y?
47 XEQ "CSY"
48 2
49 -
50 X=0?
51 XEQ "CSY"
52 XEQ "STY"
53 RCL "MAXX"
54 2
55 -
56 RCL "X"
57 X=Y?
58 XEQ "CSX"
59 2
60 -
61 X=0?
62 XEQ "CSX"
63 XEQ "STX"
64 GTO "START"
65▸LBL "CSY"
66 RCL "dY"
67 +/-
68 STO "dY"
69 RTN
70▸LBL "CSX"
71 RCL "dX"
72 +/-
73 STO "dX"
74 RTN
75▸LBL "STY"
76 RCL "Y"
77 RCL+ "dY"
78 STO "Y"
79 RTN
80▸LBL "STX"
81 RCL "X"
82 RCL+ "dX"
83 STO "X"
84 RTN
85▸LBL "PUTB"
86 1
87 +
88 PIXEL
89 1
90 -
91 X<>Y
92 1
93 -
94 X<>Y
95 PIXEL
96 X<>Y
97 2
98 +
99 X<>Y
100 PIXEL
101 X<>Y
102 1
103 -
104 X<>Y
105 1
106 -
107 PIXEL
108 RTN
109 END


Attached File(s) Thumbnail(s)
   

.zip  BNG2.raw.zip (Size: 364 bytes / Downloads: 6)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
[HP42] bounching ball - Dave75 - 09-30-2024 07:41 PM
RE: [HP42] bounching ball - Steve Simpkin - 09-30-2024, 08:29 PM
RE: [HP42] bounching ball - Dave75 - 10-01-2024, 04:21 PM



User(s) browsing this thread: 1 Guest(s)