[TI ASM] Splash Screen In Greyscale

Got questions? Got answers? Go here for both.

Moderator: MaxCoderz Staff

User avatar
L4E_WakaMol-King
Maxcoderz Staff
Posts: 342
Joined: Tue 01 Nov, 2005 6:34 am

Post by L4E_WakaMol-King »

There's got to be a simple greyscale routine out there somewhere that I can just plug my picture into...

Desolate was virtually flickerless when I played it... so I know it can be done...
Image - Now Under Development - [Progress]
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

Yes, if you ditch the sound idea, you can just use a greyscale package. Not that that will be perfect, but you'll get a lot closer to perfection a lot faster ;)
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
User avatar
L4E_WakaMol-King
Maxcoderz Staff
Posts: 342
Joined: Tue 01 Nov, 2005 6:34 am

Post by L4E_WakaMol-King »

Here's my updated code, Jim e.

- Interrupts disabled
- IonFastCopy
- Direct key input instead of _getkey

The best value for TEST_VALUE was about 2200 or 2550... but it's still flickery and fairly wavey.

Code: Select all

	ld hl,2000		;  TEST_VALUE = 2200 or 2550
	ld (TEST_VALUE),hl	

	di			;  Disable interrupts

lp_greyscale_loop:

	ld hl,Splash1		;  Draw Layer 1
	call disp_pic
	ld hl,Splash2		;  Draw Layer 2
	call disp_pic
	ld hl,Splash2		;  Draw Layer 2
	call disp_pic

	ld c,1			;  Read in a key
	ld a,$FF
	out (c),a
	ld a,%11111110
	out (c),a
	in b,(c)
	
	bit 3,b			;  Increase TEST_VALUE on [UP]
	jr z, increase_test
	bit 0,b			;  If [DEL] not pressed, loop
	jr nz, lp_greyscale_loop
	jp main_game_start	;  Goto start of game

disp_pic:			;  Display a picture to the screen
	ld de,PLOTSSCREEN
	ld bc,768
	ldir
	call IonFastCopy

	ld bc,(TEST_VALUE)	;  Loop for greyscale timing
delayloop:
	dec bc              	;  6 tstates
	ld a,b              	;  4 tstates
	or c                	;  4 tstates
   	jp nz,delayloop     	;  10 tstates
	ret

increase_test:
	ld bc,1
	ld hl,(TEST_VALUE)
	add hl,bc
	ld (TEST_VALUE),hl
	ld a,0
	ld (curcol),a
	bcall(_disphl)
	bcall(_getkey)
	nop
	nop
	nop
	jr lp_greyscale_loop
Image - Now Under Development - [Progress]
User avatar
Jim e
Calc King
Posts: 2457
Joined: Sun 26 Dec, 2004 5:27 am
Location: SXIOPO = Infinite lives for both players
Contact:

Post by Jim e »

where did that getkey come from thats probably locking up you program if I am correct. Aside from that add hl,bc can be replace with inc hl. If you add in a decreaser dec hl is the oppsoing opcode.

if you just want a routine, look up rigview.
Image
User avatar
L4E_WakaMol-King
Maxcoderz Staff
Posts: 342
Joined: Tue 01 Nov, 2005 6:34 am

Post by L4E_WakaMol-King »

The getkey you see in there is to pause the program after incrementing the TEST_VALUE. Basically, TEST_VALUE starts at 2000, and every time you press the UP key, it adds one to it. When you do that, it pauses the program and displays the value of TEST_VALUE on the screen... that way when you get to the best value of TEST_VALUE, you can write down what it is.

I could be wrong, but since that getkey only executes once every time that you press the UP key, and not during the actual greyscale display loop, I doubt it is affecting the quality of the greyscale.
Image - Now Under Development - [Progress]
User avatar
Jim e
Calc King
Posts: 2457
Joined: Sun 26 Dec, 2004 5:27 am
Location: SXIOPO = Infinite lives for both players
Contact:

Post by Jim e »

I didn't it would effect the quality I said it would lock up the calc. It requires im 1 and ei. I still suggest using direct input for all key related issues.
Image
User avatar
L4E_WakaMol-King
Maxcoderz Staff
Posts: 342
Joined: Tue 01 Nov, 2005 6:34 am

Post by L4E_WakaMol-King »

Same problems :?. It seems that the best value for TEST_VALUE is somewhere around 2250 now.

Could _disphl be the problem?

Code: Select all

	ld hl,2000		;  TEST_VALUE = 2200 or 2550
	ld (TEST_VALUE),hl	

	di			;  Disable interrupts

lp_greyscale_loop:

	ld hl,Splash1		;  Draw Layer 1
	call disp_pic
	ld hl,Splash2		;  Draw Layer 2
	call disp_pic
	ld hl,Splash2		;  Draw Layer 2
	call disp_pic

	ld c,1			;  Read in a key
	ld a,$FF
	out (c),a
	ld a,%11111110
	out (c),a
	in b,(c)
	
	bit 3,b			;  Increase TEST_VALUE on [UP]
	jr z, increase_test
	bit 2,b			;  If [DEL] not pressed, loop
	jr nz, lp_greyscale_loop
	jp main_game_start	;  Goto start of game

disp_pic:			;  Display a picture to the screen
	ld de,PLOTSSCREEN
	ld bc,768
	ldir
	call IonFastCopy

	ld bc,(TEST_VALUE)	;  Loop for greyscale timing
delayloop:
	dec bc              	;  6 tstates
	ld a,b              	;  4 tstates
	or c                	;  4 tstates
   	jp nz,delayloop     	;  10 tstates
	ret

increase_test:
	ld bc,1
	ld hl,(TEST_VALUE)
	add hl,bc
	ld (TEST_VALUE),hl
	ld a,0
	ld (curcol),a
	bcall(_disphl)

	ld c,1			;  Check for [LEFT] key
key_in_loop:
	ld a,$FF
	out (c),a
	ld a,%11111110
	out (c),a
	in b,(c)
	bit 1,b	
	jp nz, key_in_loop

	nop
	nop
	nop
	jr lp_greyscale_loop
Image - Now Under Development - [Progress]
User avatar
Jim e
Calc King
Posts: 2457
Joined: Sun 26 Dec, 2004 5:27 am
Location: SXIOPO = Infinite lives for both players
Contact:

Post by Jim e »

You seem to be under estimating the amount of tuning you need to do. I meant for you to out right remove getkey(not replace). Just get rid of the disp hl and getkey. And add in a decreaser as well YOU'LL NEED IT. When you exit, thats when you can disphl.

Last thing try a TEST_VALUE of 1000. That might do better.
Image
User avatar
L4E_WakaMol-King
Maxcoderz Staff
Posts: 342
Joined: Tue 01 Nov, 2005 6:34 am

Post by L4E_WakaMol-King »

Ok, I'll give that a try.
Image - Now Under Development - [Progress]
User avatar
L4E_WakaMol-King
Maxcoderz Staff
Posts: 342
Joined: Tue 01 Nov, 2005 6:34 am

Post by L4E_WakaMol-King »

Success!

~ 758 is the magic number. Jim e, thank you so much!

Now for the music... Lol!

(Don't have a 2.5 mm converter yet, so that won't come till later.)
Image - Now Under Development - [Progress]
Post Reply