$855A2-$85792
{
	PHP ;
	REP #$30 ;
	LDA $0998 ;
	CMP #$0028 ; Check if we're in an demo sequence

	BPL CF_INTRO_SKIP ;

	LDA #$0430 ;	Checks Input L, R, Down
	ORA $09B2 ; ChecksInput L, R, Down + Fire button
	STA $12 ;
	LDA $8B ;	Checks current input
	CMP $12 ;	Makes sure input matches

	BNE CF_ABORT ; Ends if not

CF_INTRO_SKIP:

	LDA $0B2E ;

	BNE CF_ABORT ; Ends if samus is moving

	LDA $0B2C ;

	BNE CF_ABORT ; Ends if samus is moving

	LDA $09C2 ; Checks Health
	CMP #$0033 ;

	BPL CF_ABORT ; End if more than 51

	LDA $09D6 ; Checks reserve tanks

	BNE CF_ABORT ; End if any energy in reserve

	LDA $09C6 ; Checks missiles
	CMP #$000A ;

	BMI CF_ABORT ; End if < 10

	LDA $09CA ; Check Supers
	CMP #$000A ;

	BMI CF_ABORT ; End if < 10

	LDA $09CE ; Checks Powerbombs
	CMP #$000A ;

	BPL CF_PROCEED ; Continue if > 10

CF_ABORT:

	PLP ;
	SEC ;
	RTL ;

CF_PROCEED:

	LDA $0A1E ;	Checks Movement direction
	AND #$00FF ;
	CMP #$0004 ; Checks if facing left

	BEQ CF_LEFT ; Branch if LEFT

	LDA #$00D3 ; Sets CF pose for facing RIGHT

	BRA CF_SETUP ;

CF_LEFT:

	LDA #$00D4 ; Sets CF pose for facing LEFT

CF_SETUP:

	STA $0A1C ; Store to set Pose
	JSL $91F433 ; // $8F433 IN ROM ;
	JSL $91FB08 ; // $8FB08 IN ROM ;
	LDA $0A1F ;
	AND #$00FF ;
	CMP #$001B ; Checks if Movement type is 1B = CF

	BNE CF_ABORT ; Branch if NO

	LDA $0A20 ;
	STA $0A24 ;
	LDA $0A22 ;
	STA $0A26 ;
	LDA $0A1C ;
	STA $0A20 ;
	LDA $0A1E ;
	STA $0A22 ;
	LDA #$D678 ;
	STA $0A58 ;
	LDA $0A60 ;
	CMP #$E91D ; Checks inpute type?

	BEQ CF_CONTINUE ;

	LDA #$E90E ; Removes controller input
	STA $0A60 ;

CF_CONTINUE:

	LDA #$0009 ;
	STA $0AA2 ;
	STZ $0DEA ;
	LDA #$000A ; Loads Countdown starting with missiles
	STA $0DEC ; Stores for later
	STZ $0DEE ;
	STZ $0DF0 ;
	STZ $0DF2 ;
	LDA #$0007 ;
	STA $0ACC ;
	STZ $0ACE ;
	LDA #$0001 ;
	STA $0A68 ;
	STA $0DF2 ;
	STZ $18A8 ;
	STZ $18AA ;
	STZ $0A52 ;
	PLP ;
	CLC ;
	RTL ;

org $90D678	;  ALTERNATE ENTRY POINT

	LDA $0AFA ;
	DEC A ;
	DEC A ;
	STA $0AFA ;
	LDA $0AA2 ;
	DEC A ;
	STA $0AA2 ;

	BPL CF_END ;

	LDA #$0003 ;
	STA $0A94 ;
	LDA #$0006 ;
	STA $0A96 ;
	LDA $0AFA ;
	STA $0DF0 ;
	LDA #$D6CE ;
	STA $0A58 ;
	STZ $18A8 ;
	STZ $18AA ;
	LDA #$0001 ;
	JSL $809125 ; // $1125 IN ROM ;
	STZ $0CEE ;
	LDA $0AF6 ;
	STA $0CE2 ;
	LDA $0AFA ;
	STA $0CE4 ;
	PHX ;
	PHY ;
	PHP ;
	PHB ;
	JSL $888288 ; // $40288 IN ROM ;
	JSL $88A2A6 ; // $422A6 IN ROM ;
	PLB ;
	PLP ;
	PLY ;
	PLX ;

CF_END:

	RTS ;

;	org $90D6CE	; ALTERNATE ENTRY POINT

	LDA $0DEA ; loads bytes for which ammo depelete step we are on
	ASL A ;
	TAX ;
	JSR CF_AMMO_TABLE, X	; Grabs pointers from table
	STZ $18A8 ;
	STZ $18AA ;
	RTS ;

;	org $90D6DD
CF_AMMO_TABLE:
	dw DEC_MISSILES, DEC_SMISSILES, DEC_POWERBOMBS


DEC_MISSILES:	;	org $90D6E3 ;	MISSILE DECREASE
	LDA $05B6	 ; Checks in game timer Frame
	BIT #$0007 ; 
	BNE CF_DEC_END_1 ; Branches if not 0 or 8
	DEC $09C6 ; DEC missiles every 8 frames
	LDA #$0032 ;
	JSL $91DF12 ;	Routine which Refills Energy to Samus
	DEC $0DEC ;
	BEQ CF_SM_SETUP ; Branch when Dec = 0
	BPL CF_DEC_END_1 ;
CF_SM_SETUP:
	LDA #$000A ;	Loads Number of SUPER MISSILES to subtract
	STA $0DEC ;	Stores Number for later
	INC $0DEA ; Increases Value which tells the game where to subtract from
CF_DEC_END_1:
	RTS ;

DEC_SMISSILES:	;	org $90D706 ;	SUPER MISSILE DECREASE
	LDA $05B6 ;	Checks in game timer Frame
	BIT #$0007 ;
	BNE CF_DEC_END_2 ;	Branches if not 0 or 8
	DEC $09CA ; Decrease Super Missiles
	LDA #$0032 ; Loads HP to restore
	JSL $91DF12 ;	Routine which Refills Energy to Samus
	DEC $0DEC ;
	BEQ CF_PB_SETUP ; Branch when Dec = 0
	BPL CF_DEC_END_2 ;
CF_PB_SETUP:
	LDA #$000A ; When 0DEC = 0 then Add # of powerbombs to reduce
	STA $0DEC ;
	INC $0DEA ;
CF_DEC_END_2:
	RTS ;

DEC_POWERBOMBS:	;	org $90D729	;	POWERBOMB DECREASE
	LDA $05B6 ;	Checks in game timer Frame
	BIT #$0007 ; Branches if not 0 or 8
	BNE CF_DEC_END_3 ;
	DEC $09CE ;	Decrease Powerbombs
	LDA #$0032 ;
	JSL $91DF12 ;	Routine which Refills Energy to Samus
	DEC $0DEC ;
	BEQ CF_AMMO_DEC_END ;
	BPL CF_DEC_END_3 ;
CF_AMMO_DEC_END:
	LDA #$D75B ;
	STA $0A58 ;
	LDA #$EB52 ;
	STA $0A5C ;
	LDA #$0003 ;
	STA $0A94 ;
	LDA #$000C ;
	STA $0A96 ;
CF_DEC_END_3:
	RTS ;

; org $90D75B ; Ends CF, Sets up normal pose
;	LDA $0AFA ;
;	CMP $0DF0 ;
;	BEQ BRANCH_OMICRON ;
;	INC A ;
;	STA $0AFA ;
;BRANCH_OMICRON:
;	LDA $0A1F ;
;	AND #$00FF ;
;	BNE BRANCH_PI ;
;	STZ $0CEE ;
;	LDA #$FFFF ;
;	STA $0A68 ;
;	LDA #$A337 ;
;	STA $0A58 ;
;	LDA $0A60 ;
;	CMP #$E91D ;
;	BEQ BRANCH_PI ;
;	LDA #$E913 ;
;	STA $0A60 ;
;	STZ $18A8 ;
;	STZ $18AA ;
;BRANCH_PI:
;	RTS ;
}