Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
20 May, 2013, 00:32:19 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: [1] 2 3   Go Down
  Print  
Author Topic: Conway's Game of Life -  (Read 1847 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
Michael_Lee
LV9 Veteran (Next: 1337)
*********
Offline Offline

Gender: Male
Last Login: 09 August, 2012, 18:48:39
Date Registered: 05 August, 2010, 01:00:06
Posts: 1020

Topic starter
Total Post Ratings: +115

View Profile
« on: 27 November, 2010, 21:32:33 »
+1

A version of Conway's game of life for the calc.

Controls:
[Y=] for edit mode - you can toggle squares here.
[2ND] toggles squares.
Hold [ALPHA] when moving the cursor to slow it down (this allows for precision placement)

[TRACE] to enter 'Step' Mode - here, click [2ND] to proceed to the next generation.
[GRAPH] starts 'Auto' Mode - here, the screen refreshes as soon as it can.

At all times, you can HOLD [ + ] or [ - ] to zoom in or out.
Press [CLEAR] to return to the menu, then to quit.

In Step or Auto mode, it's a good idea to try holding all buttons, they're kind of slow to react.

General notes:
The larger the area your squares are taking up, the slower it'll run.
Also, if a square is toggled next to the edge, weird things could happen, so don't do that.
This hasn't been thoroughly bug-tested, and the controls aren't working smoothly yet, but I'll be working on it.


* GOL_2010_11_27_01_GIF.gif (458.2 KB, 192x128 - viewed 286 times.)
* GOL_2010_11_27_01.zip (5 KB - downloaded 54 times.)
« Last Edit: 27 November, 2010, 21:33:02 by Michael_Lee » Logged

My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.
calcdude84se
Needs Motivation
Members
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: 14 May, 2013, 16:12:14
Date Registered: 21 April, 2010, 04:20:59
Posts: 2207


Total Post Ratings: +62

View Profile
« Reply #1 on: 27 November, 2010, 21:34:54 »
0

Nice Smiley
What language is this in? Axe?
I wish you good luck getting it to work and making it fast! Cheesy
Logged

"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Bug me about PartesOS. I might just need reminding.
Munchor
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: 07 May, 2013, 22:49:01
Date Registered: 16 October, 2010, 15:39:13
Location: Position
Posts: 6209


Total Post Ratings: +174

View Profile
« Reply #2 on: 27 November, 2010, 21:35:11 »
0

A version of Conway's game of life for the calc.

Controls:
[Y=] for edit mode - you can toggle squares here.
[2ND] toggles squares.
Hold [ALPHA] when moving the cursor to slow it down (this allows for precision placement)

[TRACE] to enter 'Step' Mode - here, click [2ND] to proceed to the next generation.
[GRAPH] starts 'Auto' Mode - here, the screen refreshes as soon as it can.

At all times, you can HOLD [ + ] or [ - ] to zoom in or out.
Press [CLEAR] to return to the menu, then to quit.

In Step or Auto mode, it's a good idea to try holding all buttons, they're kind of slow to react.

General notes:
The larger the area your squares are taking up, the slower it'll run.
Also, if a square is toggled next to the edge, weird things could happen, so don't do that.
This hasn't been thoroughly bug-tested, and the controls aren't working smoothly yet, but I'll be working on it.

Is Conway's Game of Life a browser game? is it a free game?

I mean, can we have a link, if it is, to compare?
Logged
DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)
*
Offline Offline

Gender: Male
Last Login: Yesterday at 19:36:19
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50202


Total Post Ratings: +2611

View Profile WWW
« Reply #3 on: 27 November, 2010, 21:37:14 »
0

Nice stuff Michael_Lee. Does it uses the stuff from the Game of Life that came with Axe Parser app?
Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter|Myspace
AngelFish
This is my custom title
Administrator
LV12 Extreme Poster (Next: 5000)
*
Offline Offline

Gender: Male
Last Login: 18 May, 2013, 00:41:29
Date Registered: 15 August, 2010, 09:18:54
Posts: 3187


Total Post Ratings: +218

View Profile
« Reply #4 on: 27 November, 2010, 21:40:06 »
0

Is Conway's Game of Life a browser game? is it a free game?

I mean, can we have a link, if it is, to compare?

Conway's Life isn't a browser game. It's actually a mathematical system that happens to produce interesting patterns. An applet of the game can be found here.
Logged

∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ
Michael_Lee
LV9 Veteran (Next: 1337)
*********
Offline Offline

Gender: Male
Last Login: 09 August, 2012, 18:48:39
Date Registered: 05 August, 2010, 01:00:06
Posts: 1020

Topic starter
Total Post Ratings: +115

View Profile
« Reply #5 on: 27 November, 2010, 21:42:19 »
0

What language is this in? Axe?
Yep, it's Axe.  Sorry, I should have mentioned that earlier.

Is Conway's Game of Life a browser game? is it a free game?

I mean, can we have a link, if it is, to compare?

There are many versions of this 'game' (it's not really a game, technically), but I like this one: http://www.ibiblio.org/lifepatterns/.  To start the Java applet, you have to press the button at the top left corner that says 'Enjoy Life' (it's a pop-up)

Nice stuff Michael_Lee. Does it uses the stuff from the Game of Life that came with Axe Parser app?
Axe Parser came with the Game of Life?  o.o  I didn't know that.

Edit: Ninja'd Tongue
« Last Edit: 27 November, 2010, 21:42:55 by Michael_Lee » Logged

My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.
DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)
*
Offline Offline

Gender: Male
Last Login: Yesterday at 19:36:19
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50202


Total Post Ratings: +2611

View Profile WWW
« Reply #6 on: 27 November, 2010, 21:43:43 »
0

Yeah it always did since almost the beginning. Tongue

In fact, if you check the releases thread, there's even a screenshot from Feb or March. Grin
Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter|Myspace
Munchor
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: 07 May, 2013, 22:49:01
Date Registered: 16 October, 2010, 15:39:13
Location: Position
Posts: 6209


Total Post Ratings: +174

View Profile
« Reply #7 on: 27 November, 2010, 21:45:06 »
0

Well, I tried the Applet, I like the phylosophic view of it.

Now, concerning your game, nice Axe program, the interface, especially the menu looks functional and you KIS (kept it simple).

So, good luck with it!
Logged
Michael_Lee
LV9 Veteran (Next: 1337)
*********
Offline Offline

Gender: Male
Last Login: 09 August, 2012, 18:48:39
Date Registered: 05 August, 2010, 01:00:06
Posts: 1020

Topic starter
Total Post Ratings: +115

View Profile
« Reply #8 on: 27 November, 2010, 21:45:42 »
0

Yeah it always did since almost the beginning. Tongue

In fact, if you check the releases thread, there's even a screenshot from Feb or March. Grin

Ah, well, I kinda like mine better Cheesy.
« Last Edit: 27 November, 2010, 21:46:00 by Michael_Lee » Logged

My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.
Munchor
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: 07 May, 2013, 22:49:01
Date Registered: 16 October, 2010, 15:39:13
Location: Position
Posts: 6209


Total Post Ratings: +174

View Profile
« Reply #9 on: 27 November, 2010, 21:47:55 »
0

Yeah it always did since almost the beginning. Tongue

In fact, if you check the releases thread, there's even a screenshot from Feb or March. Grin

Ah, well, I kinda like mine better Cheesy.


That's the way to go: OPTIMISM Cheesy
Logged
DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)
*
Offline Offline

Gender: Male
Last Login: Yesterday at 19:36:19
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50202


Total Post Ratings: +2611

View Profile WWW
« Reply #10 on: 28 November, 2010, 21:05:29 »
0

Yeah I personally like yours a lot more since you can draw stuff anywhere. The old one included with Axe was to demonstrate Axe speed.
Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter|Myspace
Michael_Lee
LV9 Veteran (Next: 1337)
*********
Offline Offline

Gender: Male
Last Login: 09 August, 2012, 18:48:39
Date Registered: 05 August, 2010, 01:00:06
Posts: 1020

Topic starter
Total Post Ratings: +115

View Profile
« Reply #11 on: 29 November, 2010, 05:27:50 »
+1

Updated.
You can now press [WINDOW] to alter the 'rules' of the game.
The original game of life turns cells on if they have 3 neighbors, and lets them survive with two or three - now you can alter these rules for interesting simulations.
The skulls mean that the cell dies, the blank allows survival, and smileys let cells be born.
For particularly interesting configurations, check this: http://en.wikipedia.org/wiki/Life-like_cellular_automata.
For now, not all of the configurations will work, (in the cases where its possible for a cell to be born, but not to survive with the same amount of neighbors), but the majority do.

Also, press [ZOOM] to try toggling between full speed mode (only on the TI-84+SE, I think) and normal.
Pressing [DEL] will clear the screen while editing.


* GOL-2010-11-28-01_GIF.gif (661.45 KB, 192x128 - viewed 244 times.)
* GOL_2010-11-28-01.zip (5.98 KB - downloaded 39 times.)
Logged

My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.
ztrumpet
The Rarely Active One
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: 23 April, 2013, 16:09:52
Date Registered: 08 November, 2009, 21:10:12
Location: Michigan
Posts: 5687


Total Post Ratings: +360

View Profile
« Reply #12 on: 29 November, 2010, 05:54:55 »
0

This is pretty cool.  I suggest adding a Pause 400 or so on the main menu - it's hard to select things here.  Have you checked the algorithm Quigibo uses; it seems a little faster, but yours allows the changing of the rules. Grin
Nice job! Smiley
Logged

Michael_Lee
LV9 Veteran (Next: 1337)
*********
Offline Offline

Gender: Male
Last Login: 09 August, 2012, 18:48:39
Date Registered: 05 August, 2010, 01:00:06
Posts: 1020

Topic starter
Total Post Ratings: +115

View Profile
« Reply #13 on: 29 November, 2010, 06:12:20 »
0

Huh - I had added a
While getkey(0)
   Dispgraph
End
specifically to prevent that problem. 
Are you using Wabbitemu?  Because, for me, Wabbitemu has a tendency to speed things up and make controlling things harder.

Compared to Quigbo's, mine is more convoluted to allow editing.
Logged

My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.
Iambian
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: 14 May, 2013, 14:52:06
Date Registered: 04 September, 2008, 20:12:14
Location: Nowhere in particular
Posts: 636


Total Post Ratings: +167

View Profile
« Reply #14 on: 29 November, 2010, 06:22:46 »
0

As requested from IRC, a piece of ASM from my own 2D Cellular Automata program. This one handles the buffer, generates the needed LUTs and performs the stuff needed for each "generation."

I know there are better ways to handle generating the rules, but I was lazy. Back in 2006, and even now in 2010.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
begincellular2:
 call preservedata  ;preserving both sides of both tables so buffer under/overflow can occur
 call begincellular
 call restoredata   ;loading back data stuffs.
 ret
preservedata:
 ld hl,appbackupscreen-12
 ld de,statVars
 ld bc,12
 ldir
 ld hl,appbackupscreen+768
 ld bc,12
 ldir
 ld hl,savesscreen-12
 ld bc,12
 ldir
 ld hl,savesscreen+768
 ld bc,12
 ldir
 ret
restoredata:
 ld de,appbackupscreen-12
 ld hl,statVars
 ld bc,12
 ldir
 ld de,appbackupscreen+768
 ld bc,12
 ldir
 ld de,savesscreen-12
 ld bc,12
 ldir
 ld de,savesscreen+768
 ld bc,12
 ldir
 ret

begincellular:
 ld a,0
 out ($20),a
 ld hl,$8B00  ;embedded in StatVars memory location. Invalidate stat vars else sys will crash.
 ld de,0
;# of bits in each byte, grouped by nibbles
cenloop00:
 xor a        ;table 1
 ld b,4
 rrc l
 adc a,d
 djnz $-3
 ld e,a
 xor a
 ld b,4
 rrc l
 adc a,d
 djnz $-3
 rrca
 rrca
 rrca
 rrca
 or e
 ld (hl),a
 inc l
 jr nz,cenloop00

;ReturnToLife and KeepAlive tables in LUT format

 ld IX,$8000       ;initialize LUT position
 ld b,$FF          ;255 loops. Fencepost error elimated, since 1/2 of data isn't used.
maxloopa:
 ld hl,(rules)     ; load ruleset
 ld c,(hl)         ; first byte is count
 inc hl            ; next byte
 ld (IX+0),$00     ; clear off byte
minloop01:
 ld a,IXl          ; get current position on LUT
 and $0F           ; get lower nibble
 cp (hl)           ; compare with ruleset (bits set = perform this action) for lower half
 jr nz,$+6         ; if no match, do not change bits
 set 2,(IX+0)      ; change upper bit of nibble
 ld a,IXl          ; get current position on LUT
 rlca \ rlca \ rlca \ rlca  ;shift
 and $0F           ;strip MSN from byte
 cp (hl)           ;compare that with data in HL (the rule byte)
 jr nz,$+6         ;if not equal, then set bit 7 for rule
 set 6,(IX+0)      ;...
 inc hl            ;next rule byte
 dec c             ;decrement counter for number of rule bytes
 jr nz,minloop01   ;go back to start of routine to check next rule
 inc IXh           ;go to next aligned set for rules
 ld c,(hl)         ;load next set of rules. byte counter
 inc hl            ;next byte
 ld (IX+0),$FF     ;load LUT with this value
minloop02:  ;AND loop
 ld a,IXl          ;get LUT LSB
 and $0F           ;strip MSN
 cp (hl)           ;compare with rule bit
 jr z,$+8          ;do not reset if they match. Else, reset bit.
 res 2,(IX+0)      ;...
 jr $+6
 res 0,(IX+0)      ;used for flag if a match has been taken at some point
 ld a,IXl          ;get MSN of LUT position
 rlca \ rlca \ rlca \ rlca  ;shift to LSB
 and $0F           ;strip MSN (now LSB) of LUT position
 cp (hl)           ;compare with rule byte
 jr z,$+8          ;do not reset if they match. Else, reset bit
 res 6,(IX+0)      ;...
 jr $+6
 res 4,(IX+0)      ;used for flag if a match has been taken at some point
 inc hl            ;get next rule byte
 dec c             ;decrement rule byte counter
 jr nz,minloop02   ;loop until there are no more rule bytes left in counter
 
 bit 0,(IX+0)      ;testing series... for the AND loop
 jr nz,$+10        ;
 set 0,(IX+0)      ;
 set 2,(IX+0)      ;
 
 bit 4,(IX+0)      ;
 jr nz,$+10        ;
 set 4,(IX+0)      ;
 set 6,(IX+0)      ;

 dec IXh           ;move cursor back to first LUT
 inc IXl           ;next byte in LUT
 djnz maxloopa     ;go back to main set. Reset pointer to rule table for another run-through.
;Tacked-on table converter code
 ld bc,2
 ld hl,$8000
fixloopa:
 ld a,(hl)
; 76543210
;%01000100
 bit 2,a
 jr z,$+6
 or 00001111b
 jr $+4
 and 11110000b
 bit 6,a
 jr z,$+6
 or 11110000b
 jr $+4
 and 00001111b
 ld (hl),a
 inc hl
 djnz fixloopa
 dec c
 jr nz,fixloopa
;End LUT generator

 xor a
 ld (halted),a
begincellular2a:
 ld a,(halted)
 or a
 jr nz,$+5
 call workscreen

 call showgraph
 call _getkbd
 cp $37
 ret z
 cp $36  ;2nd. Step over iteration
 jr nz,$+7
 call workscreen
 jr begincellular2a
 cp $38  ;DEL. Toggle halt mode
 jr nz,begincellular2delskip
 call _getkbd
 or a
 jr nz,$-4    ;wait until the key has been released.
 ld a,(halted)
 inc a
 and 00000001b
 ld (halted),a
 jr begincellular2a
begincellular2delskip:
 jp begincellular2a

workscreen:
 push IY  ;save this register, 'tis prone to being destroyed in this routine.
  di       ;prevent interrupts. Will be using shadow registers for spare registers
  ld a,(iterations)
  ld hl,savesscreen
  ld de,appbackupscreen
  bit 0,a
  jr nz,$+3  ;jump past the "jr $+3" that is below.
  ex de,hl
  ld (buf1),hl
  ld (buf2),de
;
  ld hl,(buf1)  ;buffer copy outside of range. Previous routine fixes it later.
  ld e,l
  ld d,h
  ld bc,-12
  add hl,bc
  ex de,hl
  ld bc,768-12
  add hl,bc
  ld bc,12
  ldir
  ld hl,(buf1)
  ld e,l
  ld d,h
  ex de,hl
  ld bc,768
  add hl,bc
  ex de,hl
  ld bc,12
  ldir

  exx      ;saving these values for very quick reference
  ld hl,$8100  ;
  exx
  ld hl,$8B00
;
; Clock initializing for speed count:
;  ld a,0
;  out ($30),a
;  ld a,$41
;  out ($30),a  ;Timer/33
;  ld a,0
;  out ($31),a  ;Set mode: Count to zero & stop
;  ld a,$FF
;  out ($32),a  ;Begin counting from $FF
;Clock init done
;
  ld ix,(buf1)  ;IX=first buffer, IY=second buffer. HL buf dropped altogether.
  ld iy,(buf2)
  ld b,64
  push bc
   call workonthisrow
  pop bc
  djnz $-5
 pop iy
;
;Fetch value off the clock
; ld hl,$0505
; ld (currow),hl
; in a,($32)
; ld l,a
; ld h,0
; bcall(_DispHL)
; ld a,0
; out ($30),a   ;disable timer
;Stop clock section
;
 di
 ld (temp1),SP
 ld SP,iterations
 pop hl \ pop de \ ld bc,$0001 ;|
 add hl,bc \ dec bc \ ex de,hl ; >Increment 4-byte counter and use set vectors to compare
 adc hl,bc \ push hl \ push de ;|
 pop hl \ pop ix \ pop bc \ pop de
 or a \ sbc hl,bc
 push hl \ pop ix
 sbc hl,de  ;4-byte subtraction
 ld SP,(temp1)
 ret nz

; ld hl,(iterations)
; inc hl
; ld (iterations),hl
; ld a,l
; or h
; jr nz,$+9
; ld hl,(iterations+2)
; inc hl
; ld (iterations+2),hl  ;if first HL=0, then boundry has crossed and need to increment next set of HL 2 bytes above it
; ld hl,(iterations)
; ld de,(setloops)
; ld a,e \ xor l \ ret nz
; ld a,d \ xor h \ ret nz
; ld hl,(iterations+2)
; ld de,(setloops+2)
; ld a,e \ xor l \ ret nz
; ld a,d \ xor h \ ret nz
;if passed this point, then this means that (iterations) and (setloops) in all four bytes match. Tells program to end iterations now by setting (done) to 1.
 ld a,1        ;setting to 1. Calling routine cutoff has been commented out
 ld (done),a   ;so that this has no effect
 ret


;===========================================================================================
;Main Work algorithm found here. Not as big of bloat as before, but it's still fast...... ==
;===========================================================================================
;===========================================================================================
;
workonthisrow:
 call leftiter
 call centeriter
 call fourthiter
 ld a,10
Workonthisrowsub:
 push af
  call firstiter
  call centeriter
  call fourthiter
 pop af
 dec a
 jr nz,Workonthisrowsub
 call firstiter
 call centeriter
 call rightiter
 ret

;External setup:
;HL = LUT for bit comparison
;HL'= LUT for result testing
; Two LUTs are indexed by HL by incrementing and decrementing H (256 byte wide tables)
;IX = pointer to buffer 1 (reading)
;IY = pointer to buffer 2 (writing)
;
;Internal setup:
;D= row above
;E= row below
;C= current position
;B= temporary variable
;B'=center byte storage
;
;Registers used so far:
; AF, BC, DE, HL, AF', BC', HL', IX, IY
;
;Free registers:
; DE'
;
firstiter:
 ld d,(ix-12)
 ld e,(ix+12)
 ld c,(ix+00)
 ld a,(ix-13)
 rrca
 ld a,d
 rra
 and 11101110b
 ld l,a
 ld b,(hl)
 ld a,(ix+11)
 rrca
 ld a,e
 rra
 and 11101110b
 ld l,a
 ld a,(hl)
 ex af,af'
 ld a,(ix-01)
 rrca
 ld a,c
 rra
 and 10101010b
 ld l,a
 ld a,c
 ex af,af'
 add a,(hl)
 add a,b
 exx
 ld l,a
 ex af,af'
 ld b,a
 and (hl) \ dec h
 or (hl)  \ inc h
 and 10001000b
 ld c,a
 exx
 ret
 
centeriter:
 ld a,d
 and 11101110b
 ld l,a
 ld b,(hl)
 ld a,e
 and 11101110b
 ld l,a
 ld a,(hl)
 ex af,af'
 ld a,c
 and 10101010b
 ld l,a
 ex af,af'
 add a,(hl)
 add a,b
 exx
 ld l,a
 ld a,b
 and (hl) \ dec h
 or (hl)  \ inc h
 and 01000100b
 or c
 ld c,a
 exx
 ld a,d
 and 01110111b
 ld l,a
 ld b,(hl)
 ld a,e
 and 01110111b
 ld l,a
 ld a,(hl)
 ex af,af'
 ld a,c
 and 01010101b
 ld l,a
 ex af,af'
 add a,(hl)
 add a,b
 exx
 ld l,a
 ld a,b
 and (hl) \ dec h
 or (hl)  \ inc h
 and 00100010b
 or c
 ld c,a
 exx
 ret

fourthiter:
 ld a,(ix-11)
 rlca
 ld a,d
 rla
 and 01110111b
 ld l,a
 ld d,(hl)
 ld a,(ix+13)
 rlca
 ld a,e
 rla
 and 01110111b
 ld l,a
 ld e,(hl)
 ld a,(ix+01)
 rlca
 ld a,c
 rla
 and 01010101b
 ld l,a
 ld a,(hl)
 add a,e
 add a,d
 exx
 ld l,a
 ld a,b
 and (hl) \ dec h
 or (hl)  \ inc h
 and 00010001b
 or c
 ld (iy+0),a
 exx
 inc ix
 inc iy
 ret
;=============== side of screen routines
leftiter:
 ld d,(ix-12)
 ld e,(ix+12)
 ld c,(ix+00)
 ld a,(ix-01)
 rrca
 ld a,d
 rra
 and 11101110b
 ld l,a
 ld b,(hl)
 ld a,(ix+23)
 rrca
 ld a,e
 rra
 and 11101110b
 ld l,a
 ld a,(hl)
 ex af,af'
 ld a,(ix+11)
 rrca
 ld a,c
 rra
 and 10101010b
 ld l,a
 ld a,c
 ex af,af'
 add a,(hl)
 add a,b
 exx
 ld l,a
 ex af,af'
 ld b,a
 and (hl) \ dec h
 or (hl)  \ inc h
 and 10001000b
 ld c,a
 exx
 ret

rightiter:
 ld a,(ix-23)
 rlca
 ld a,d
 rla
 and 01110111b
 ld l,a
 ld d,(hl)
 ld a,(ix+01)
 rlca
 ld a,e
 rla
 and 01110111b
 ld l,a
 ld e,(hl)
 ld a,(ix-11)
 rlca
 ld a,c
 rla
 and 01010101b
 ld l,a
 ld a,(hl)
 add a,e
 add a,d
 exx
 ld l,a
 ld a,b
 and (hl) \ dec h
 or (hl)  \ inc h
 and 00010001b
 or c
 ld (iy+0),a
 exx
 inc ix
 inc iy
 ret
Logged

A Cherry-Flavored Iambian draws near... what do you do? ...
Projects in my development environment:
Celtic 3 (83+) 95% (Hold) | CaDan (83+) 15% (Rst) | E:SoR (84+) 10% (Rst) | CaDanITE (83+) 4% (Hold) | FF:TIoC (83+) 2% (Data)
Pages: [1] 2 3   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 1.603 seconds with 31 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.