
Great job PT_

DrawField:
scf
sbc hl, hl
ld (hl), 2
; Speed: 722161/721349/711751 cycles
ld hl, -3
jp mpShaData
DrawFieldStart:
add hl, sp
ld (TempSP2 - AoCEDisplayIsoTile + cursorImage), hl
ld hl, (currDrawingBuffer)
ld de, 15
add hl, de
ld (startingPosition - DrawFieldStart + mpShaData), hl
ld de, 8*320
ld b, 29
DisplayEachRowLoop:
bit 0, b
exx
startingPosition = $+2
ld iy, 0
ld a, 10
jr nz, DisplayRowOfTilesLoop
dec a
lea iy, iy+16
DisplayRowOfTilesLoop:
ld hl, _tile_test \.r2
call cursorImage
lea iy, iy+32
dec a
jr nz, DisplayRowOfTilesLoop
exx
add hl, de
ld (startingPosition - DrawFieldStart + mpShaData), hl
djnz DisplayEachRowLoop
ret
DrawFieldEnd:
.echo DrawFieldEnd-DrawFieldStart
AoCEDisplayIsoTile:
; Thanks a lot to TheMachine02 and grosged for help and optimizations!
; Input:
; IY = pointer to output
; HL = pointer to iso sprite
;
; Bytes: 168 bytes
; Time: 2558 cycles
lea de, iy
ld ix, 0
lea bc, ix+2
add ix, de
ld sp, 320
ldir
add ix, sp
lea de, ix-2
ld c, 6
ldir
add ix, sp
lea de, ix-4
ld c, 10
ldir
add ix, sp
lea de, ix-6
ld c, 14
ldir
add ix, sp
lea de, ix-8
ld c, 18
ldir
add ix, sp
lea de, ix-10
ld c, 22
ldir
add ix, sp
lea de, ix-12
ld c, 26
ldir
add ix, sp
lea de, ix-14
ld c, 30
ldir
add ix, sp
lea de, ix-15
ld c, 32
ldir
add ix, sp
lea de, ix-14
ld c, 30
ldir
add ix, sp
lea de, ix-12
ld c, 26
ldir
add ix, sp
lea de, ix-10
ld c, 22
ldir
add ix, sp
lea de, ix-8
ld c, 18
ldir
add ix, sp
lea de, ix-6
ld c, 14
ldir
add ix, sp
lea de, ix-4
ld c, 10
ldir
add ix, sp
lea de, ix-2
ld c, 6
ldir
add ix, sp
lea de, ix
ldi
ldi
TempSP2 = $+1
ld sp, 0
ret
AoCEDisplayIsoTileEnd:
grosged wrote:I can see a few optimisations ...But I need to know more about the final version of the routine DrawFieldStart as it will read several different sprites pointers according to a defined map, won't it ?
Size of that map also needed
And perhaps a diagonal manner/order for displaying isotiles would be faster ?...
PT_ wrote:Well, the final algorithm for drawing fields, is first knowing the offsets (i.e. shifting the entire map), is really easy though. Next is that I need something that checks if the displayed tile is in the range of the tilemap or not, and if not, draw a black tile (the background). If we continue this, we can skip drawing the tiles where the base of the buildings are, so if a lumbercamp is located at (10,11), and that tile is in the screen boundaries, skip the drawing part, as the builing will already draw that tile. And yes, I've thought of a diagonal renderer, never did anything with itOh, the map size will be around 200x200, but that can change if I want to
Wistaro wrote:Oh, you switched to ASM
Do you want to (re)write the entire program in ASM?
Return to Langages alternatifs
Users browsing this forum: ClaudeBot [spider] and 12 guests