;#define fourcolor 
 .assume ADL=1
 .org $D1A881-2
.db $EF,$7B	


 call $020828 ;_homeup
 call $020810 ;_ClrScrnFull
 call $020848 ;_RunIndicOff - no busy icon
	ld   a,mb
	push af
	push iy
	Call GetCurrentMB
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;	
	
	
	
#ifdef fourcolor
		ld de,$E30200
		ld hl,palette
		
		ld bc,16*2
		
		ldir 
		
			 ;%WUUVPBBRFMTBMMME
		ld de,%0000100000100101
		ld ($E30018),de
		
		
#endif
	ld hl,Sprite
	ld bc,Sprite
	call monitor
	call SpriteTest
	jp finish
	
	
.assume ADL=0
Test8bit:

	ld.lis bc,$1234	;L__=24 bit register  _IS=Load 16 bit val (zero's BCU)
	ld.sis de,$1234	;S__=16 bit register  _IS=Load 16 bit val (unk in z80 mode)
	
	ld.sil hl,$123456	;S__=16 bit reg  _IL=Load 24 bit val  (unk in z80 mode)
	ld.lil ix,$123456	;L__=24 bit reg  _IL=Load 24 bit val 
	
	call.sil MonitorL
	
	
	
	ret.l
	
Test8Bit_Outs:
	ld bc,$45ED
	ld ($0066),bc

	ld hl,$0060
	ld bc,32
	call.sil Monitor_MemDumpL
	
	ld bc,$B024	;Backlight
	ld a,255
	out (bc),a
	
	
	ld bc,$0001	;CPU speed 
	in a,(bc)
	call.sil MonitorL
	ld a,0		;6 mhz :-(
	out (bc),a
	
	
	
	
	ret.l
	
.assume ADL=1	

Palette:
    .dw %0000000000000000; ;0  %-BBBBBGGGGGRRRRR
    .dw %0000001011011111; ;1  %-BBBBBGGGGGRRRRR
    .dw %0101011001000100; ;2  %-BBBBBGGGGGRRRRR
    .dw %0111111111101001; ;3  %-BBBBBGGGGGRRRRR
    .dw %0111110000010110; ;4  %-BBBBBGGGGGRRRRR
    .dw %0000000100101101; ;5  %-BBBBBGGGGGRRRRR
    .dw %0101011001010010; ;6  %-BBBBBGGGGGRRRRR
    .dw %0000000000010110; ;7  %-BBBBBGGGGGRRRRR
    .dw %0111111111111111; ;8  %-BBBBBGGGGGRRRRR
    .dw %0111110100100000; ;9  %-BBBBBGGGGGRRRRR
    .dw %0111111001011011; ;10  %-BBBBBGGGGGRRRRR
    .dw %0111111011000000; ;11  %-BBBBBGGGGGRRRRR
    .dw %0000000110110110; ;12  %-BBBBBGGGGGRRRRR
    .dw %0101011011010110; ;13  %-BBBBBGGGGGRRRRR
    .dw %0000001101111111; ;14  %-BBBBBGGGGGRRRRR
    .dw %0000000000011111; ;15  %-BBBBBGGGGGRRRRR


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;	
Finish:
	pop iy
	pop af
	ld mb,a
 call $020D8C ;_GetKey
 call $020810 ;_ClrScrnFull

	ld de,%100100101101
	ld ($E30018),de	;True color

 
 res 5,(iy+0) ;donePrgm , doneFlags
 
 ret
 
SpriteTest:
	ld hl,Sprite
	ld de,$D40000+640-128
	ld ixl,54
	
NextLine:
	push de
#ifdef fourcolor
	ld bc,58/2
#else
	ld bc,58*2
#endif
		
		ldir
	pop de
	Call GetNextLine
	
	dec ixl
	jr nz,NextLine
	ret
	
#include "\SrcAll\Functions.asm"
#include "\SrcAll\Monitor.asm"


Sprite:
#ifdef fourcolor
;HL Nibbles swapped %LLLLRRRRR
#import "\ResAll\Sprites\SpriteT84_4bpp.RAW"
#else
#import "\ResAll\Sprites\SpriteT84.RAW"
#endif

Font:
#import "\ResAll\Font96.FNT"


GetCurrentMB:
	di
	ld ix,0
	add ix,sp
	ld a,(ix+2)
	ld mb,a			;Get current block
	ld.sis sp,StackZ80 & $FFFF	;Safe Stack
	ret
;Stack for Classic Z80
	.dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
	.dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
StackZ80: 
  
