Code: Select all
Draw_VGA_Tilemap:
;no RLE
;INPUT:
;DS:SI = TILEMAP SOURCE
	mov dx,0	;reset drawing cursors to top left of screen
Draw_VGA_Tilemap_NextRow:
Draw_VGA_Tilemap_NextColumn:
	
	lodsb			;get the next tile index
	push si
	push bx
		mov ah,0
		mov bx,offset TilemapLookupTable
		;in a later build pull this from ram, to allow for more
		;lookup tables than just one.
		call XLATW
		;returns the offset of the tile's bitmap data in ax
		mov si,ax
		call LocateVRAM	;adjust DI according to DX.
		lodsb
		mov cl,al
		lodsb
		mov ch,al
		mov word ptr [ds:PixelPlotX],cx
		call DrawBitmap_VGA_Palette0
	pop bx
	pop si
	inc dh
	cmp dh,40
	jb Draw_VGA_Tilemap_NextColumn
	mov dh,0
	inc dl
	cmp dl,0Dh
	jb Draw_VGA_Tilemap_NextRow
done_Draw_VGA_Tilemap:
	ret
Code: Select all
Draw_VGA_Tilemap:
;no RLE
;INPUT:
;DS:SI = TILEMAP SOURCE
	mov dx,0	;reset drawing cursors to top left of screen
Draw_VGA_Tilemap_NextRow:
Draw_VGA_Tilemap_NextColumn:
	; call repeatOnce
	
	lodsb			;get the next tile index
	push si
	push bx
		mov ah,0
		mov bx,offset TilemapLookupTable
		;in a later build pull this from ram, to allow for more
		;lookup tables than just one.
		call XLATW
		;returns the offset of the tile's bitmap data in ax
		mov si,ax
		call LocateVRAM	;adjust DI according to DX.
		lodsb
		mov cl,al
		lodsb
		mov ch,al
		mov word ptr [ds:PixelPlotX],cx
		call DrawBitmap_VGA_Palette0
	pop bx
	pop si
	inc dh
	; cmp dh,40
	; jb Draw_VGA_Tilemap_NextColumn
	; mov dh,0
	; inc dl
	; cmp dl,0Dh
	; jb Draw_VGA_Tilemap_NextRow
done_Draw_VGA_Tilemap:
	ret
Code: Select all
Draw_VGA_Tilemap:
;no RLE
;INPUT:
;DS:SI = TILEMAP SOURCE
	mov dx,0	;reset drawing cursors to top left of screen
Draw_VGA_Tilemap_NextRow:
Draw_VGA_Tilemap_NextColumn:
	call repeatOnce
	
	lodsb			;get the next tile index
	push si
	push bx
		mov ah,0
		mov bx,offset TilemapLookupTable
		;in a later build pull this from ram, to allow for more
		;lookup tables than just one.
		call XLATW
		;returns the offset of the tile's bitmap data in ax
		mov si,ax
		call LocateVRAM	;adjust DI according to DX.
		lodsb
		mov cl,al
		lodsb
		mov ch,al
		mov word ptr [ds:PixelPlotX],cx
		call DrawBitmap_VGA_Palette0
	pop bx
	pop si
	inc dh
	; cmp dh,40
	; jb Draw_VGA_Tilemap_NextColumn
	; mov dh,0
	; inc dl
	; cmp dl,0Dh
	; jb Draw_VGA_Tilemap_NextRow
done_Draw_VGA_Tilemap:
	ret
Code: Select all
repeatOnce:
	pop ax
	push ax
	push ax
	ret
However, there are times when this will not work. Here's an example of that:
Code: Select all
foo:
	push bx
	push cx
	call repeatOnce
	;do stuff
	pop cx
	pop bx
	ret