@@ -2362,6 +2362,9 @@ _: ld (DrawTile_SMC),hl \.r
2362
2362
or a , a
2363
2363
jr nz , _height_is_pow2
2364
2364
call __idvrmu
2365
+ ex de , hl
2366
+ push de
2367
+ pop bc
2365
2368
jr _height_is_not_pow2
2366
2369
_height_is_pow2: ; compute as power of 2 height using shifts
2367
2370
ld b , a
@@ -2373,15 +2376,18 @@ _: srl h
2373
2376
rr l
2374
2377
djnz - _
2375
2378
_height_is_not_pow2:
2376
- ld (ix +- 4 ) , l ; y = y_offset / tilemap->t_tile_height
2377
- ld (ix + y_offset) , bc ; y_offset = y_offset % tilemap->t_tile_height ;
2379
+ ld (ix +- 4 ) , l ; y = y_offset / tilemap->tile_height
2380
+ ld (ix + y_offset) , bc ; y_offset = y_offset % tilemap->tile_height ;
2378
2381
2379
2382
ld c , (iy + t_tile_width)
2380
2383
ld hl , (ix + x_offset) ; x offset
2381
2384
ld a , (iy + t_type_width)
2382
2385
or a , a
2383
2386
jr nz , _width_is_pow2
2384
2387
call __idvrmu
2388
+ ex de , hl
2389
+ push de
2390
+ pop bc
2385
2391
jr _width_is_not_pow2
2386
2392
_width_is_pow2:
2387
2393
ld b , a
@@ -2398,7 +2404,7 @@ _width_is_not_pow2:
2398
2404
ld hl , (iy + t_x_loc)
2399
2405
or a , a
2400
2406
sbc hl , bc
2401
- ld (x_offset_smc) , hl \.r ; x_offset_smc = tilemap->t_x_loc - x_offset;
2407
+ ld (x_offset_smc) , hl \.r ; x_offset_smc = tilemap->x_loc - x_offset;
2402
2408
2403
2409
or a , a
2404
2410
sbc hl , hl
@@ -2422,6 +2428,7 @@ x_offset_smc =$+1
2422
2428
jr X_Loop
2423
2429
2424
2430
_x_loop_inner:
2431
+ or a , a
2425
2432
sbc hl , hl
2426
2433
ld l , (ix +- 1 )
2427
2434
ld bc , (iy + t_data) ; iy -> tilemap data
@@ -2490,7 +2497,7 @@ _TilePtr:
2490
2497
; A pointer to an indexed tile in the tilemap (so it can be looked at or changed)
2491
2498
; C Function:
2492
2499
; uint8_t *gfx_TilePtr(gfx_tilemap_t *tilemap, unsigned x_offset, unsigned y_offset) {
2493
- ; return &tilemap->map[(x_offset/tilemap->t_tile_width )+((y_offset/tilemap->t_tile_height )*tilemap->width)];
2500
+ ; return &tilemap->map[(x_offset/tilemap->tile_width )+((y_offset/tilemap->tile_height )*tilemap->width)];
2494
2501
; }
2495
2502
push ix
2496
2503
ld ix , 0
@@ -2499,10 +2506,11 @@ _TilePtr:
2499
2506
ld hl , (ix + x_offset)
2500
2507
ld a , (iy + t_type_width)
2501
2508
or a , a
2502
- jr z ,+ _
2509
+ jr nz ,+ _
2503
2510
ld bc , 0
2504
2511
ld c , (iy + t_tile_width)
2505
2512
call __idvrmu
2513
+ ex de , hl
2506
2514
jr _width_no_pow2
2507
2515
_: ld b , a
2508
2516
_: srl h
@@ -2513,10 +2521,13 @@ _width_no_pow2:
2513
2521
ld hl , (ix + y_offset)
2514
2522
ld a , (iy + t_type_height)
2515
2523
or a , a
2516
- jr z ,+ _
2524
+ jr nz ,+ _
2517
2525
ld bc , 0
2518
2526
ld c , (iy + t_tile_height)
2527
+ push de
2519
2528
call __idvrmu
2529
+ ex de , hl
2530
+ pop de
2520
2531
jr _height_no_pow2
2521
2532
_: ld b , a
2522
2533
_: srl h
0 commit comments