1 ;-------------------------------------------------------- 2 ; File Created by SDCC : free open source ANSI-C Compiler 3 ; Version 3.4.1 #9142 (Dec 26 2014) (Linux) 4 ; This file was generated Sat Dec 27 23:03:17 2014 5 ;-------------------------------------------------------- 6 .module life 7 .optsdcc -mz80 8 9 ;-------------------------------------------------------- 10 ; Public variables in this module 11 ;-------------------------------------------------------- 12 .globl _life 13 .globl _calc_nextgen 14 .globl _fill_feld_random 15 .globl _get_rreg 16 .globl _prng 17 .globl _sprng 18 .globl _delay 19 .globl _SetDigit 20 .globl _keypress 21 .globl _curs_set 22 .globl _clrtoeol 23 .globl _clear 24 .globl _addint 25 .globl _addstr 26 .globl _addch 27 .globl _move 28 .globl _rreg 29 .globl _n_cells 30 .globl _feld 31 ;-------------------------------------------------------- 32 ; special function registers 33 ;-------------------------------------------------------- 0000 34 _STI_IDR = 0x0000 0001 35 _STI_GPIP = 0x0001 0002 36 _STI_IPRB = 0x0002 0003 37 _STI_IPRA = 0x0003 0004 38 _STI_ISRB = 0x0004 0005 39 _STI_ISRA = 0x0005 0006 40 _STI_IMRB = 0x0006 0007 41 _STI_IMRA = 0x0007 0008 42 _STI_PVR = 0x0008 0009 43 _STI_TABCR = 0x0009 000A 44 _STI_TBDR = 0x000a 000B 45 _STI_TADR = 0x000b 000C 46 _STI_UCR = 0x000c 000D 47 _STI_RSR = 0x000d 000E 48 _STI_TSR = 0x000e 000F 49 _STI_UDR = 0x000f 0020 50 _PIO8255_PORT_A = 0x0020 0021 51 _PIO8255_PORT_B = 0x0021 0022 52 _PIO8255_PORT_C = 0x0022 0023 53 _PIO8255_CNTRL = 0x0023 0040 54 _ADC0804_READ = 0x0040 0060 55 _SEG7 = 0x0060 56 ;-------------------------------------------------------- 57 ; ram data 58 ;-------------------------------------------------------- 59 .area _DATA 0000 60 _feld:: 0000 61 .ds 3840 0F00 62 _n_cells:: 0F00 63 .ds 2 0F02 64 _rreg:: 0F02 65 .ds 1 66 ;-------------------------------------------------------- 67 ; ram data 68 ;-------------------------------------------------------- 69 .area _INITIALIZED 70 ;-------------------------------------------------------- 71 ; absolute external ram data 72 ;-------------------------------------------------------- 73 .area _DABS (ABS) 74 ;-------------------------------------------------------- 75 ; global & static initialisations 76 ;-------------------------------------------------------- 77 .area _HOME 78 .area _GSINIT 79 .area _GSFINAL 80 .area _GSINIT 81 ;-------------------------------------------------------- 82 ; Home 83 ;-------------------------------------------------------- 84 .area _HOME 85 .area _HOME 86 ;-------------------------------------------------------- 87 ; code 88 ;-------------------------------------------------------- 89 .area _CODE 90 ;life.c:47: uint8_t get_rreg() 91 ; --------------------------------- 92 ; Function get_rreg 93 ; --------------------------------- 0000 94 _get_rreg_start:: 0000 95 _get_rreg: 96 ;life.c:52: __endasm; 0000 ED 5F [ 9] 97 ld a,r 0002 32r02r0F [13] 98 ld (_rreg),a 99 ;life.c:54: return(rreg); 0005 FD 21r02r0F [14] 100 ld iy,#_rreg 0009 FD 6E 00 [19] 101 ld l,0 (iy) 000C C9 [10] 102 ret 000D 103 _get_rreg_end:: 104 ;life.c:58: void fill_feld_random() 105 ; --------------------------------- 106 ; Function fill_feld_random 107 ; --------------------------------- 000D 108 _fill_feld_random_start:: 000D 109 _fill_feld_random: 000D DD E5 [15] 110 push ix 000F DD 21 00 00 [14] 111 ld ix,#0 0013 DD 39 [15] 112 add ix,sp 0015 F5 [11] 113 push af 114 ;life.c:63: k = MAX_ZELLEN; 0016 21 F4 01 [10] 115 ld hl,#0x01F4 0019 E3 [19] 116 ex (sp), hl 117 ;life.c:64: do { 001A 118 00101$: 119 ;life.c:65: x = prng(MAX_X); 001A 21 4F 00 [10] 120 ld hl,#0x004F 001D E5 [11] 121 push hl 001E CDr00r00 [17] 122 call _prng 0021 F1 [10] 123 pop af 0022 55 [ 4] 124 ld d,l 125 ;life.c:66: y = prng(MAX_Y); 0023 D5 [11] 126 push de 0024 21 17 00 [10] 127 ld hl,#0x0017 0027 E5 [11] 128 push hl 0028 CDr00r00 [17] 129 call _prng 002B F1 [10] 130 pop af 002C D1 [10] 131 pop de 002D 5D [ 4] 132 ld e,l 133 ;life.c:67: feld.last[x][y] = ALIVE; 002E 4A [ 4] 134 ld c,d 002F 06 00 [ 7] 135 ld b,#0x00 0031 69 [ 4] 136 ld l, c 0032 60 [ 4] 137 ld h, b 0033 29 [11] 138 add hl, hl 0034 09 [11] 139 add hl, bc 0035 29 [11] 140 add hl, hl 0036 29 [11] 141 add hl, hl 0037 29 [11] 142 add hl, hl 0038 01r00r00 [10] 143 ld bc,#_feld 003B 09 [11] 144 add hl,bc 003C 4B [ 4] 145 ld c,e 003D 06 00 [ 7] 146 ld b,#0x00 003F 09 [11] 147 add hl,bc 0040 36 01 [10] 148 ld (hl),#0x01 149 ;life.c:68: move(MAX_Y-y,x); 0042 3E 17 [ 7] 150 ld a,#0x17 0044 93 [ 4] 151 sub a, e 0045 D5 [11] 152 push de 0046 33 [ 6] 153 inc sp 0047 F5 [11] 154 push af 0048 33 [ 6] 155 inc sp 0049 CDr00r00 [17] 156 call _move 157 ;life.c:69: addch('O'); 004C 26 4F [ 7] 158 ld h,#0x4F 004E E3 [19] 159 ex (sp),hl 004F 33 [ 6] 160 inc sp 0050 CDr00r00 [17] 161 call _addch 0053 33 [ 6] 162 inc sp 163 ;life.c:70: k--; 0054 DD 6E FE [19] 164 ld l,-2 (ix) 0057 DD 66 FF [19] 165 ld h,-1 (ix) 005A 2B [ 6] 166 dec hl 005B 33 [ 6] 167 inc sp 005C 33 [ 6] 168 inc sp 005D E5 [11] 169 push hl 170 ;life.c:71: } while (k > 0); 005E 7C [ 4] 171 ld a,h 005F B5 [ 4] 172 or a,l 0060 20 B8 [12] 173 jr NZ,00101$ 0062 F1 [10] 174 pop af 0063 DD E1 [14] 175 pop ix 0065 C9 [10] 176 ret 0066 177 _fill_feld_random_end:: 178 ;life.c:76: static char cell_status(uint8_t xpos, uint8_t ypos) 179 ; --------------------------------- 180 ; Function cell_status 181 ; --------------------------------- 0066 182 _cell_status: 0066 DD E5 [15] 183 push ix 0068 DD 21 00 00 [14] 184 ld ix,#0 006C DD 39 [15] 185 add ix,sp 006E 21 F4 FF [10] 186 ld hl,#-12 0071 39 [11] 187 add hl,sp 0072 F9 [ 6] 188 ld sp,hl 189 ;life.c:83: livecells = 0; 0073 0E 00 [ 7] 190 ld c,#0x00 191 ;life.c:84: foo = feld.last[xpos][ypos]; 0075 DD 5E 04 [19] 192 ld e,4 (ix) 0078 16 00 [ 7] 193 ld d,#0x00 007A 6B [ 4] 194 ld l, e 007B 62 [ 4] 195 ld h, d 007C 29 [11] 196 add hl, hl 007D 19 [11] 197 add hl, de 007E 29 [11] 198 add hl, hl 007F 29 [11] 199 add hl, hl 0080 29 [11] 200 add hl, hl 0081 11r00r00 [10] 201 ld de,#_feld 0084 19 [11] 202 add hl,de 0085 DD 7E 05 [19] 203 ld a,5 (ix) 0088 DD 77 FF [19] 204 ld -1 (ix), a 008B 5F [ 4] 205 ld e, a 008C 16 00 [ 7] 206 ld d,#0x00 008E 19 [11] 207 add hl,de 008F 7E [ 7] 208 ld a,(hl) 0090 DD 77 F7 [19] 209 ld -9 (ix),a 210 ;life.c:87: for (y = ypos-1;y <= (ypos+1);y++) { 0093 DD 7E FF [19] 211 ld a,-1 (ix) 0096 C6 FF [ 7] 212 add a,#0xFF 0098 DD 77 F4 [19] 213 ld -12 (ix),a 009B DD 7E 04 [19] 214 ld a,4 (ix) 009E C6 FF [ 7] 215 add a,#0xFF 00A0 DD 77 F6 [19] 216 ld -10 (ix),a 00A3 217 00123$: 00A3 DD 5E FF [19] 218 ld e,-1 (ix) 00A6 16 00 [ 7] 219 ld d,#0x00 00A8 13 [ 6] 220 inc de 00A9 63 [ 4] 221 ld h,e 00AA DD 6E F4 [19] 222 ld l,-12 (ix) 00AD DD 7E F4 [19] 223 ld a,-12 (ix) 00B0 17 [ 4] 224 rla 00B1 9F [ 4] 225 sbc a, a 00B2 5F [ 4] 226 ld e,a 00B3 7C [ 4] 227 ld a,h 00B4 95 [ 4] 228 sub a, l 00B5 7A [ 4] 229 ld a,d 00B6 9B [ 4] 230 sbc a, e 00B7 E2rBCr00 [10] 231 jp PO, 00183$ 00BA EE 80 [ 7] 232 xor a, #0x80 00BC 233 00183$: 00BC FAr8Er01 [10] 234 jp M,00116$ 235 ;life.c:88: for(x = xpos-1;x <= (xpos+1);x++) { 00BF DD 7E F6 [19] 236 ld a,-10 (ix) 00C2 DD 77 F5 [19] 237 ld -11 (ix),a 00C5 DD 7E F4 [19] 238 ld a,-12 (ix) 00C8 07 [ 4] 239 rlca 00C9 E6 01 [ 7] 240 and a,#0x01 00CB DD 77 FE [19] 241 ld -2 (ix),a 00CE 3E 17 [ 7] 242 ld a,#0x17 00D0 DD 96 F4 [19] 243 sub a, -12 (ix) 00D3 E2rD8r00 [10] 244 jp PO, 00184$ 00D6 EE 80 [ 7] 245 xor a, #0x80 00D8 246 00184$: 00D8 07 [ 4] 247 rlca 00D9 E6 01 [ 7] 248 and a,#0x01 00DB DD 77 FD [19] 249 ld -3 (ix),a 00DE DD 71 FC [19] 250 ld -4 (ix),c 00E1 251 00120$: 00E1 DD 6E 04 [19] 252 ld l,4 (ix) 00E4 26 00 [ 7] 253 ld h,#0x00 00E6 23 [ 6] 254 inc hl 00E7 DD 56 F5 [19] 255 ld d,-11 (ix) 00EA DD 7E F5 [19] 256 ld a,-11 (ix) 00ED 17 [ 4] 257 rla 00EE 9F [ 4] 258 sbc a, a 00EF 5F [ 4] 259 ld e,a 00F0 7D [ 4] 260 ld a,l 00F1 92 [ 4] 261 sub a, d 00F2 7C [ 4] 262 ld a,h 00F3 9B [ 4] 263 sbc a, e 00F4 E2rF9r00 [10] 264 jp PO, 00185$ 00F7 EE 80 [ 7] 265 xor a, #0x80 00F9 266 00185$: 00F9 FAr85r01 [10] 267 jp M,00145$ 268 ;life.c:91: if (x < 0 ) 00FC DD CB F5 7E [20] 269 bit 7, -11 (ix) 0100 28 06 [12] 270 jr Z,00105$ 271 ;life.c:92: x1 = MAX_X; 0102 DD 36 FB 4F [19] 272 ld -5 (ix),#0x4F 0106 18 19 [12] 273 jr 00106$ 0108 274 00105$: 275 ;life.c:93: else if (x > MAX_X) 0108 3E 4F [ 7] 276 ld a,#0x4F 010A DD 96 F5 [19] 277 sub a, -11 (ix) 010D E2r12r01 [10] 278 jp PO, 00186$ 0110 EE 80 [ 7] 279 xor a, #0x80 0112 280 00186$: 0112 F2r1Br01 [10] 281 jp P,00102$ 282 ;life.c:94: x1 = 0; 0115 DD 36 FB 00 [19] 283 ld -5 (ix),#0x00 0119 18 06 [12] 284 jr 00106$ 011B 285 00102$: 286 ;life.c:95: else x1 = x; 011B DD 7E F5 [19] 287 ld a,-11 (ix) 011E DD 77 FB [19] 288 ld -5 (ix),a 0121 289 00106$: 290 ;life.c:97: if (y < 0) 0121 DD 7E FE [19] 291 ld a,-2 (ix) 0124 B7 [ 4] 292 or a, a 0125 28 06 [12] 293 jr Z,00111$ 294 ;life.c:98: y1 = MAX_Y; 0127 DD 36 FA 17 [19] 295 ld -6 (ix),#0x17 012B 18 12 [12] 296 jr 00112$ 012D 297 00111$: 298 ;life.c:99: else if (y > MAX_Y) 012D DD 7E FD [19] 299 ld a,-3 (ix) 0130 B7 [ 4] 300 or a, a 0131 28 06 [12] 301 jr Z,00108$ 302 ;life.c:100: y1 = 0; 0133 DD 36 FA 00 [19] 303 ld -6 (ix),#0x00 0137 18 06 [12] 304 jr 00112$ 0139 305 00108$: 306 ;life.c:101: else y1 = y; 0139 DD 7E F4 [19] 307 ld a,-12 (ix) 013C DD 77 FA [19] 308 ld -6 (ix),a 013F 309 00112$: 310 ;life.c:103: if (feld.last[x1][y1] == ALIVE) 013F DD 4E FB [19] 311 ld c,-5 (ix) 0142 06 00 [ 7] 312 ld b,#0x00 0144 69 [ 4] 313 ld l, c 0145 60 [ 4] 314 ld h, b 0146 29 [11] 315 add hl, hl 0147 09 [11] 316 add hl, bc 0148 29 [11] 317 add hl, hl 0149 29 [11] 318 add hl, hl 014A 29 [11] 319 add hl, hl 014B DD 75 F8 [19] 320 ld -8 (ix),l 014E DD 74 F9 [19] 321 ld -7 (ix),h 0151 DD 7E F8 [19] 322 ld a,-8 (ix) 0154 C6r00 [ 7] 323 add a, #<(_feld) 0156 DD 77 F8 [19] 324 ld -8 (ix),a 0159 DD 7E F9 [19] 325 ld a,-7 (ix) 015C CEs00 [ 7] 326 adc a, #>(_feld) 015E DD 77 F9 [19] 327 ld -7 (ix),a 0161 DD 7E F8 [19] 328 ld a,-8 (ix) 0164 DD 86 FA [19] 329 add a, -6 (ix) 0167 DD 77 F8 [19] 330 ld -8 (ix),a 016A DD 7E F9 [19] 331 ld a,-7 (ix) 016D CE 00 [ 7] 332 adc a, #0x00 016F DD 77 F9 [19] 333 ld -7 (ix),a 0172 DD 6E F8 [19] 334 ld l,-8 (ix) 0175 DD 66 F9 [19] 335 ld h,-7 (ix) 0178 7E [ 7] 336 ld a,(hl) 0179 3D [ 4] 337 dec a 017A 20 03 [12] 338 jr NZ,00121$ 339 ;life.c:104: livecells++; 017C DD 34 FC [23] 340 inc -4 (ix) 017F 341 00121$: 342 ;life.c:88: for(x = xpos-1;x <= (xpos+1);x++) { 017F DD 34 F5 [23] 343 inc -11 (ix) 0182 C3rE1r00 [10] 344 jp 00120$ 0185 345 00145$: 0185 DD 4E FC [19] 346 ld c,-4 (ix) 347 ;life.c:87: for (y = ypos-1;y <= (ypos+1);y++) { 0188 DD 34 F4 [23] 348 inc -12 (ix) 018B C3rA3r00 [10] 349 jp 00123$ 018E 350 00116$: 351 ;life.c:109: if (foo == ALIVE) 018E DD 7E F7 [19] 352 ld a,-9 (ix) 0191 3D [ 4] 353 dec a 0192 20 01 [12] 354 jr NZ,00118$ 355 ;life.c:110: livecells--; 0194 0D [ 4] 356 dec c 0195 357 00118$: 358 ;life.c:113: return((foo && (livecells == 2)) || (livecells == 3)); 0195 DD 7E F7 [19] 359 ld a,-9 (ix) 0198 B7 [ 4] 360 or a, a 0199 28 05 [12] 361 jr Z,00132$ 019B 79 [ 4] 362 ld a,c 019C D6 02 [ 7] 363 sub a, #0x02 019E 28 09 [12] 364 jr Z,00128$ 01A0 365 00132$: 01A0 79 [ 4] 366 ld a,c 01A1 D6 03 [ 7] 367 sub a, #0x03 01A3 28 04 [12] 368 jr Z,00128$ 01A5 2E 00 [ 7] 369 ld l,#0x00 01A7 18 02 [12] 370 jr 00129$ 01A9 371 00128$: 01A9 2E 01 [ 7] 372 ld l,#0x01 01AB 373 00129$: 01AB DD F9 [10] 374 ld sp, ix 01AD DD E1 [14] 375 pop ix 01AF C9 [10] 376 ret 377 ;life.c:117: uint16_t calc_nextgen() 378 ; --------------------------------- 379 ; Function calc_nextgen 380 ; --------------------------------- 01B0 381 _calc_nextgen_start:: 01B0 382 _calc_nextgen: 01B0 DD E5 [15] 383 push ix 01B2 DD 21 00 00 [14] 384 ld ix,#0 01B6 DD 39 [15] 385 add ix,sp 01B8 21 F7 FF [10] 386 ld hl,#-9 01BB 39 [11] 387 add hl,sp 01BC F9 [ 6] 388 ld sp,hl 389 ;life.c:122: mods = 0; 01BD 01 00 00 [10] 390 ld bc,#0x0000 391 ;life.c:123: n_cells = 0; 01C0 21 00 00 [10] 392 ld hl,#0x0000 01C3 22r00r0F [16] 393 ld (_n_cells),hl 394 ;life.c:125: for (y=0;y <= MAX_Y;y++) { 01C6 1E 00 [ 7] 395 ld e,#0x00 396 ;life.c:126: for (x=0;x <= MAX_X;x++) { 01C8 397 00119$: 01C8 3E 17 [ 7] 398 ld a,#0x17 01CA 93 [ 4] 399 sub a, e 01CB DD 77 FA [19] 400 ld -6 (ix),a 01CE DD 71 F8 [19] 401 ld -8 (ix),c 01D1 DD 70 F9 [19] 402 ld -7 (ix),b 01D4 DD 36 F7 00 [19] 403 ld -9 (ix),#0x00 01D8 DD 36 FE 00 [19] 404 ld -2 (ix),#0x00 01DC DD 36 FF 00 [19] 405 ld -1 (ix),#0x00 01E0 DD 36 FC 00 [19] 406 ld -4 (ix),#0x00 01E4 DD 36 FD 00 [19] 407 ld -3 (ix),#0x00 01E8 408 00110$: 409 ;life.c:128: feld.next[x][y] = cell_status(x,y); 01E8 3Er80 [ 7] 410 ld a,#<((_feld + 0x0780)) 01EA DD 86 FC [19] 411 add a, -4 (ix) 01ED 67 [ 4] 412 ld h,a 01EE 3Es07 [ 7] 413 ld a,#>((_feld + 0x0780)) 01F0 DD 8E FD [19] 414 adc a, -3 (ix) 01F3 6F [ 4] 415 ld l,a 01F4 7C [ 4] 416 ld a,h 01F5 83 [ 4] 417 add a, e 01F6 4F [ 4] 418 ld c,a 01F7 7D [ 4] 419 ld a,l 01F8 CE 00 [ 7] 420 adc a, #0x00 01FA 47 [ 4] 421 ld b,a 01FB C5 [11] 422 push bc 01FC D5 [11] 423 push de 01FD 7B [ 4] 424 ld a,e 01FE F5 [11] 425 push af 01FF 33 [ 6] 426 inc sp 0200 DD 7E F7 [19] 427 ld a,-9 (ix) 0203 F5 [11] 428 push af 0204 33 [ 6] 429 inc sp 0205 CDr66r00 [17] 430 call _cell_status 0208 F1 [10] 431 pop af 0209 DD 75 FB [19] 432 ld -5 (ix),l 020C D1 [10] 433 pop de 020D C1 [10] 434 pop bc 020E DD 7E FB [19] 435 ld a,-5 (ix) 0211 02 [ 7] 436 ld (bc),a 437 ;life.c:131: if (feld.next[x][y] != feld.last[x][y]) 0212 3Er00 [ 7] 438 ld a,#<(_feld) 0214 DD 86 FC [19] 439 add a, -4 (ix) 0217 6F [ 4] 440 ld l,a 0218 3Es00 [ 7] 441 ld a,#>(_feld) 021A DD 8E FD [19] 442 adc a, -3 (ix) 021D 67 [ 4] 443 ld h,a 021E 16 00 [ 7] 444 ld d,#0x00 0220 19 [11] 445 add hl, de 0221 56 [ 7] 446 ld d,(hl) 0222 DD 7E FB [19] 447 ld a,-5 (ix) 0225 92 [ 4] 448 sub a, d 0226 28 31 [12] 449 jr Z,00105$ 450 ;life.c:133: move(MAX_Y-y,x); 0228 C5 [11] 451 push bc 0229 D5 [11] 452 push de 022A DD 66 F7 [19] 453 ld h,-9 (ix) 022D DD 6E FA [19] 454 ld l,-6 (ix) 0230 E5 [11] 455 push hl 0231 CDr00r00 [17] 456 call _move 0234 F1 [10] 457 pop af 0235 D1 [10] 458 pop de 0236 C1 [10] 459 pop bc 460 ;life.c:134: if (feld.next[x][y] == ALIVE) 0237 0A [ 7] 461 ld a,(bc) 0238 3D [ 4] 462 dec a 0239 20 0C [12] 463 jr NZ,00102$ 464 ;life.c:135: addch('O'); 023B D5 [11] 465 push de 023C 3E 4F [ 7] 466 ld a,#0x4F 023E F5 [11] 467 push af 023F 33 [ 6] 468 inc sp 0240 CDr00r00 [17] 469 call _addch 0243 33 [ 6] 470 inc sp 0244 D1 [10] 471 pop de 0245 18 0A [12] 472 jr 00103$ 0247 473 00102$: 474 ;life.c:137: addch(' '); 0247 D5 [11] 475 push de 0248 3E 20 [ 7] 476 ld a,#0x20 024A F5 [11] 477 push af 024B 33 [ 6] 478 inc sp 024C CDr00r00 [17] 479 call _addch 024F 33 [ 6] 480 inc sp 0250 D1 [10] 481 pop de 0251 482 00103$: 483 ;life.c:139: mods++; 0251 DD 34 F8 [23] 484 inc -8 (ix) 0254 20 03 [12] 485 jr NZ,00149$ 0256 DD 34 F9 [23] 486 inc -7 (ix) 0259 487 00149$: 0259 488 00105$: 489 ;life.c:142: if (feld.next[x][y] == ALIVE) 0259 3Er80 [ 7] 490 ld a,#<((_feld + 0x0780)) 025B DD 86 FE [19] 491 add a, -2 (ix) 025E 6F [ 4] 492 ld l,a 025F 3Es07 [ 7] 493 ld a,#>((_feld + 0x0780)) 0261 DD 8E FF [19] 494 adc a, -1 (ix) 0264 67 [ 4] 495 ld h,a 0265 4B [ 4] 496 ld c,e 0266 06 00 [ 7] 497 ld b,#0x00 0268 09 [11] 498 add hl,bc 0269 7E [ 7] 499 ld a,(hl) 026A 3D [ 4] 500 dec a 026B 20 0A [12] 501 jr NZ,00111$ 502 ;life.c:143: n_cells++; 026D 21r00r0F [10] 503 ld hl, #_n_cells+0 0270 34 [11] 504 inc (hl) 0271 20 04 [12] 505 jr NZ,00152$ 0273 21r01r0F [10] 506 ld hl, #_n_cells+1 0276 34 [11] 507 inc (hl) 0277 508 00152$: 0277 509 00111$: 510 ;life.c:126: for (x=0;x <= MAX_X;x++) { 0277 DD 7E FE [19] 511 ld a,-2 (ix) 027A C6 18 [ 7] 512 add a, #0x18 027C DD 77 FE [19] 513 ld -2 (ix),a 027F DD 7E FF [19] 514 ld a,-1 (ix) 0282 CE 00 [ 7] 515 adc a, #0x00 0284 DD 77 FF [19] 516 ld -1 (ix),a 0287 DD 7E FC [19] 517 ld a,-4 (ix) 028A C6 18 [ 7] 518 add a, #0x18 028C DD 77 FC [19] 519 ld -4 (ix),a 028F DD 7E FD [19] 520 ld a,-3 (ix) 0292 CE 00 [ 7] 521 adc a, #0x00 0294 DD 77 FD [19] 522 ld -3 (ix),a 0297 DD 34 F7 [23] 523 inc -9 (ix) 029A 3E 4F [ 7] 524 ld a,#0x4F 029C DD 96 F7 [19] 525 sub a, -9 (ix) 029F D2rE8r01 [10] 526 jp NC,00110$ 527 ;life.c:125: for (y=0;y <= MAX_Y;y++) { 02A2 DD 4E F8 [19] 528 ld c,-8 (ix) 02A5 DD 46 F9 [19] 529 ld b,-7 (ix) 02A8 1C [ 4] 530 inc e 02A9 3E 17 [ 7] 531 ld a,#0x17 02AB 93 [ 4] 532 sub a, e 02AC D2rC8r01 [10] 533 jp NC,00119$ 534 ;life.c:148: LedOut(n_cells); 02AF 3Ar00r0F [13] 535 ld a,(#_n_cells + 0) 02B2 2F [ 4] 536 cpl 02B3 D3 20 [11] 537 out (_PIO8255_PORT_A),a 538 ;life.c:151: memcpy(feld.last,feld.next,sizeof(feld.next)); 02B5 11r00r00 [10] 539 ld de,#_feld 02B8 21r80r07 [10] 540 ld hl,#_feld + 1920 02BB 01 80 07 [10] 541 ld bc,#0x0780 02BE ED B0 [21] 542 ldir 543 ;life.c:154: return (mods); 02C0 DD 6E F8 [19] 544 ld l,-8 (ix) 02C3 DD 66 F9 [19] 545 ld h,-7 (ix) 02C6 DD F9 [10] 546 ld sp, ix 02C8 DD E1 [14] 547 pop ix 02CA C9 [10] 548 ret 02CB 549 _calc_nextgen_end:: 550 ;life.c:158: void life (void) 551 ; --------------------------------- 552 ; Function life 553 ; --------------------------------- 02CB 554 _life_start:: 02CB 555 _life: 02CB DD E5 [15] 556 push ix 02CD DD 21 00 00 [14] 557 ld ix,#0 02D1 DD 39 [15] 558 add ix,sp 02D3 F5 [11] 559 push af 02D4 F5 [11] 560 push af 02D5 F5 [11] 561 push af 562 ;life.c:163: curs_set(0); 02D6 AF [ 4] 563 xor a, a 02D7 F5 [11] 564 push af 02D8 33 [ 6] 565 inc sp 02D9 CDr00r00 [17] 566 call _curs_set 02DC 33 [ 6] 567 inc sp 568 ;life.c:164: clear(); 02DD CDr00r00 [17] 569 call _clear 570 ;life.c:167: memset(feld.last,DEAD,sizeof(feld.last)); 02E0 21r00r00 [10] 571 ld hl,#_feld 02E3 36 00 [10] 572 ld (hl), #0x00 02E5 5D [ 4] 573 ld e, l 02E6 54 [ 4] 574 ld d, h 02E7 13 [ 6] 575 inc de 02E8 01 7F 07 [10] 576 ld bc, #0x077F 02EB ED B0 [21] 577 ldir 578 ;life.c:168: memset(feld.next,DEAD,sizeof(feld.next)); 02ED 21r80r07 [10] 579 ld hl,#(_feld + 0x0780) 02F0 36 00 [10] 580 ld (hl), #0x00 02F2 5D [ 4] 581 ld e, l 02F3 54 [ 4] 582 ld d, h 02F4 13 [ 6] 583 inc de 02F5 01 7F 07 [10] 584 ld bc, #0x077F 02F8 ED B0 [21] 585 ldir 586 ;life.c:170: move (12,25); 02FA 21 0C 19 [10] 587 ld hl,#0x190C 02FD E5 [11] 588 push hl 02FE CDr00r00 [17] 589 call _move 590 ;life.c:171: addstr("Conways Game of Life..."); 0301 21rB6r03 [10] 591 ld hl, #___str_0 0304 E3 [19] 592 ex (sp),hl 0305 CDr00r00 [17] 593 call _addstr 594 ;life.c:172: delay(40000); 0308 21 40 9C [10] 595 ld hl, #0x9C40 030B E3 [19] 596 ex (sp),hl 030C CDr00r00 [17] 597 call _delay 030F F1 [10] 598 pop af 599 ;life.c:177: sprng(get_rreg()); // Zufall initialisieren mit R Register 0310 CDr00r00 [17] 600 call _get_rreg 0313 26 00 [ 7] 601 ld h,#0x00 0315 E5 [11] 602 push hl 0316 CDr00r00 [17] 603 call _sprng 0319 F1 [10] 604 pop af 605 ;life.c:178: SetDigit((uint8_t)total_runs); 031A AF [ 4] 606 xor a, a 031B F5 [11] 607 push af 031C 33 [ 6] 608 inc sp 031D CDr00r00 [17] 609 call _SetDigit 0320 33 [ 6] 610 inc sp 611 ;life.c:181: while (1) 0321 DD 36 FE 00 [19] 612 ld -2 (ix),#0x00 0325 DD 36 FF 00 [19] 613 ld -1 (ix),#0x00 0329 614 00107$: 615 ;life.c:183: clear(); 0329 CDr00r00 [17] 616 call _clear 617 ;life.c:184: fill_feld_random(); // Feld zufaellig bespielen 032C CDr0Dr00 [17] 618 call _fill_feld_random 619 ;life.c:186: do { 032F 21 00 00 [10] 620 ld hl,#0x0000 0332 E3 [19] 621 ex (sp), hl 0333 622 00103$: 623 ;life.c:188: changes = calc_nextgen(); 0333 CDrB0r01 [17] 624 call _calc_nextgen 0336 DD 75 FC [19] 625 ld -4 (ix),l 0339 DD 74 FD [19] 626 ld -3 (ix),h 627 ;life.c:189: generation++; 033C DD 34 FA [23] 628 inc -6 (ix) 033F 20 03 [12] 629 jr NZ,00124$ 0341 DD 34 FB [23] 630 inc -5 (ix) 0344 631 00124$: 632 ;life.c:191: move(0,22); 0344 21 00 16 [10] 633 ld hl,#0x1600 0347 E5 [11] 634 push hl 0348 CDr00r00 [17] 635 call _move 034B F1 [10] 636 pop af 637 ;life.c:192: clrtoeol(); 034C CDr00r00 [17] 638 call _clrtoeol 639 ;life.c:193: addstr("|Genr: "); addint(generation); 034F 21rCEr03 [10] 640 ld hl,#___str_1 0352 E5 [11] 641 push hl 0353 CDr00r00 [17] 642 call _addstr 0356 F1 [10] 643 pop af 0357 E1 [10] 644 pop hl 0358 E5 [11] 645 push hl 0359 E5 [11] 646 push hl 035A CDr00r00 [17] 647 call _addint 648 ;life.c:194: addstr(" Mods: "); addint(changes); 035D 21rD6r03 [10] 649 ld hl, #___str_2 0360 E3 [19] 650 ex (sp),hl 0361 CDr00r00 [17] 651 call _addstr 0364 F1 [10] 652 pop af 0365 C1 [10] 653 pop bc 0366 E1 [10] 654 pop hl 0367 E5 [11] 655 push hl 0368 C5 [11] 656 push bc 0369 E5 [11] 657 push hl 036A CDr00r00 [17] 658 call _addint 659 ;life.c:195: addstr(" Cells: "); addint(n_cells); 036D 21rDEr03 [10] 660 ld hl, #___str_3 0370 E3 [19] 661 ex (sp),hl 0371 CDr00r00 [17] 662 call _addstr 0374 F1 [10] 663 pop af 0375 2Ar00r0F [16] 664 ld hl,(_n_cells) 0378 E5 [11] 665 push hl 0379 CDr00r00 [17] 666 call _addint 667 ;life.c:196: addstr(" Run: "); addint(total_runs); 037C 21rE7r03 [10] 668 ld hl, #___str_4 037F E3 [19] 669 ex (sp),hl 0380 CDr00r00 [17] 670 call _addstr 0383 F1 [10] 671 pop af 0384 DD 6E FE [19] 672 ld l,-2 (ix) 0387 DD 66 FF [19] 673 ld h,-1 (ix) 038A E5 [11] 674 push hl 038B CDr00r00 [17] 675 call _addint 676 ;life.c:197: addstr("|"); 038E 21rEEr03 [10] 677 ld hl, #___str_5 0391 E3 [19] 678 ex (sp),hl 0392 CDr00r00 [17] 679 call _addstr 0395 F1 [10] 680 pop af 681 ;life.c:198: if (keypress()==0x0d) 0396 CDr00r00 [17] 682 call _keypress 0399 7D [ 4] 683 ld a,l 039A D6 0D [ 7] 684 sub a, #0x0D 039C 28 0C [12] 685 jr Z,00105$ 686 ;life.c:201: } while (changes > 25); 039E 3E 19 [ 7] 687 ld a,#0x19 03A0 DD BE FC [19] 688 cp a, -4 (ix) 03A3 3E 00 [ 7] 689 ld a,#0x00 03A5 DD 9E FD [19] 690 sbc a, -3 (ix) 03A8 38 89 [12] 691 jr C,00103$ 03AA 692 00105$: 693 ;life.c:203: total_runs++; 03AA DD 34 FE [23] 694 inc -2 (ix) 03AD C2r29r03 [10] 695 jp NZ,00107$ 03B0 DD 34 FF [23] 696 inc -1 (ix) 03B3 C3r29r03 [10] 697 jp 00107$ 03B6 698 _life_end:: 03B6 699 ___str_0: 03B6 43 6F 6E 77 61 79 700 .ascii "Conways Game of Life..." 73 20 47 61 6D 65 20 6F 66 20 4C 69 66 65 2E 2E 2E 03CD 00 701 .db 0x00 03CE 702 ___str_1: 03CE 7C 47 65 6E 72 3A 703 .ascii "|Genr: " 20 03D5 00 704 .db 0x00 03D6 705 ___str_2: 03D6 20 4D 6F 64 73 3A 706 .ascii " Mods: " 20 03DD 00 707 .db 0x00 03DE 708 ___str_3: 03DE 20 43 65 6C 6C 73 709 .ascii " Cells: " 3A 20 03E6 00 710 .db 0x00 03E7 711 ___str_4: 03E7 20 52 75 6E 3A 20 712 .ascii " Run: " 03ED 00 713 .db 0x00 03EE 714 ___str_5: 03EE 7C 715 .ascii "|" 03EF 00 716 .db 0x00 717 .area _CODE 718 .area _INITIALIZER 719 .area _CABS (ABS)