<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[ChipMusic.org - Gameboy Camera - Force Trippy H]]></title>
	<link rel="self" href="https://chipmusic.org:80/forums/feed/atom/topic/17587/"/>
	<updated>2016-06-23T22:27:09Z</updated>
	<generator>PunBB</generator>
	<id>https://chipmusic.org/forums/topic/17587/gameboy-camera-force-trippy-h/</id>
		<entry>
			<title type="html"><![CDATA[Re: Gameboy Camera - Force Trippy H]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/245392/#p245392"/>
			<content type="html"><![CDATA[<p>Sorry guys! Super busy. Here is what I have on my work PC</p><p>Known Routines:</p><p>$097D - &quot;Delay_1&quot; This is a delay routine, value passed via BC<br />$03AD - &quot;LCD_Turn_Off&quot; No variables passed<br />$0462 - &quot;Zero_RAM&quot;&nbsp; &nbsp; Start location passed in HL, number of bytes to zero in BC<br />$03E2 - &quot;DMA_Routine_2_HRAM&quot; , No Variables, moves a 10 byte program into HRAM, the DMA routine.<br />$092A - &quot;Init_OAM_Buffer&quot;&nbsp; &nbsp; ;Sets the OAM buffer ($D400) to 0xF0<br />$0914 - &quot;Clear_Tile_Map0&quot;&nbsp; &nbsp; ;sets $9800-9BFF to $FF<br />$091F - &quot;Clear_Tile_Map1&quot; &nbsp; &nbsp; ;sets $9C00-9FFF to $FF<br />$2B25 - &quot;Init_Snd&quot;&nbsp; &nbsp; &nbsp; &nbsp; ;Turns sound registers on, volume, channels, clears DD00-DF00<br />$1DEC -<br />$1DE0 - &quot;Delay_2&quot; , No variables Passed.</p><p>Known Memory Locations:<br />$FF9B - Current Memory Bank selected<br />$D400 - D49F - DMA Start address (Buffer?)<br />$DD00-DF00 - Suspected Sound buffers?</p><br /><br /><br /><p>$0101: Jp Main</p><p>Main:<br />&nbsp; &nbsp; Ld sp, $FFFE &nbsp; &nbsp; &nbsp; &nbsp; ;Initialise Stack<br />&nbsp; &nbsp; Di&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;disable interrupts<br />&nbsp; &nbsp; Xor a&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;clear a<br />&nbsp; &nbsp; Ldh [$FF0F], a&nbsp; &nbsp; ;Dissable all IRQ’s<br />&nbsp; &nbsp; Ldh a,[$FF40]&nbsp; &nbsp; &nbsp; &nbsp; ;Get LCDC<br />&nbsp; &nbsp; Bit 7,a&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;Test bit 7 – Display Enabled?<br />&nbsp; &nbsp; Jr zn, LCD_Enabled&nbsp; &nbsp; ;Conditional Jump ()<br />&nbsp; &nbsp; Set 7,a&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;set bit 7<br />&nbsp; &nbsp; Ldh [$FF40],a&nbsp; &nbsp; &nbsp; &nbsp; ;Store LCDC</p><p>LCD_Enabled: <br />&nbsp; &nbsp; Ld bc, $0002&nbsp; &nbsp; &nbsp; &nbsp; ;pass $0002 to Function $097D<br />&nbsp; &nbsp; Call Delay_1 &nbsp; &nbsp; &nbsp; &nbsp; ;Jazz, Please watch this in the emulator to find the delay length?<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;Best guess is the delay is necessary to initialise the cart MCU</p><p>VblankWait: <br />&nbsp; &nbsp; Ldh a,[FF44]&nbsp; &nbsp; &nbsp; &nbsp; ;Waiting for a V-Blank…<br />&nbsp; &nbsp; Cp a,$91<br />&nbsp; &nbsp; Jr c,VblankWait</p><p>&nbsp; &nbsp; Ld a,$80<br />&nbsp; &nbsp; Ldh [$FF40],a ;Enable LCD – Did I make a mistake with the above routines? Jazz?<br />&nbsp; &nbsp; Xor a &nbsp; &nbsp; &nbsp; &nbsp; ;Clear A<br />&nbsp; &nbsp; Ldh [$FF47],a &nbsp; &nbsp; ;Clear Pallete Data<br />&nbsp; &nbsp; Ldh [$FF48],a &nbsp; &nbsp; ;Clear Pallete Data<br />&nbsp; &nbsp; Ldh [$FF49],a &nbsp; &nbsp; ;Clear Pallete Data</p><p>&nbsp; &nbsp; Ld bc, $0002&nbsp; &nbsp; &nbsp; &nbsp; ;pass $0002 to Function $097D<br />&nbsp; &nbsp; Call Delay_1 &nbsp; &nbsp; &nbsp; &nbsp; ;Jazz, Please watch this in the emulator to find the delay length?<br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; Call&nbsp; Turn_LCD_Off&nbsp; &nbsp; </p><p>&nbsp; &nbsp; ld hl,$C000&nbsp; &nbsp; &nbsp; &nbsp; ;Load HL with Work RAM location<br />&nbsp; &nbsp; ld BC,$1FFF&nbsp; &nbsp; &nbsp; &nbsp; ;Load BC with 1FFF<br />&nbsp; &nbsp; Call Zero_RAM&nbsp; &nbsp; &nbsp; &nbsp; ;Zero BC number of bytes, from location HL</p><p>&nbsp; &nbsp; </p><p>&nbsp; &nbsp; ld&nbsp; &nbsp;a,$00&nbsp; &nbsp; &nbsp; &nbsp; ;Why do they zero A this way, and not XOR A like other routines???<br />&nbsp; &nbsp; ld&nbsp; &nbsp;[$0000],a&nbsp; &nbsp; &nbsp; &nbsp; ;Disable Cartridge Save RAM<br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,$01&nbsp; &nbsp; &nbsp; &nbsp; ;<br />&nbsp; &nbsp; ld&nbsp; &nbsp;[$2000],a&nbsp; &nbsp; &nbsp; &nbsp; ;Set ROM bank 1<br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,$00&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; ld&nbsp; &nbsp;[$4000],a&nbsp; &nbsp; &nbsp; &nbsp; ;Set Ram bank 0<br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,$01<br />&nbsp; &nbsp; ldh&nbsp; [$FF9B],a&nbsp; &nbsp; &nbsp; &nbsp; ;Store 1 into FF9B - Perhaps a buffer to keep track of bank numbers?<br />&nbsp; &nbsp; ld&nbsp; &nbsp;sp,$DFFF&nbsp; &nbsp; &nbsp; &nbsp; ;Move stack pointer to $DFFF<br />&nbsp; &nbsp; ld&nbsp; &nbsp;hl,$FF80&nbsp; &nbsp; &nbsp; &nbsp; ;Load $FF80 into HL<br />&nbsp; &nbsp; ld&nbsp; &nbsp;bc,$007E&nbsp; &nbsp; &nbsp; &nbsp; ;Load $007E into BC<br />&nbsp; &nbsp; Call Zero_RAM&nbsp; &nbsp; &nbsp; &nbsp; ;Clear the HRAM</p><p>&nbsp; &nbsp; <br />&nbsp; &nbsp; Call DMA_Routine_2_HRAM ;move the DMA routine to HRAM</p><p>&nbsp; &nbsp; Call Init_OAM_Buffer&nbsp; &nbsp; ;Sets the OAM buffer ($D400) to 0xF0</p><p>&nbsp; &nbsp; Call Clear_Tile_Map0</p><p>&nbsp; &nbsp; Call Clear_Tile_Map1</p><p>&nbsp; &nbsp; xor a&nbsp; &nbsp; ;Clear A<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; ld&nbsp; &nbsp;[$D520],a&nbsp; &nbsp; ;Zero all these important registers...<br />&nbsp; &nbsp; ld&nbsp; &nbsp;[$D521],a<br />&nbsp; &nbsp; ld&nbsp; &nbsp;[$D522],a<br />&nbsp; &nbsp; ldh&nbsp; [$FFC5],a<br />&nbsp; &nbsp; ldh&nbsp; [$FFC6],a<br />&nbsp; &nbsp; ldh&nbsp; [$FFD0],a<br />&nbsp; &nbsp; ldh&nbsp; [$FFD4],a<br />&nbsp; &nbsp; ld&nbsp; &nbsp;[$DC41],a<br />&nbsp; &nbsp; ld&nbsp; &nbsp;[$D523],a<br />&nbsp; &nbsp; ldh&nbsp; [$FFC4],a</p><p>&nbsp; &nbsp; ld&nbsp; &nbsp;hl,$FFAB<br />&nbsp; &nbsp; xor&nbsp; a<br />&nbsp; &nbsp; ldi&nbsp; [hl],a&nbsp; &nbsp; ;Zero from&nbsp; FFAB - FFB2<br />&nbsp; &nbsp; ldi&nbsp; [hl],a<br />&nbsp; &nbsp; ldi&nbsp; [hl],a<br />&nbsp; &nbsp; ldi&nbsp; [hl],a<br />&nbsp; &nbsp; ldi&nbsp; [hl],a<br />&nbsp; &nbsp; ldi&nbsp; [hl],a<br />&nbsp; &nbsp; ldi&nbsp; [hl],a<br />&nbsp; &nbsp; ldi&nbsp; [hl],a<br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,$8F<br />&nbsp; &nbsp; ldi&nbsp; [hl],a&nbsp; &nbsp; ;$8F into FFB3<br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,$A6<br />&nbsp; &nbsp; ldi&nbsp; [hl],&nbsp; &nbsp; ;$A6 into FFB4</p><p>&nbsp; &nbsp; Call Init_Snd&nbsp; &nbsp; ;</p><p>&nbsp; &nbsp; Call $1DEC&nbsp; &nbsp; ;</p><br /><br /><br /><br /><br /><p>$1DEC:<br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,$0B<br />&nbsp; &nbsp; ld&nbsp; &nbsp;hl,$4010<br />&nbsp; &nbsp; call $1D95</p><p>&nbsp; &nbsp; call Delay_2</p><p>&nbsp; &nbsp; ldh&nbsp; a,[$FF00]<br />&nbsp; &nbsp; and&nbsp; a,$03<br />&nbsp; &nbsp; cp&nbsp; &nbsp;a,$03<br />&nbsp; &nbsp; jr&nbsp; &nbsp;nz,$1E3A<br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,$20<br />&nbsp; &nbsp; ldh&nbsp; [$FF00],a<br />&nbsp; &nbsp; ldh&nbsp; a,[$FF00]<br />&nbsp; &nbsp; ldh&nbsp; a,[$FF00]<br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,$30<br />&nbsp; &nbsp; ldh&nbsp; [$FF00],a<br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,$10<br />&nbsp; &nbsp; ldh&nbsp; [$FF00],a<br />&nbsp; &nbsp; ldh&nbsp; a,[$FF00]<br />&nbsp; &nbsp; ldh&nbsp; a,[$FF00]<br />&nbsp; &nbsp; ldh&nbsp; a,[$FF00]<br />&nbsp; &nbsp; ldh&nbsp; a,[$FF00]<br />&nbsp; &nbsp; ldh&nbsp; a,[$FF00]<br />&nbsp; &nbsp; ldh&nbsp; a,[$FF00]<br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,$30<br />&nbsp; &nbsp; ldh&nbsp; [$FF00],a<br />&nbsp; &nbsp; ldh&nbsp; a,[$FF00]<br />&nbsp; &nbsp; ldh&nbsp; a,[$FF00]<br />&nbsp; &nbsp; ldh&nbsp; a,[$FF00]<br />&nbsp; &nbsp; ldh&nbsp; a,[$FF00]<br />&nbsp; &nbsp; and&nbsp; a,$03<br />&nbsp; &nbsp; cp&nbsp; &nbsp;a,$03<br />&nbsp; &nbsp; jr&nbsp; &nbsp;nz,$1E3A<br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,$0B<br />&nbsp; &nbsp; ld&nbsp; &nbsp;hl,$4000<br />&nbsp; &nbsp; call $1D95<br />&nbsp; &nbsp; call $1DE0<br />&nbsp; &nbsp; and&nbsp; a<br />&nbsp; &nbsp; ret&nbsp; <br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,$0B<br />&nbsp; &nbsp; ld&nbsp; &nbsp;hl,$4000<br />&nbsp; &nbsp; call $1D95<br />&nbsp; &nbsp; call Delay_2<br />&nbsp; &nbsp; scf&nbsp; <br />&nbsp; &nbsp; ret&nbsp; </p><br /><br /><br /><p>$1D95:&nbsp; &nbsp; ;Variables passed, A and HL</p><p>&nbsp; &nbsp; ldh&nbsp; [$FF9D],a&nbsp; &nbsp; &nbsp; &nbsp; ;put variable A into FF9D - Temp bank buffer 2?<br />&nbsp; &nbsp; ldh&nbsp; a,[BankBuffer]&nbsp; &nbsp; ;Get current bank<br />&nbsp; &nbsp; push af&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;Store it on the stack<br />&nbsp; &nbsp; ldh&nbsp; a,[$FF9D]&nbsp; &nbsp; &nbsp; &nbsp; ;Get that variable buffer<br />&nbsp; &nbsp; ldh&nbsp; [BankBuffer],a&nbsp; &nbsp; ;Update the current bank register<br />&nbsp; &nbsp; ld&nbsp; &nbsp;[$2000],a&nbsp; &nbsp; &nbsp; &nbsp; ;Set the bank<br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,[hl]&nbsp; &nbsp; &nbsp; &nbsp; ;Load first byte of passed variable HL<br />&nbsp; &nbsp; and&nbsp; a,$07&nbsp; &nbsp; &nbsp; &nbsp; ;cmp with $07<br />&nbsp; &nbsp; jr&nbsp; &nbsp;z,Label1&nbsp; &nbsp; &nbsp; &nbsp; ;if something, then end routine.....</p><p>&nbsp; &nbsp; ld&nbsp; &nbsp;b,a&nbsp; &nbsp; &nbsp; &nbsp; ;otherwise,&nbsp; multiply it by 0xFF, and put it in BC<br />&nbsp; &nbsp; ld&nbsp; &nbsp;c,$00<br />&nbsp; &nbsp; push bc&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;push BC onto the stack<br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,$00&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; ld&nbsp; &nbsp;[$ff00+c],a&nbsp; &nbsp; ;Clear keypad latch<br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,$30<br />&nbsp; &nbsp; ld&nbsp; &nbsp;[$ff00+c],a&nbsp; &nbsp; ;Set P14+15 high<br />&nbsp; &nbsp; ld&nbsp; &nbsp;b,$10&nbsp; &nbsp; &nbsp; &nbsp; ;load B with $10<br />Label4:&nbsp; &nbsp; ld&nbsp; &nbsp;e,$08&nbsp; &nbsp; &nbsp; &nbsp; ;Load E with $08<br />&nbsp; &nbsp; ldi&nbsp; a,[hl]&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; ld&nbsp; &nbsp;d,a<br />Label3:&nbsp; &nbsp; bit&nbsp; 0,d<br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,$10<br />&nbsp; &nbsp; jr&nbsp; &nbsp;nz,Label2<br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,$20<br />Label2:&nbsp; &nbsp; ld&nbsp; &nbsp;[$ff00+c],a<br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,$30<br />&nbsp; &nbsp; ld&nbsp; &nbsp;[$ff00+c],a<br />&nbsp; &nbsp; rr&nbsp; &nbsp;d<br />&nbsp; &nbsp; dec&nbsp; e<br />&nbsp; &nbsp; jr&nbsp; &nbsp;nz,Label3<br />&nbsp; &nbsp; dec&nbsp; b<br />&nbsp; &nbsp; jr&nbsp; &nbsp;nz,Label4<br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,$20<br />&nbsp; &nbsp; ld&nbsp; &nbsp;[$ff00+c],a<br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,$30<br />&nbsp; &nbsp; ld&nbsp; &nbsp;[$ff00+c],a<br />&nbsp; &nbsp; pop&nbsp; bc<br />&nbsp; &nbsp; dec&nbsp; b<br />&nbsp; &nbsp; jr&nbsp; &nbsp;z,Label1<br />&nbsp; &nbsp; call Delay_2<br />&nbsp; &nbsp; jr&nbsp; &nbsp;$1DA9<br />Label1:&nbsp; &nbsp; pop&nbsp; af<br />&nbsp; &nbsp; ldh&nbsp; [BankBuffer],a<br />&nbsp; &nbsp; ld&nbsp; &nbsp;[$2000],a<br />&nbsp; &nbsp; ret&nbsp; </p><p>Delay_2:<br />&nbsp; &nbsp; ld&nbsp; &nbsp;de,$1B58<br />.Loop&nbsp; &nbsp; nop&nbsp; <br />&nbsp; &nbsp; nop&nbsp; <br />&nbsp; &nbsp; nop&nbsp; <br />&nbsp; &nbsp; dec&nbsp; de<br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,d<br />&nbsp; &nbsp; or&nbsp; &nbsp;e<br />&nbsp; &nbsp; jr&nbsp; &nbsp;nz,.Loop<br />&nbsp; &nbsp; ret&nbsp; </p><br /><br /><br /><br /><p>Init_Snd: ;Set bank 1F, execute code at $7FF6, Restore previous bank.<br />&nbsp; &nbsp; ldh&nbsp; a,[$FF9B] ;Store the current ROM bank<br />&nbsp; &nbsp; push af<br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,$1F&nbsp; &nbsp; ;Change to ROM Bank 1F<br />&nbsp; &nbsp; ldh&nbsp; [$FF9B],a&nbsp; &nbsp; ;Update the bank buffer<br />&nbsp; &nbsp; ld&nbsp; &nbsp;[$2000],a&nbsp; &nbsp; ;Switch bank 1F<br />&nbsp; &nbsp; call $7FF6&nbsp; &nbsp; ;Turn on Sound registers, Zero DD00-DF00 - Sound buffers???<br />&nbsp; &nbsp; pop&nbsp; af&nbsp; &nbsp; &nbsp; &nbsp; ;Restore the current rom bank<br />&nbsp; &nbsp; ldh&nbsp; [$FF9B],a&nbsp; &nbsp; ;<br />&nbsp; &nbsp; d&nbsp; &nbsp;[$2000],a&nbsp; &nbsp; ;Set the current rom bank.<br />&nbsp; &nbsp; ret&nbsp; &nbsp; &nbsp; </p><p>&nbsp; &nbsp; &nbsp; &nbsp; 1F:7FF6 &gt; jumps to :5343<br />&nbsp; &nbsp; &nbsp; &nbsp; 1F:5343:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ld&nbsp; &nbsp;a,$80<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ldh&nbsp; [$FF26],a&nbsp; &nbsp; ;Enable all sound channels<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ld&nbsp; &nbsp;a,$77<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ldh&nbsp; [$FF24],a&nbsp; ;Max volume<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ld&nbsp; &nbsp;a,$FF<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ldh&nbsp; [$FF25],a&nbsp; &nbsp; ;Sound output to all terminals<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ld&nbsp; &nbsp;hl,$DD00<br />&nbsp; &nbsp; &nbsp; &nbsp; .Loop&nbsp; &nbsp; ld&nbsp; &nbsp;[hl],$00&nbsp; &nbsp; ;Zero DD00-DF00<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inc&nbsp; l<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jr&nbsp; &nbsp;nz,.Loop<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inc&nbsp; h<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ld&nbsp; &nbsp;a,h<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cp&nbsp; &nbsp;a,$DF<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jr&nbsp; &nbsp;nz,.Loop<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ret&nbsp; </p><p>Clear_Tile_Map0:<br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,$FF<br />&nbsp; &nbsp; ld&nbsp; &nbsp;hl,$9800<br />&nbsp; &nbsp; ldi&nbsp; [hl],a<br />&nbsp; &nbsp; bit&nbsp; 2,h<br />&nbsp; &nbsp; jr&nbsp; &nbsp;z,$0919<br />&nbsp; &nbsp; ret&nbsp; </p><br /><p>Clear_Tile_Map1:<br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,$FF<br />&nbsp; &nbsp; ld&nbsp; &nbsp;hl,$9C00<br />&nbsp; &nbsp; ldi&nbsp; [hl],a<br />&nbsp; &nbsp; bit&nbsp; 5,h<br />&nbsp; &nbsp; jr&nbsp; &nbsp;z,$0924<br />&nbsp; &nbsp; ret&nbsp; <br />&nbsp; &nbsp; </p><br /><p>Init_OAM_Buffer: ;Set OAM buffer to 0xF0, all of it.<br />&nbsp; &nbsp; ld&nbsp; &nbsp;hl,$D400<br />&nbsp; &nbsp; ld&nbsp; &nbsp;b,$A0<br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,$F0<br />&nbsp; &nbsp; ldi&nbsp; [hl],a<br />&nbsp; &nbsp; dec&nbsp; b<br />&nbsp; &nbsp; jr&nbsp; &nbsp;nz,$0931<br />&nbsp; &nbsp; xor&nbsp; a<br />&nbsp; &nbsp; ldh&nbsp; [$FF9A],a<br />&nbsp; &nbsp; ret&nbsp; </p><br /><br /><p>DMA_Routine_2_HRAM: ;Move the DMA transfer routine into HRAM<br />&nbsp; &nbsp; ld&nbsp; &nbsp;c,$80<br />&nbsp; &nbsp; ld&nbsp; &nbsp;b,$0A<br />&nbsp; &nbsp; ld&nbsp; &nbsp;hl,DMA_Routine&nbsp; &nbsp; <br />&nbsp; &nbsp; ldi&nbsp; a,[hl]&nbsp; &nbsp; ;<br />&nbsp; &nbsp; ld&nbsp; &nbsp;[$ff00+c],a<br />&nbsp; &nbsp; inc&nbsp; c<br />&nbsp; &nbsp; dec&nbsp; b<br />&nbsp; &nbsp; jr&nbsp; &nbsp;nz,$03E9<br />&nbsp; &nbsp; ret&nbsp; &nbsp; &nbsp; </p><p>DMA_Routine:&nbsp; &nbsp; ;This routine is placed into HRAM via DMA_Routine_2_HRAM<br />&nbsp; &nbsp; ld a,$D4&nbsp; &nbsp; &nbsp; &nbsp; ;Start address = $D400, Destination is FE00<br />&nbsp; &nbsp; ldh [$FF46],a<br />&nbsp; &nbsp; ld a,$28<br />&nbsp; &nbsp; dec a<br />&nbsp; &nbsp; jr nz,$03F6<br />&nbsp; &nbsp; Ret</p><p>Zero_RAM:<br />&nbsp; &nbsp; xor&nbsp; a<br />&nbsp; &nbsp; ldi&nbsp; [hl],a<br />&nbsp; &nbsp; dec&nbsp; bc<br />&nbsp; &nbsp; ld&nbsp; &nbsp;a,c<br />&nbsp; &nbsp; or&nbsp; &nbsp;b<br />&nbsp; &nbsp; jr&nbsp; &nbsp;nz,$0462<br />&nbsp; &nbsp; ret &nbsp; &nbsp; </p><br /><br /><p>Turn_LCD_Off:<br />&nbsp; &nbsp; Ldh a,[$FF40] &nbsp; &nbsp; ; get LCDC<br />&nbsp; &nbsp; Bit 7,a&nbsp; &nbsp; &nbsp; &nbsp; ;Disabled?<br />&nbsp; &nbsp; Ret z&nbsp; &nbsp; &nbsp; &nbsp; ;return with zero flag carried<br />&nbsp; &nbsp; Ldh a,[$FFFF]&nbsp; &nbsp; ;Get Interrupt Status<br />&nbsp; &nbsp; Push AF&nbsp; &nbsp; &nbsp; &nbsp; ;push it to the stack<br />&nbsp; &nbsp; And A,$FC&nbsp; &nbsp; ;Clear bits 0+1 – Vblank int, and LCD Stat int.<br />&nbsp; &nbsp; Ldh [$FFFF],A&nbsp; &nbsp; ;Update the interrupt status</p><p>.Wait4V:<br />&nbsp; &nbsp; Ld a,[FF44]<br />&nbsp; &nbsp; Cp a,$91<br />Jr nz, .Wait4V<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; Ldh a,[$FFAB]&nbsp; &nbsp; ;FFAB is a buffer register of LCDC<br />&nbsp; &nbsp; Res 7,a<br />&nbsp; &nbsp; ldh [$FF40],a&nbsp; &nbsp; ;store in LCDC<br />&nbsp; &nbsp; ldh [$FFAB],a&nbsp; &nbsp;;Update LCDC buffer register&nbsp; &nbsp; <br />&nbsp; &nbsp; pop af<br />&nbsp; &nbsp; ldh [$FFFF],a&nbsp; &nbsp; ;restore the Interupt register<br />&nbsp; &nbsp; RET</p><br /><br /><p>Delay_1 : ;Data passed in via Register BC<br />&nbsp; &nbsp; Ld de,$06D6&nbsp; &nbsp; &nbsp; &nbsp; ;Delay loop pre-set<br />Delay_Inner_Loop:<br />&nbsp; &nbsp; Nop<br />&nbsp; &nbsp; Nop<br />&nbsp; &nbsp; Nop<br />&nbsp; &nbsp; Dec de&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;<br />&nbsp; &nbsp; Ld a,d&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;<br />&nbsp; &nbsp; Or e&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;<br />&nbsp; &nbsp; Jr nz, Delay_Inner_Loop: ;Loop $06D6 times<br />&nbsp; &nbsp; Dec BC<br />&nbsp; &nbsp; Ld a,b<br />&nbsp; &nbsp; Or c<br />&nbsp; &nbsp; Jr nz, Delay_1: ;Loop the above loop, BC times.<br />&nbsp; &nbsp; Ret</p><br /><p>There is more on my home PC</p>]]></content>
			<author>
				<name><![CDATA[BennVenn]]></name>
				<uri>https://chipmusic.org/BennVenn</uri>
			</author>
			<updated>2016-06-23T22:27:09Z</updated>
			<id>https://chipmusic.org/forums/post/245392/#p245392</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Gameboy Camera - Force Trippy H]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/245345/#p245345"/>
			<content type="html"><![CDATA[<p>this would save me so much time. patiently waiting :3</p>]]></content>
			<author>
				<name><![CDATA[unicorn wizard]]></name>
				<uri>https://chipmusic.org/unicorn+wizard</uri>
			</author>
			<updated>2016-06-23T05:47:22Z</updated>
			<id>https://chipmusic.org/forums/post/245345/#p245345</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Gameboy Camera - Force Trippy H]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/245344/#p245344"/>
			<content type="html"><![CDATA[<p>this would save me so much time. patiently waiting :3</p>]]></content>
			<author>
				<name><![CDATA[unicorn wizard]]></name>
				<uri>https://chipmusic.org/unicorn+wizard</uri>
			</author>
			<updated>2016-06-23T05:47:03Z</updated>
			<id>https://chipmusic.org/forums/post/245344/#p245344</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Gameboy Camera - Force Trippy H]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/245045/#p245045"/>
			<content type="html"><![CDATA[<p>Unfortunately Ben never got around sending me what he has so far... <img src="https://chipmusic.org/forums/img/smilies/sad.png" width="15" height="15" alt="sad" /></p>]]></content>
			<author>
				<name><![CDATA[zemzelett]]></name>
				<uri>https://chipmusic.org/zemzelett</uri>
			</author>
			<updated>2016-06-15T08:53:07Z</updated>
			<id>https://chipmusic.org/forums/post/245045/#p245045</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Gameboy Camera - Force Trippy H]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/244987/#p244987"/>
			<content type="html"><![CDATA[<p>Any updates? <img src="https://chipmusic.org/forums/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></content>
			<author>
				<name><![CDATA[nordloef]]></name>
				<uri>https://chipmusic.org/nordloef</uri>
			</author>
			<updated>2016-06-13T17:10:32Z</updated>
			<id>https://chipmusic.org/forums/post/244987/#p244987</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Gameboy Camera - Force Trippy H]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/242872/#p242872"/>
			<content type="html"><![CDATA[<p>It&#039;s on hold while I finish up a few other projects. I&#039;m happy to pass what I&#039;ve done on to you. PM me?</p>]]></content>
			<author>
				<name><![CDATA[BennVenn]]></name>
				<uri>https://chipmusic.org/BennVenn</uri>
			</author>
			<updated>2016-04-17T23:09:39Z</updated>
			<id>https://chipmusic.org/forums/post/242872/#p242872</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Gameboy Camera - Force Trippy H]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/242869/#p242869"/>
			<content type="html"><![CDATA[<p>May i ask if you are still working on this?</p><p>I wanted to do the same a few months back but didn&#039;t get around doing it and then i saw your post. That&#039;s why i&#039;m asking.</p>]]></content>
			<author>
				<name><![CDATA[zemzelett]]></name>
				<uri>https://chipmusic.org/zemzelett</uri>
			</author>
			<updated>2016-04-17T22:21:03Z</updated>
			<id>https://chipmusic.org/forums/post/242869/#p242869</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Gameboy Camera - Force Trippy H]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/240938/#p240938"/>
			<content type="html"><![CDATA[<div class="quotebox"><cite>Jazzmarazz wrote:</cite><blockquote><p>[<br />I found what you are talking about. That is a pretty ugly side-effect of disabling interrupts, loading too much stuff and the enabling interrupts again. I can definitely look into it.</p></blockquote></div><p>Ah cool, would be amazing, good luck! <img src="https://chipmusic.org/forums/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></content>
			<author>
				<name><![CDATA[Cementimental]]></name>
				<uri>https://chipmusic.org/Cementimental</uri>
			</author>
			<updated>2016-03-03T18:52:44Z</updated>
			<id>https://chipmusic.org/forums/post/240938/#p240938</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Gameboy Camera - Force Trippy H]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/239142/#p239142"/>
			<content type="html"><![CDATA[<p>No, there is a substantial amount to weed through. And yeah, the code should be available once we&#039;re finished with it.</p>]]></content>
			<author>
				<name><![CDATA[Jazzmarazz]]></name>
				<uri>https://chipmusic.org/Jazzmarazz</uri>
			</author>
			<updated>2016-02-02T00:02:51Z</updated>
			<id>https://chipmusic.org/forums/post/239142/#p239142</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Gameboy Camera - Force Trippy H]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/239139/#p239139"/>
			<content type="html"><![CDATA[<p>Oh, sorry I thought you meant you had already reversed the whole thing.</p>]]></content>
			<author>
				<name><![CDATA[catskull]]></name>
				<uri>https://chipmusic.org/catskull</uri>
			</author>
			<updated>2016-02-01T23:32:31Z</updated>
			<id>https://chipmusic.org/forums/post/239139/#p239139</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Gameboy Camera - Force Trippy H]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/239138/#p239138"/>
			<content type="html"><![CDATA[<p>Not at this time. Besides, we only have a few routines reversed. I&#039;ll talk with Benn and see what he plans. <br />I have no issue.</p>]]></content>
			<author>
				<name><![CDATA[Jazzmarazz]]></name>
				<uri>https://chipmusic.org/Jazzmarazz</uri>
			</author>
			<updated>2016-02-01T23:13:34Z</updated>
			<id>https://chipmusic.org/forums/post/239138/#p239138</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Gameboy Camera - Force Trippy H]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/239137/#p239137"/>
			<content type="html"><![CDATA[<p>Sweet! Open source Trippy-H. Are you posting the code anywhere?</p>]]></content>
			<author>
				<name><![CDATA[catskull]]></name>
				<uri>https://chipmusic.org/catskull</uri>
			</author>
			<updated>2016-02-01T23:08:57Z</updated>
			<id>https://chipmusic.org/forums/post/239137/#p239137</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Gameboy Camera - Force Trippy H]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/239135/#p239135"/>
			<content type="html"><![CDATA[<p>Update:<br />Benn and I (mostly Benn) have decided to hand-disassemble the machine code of the Gameboy Camera ROM. With this, the ROM can be rewritten and recompiled to reflect whatever changes, updates or exclusions we choose. It makes for any changes to be much more simple and to some extent, more plausible. Modifying the routines will make any releases less wasteful with resources. There is no need for a dedicated Trippy-H game to be 1MByte.</p>]]></content>
			<author>
				<name><![CDATA[Jazzmarazz]]></name>
				<uri>https://chipmusic.org/Jazzmarazz</uri>
			</author>
			<updated>2016-02-01T22:21:46Z</updated>
			<id>https://chipmusic.org/forums/post/239135/#p239135</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Gameboy Camera - Force Trippy H]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/238982/#p238982"/>
			<content type="html"><![CDATA[<p>PM&#039;d</p>]]></content>
			<author>
				<name><![CDATA[BennVenn]]></name>
				<uri>https://chipmusic.org/BennVenn</uri>
			</author>
			<updated>2016-01-28T21:21:31Z</updated>
			<id>https://chipmusic.org/forums/post/238982/#p238982</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Gameboy Camera - Force Trippy H]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/238980/#p238980"/>
			<content type="html"><![CDATA[<div class="quotebox"><cite>pselodux wrote:</cite><blockquote><div class="quotebox"><cite>Jazzmarazz wrote:</cite><blockquote><p>That would probably be one of the last updates I add if at all. I can imagine that being one of the most difficult. <br />If I had a source code, I would say no problem. Bu ti am just editing the hex file, one bit at a time. <img src="https://chipmusic.org/forums/img/smilies/tongue.png" width="15" height="15" alt="tongue" /></p></blockquote></div><p>Yeah, understood, it&#039;s a bit of a dream <img src="https://chipmusic.org/forums/img/smilies/big_smile.png" width="15" height="15" alt="big_smile" /> great work so far though!</p></blockquote></div><p>There is so much extra space in ROM and WRAM that it would be feasible. I would just need to figure out how to intercept the button-detect routine and add a few more two-button jumps.</p>]]></content>
			<author>
				<name><![CDATA[Jazzmarazz]]></name>
				<uri>https://chipmusic.org/Jazzmarazz</uri>
			</author>
			<updated>2016-01-28T20:38:17Z</updated>
			<id>https://chipmusic.org/forums/post/238980/#p238980</id>
		</entry>
</feed>
