Create_File:
	;Inputs - A is folder, (fileOP1) is the file name, BC is the number of bytes to create
	;Outputs - FAT entry made, pointers updated, HL points to the first byte of the program's
	;location...a new RAM page is swapped in (returned in A), so be sure to swap 81h back as needed.
	ld hl,(varTableEnd)
	dec hl
	and 01111111b			;make sure bit 7 is reset
	ld (hl),a				;set up the parent folder
	dec hl
	ld (hl),0				;files obviously have a folder number of 0
	dec hl
	ld a,(nextRAMpage)
	ld (hl),a
	dec hl
	ld de,(nextRAMoffset)
	ld (hl),e
	dec hl
	ld (hl),d
	dec hl
	ld (hl),c
	dec hl
	ld (hl),b
	dec hl
	push bc
	ex de,hl
	ld hl,fileOP1
	ld b,11
Create_File_Backwards:
	ld a,(hl)
	ld (de),a
	inc hl
	dec de
	djnz Create_File_Backwards
	xor a
	ld (de),a			;FAT entry set up
	ld de,-18
	ld hl,(varTableEnd)
	add hl,de
	ld (varTableEnd),hl		;Now FAT is all done, pointers updated
	ld a,(nextRAMpage)
	out (7),a
	ld hl,(nextRAMoffset)
	pop bc
	push af
	push hl
	;Now we must set up where the next variable would be
	ld de,8000h
	or a
	sbc hl,de
	;HL now is the offset on the initial page
	add hl,bc			;HL now must be adjusted for crossing a page boundary
	ld d,40h
	ld a,-1
Create_File_Loop:
	inc a
	or a
	sbc hl,de
	jr nc,Create_File_Loop
	add hl,de
	;A is the number of pages to add to the current page
	ld b,a
	ld a,(nextRAMpage)
	add a,b
	ld (nextRAMpage),a
	ld d,80h
	add hl,de
	ld (nextRAMoffset),hl
	pop hl
	pop af
	ret