Важная информация

User Tag List

Страница 3 из 3 ПерваяПервая 123
Показано с 21 по 25 из 25

Тема: Выравнивание, утрамбовывание и впихивание кода + быстрые таблицы переходов и SJASM

  1. #21
    Guru Аватар для goodboy
    Регистрация
    27.02.2005
    Адрес
    москва
    Сообщений
    11,568
    Записей в дневнике
    1
    Спасибо Благодарностей отдано 
    22
    Спасибо Благодарностей получено 
    317
    Поблагодарили
    199 сообщений
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)

    По умолчанию

    Цитата Сообщение от goodboy Посмотреть сообщение
    на спеке есть пара/тройка адвентюр где вообще 68000 эмулится
    Цитата Сообщение от NEO SPECTRUMAN Посмотреть сообщение
    и какие?
    http://www.worldofspectrum.org/infos...c+Scrolls+Ltd$
    сам я естественно не проверял (мозгов для понимания процесса не хватит), но читал об этом

  2. #22
    Guru Аватар для NEO SPECTRUMAN
    Регистрация
    22.05.2011
    Адрес
    Дзержинск
    Сообщений
    4,059
    Спасибо Благодарностей отдано 
    159
    Спасибо Благодарностей получено 
    224
    Поблагодарили
    183 сообщений
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    По умолчанию

    Цитата Сообщение от goodboy Посмотреть сообщение
    сам я естественно не проверял (мозгов для понимания процесса не хватит), но читал об этом
    а где про это написано?

    какаято там дикая дикость таки есть
    Последний раз редактировалось NEO SPECTRUMAN; 04.08.2019 в 01:49.

  3. #23
    Guru Аватар для goodboy
    Регистрация
    27.02.2005
    Адрес
    москва
    Сообщений
    11,568
    Записей в дневнике
    1
    Спасибо Благодарностей отдано 
    22
    Спасибо Благодарностей получено 
    317
    Поблагодарили
    199 сообщений
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)

    По умолчанию

    с ходу нашёл например
    Код:
      * Eventually this game code was compiled into an intermediate code called
        ELTHAM (Extra Low Tech Highly Ambiguous Methodology or alternativly
        Extra Low Tech Highly Ambiguous Metacode).
    
      * The ELTHAM code implemented a subset of the 68000 machine code. It was
        executed "natively" on ST, Amiga, QL, Macintosh and emulated on the
        other systems. The virtual machine used up to 64k. On 8 bit machines
        they used virtual memory mechanisms. On the C64 non-active pages were
        held on the floppy disc. Only "read-only" pages were swapped.

  4. #24
    Guru Аватар для NEO SPECTRUMAN
    Регистрация
    22.05.2011
    Адрес
    Дзержинск
    Сообщений
    4,059
    Спасибо Благодарностей отдано 
    159
    Спасибо Благодарностей получено 
    224
    Поблагодарили
    183 сообщений
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    По умолчанию

    Добавл костыль для страничной организации памяти
    для каждой страницы
    придется ручками и копипастой делать свою копию макросов (ищем их по коменту paging)
    и автозаменой менять номер страницы "_pg00" на тот который нужно


    все макросы для работы в страничном режиме имеет "_pg00" в конце

    макросы быстрых таблиц требуют дополнительного указания
    в какой странице находятся таблицы
    fasttab_allocate_macro_pg00 tab_16k_page, tab_haddr, procedure_number
    fasttabright_allocate_macro_pg00 tab_16k_page, tab_haddr, procedure_number
    в процессе записи в таблицы
    по всем 4-м слотам подключается указанная в tab_16k_page страница
    и в таблицу по адресу tab_haddr*$100 ведется запись старшего адреса перехода
    после чего во все слоты возвращаются ИСХОДНЫЕ СТРАНИЦЫ которые сохраняются в начале вызова макроса
    и по идеи повторно выставлять страницы в слотах не нужно

    текущий адрес $ после всех команд
    по моему не сохраняется
    и указывает на место последней записи
    так что после окончания утрамбовки всех процедур
    нужно делать новый org


    для примера
    утрамбованы 2 разных набора данных
    по пересекающимся адресам но в разных страницах памяти

    слева видны таблицы которые вне переключаемого окна



    и более наглядная картинка
    для чего все это нужно



    Собственно сам код с примером что изображен на картинках
    Код:
    		device zxspectrum128
    
    ;==============================================================================
    ; ALLOCATE DATA PROCEDURES r0012
    ; for SjASMPlus Z80 Cross-Assembler v1.14.5 (https://github.com/z00m128/sjasmplus)
    ; by NS									03.2020
    ;==============================================================================
    ;							...some greets to Ped7g
    ;==============================================================================
    
    ; когда нужно индексироть переключаемые 16к страницы
    ; копипастить и автозаменять с инкрементом все содержащее pg00 (paging в коментах)
    ; столько раз сколько страниц используется
    
    ; tab = 8 chars (для ровностей оформления)
    
    ;------------------------------------------------------------------------------
    						lua allpass
    --PAGES FOR ALLOCATE
    	lua_code_allocator_start_page = 0xC0		--область поиска свободного места
    	lua_code_allocator_end_page = 0xCF
    
    	lua_code_allocator_start_page_pg00 = 0xC0	--paging
    	lua_code_allocator_end_page_pg00 = 0xCF		--копипастить и автозаменять
    
    --ERRORS
    	lua_org_overwrite_error_stop = 1
    						endlua
    ;------------------------------------------------------------------------------
    ;MEMORY INIT
    						lua pass1			;
    						lua_code_allocator_array = {}
    						endlua
    						
    						lua pass1			;paging
    						lua_code_allocator_array_pg00 = {}
    						endlua
    							
    ; принятое представление памяти
    ;
    ;		 up
    ;	0000,0100...FE00,FF00
    ;	0001,0101...FE01,FF01
    ; left	.....................  right
    ;	00FE,01FE...FEFE,FFFE
    ;	00FF,01FF...FEFF,FFFF
    ;		down
    ;
    ;------------------------------------------------------------------------------
    						lua allpass
    	--all memory free
    	for temp_byte_cnt = 0x0000, 0xFFFF, 1 do
    	lua_code_allocator_array[temp_byte_cnt] = 1
    	end						
    						
    	for temp_byte_cnt_pg00 = 0x0000, 0xFFFF, 1 do			--paging
    	lua_code_allocator_array_pg00[temp_byte_cnt_pg00] = 1
    	end
    	
    		--ROM 					;помечаем участок куда запись невозможна
    		for temp_byte_cnt = 0x0000, 0x3FFF, 1 do
    		lua_code_allocator_array[temp_byte_cnt] = 0
    		end						
    								
    		for temp_byte_cnt_pg00 = 0x0000, 0x3FFF, 1 do		--paging
    		lua_code_allocator_array_pg00[temp_byte_cnt_pg00] = 0
    		end
    		
    		
    		----some code protect			;защита участков кода\данных от записи
    		--for temp_byte_cnt = 0x9000, 0x91FF, 1 do
    		--lua_code_allocator_array[temp_byte_cnt] = 0
    		--end
    	
    		--for temp_byte_cnt_pg00 = 0x9000, 0x91FF, 1 do		--paging
    		--lua_code_allocator_array_pg00[temp_byte_cnt_pg00] = 0
    		--end
    	
    						endlua
    						
    						
    
    ;==============================================================================	
    ; Manual или около того				
    ;==============================================================================
    ; FAST TAB - генерация быстрых таблиц переходов и утрамбовывание процедур
    ;						с выравниванием по левому краю
    ;
    ;	fasttab_allocate_macro tab_haddr, procedure_number
    ;	code\data...
    ;	end_fasttab_allocate_macro
    ;
    ;	fasttab_allocate_macro_pg00 tab_16k_page, tab_haddr, procedure_number
    ;	code\data...
    ;	end_fasttab_allocate_macro_pg00
    ;------------------------------------------------------------------------------
    ; FAST TAB RIGHT - генерация быстрых таблиц переходов и утрамбовывание процедур
    ;						с выравниванием по правому краю
    ;
    ;	fasttabright_allocate_macro tab_haddr, procedure_number
    ;	code\data...
    ;	end_fasttabright_allocate_macro
    ;
    ;	fasttabright_allocate_macro_pg00 tab_16k_page, tab_haddr, procedure_number
    ;	code\data...
    ;	end_fasttabright_allocate_macro_pg00
    ;------------------------------------------------------------------------------
    ; FAST TAB USING
    ;	ld a,l		;4	;ld a,l
    ;	ld h,tab_haddr	;7	;ld h,tab_haddr
    ;	ld h,(hl)	;7	;ld h,(hl)
    ;	jp (hl)		;4	;dup 32 : ldi : edup
    ;			;22t	:
    ;------------------------------------------------------------------------------
    ; TAMP LEFT - утрамбовывание кода в найденное свободное место
    ;						с выравниванием по левому верхнему краю
    ;	tampleft_allocate_macro
    ;	code\data...
    ;	end_tampleft_allocate_macro
    ;
    ;	tampleft_allocate_macro_pg00
    ;	code\data...
    ;	end_tampleft_allocate_macro_pg00
    ;------------------------------------------------------------------------------
    ; TAMP RIGHT - утрамбовывание кода в найденное свободное место
    ;						с выравниванием по правому нижнему краю
    ;	tampright_allocate_macro
    ;	code\data...
    ;	end_tampright_allocate_macro
    ;
    ;	tampright_allocate_macro_pg00
    ;	code\data...
    ;	end_tampright_allocate_macro_pg00
    ;------------------------------------------------------------------------------
    ; TAMP LEFT ALIGN 256 - утрамбовывание кода в найденное свободное место
    ;						с выравниванием по кратному 256 адресу
    ;						с выравниванием по левому верхнему краю
    ;	tampleft_align256_allocate_macro
    ;	code\data...
    ;	end_tampleft_align256_allocate_macro
    ;
    ;	tampleft_align256_allocate_macro_pg00
    ;	code\data...
    ;	end_tampleft_align256_allocate_macro_pg00
    ;------------------------------------------------------------------------------
    ; TAMP RIGHT ALIGN 256 - утрамбовывание кода в найденное свободное место
    ;						с выравниванием по кратному 256 адресу
    ;						с выравниванием по правому верхнему краю
    ;	tampright_align256_allocate_macro
    ;	code\data...
    ;	end_tampright_align256_allocate_macro
    ;
    ;	tampright_align256_allocate_macro_pg00
    ;	code\data...
    ;	end_tampright_align256_allocate_macro_pg00
    ;------------------------------------------------------------------------------
    ; ORG - запихивание кода по указанному адресу с маркировкой занятого места
    ;						с предупреждением при перезаписи данных
    ;						и опциональной остановкой компиляции
    ;	org_allocate_macro addr
    ;	code\data...
    ;	end_org_allocate_macro
    ;
    ;	org_allocate_macro_pg00 addr
    ;	code\data...
    ;	end_org_allocate_macro_pg00
    ;==============================================================================
    
    
    
    
    	
    
    
    
    ;------------------------------------------------------------------------------
    ;INIT SOME ARRAYS
    
    ;FAST TAB INIT
    	lua pass1
    			lua_fasttab_allocate_procedure_start_addr = {}
    				for temp_cnt = 0,255,1 do
    				lua_fasttab_allocate_procedure_start_addr[temp_cnt] = {}
    				end
    			lua_fasttab_allocate_end_addr = {}
    				for temp_cnt = 0,255,1 do
    				lua_fasttab_allocate_end_addr[temp_cnt] = {}
    				end
    	endlua
    ;FAST TAB RIGHT INIT
    	lua pass1
    			lua_fasttabright_allocate_procedure_start_addr = {}
    				for temp_cnt = 0,255,1 do
    				lua_fasttabright_allocate_procedure_start_addr[temp_cnt] = {}
    				end
    			lua_fasttabright_allocate_end_addr = {}
    				for temp_cnt = 0,255,1 do
    				lua_fasttabright_allocate_end_addr[temp_cnt] = {}
    				end
    	endlua
    ;ORG DATA INIT
    	lua pass1
    			lua_org_allocate_procedure_start_addr = {}
    			lua_org_allocate_end_addr = {}
    	endlua
    	lua allpass
    			lua_org_procedure_count = 0
    	endlua
    ;TAMP_LEFT DATA INIT
    	lua pass1
    			lua_tampleft_allocate_procedure_start_addr = {}
    			lua_tampleft_allocate_end_addr = {}
    	endlua
    	lua allpass
    			lua_tampleft_procedure_count = 0
    	endlua
    ;TAMP_LEFT ALIGN 256 DATA INIT
    	lua pass1
    			lua_tampleft_align256_allocate_procedure_start_addr = {}
    			lua_tampleft_align256_allocate_end_addr = {}
    	endlua
    	lua allpass
    			lua_tampleft_align256_procedure_count = 0
    	endlua
    ;TAMP_RIGHT DATA INIT
    	lua pass1
    			lua_tampright_allocate_procedure_start_addr = {}
    			lua_tampright_allocate_end_addr = {}
    	endlua
    	lua allpass
    			lua_tampright_procedure_count = 0
    	endlua
    ;TAMP_RIGHT ALIGN 256 DATA INIT
    	lua pass1
    			lua_tampright_align256_allocate_procedure_start_addr = {}
    			lua_tampright_align256_allocate_end_addr = {}
    	endlua
    	lua allpass
    			lua_tampright_align256_procedure_count = 0
    	endlua
    ;------------------------------------------------------------------------------
    ;FAST TAB 8P INIT
    	lua pass1
    			lua_fasttab_8p_allocate_procedure_start_addr = {}
    				for temp_cnt = 0,255,1 do
    				lua_fasttab_8p_allocate_procedure_start_addr[temp_cnt] = {}
    				end
    			lua_fasttab_8p_allocate_end_addr = {}
    				for temp_cnt = 0,255,1 do
    				lua_fasttab_8p_allocate_end_addr[temp_cnt] = {}
    				end
    	endlua
    ;------------------------------------------------------------------------------	
    ;------------------------------------------------------------------------------
    	
    ;PAGING
    
    ;------------------------------------------------------------------------------	
    ;------------------------------------------------------------------------------
    ;------------------------------------------------------------------------------	
    ;------------------------------------------------------------------------------
    
    	
    	
    ;копипастить и автозаменять для нужного количества страниц
    	
    	
    ;------------------------------------------------------------------------------
    ;INIT SOME ARRAYS for pg00					;paging
    
    ;FAST TAB INIT pg00
    	lua pass1
    			lua_fasttab_allocate_procedure_start_addr_pg00 = {}
    				for temp_cnt = 0,255,1 do
    				lua_fasttab_allocate_procedure_start_addr_pg00[temp_cnt] = {}
    				end
    			lua_fasttab_allocate_end_addr_pg00 = {}
    				for temp_cnt = 0,255,1 do
    				lua_fasttab_allocate_end_addr_pg00[temp_cnt] = {}
    				end
    	endlua
    ;FAST TAB RIGHT INIT pg00
    	lua pass1
    			lua_fasttabright_allocate_procedure_start_addr_pg00 = {}
    				for temp_cnt = 0,255,1 do
    				lua_fasttabright_allocate_procedure_start_addr_pg00[temp_cnt] = {}
    				end
    			lua_fasttabright_allocate_end_addr_pg00 = {}
    				for temp_cnt = 0,255,1 do
    				lua_fasttabright_allocate_end_addr_pg00[temp_cnt] = {}
    				end
    	endlua
    ;ORG DATA INIT pg00
    	lua pass1
    			lua_org_allocate_procedure_start_addr_pg00 = {}
    			lua_org_allocate_end_addr_pg00 = {}
    	endlua
    	lua allpass
    			lua_org_procedure_count_pg00 = 0
    	endlua
    ;TAMP_LEFT DATA INIT pg00
    	lua pass1
    			lua_tampleft_allocate_procedure_start_addr_pg00 = {}
    			lua_tampleft_allocate_end_addr_pg00 = {}
    	endlua
    	lua allpass
    			lua_tampleft_procedure_count_pg00 = 0
    	endlua
    ;TAMP_LEFT ALIGN 256 DATA INIT pg00
    	lua pass1
    			lua_tampleft_align256_allocate_procedure_start_addr_pg00 = {}
    			lua_tampleft_align256_allocate_end_addr_pg00 = {}
    	endlua
    	lua allpass
    			lua_tampleft_align256_procedure_count_pg00 = 0
    	endlua
    ;TAMP_RIGHT DATA INIT pg00
    	lua pass1
    			lua_tampright_allocate_procedure_start_addr_pg00 = {}
    			lua_tampright_allocate_end_addr_pg00 = {}
    	endlua
    	lua allpass
    			lua_tampright_procedure_count_pg00 = 0
    	endlua
    ;TAMP_RIGHT ALIGN 256 DATA INIT pg00
    	lua pass1
    			lua_tampright_align256_allocate_procedure_start_addr_pg00 = {}
    			lua_tampright_align256_allocate_end_addr_pg00 = {}
    	endlua
    	lua allpass
    			lua_tampright_align256_procedure_count_pg00 = 0
    	endlua
    ;------------------------------------------------------------------------------
    
    	
    	
    	
    	
    
    ;------------------------------------------------------------------------------	
    ;------------------------------------------------------------------------------
    ;------------------------------------------------------------------------------	
    ;------------------------------------------------------------------------------
    
    	display "============================================================================="
    	display "LAST PASS!!!!"
    	display "============================================================================="
    
    ;==============================================================================
    ;==============================================================================
    
    
    
    
    ;==============================================================================
    ; FAST TAB
    ;==============================================================================
    ;FAST TAB macro
    						;по окончанию PASS2 уже установлен новый org!
    	macro fasttab_allocate_macro _fasttab_alloc_table_haddr?, _fasttab_alloc_procedure_number?
    								
    @__fasttab_allocate_table_haddr = _fasttab_alloc_table_haddr?
    @__fasttab_allocate_procedure_number = _fasttab_alloc_procedure_number?
    								
    		lua pass1
    								
    		lua_fasttab_allocate_procedure_start_addr[(_c("__fasttab_allocate_table_haddr"))][(_c("__fasttab_allocate_procedure_number"))] = _c("$")	
    									
    		endlua
    		lua allpass
    		lua_function_fasttab_allocate((_c("__fasttab_allocate_table_haddr")),(_c("__fasttab_allocate_procedure_number")))
    		endlua
    		
    		lua pass2	;copy
    		if lua_fasttab_allocator_page_finded == 1 then
    								
    			_pc(string.format("org $%04x", _c("__fasttab_allocate_table_haddr * 256") + (_c("__fasttab_allocate_procedure_number"))))
    								
    			_pc(string.format("defb $%02x", lua_fasttab_allocator_new_h_org))
    								
    			_pc(string.format("org $%04x", lua_fasttab_allocator_new_h_org*256 + (_c("__fasttab_allocate_procedure_number"))))
    		end 
    		endlua
    		lua pass3	;
    		if lua_fasttab_allocator_page_finded == 1 then
    								
    			_pc(string.format("org $%04x", _c("__fasttab_allocate_table_haddr * 256") + (_c("__fasttab_allocate_procedure_number"))))
    								
    			_pc(string.format("defb $%02x", lua_fasttab_allocator_new_h_org))
    								
    			_pc(string.format("org $%04x", lua_fasttab_allocator_new_h_org*256 + (_c("__fasttab_allocate_procedure_number"))))
    		end 
    		endlua
    	endm
    	
    ;------------------------------------------------------------------------------
    	
    		macro end_fasttab_allocate_macro
    		lua pass1
    								
    		lua_fasttab_allocate_end_addr[(_c("__fasttab_allocate_table_haddr"))][(_c("__fasttab_allocate_procedure_number"))] = _c("$")
    		--lua_fasttab_allocate_end_addr[lua_fasttab_table_haddr][lua_fasttab_procedure_number] = _c("$")
    								
    		endlua
    		lua allpass
    		lua_function_fasttab_allocate_end(_c("__fasttab_allocate_procedure_number"))
    		endlua
    	endm
    
    ;------------------------------------------------------------------------------
    ;FAST TAB lua
    
            lua allpass
    	
    	function lua_function_fasttab_allocate(lua_fasttab_table_haddr,lua_fasttab_procedure_number)
    								
    		fasttab_allocate_size = (lua_fasttab_allocate_end_addr[(_c("__fasttab_allocate_table_haddr"))][(_c("__fasttab_allocate_procedure_number"))]-lua_fasttab_allocate_procedure_start_addr[(_c("__fasttab_allocate_table_haddr"))][(_c("__fasttab_allocate_procedure_number"))])
    								
    			--free page search
    			lua_fasttab_allocator_page_finded = 0
    			fasttab_allocator_page_free_bytes = 1
    
    			for fasttab_allocator_page_search = lua_code_allocator_start_page, lua_code_allocator_end_page, 1 do
    				if lua_fasttab_allocator_page_finded == 0 then
    								
    				fasttab_allocator_page_free_bytes = 1
    								
    					for fasttab_allocator_byte_scan = ((fasttab_allocator_page_search*256) + lua_fasttab_procedure_number), ((fasttab_allocator_page_search*256) + lua_fasttab_procedure_number + fasttab_allocate_size - 1), 1 do
    								
    						if lua_code_allocator_array[fasttab_allocator_byte_scan] == 0 then
    							-- страница занята
    							fasttab_allocator_page_free_bytes = 0
    							--break
    						end
    					end
    				end
    				if lua_fasttab_allocator_page_finded == 0 then
    					if fasttab_allocator_page_free_bytes == 1 then
    								
    						for fasttab_allocator_byte_fill = ((fasttab_allocator_page_search*256) + lua_fasttab_procedure_number), ((fasttab_allocator_page_search*256) + fasttab_allocate_size + lua_fasttab_procedure_number - 1), 1 do
    						-- очистка свободных страниц
    						lua_code_allocator_array[fasttab_allocator_byte_fill] = 0
    								
    						end
    			
    					lua_fasttab_allocator_page_finded = 1
    					lua_fasttab_allocator_new_h_org = fasttab_allocator_page_search
    								
    						if (lua_code_allocator_start_page*256) > ((fasttab_allocator_page_search*256) + lua_fasttab_procedure_number) then
    							sj.error("OUT OF MEMORY !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("FAST TAB")
    							print ("new_org < (lua_code_allocator_start_page*256)")
    							print (string.format("in procedure = $%02x",lua_fasttab_procedure_number))
    							print (string.format("table = $%02x",lua_fasttab_table_haddr))
    							sj.exit()
    						end
    						if ((lua_code_allocator_end_page*256)+255) < ((fasttab_allocator_page_search*256) + fasttab_allocate_size + lua_fasttab_procedure_number - 1) then
    							sj.error("OUT OF MEMORY !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("FAST TAB")
    							print("new_org > ((lua_code_allocator_end_page*256)+255)")
    							print (string.format("in procedure = $%02x",lua_fasttab_procedure_number))
    							print (string.format("table = $%02x",lua_fasttab_table_haddr))
    							sj.exit()
    						end
    					end
    				end
    			end
    			if lua_fasttab_allocator_page_finded == 0 then
    				if fasttab_allocator_page_free_bytes == 0 then
    					sj.error("FREE PAGE NOT FOUND !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("FAST TAB")
    							print (string.format("procedure = $%02x",lua_fasttab_procedure_number))
    							print (string.format("table = $%02x",lua_fasttab_table_haddr))
    							sj.exit()
    				end
    			end
    			if lua_fasttab_allocator_page_finded == 0 then
    				if fasttab_allocator_page_free_bytes == 1 then
    					sj.error("FREE PAGE NOT FOUND !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("free_bytes = 1")
    							print ("FAST TAB")
    							print (string.format("procedure = $%02x",lua_fasttab_procedure_number))
    							print (string.format("table = $%02x",lua_fasttab_table_haddr))
    							sj.exit()
    				end
    			end
    	end
    
    -- ----------------------------------------------------------------------------
    	
    	function lua_function_fasttab_allocate_end(lua_fasttab_procedure_number)
    								
    	end
    	
    	endlua
    
    ;==============================================================================
    ; FAST TAB RIGHT
    ;==============================================================================
    ;FAST TAB RIGHT macro
    					;по окончанию PASS2 уже установлен новый org!
    	macro fasttabright_allocate_macro _fasttabright_alloc_table_haddr?, _fasttabright_alloc_procedure_number?
    								
    @__fasttabright_allocate_table_haddr = _fasttabright_alloc_table_haddr?
    @__fasttabright_allocate_procedure_number = _fasttabright_alloc_procedure_number?
    								
    				lua pass1		
    								
    		lua_fasttabright_allocate_procedure_start_addr[(_c("__fasttabright_allocate_table_haddr"))][(_c("__fasttabright_allocate_procedure_number"))] = _c("$")	
    								
    		endlua
    		lua allpass
    		lua_function_fasttabright_allocate((_c("__fasttabright_allocate_table_haddr")),(_c("__fasttabright_allocate_procedure_number")))
    		endlua
    		
    		lua pass2	;copy
    		if lua_fasttabright_allocator_page_finded == 1 then
    								
    			_pc(string.format("org $%04x", _c("__fasttabright_allocate_table_haddr * 256") + (_c("__fasttabright_allocate_procedure_number"))))
    								
    			_pc(string.format("defb $%02x", lua_fasttabright_allocator_new_h_org))
    								
    			_pc(string.format("org $%04x", lua_fasttabright_allocator_new_h_org*256 + (_c("__fasttabright_allocate_procedure_number"))))
    		end 
    		endlua
    		lua pass3	;
    		if lua_fasttabright_allocator_page_finded == 1 then
    								
    			_pc(string.format("org $%04x", _c("__fasttabright_allocate_table_haddr * 256") + (_c("__fasttabright_allocate_procedure_number"))))
    								
    			_pc(string.format("defb $%02x", lua_fasttabright_allocator_new_h_org))
    								
    			_pc(string.format("org $%04x", lua_fasttabright_allocator_new_h_org*256 + (_c("__fasttabright_allocate_procedure_number"))))
    		end 
    		endlua
    	endm
    	
    ;------------------------------------------------------------------------------
    	
    		macro end_fasttabright_allocate_macro
    		lua pass1
    								
    		lua_fasttabright_allocate_end_addr[(_c("__fasttabright_allocate_table_haddr"))][(_c("__fasttabright_allocate_procedure_number"))] = _c("$")
    		--lua_fasttabright_allocate_end_addr[lua_fasttabright_table_haddr][lua_fasttabright_procedure_number] = _c("$")
    								
    		endlua
    		lua allpass
    		lua_function_fasttabright_allocate_end(_c("__fasttabright_allocate_procedure_number"))
    		endlua
    	endm
    
    ;------------------------------------------------------------------------------
    ;FAST TAB RIGHT lua
    
            lua allpass
    	
    	function lua_function_fasttabright_allocate(lua_fasttabright_table_haddr,lua_fasttabright_procedure_number)
    								
    		fasttabright_allocate_size = (lua_fasttabright_allocate_end_addr[(_c("__fasttabright_allocate_table_haddr"))][(_c("__fasttabright_allocate_procedure_number"))]-lua_fasttabright_allocate_procedure_start_addr[(_c("__fasttabright_allocate_table_haddr"))][(_c("__fasttabright_allocate_procedure_number"))])
    								
    			--free page search
    			lua_fasttabright_allocator_page_finded = 0
    			fasttabright_allocator_page_free_bytes = 1
    
    			for fasttabright_allocator_page_search = lua_code_allocator_end_page, lua_code_allocator_start_page, -1 do
    				if lua_fasttabright_allocator_page_finded == 0 then
    								
    				fasttabright_allocator_page_free_bytes = 1
    								
    					for fasttabright_allocator_byte_scan = ((fasttabright_allocator_page_search*256) + lua_fasttabright_procedure_number), ((fasttabright_allocator_page_search*256) + lua_fasttabright_procedure_number + fasttabright_allocate_size - 1), 1 do
    								
    						if lua_code_allocator_array[fasttabright_allocator_byte_scan] == 0 then
    							-- страница занята
    							
    							fasttabright_allocator_page_free_bytes = 0
    							--break
    						end
    					end
    				end
    				if lua_fasttabright_allocator_page_finded == 0 then
    					if fasttabright_allocator_page_free_bytes == 1 then
    								
    						for fasttabright_allocator_byte_fill = ((fasttabright_allocator_page_search*256) + lua_fasttabright_procedure_number), ((fasttabright_allocator_page_search*256) + fasttabright_allocate_size + lua_fasttabright_procedure_number - 1), 1 do
    						-- очистка свободных страниц
    						lua_code_allocator_array[fasttabright_allocator_byte_fill] = 0
    								
    						end
    			
    					lua_fasttabright_allocator_page_finded = 1
    					lua_fasttabright_allocator_new_h_org = fasttabright_allocator_page_search
    								
    						if (lua_code_allocator_start_page*256) > ((fasttabright_allocator_page_search*256) + lua_fasttabright_procedure_number) then
    							sj.error("OUT OF MEMORY !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("FAST TAB RIGHT")
    							print ("new_org < (lua_code_allocator_start_page*256)")
    							print (string.format("in procedure = $%02x",lua_fasttabright_procedure_number))
    							print (string.format("table = $%02x",lua_fasttabright_table_haddr))
    							sj.exit()
    						end
    						if ((lua_code_allocator_end_page*256)+255) < ((fasttabright_allocator_page_search*256) + fasttabright_allocate_size + lua_fasttabright_procedure_number - 1) then
    							sj.error("OUT OF MEMORY !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("FAST TAB RIGHT")
    							print("new_org > ((lua_code_allocator_end_page*256)+255)")
    							print (string.format("in procedure = $%02x",lua_fasttabright_procedure_number))
    							print (string.format("table = $%02x",lua_fasttabright_table_haddr))
    							sj.exit()
    						end
    					end
    				end
    			end
    			if lua_fasttabright_allocator_page_finded == 0 then
    				if fasttabright_allocator_page_free_bytes == 0 then
    					sj.error("FREE PAGE NOT FOUND !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("FAST TAB RIGHT")
    							print (string.format("procedure = $%02x",lua_fasttabright_procedure_number))
    							print (string.format("table = $%02x",lua_fasttabright_table_haddr))
    							sj.exit()
    				end
    			end
    			if lua_fasttabright_allocator_page_finded == 0 then
    				if fasttabright_allocator_page_free_bytes == 1 then
    					sj.error("FREE PAGE NOT FOUND !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("free_bytes = 1")
    							print ("FAST TAB RIGHT")
    							print (string.format("procedure = $%02x",lua_fasttabright_procedure_number))
    							print (string.format("table = $%02x",lua_fasttabright_table_haddr))
    							sj.exit()
    				end
    			end
    	end
    
    -- ----------------------------------------------------------------------------
    	
    	function lua_function_fasttabright_allocate_end(lua_fasttabright_procedure_number)
    								
    	end
    	endlua
    
    ;==============================================================================
    ; ORG
    ;==============================================================================
    ;ORG macro
    					
    	macro org_allocate_macro _org_alloc_addr?
    		
    @__org_allocate_addr = _org_alloc_addr?
    
    		lua pass1				
    		lua_org_allocate_procedure_start_addr[lua_org_procedure_count] = _c("$")
    								
    		endlua
    		
    		lua allpass
    								
    		lua_function_org_allocate (_c("__org_allocate_addr"))
    								
    		endlua
    		
    		lua pass2	;
    		if lua_org_allocator_addr_finded == 1 then
    								
    			_pc(string.format("org $%04x", lua_org_allocator_new_org))
    		end 
    		endlua
    		lua pass3	;
    		if lua_org_allocator_addr_finded == 1 then
    								
    			_pc(string.format("org $%04x", lua_org_allocator_new_org))
    		end 
    		endlua
    	endm
    
    ;------------------------------------------------------------------------------
    
    		macro end_org_allocate_macro
    		lua pass1
    								
    		lua_org_allocate_end_addr[lua_org_procedure_count] = (_c("$"))
    								
    		endlua
    		
    		lua allpass
    		lua_function_org_allocate_end(1)
    		
    		lua_org_procedure_count = lua_org_procedure_count + 1
    		endlua
    	endm
    
    ;------------------------------------------------------------------------------
    ;ORG lua
    
            lua allpass
    	
    	function lua_function_org_allocate(lua_org_allocate_addr)
    								
    		org_allocate_size = (lua_org_allocate_end_addr[lua_org_procedure_count] - lua_org_allocate_procedure_start_addr[lua_org_procedure_count])
    								
    			--free page search
    			lua_org_allocator_addr_finded = 0
    			org_allocator_free_bytes = 1
    			
    					lua_org_allocator_addr_finded = 0
    					org_allocator_free_bytes = 1
    					
    					if lua_org_allocator_addr_finded == 0 then
    					for org_allocator_byte_scan = lua_org_allocate_addr, (lua_org_allocate_addr + org_allocate_size - 1), 1 do
    								
    						if lua_code_allocator_array[org_allocator_byte_scan] == 0 then
    						org_allocator_free_bytes = 0
    						end
    					end
    							if org_allocator_free_bytes == 0 then
    								sj.error("ORG DATA OVERWRITE!!!!!!!!!!!!!!!!!!!!!!!!!!")
    								sj.warning("ORG DATA OVERWRITE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
    								print("new_org > ((lua_code_allocator_end_page*256)+255)")
    								print("procedure = ",lua_org_procedure_count)
    									if lua_org_overwrite_error_stop == 1 then
    										sj.exit()
    									end
    							end
    								
    							for org_allocator_byte_fill = lua_org_allocate_addr,(lua_org_allocate_addr + org_allocate_size - 1), 1 do
    								
    							-- очистка свободной памяти
    							lua_code_allocator_array[org_allocator_byte_fill] = 0
    							end
    				
    						lua_org_allocator_addr_finded = 1
    						lua_org_allocator_new_org = lua_org_allocate_addr
    					end
    	end
    	
    -- ----------------------------------------------------------------------------
    	
    	function lua_function_org_allocate_end(temp)
    								
    	end
    		
    	endlua
    
    ;==============================================================================
    ; TAMP LEFT
    ;==============================================================================
    ;TAMP LEFT macro
    				
    	macro tampleft_allocate_macro
    		
    		lua pass1				
    		lua_tampleft_allocate_procedure_start_addr[lua_tampleft_procedure_count] = _c("$")
    								
    		endlua
    		
    		lua allpass
    								
    		lua_function_tampleft_allocate (0)
    								
    		endlua
    		
    		lua pass2	;
    		if lua_tampleft_allocator_addr_finded == 1 then
    								
    			_pc(string.format("org $%04x", lua_tampleft_allocator_new_org))
    		end 
    		endlua
    		lua pass3	;
    		if lua_tampleft_allocator_addr_finded == 1 then
    								
    			_pc(string.format("org $%04x", lua_tampleft_allocator_new_org))
    		end 
    		endlua
    	endm
    
    ;------------------------------------------------------------------------------
    
    		macro end_tampleft_allocate_macro
    		lua pass1
    								
    		lua_tampleft_allocate_end_addr[lua_tampleft_procedure_count] = (_c("$"))
    								
    		endlua
    		
    		lua allpass
    		lua_function_tampleft_allocate_end(1)
    		
    		lua_tampleft_procedure_count = lua_tampleft_procedure_count + 1
    		endlua
    	endm
    
    ;------------------------------------------------------------------------------
    ;TAMP left lua
    
            lua allpass
    	
    	function lua_function_tampleft_allocate(temp)
    								
    		tampleft_allocate_size = (lua_tampleft_allocate_end_addr[lua_tampleft_procedure_count] - lua_tampleft_allocate_procedure_start_addr[lua_tampleft_procedure_count])
    								
    			--free page search
    			lua_tampleft_allocator_addr_finded = 0
    			tampleft_allocator_free_bytes = 1
    								
    				for tampleft_allocator_addr_search = (lua_code_allocator_start_page*256),((lua_code_allocator_end_page*256)+255), 1 do
    
    					if lua_tampleft_allocator_addr_finded == 0 then
    						tampleft_allocator_free_bytes = 1
    								
    						for tampleft_allocator_byte_scan = (tampleft_allocator_addr_search), (tampleft_allocator_addr_search + tampleft_allocate_size - 1), 1 do
    								
    						if lua_code_allocator_array[tampleft_allocator_byte_scan] == 0 then
    						tampleft_allocator_free_bytes = 0
    						end
    						end
    					end
    					
    					if lua_tampleft_allocator_addr_finded == 0 then
    						if tampleft_allocator_free_bytes == 1 then
    								
    							for tampleft_allocator_byte_fill = (tampleft_allocator_addr_search),(tampleft_allocator_addr_search + tampleft_allocate_size -1), 1 do
    								
    							-- очистка свободной памяти
    							lua_code_allocator_array[tampleft_allocator_byte_fill] = 0
    							end
    				
    						lua_tampleft_allocator_addr_finded = 1
    			
    						lua_tampleft_allocator_new_org = (tampleft_allocator_addr_search)
    								
    							if lua_tampleft_allocator_new_org > ((lua_code_allocator_end_page*256)+255) then
    								sj.error("OUT OF MEMORY !!!!!!!!!!!!!!!!!!!!!11111")
    								print ("TAMP LEFT")
    								print("new_org > ((lua_code_allocator_end_page*256)+255)")
    								print("in procedure = ",lua_tampleft_procedure_count)
    								sj.exit()
    							end
    							if (tampleft_allocator_addr_search + tampleft_allocate_size -1) > ((lua_code_allocator_end_page*256)+255) then
    								sj.error("OUT OF MEMORY !!!!!!!!!!!!!!!!!!!!!11111")
    								print ("TAMP LEFT")
    								print("new_org+size > ((lua_code_allocator_end_page*256)+255)")
    								print("in procedure = ",lua_tampleft_procedure_count)
    								sj.exit()
    							end
    							if lua_tampleft_allocator_new_org < (lua_code_allocator_start_page*256) then
    								sj.error("BUG?")
    								print ("TAMP LEFT")
    								print("new_org < (lua_code_allocator_start_page*256)")
    								print("in procedure = ",lua_tampleft_procedure_count)
    								sj.exit()
    							end
    						end
    					end
    				end
    				
    				if lua_tampleft_allocator_addr_finded == 0 then
    					if tampleft_allocator_free_bytes == 0 then
    						sj.error("FREE BYTES NOT FOUND o_O !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("TAMP LEFT")
    							print("procedure = ",lua_tampleft_procedure_count)
    							sj.exit()
    					end
    				end
    				if lua_tampleft_allocator_addr_finded == 0 then
    					if tampleft_allocator_free_bytes == 1 then
    						sj.error("FREE BYTES NOT FOUND o_O !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("free_bytes = 1")
    							print ("TAMP LEFT")
    							print("procedure = ",lua_tampleft_procedure_count)
    							sj.exit()
    					end
    				end
    	end
    
    -- ----------------------------------------------------------------------------
    	
    	function lua_function_tampleft_allocate_end(temp)
    								
    	end
    	endlua
    
    ;==============================================================================
    ; TAMP LEFT ALIGN 256
    ;==============================================================================
    ;TAMP LEFT ALIGN 256 macro
    					
    	macro tampleft_align256_allocate_macro
    		
    		lua pass1				
    		lua_tampleft_align256_allocate_procedure_start_addr[lua_tampleft_align256_procedure_count] = _c("$")
    								
    		endlua
    		
    		lua allpass
    								
    		lua_function_tampleft_align256_allocate (0)
    								
    		endlua
    		
    		lua pass2	;
    		if lua_tampleft_align256_allocator_addr_finded == 1 then
    								
    			_pc(string.format("org $%04x", lua_tampleft_align256_allocator_new_org))
    		end 
    		endlua
    		lua pass3	;
    		if lua_tampleft_align256_allocator_addr_finded == 1 then
    								
    			_pc(string.format("org $%04x", lua_tampleft_align256_allocator_new_org))
    		end 
    		endlua
    	endm
    
    ;------------------------------------------------------------------------------
    
    		macro end_tampleft_align256_allocate_macro
    		lua pass1	
    								
    		lua_tampleft_align256_allocate_end_addr[lua_tampleft_align256_procedure_count] = (_c("$"))
    								
    		endlua
    		
    		lua allpass
    		lua_function_tampleft_align256_allocate_end(1)
    		
    		lua_tampleft_align256_procedure_count = lua_tampleft_align256_procedure_count + 1
    		endlua
    	endm
    
    ;------------------------------------------------------------------------------
    ;TAMP LEFT ALIGN 256 lua
    
            lua allpass
    	
    	function lua_function_tampleft_align256_allocate(temp)
    								
    		tampleft_align256_allocate_size = (lua_tampleft_align256_allocate_end_addr[lua_tampleft_align256_procedure_count] - lua_tampleft_align256_allocate_procedure_start_addr[lua_tampleft_align256_procedure_count])
    								
    			--free page search
    			lua_tampleft_align256_allocator_addr_finded = 0
    			tampleft_align256_allocator_free_bytes = 1
    								
    				for tampleft_align256_allocator_addr_search = (lua_code_allocator_start_page*256), (lua_code_allocator_end_page*256), 256 do
    
    					if lua_tampleft_align256_allocator_addr_finded == 0 then
    						tampleft_align256_allocator_free_bytes = 1
    								
    						for tampleft_align256_allocator_byte_scan = tampleft_align256_allocator_addr_search,((tampleft_align256_allocator_addr_search + tampleft_align256_allocate_size)-1), 1 do
    								
    						if lua_code_allocator_array[tampleft_align256_allocator_byte_scan] == 0 then
    						tampleft_align256_allocator_free_bytes = 0
    						end
    						end
    					end
    					
    					if lua_tampleft_align256_allocator_addr_finded == 0 then
    						if tampleft_align256_allocator_free_bytes == 1 then
    								if (tampleft_align256_allocator_addr_search + tampleft_align256_allocate_size-1) < ((lua_code_allocator_end_page*256)+256) then
    									
    							for tampleft_align256_allocator_byte_fill = tampleft_align256_allocator_addr_search,((tampleft_align256_allocator_addr_search + tampleft_align256_allocate_size)-1), 1 do
    									
    							-- очистка свободной памяти
    							lua_code_allocator_array[tampleft_align256_allocator_byte_fill] = 0
    							end
    				
    						lua_tampleft_align256_allocator_addr_finded = 1
    			
    						lua_tampleft_align256_allocator_new_org = tampleft_align256_allocator_addr_search
    									
    							if lua_tampleft_align256_allocator_new_org < (lua_code_allocator_start_page*256) then
    								sj.error("OUT OF MEMORY !!!!!!!!!!!!!!!!!!!!!11111")
    								print ("TAMP LEFT ALIGN 256")
    								print("new_org < (lua_code_allocator_start_page*256)")
    								print("in procedure = ",lua_tampleft_align256_procedure_count)
    								sj.exit()
    							end
    							if lua_tampleft_align256_allocator_new_org > ((lua_code_allocator_end_page*256)+255) then
    								sj.error("BUG?")
    								print ("TAMP LEFT ALIGN 256")
    								print("new_org > ((lua_code_allocator_end_page*256)+255)")
    								print("in procedure = ",lua_tampleft_align256_procedure_count)
    								sj.exit()
    							end
    							if ((lua_tampleft_align256_allocator_new_org+tampleft_align256_allocate_size)-1) > ((lua_code_allocator_end_page*256)+255) then
    								sj.error("OUT OF MEMORY !!!!!!!!!!!!!!!!!!!!!11111")
    								print ("TAMP LEFT ALIGN 256")
    								print("new_org+size > ((lua_code_allocator_end_page*256)+255)")
    								print("in procedure = ",lua_tampleft_align256_procedure_count)
    								sj.exit()
    							end
    								end
    						end
    					end
    				end
    				
    				if lua_tampleft_align256_allocator_addr_finded == 0 then
    					if tampleft_align256_allocator_free_bytes == 0 then
    						sj.error("FREE BYTES NOT FOUND o_O !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("TAMP LEFT ALIGN 256")
    							
    							print("procedure = ",lua_tampleft_align256_procedure_count)
    							sj.exit()
    					end
    				end
    				if lua_tampleft_align256_allocator_addr_finded == 0 then
    					if tampleft_align256_allocator_free_bytes == 1 then
    					
    						sj.error("FREE BYTES NOT FOUND o_O !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("free_bytes = 1")
    							print ("TAMP LEFT ALIGN 256")
    							
    							print("procedure = ",lua_tampleft_align256_procedure_count)
    							sj.exit()
    					end
    				end			
    	end
    
    -- ----------------------------------------------------------------------------
    	
    	function lua_function_tampleft_align256_allocate_end(temp)
    								
    	end	
    	
    	endlua
    
    ;==============================================================================
    ; TAMP RIGHT
    ;==============================================================================
    ;TAMP RIGHT macro
    				
    	macro tampright_allocate_macro
    		
    		lua pass1				
    		lua_tampright_allocate_procedure_start_addr[lua_tampright_procedure_count] = _c("$")
    								
    		endlua
    		
    		lua allpass
    								
    		lua_function_tampright_allocate (0)
    								
    		endlua
    		
    		lua pass2	;
    		if lua_tampright_allocator_addr_finded == 1 then
    								
    			_pc(string.format("org $%04x", lua_tampright_allocator_new_org))
    		end 
    		endlua
    		lua pass3	;
    		if lua_tampright_allocator_addr_finded == 1 then
    								
    			_pc(string.format("org $%04x", lua_tampright_allocator_new_org))
    		end 
    		endlua
    	endm
    
    ;------------------------------------------------------------------------------
    
    		macro end_tampright_allocate_macro
    		lua pass1	
    								
    		lua_tampright_allocate_end_addr[lua_tampright_procedure_count] = (_c("$"))
    								
    		endlua
    		
    		lua allpass
    		lua_function_tampright_allocate_end(1)
    		
    		lua_tampright_procedure_count = lua_tampright_procedure_count + 1
    		endlua
    	endm
    
    ;------------------------------------------------------------------------------
    ;TAMP RIGHT lua
    
            lua allpass
    	
    	function lua_function_tampright_allocate(temp)
    								
    		tampright_allocate_size = (lua_tampright_allocate_end_addr[lua_tampright_procedure_count] - lua_tampright_allocate_procedure_start_addr[lua_tampright_procedure_count])
    								
    			--free page search
    			lua_tampright_allocator_addr_finded = 0
    			tampright_allocator_free_bytes = 1
    								
    				for tampright_allocator_addr_search = ((lua_code_allocator_end_page*256)+255),(lua_code_allocator_start_page*256), -1 do
    
    					if lua_tampright_allocator_addr_finded == 0 then
    						tampright_allocator_free_bytes = 1
    								
    						for tampright_allocator_byte_scan = tampright_allocator_addr_search,((tampright_allocator_addr_search - tampright_allocate_size)+1), -1 do
    								
    						if lua_code_allocator_array[tampright_allocator_byte_scan] == 0 then
    						tampright_allocator_free_bytes = 0
    						end
    						end
    					end
    					
    					if lua_tampright_allocator_addr_finded == 0 then
    						if tampright_allocator_free_bytes == 1 then
    								
    							for tampright_allocator_byte_fill = tampright_allocator_addr_search,((tampright_allocator_addr_search - tampright_allocate_size)+1), -1 do
    								
    							-- очистка свободной памяти
    							lua_code_allocator_array[tampright_allocator_byte_fill] = 0
    							end
    				
    						lua_tampright_allocator_addr_finded = 1
    			
    						lua_tampright_allocator_new_org = ((tampright_allocator_addr_search - tampright_allocate_size)+1)
    										
    							if lua_tampright_allocator_new_org < (lua_code_allocator_start_page*256) then
    								sj.error("OUT OF MEMORY !!!!!!!!!!!!!!!!!!!!!11111")
    								print ("TAMP RIGHT")
    								print("new_org < (lua_code_allocator_start_page*256)")
    								print("in procedure = ",lua_tampright_procedure_count)
    								sj.exit()
    							end
    							if lua_tampright_allocator_new_org > ((lua_code_allocator_end_page*256)+255) then
    								sj.error("BUG?")
    								print ("TAMP RIGHT")
    								print("new_org > ((lua_code_allocator_end_page*256)+255)")
    								print("in procedure = ",lua_tampright_procedure_count)
    								sj.exit()
    							end
    						end
    					end
    				end
    				
    				if lua_tampright_allocator_addr_finded == 0 then
    					if tampright_allocator_free_bytes == 0 then
    						sj.error("FREE BYTES NOT FOUND o_O !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("TAMP RIGHT")
    							
    							print("procedure = ",lua_tampright_procedure_count)
    							sj.exit()
    					end
    				end
    				if lua_tampright_allocator_addr_finded == 0 then
    					if tampright_allocator_free_bytes == 1 then
    						sj.error("FREE BYTES NOT FOUND o_O !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("free_bytes = 1")
    							print ("TAMP RIGHT")
    							
    							print("procedure = ",lua_tampright_procedure_count)
    							sj.exit()
    					end
    				end			
    	end
    
    -- ----------------------------------------------------------------------------
    
    	function lua_function_tampright_allocate_end(temp)
    								
    	end
    		
    	endlua
    
    ;==============================================================================
    ; TAMP RIGHT ALIGN 256
    ;==============================================================================
    ;TAMP RIGHT ALIGN 256 macro	
    				
    	macro tampright_align256_allocate_macro
    		
    		lua pass1				
    		lua_tampright_align256_allocate_procedure_start_addr[lua_tampright_align256_procedure_count] = _c("$")
    								
    		endlua
    		
    		lua allpass
    								
    		lua_function_tampright_align256_allocate (0)
    								
    		endlua
    		
    		lua pass2	;
    		if lua_tampright_align256_allocator_addr_finded == 1 then
    								
    			_pc(string.format("org $%04x", lua_tampright_align256_allocator_new_org))
    		end 
    		endlua
    		lua pass3	;
    		if lua_tampright_align256_allocator_addr_finded == 1 then
    								
    			_pc(string.format("org $%04x", lua_tampright_align256_allocator_new_org))
    		end 
    		endlua
    	endm
    
    ;------------------------------------------------------------------------------
    
    		macro end_tampright_align256_allocate_macro
    		lua pass1	
    								
    		lua_tampright_align256_allocate_end_addr[lua_tampright_align256_procedure_count] = (_c("$"))
    								
    		endlua
    		
    		lua allpass
    		lua_function_tampright_align256_allocate_end(1)
    		
    		lua_tampright_align256_procedure_count = lua_tampright_align256_procedure_count + 1
    		endlua
    	endm
    
    ;------------------------------------------------------------------------------
    ;TAMP RIGHT ALIGN 256 lua
    
            lua allpass
    	
    	function lua_function_tampright_align256_allocate(temp)
    								
    		tampright_align256_allocate_size = (lua_tampright_align256_allocate_end_addr[lua_tampright_align256_procedure_count] - lua_tampright_align256_allocate_procedure_start_addr[lua_tampright_align256_procedure_count])
    								
    			--free page search
    			lua_tampright_align256_allocator_addr_finded = 0
    			tampright_align256_allocator_free_bytes = 1
    								
    				for tampright_align256_allocator_addr_search = (lua_code_allocator_end_page*256),(lua_code_allocator_start_page*256), -256 do
    
    					if lua_tampright_align256_allocator_addr_finded == 0 then
    						tampright_align256_allocator_free_bytes = 1
    								
    						for tampright_align256_allocator_byte_scan = tampright_align256_allocator_addr_search,((tampright_align256_allocator_addr_search + tampright_align256_allocate_size)-1), 1 do
    							
    						if lua_code_allocator_array[tampright_align256_allocator_byte_scan] == 0 then
    						tampright_align256_allocator_free_bytes = 0
    						end
    						end
    					end
    					
    					if lua_tampright_align256_allocator_addr_finded == 0 then
    								
    						if tampright_align256_allocator_free_bytes == 1 then
    								if (tampright_align256_allocator_addr_search + tampright_align256_allocate_size-1) < ((lua_code_allocator_end_page*256)+256) then
    									
    							for tampright_align256_allocator_byte_fill = tampright_align256_allocator_addr_search,((tampright_align256_allocator_addr_search + tampright_align256_allocate_size)-1), 1 do
    								
    							-- очистка свободной памяти
    							lua_code_allocator_array[tampright_align256_allocator_byte_fill] = 0
    							end
    				
    						lua_tampright_align256_allocator_addr_finded = 1
    			
    						lua_tampright_align256_allocator_new_org = tampright_align256_allocator_addr_search
    									 	
    							if lua_tampright_align256_allocator_new_org < (lua_code_allocator_start_page*256) then
    								sj.error("OUT OF MEMORY !!!!!!!!!!!!!!!!!!!!!11111")
    								print ("TAMP RIGHT")
    								print("new_org < (lua_code_allocator_start_page*256)")
    								print("in procedure = ",lua_tampright_align256_procedure_count)
    								sj.exit()
    							end
    							if lua_tampright_align256_allocator_new_org > ((lua_code_allocator_end_page*256)+255) then
    								sj.error("BUG?")
    								print ("TAMP RIGHT")
    								print("new_org > ((lua_code_allocator_end_page*256)+255)")
    								print("in procedure = ",lua_tampright_align256_procedure_count)
    								sj.exit()
    							end
    							if ((lua_tampright_align256_allocator_new_org+tampright_align256_allocate_size)-1) > ((lua_code_allocator_end_page*256)+255) then
    								sj.error("OUT OF MEMORY !!!!!!!!!!!!!!!!!!!!!11111")
    								print ("TAMP RIGHT")
    								print("new_org+size > ((lua_code_allocator_end_page*256)+255)")
    								print("in procedure = ",lua_tampright_align256_procedure_count)
    								sj.exit()
    							end
    								end
    						end
    					end
    				end
    				
    				if lua_tampright_align256_allocator_addr_finded == 0 then
    					if tampright_align256_allocator_free_bytes == 0 then
    						sj.error("FREE BYTES NOT FOUND o_O !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("TAMP RIGHT")
    							
    							print("procedure = ",lua_tampright_align256_procedure_count)
    							sj.exit()
    					end
    				end
    				if lua_tampright_align256_allocator_addr_finded == 0 then
    					if tampright_align256_allocator_free_bytes == 1 then
    						sj.error("FREE BYTES NOT FOUND o_O !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("free_bytes = 1")
    							print ("TAMP RIGHT")
    							
    							print("procedure = ",lua_tampright_align256_procedure_count)
    							sj.exit()
    					end
    				end
    	end
    
    -- ----------------------------------------------------------------------------
    	
    	function lua_function_tampright_align256_allocate_end(temp)
    								
    	end
    		
    	endlua
    
    ;==============================================================================
    
    ;==============================================================================
    ; FAST TAB 8P
    ;==============================================================================
    ;FAST TAB 8P macro
    						;по окончанию PASS2 уже установлен новый org!
    	macro fasttab_8p_allocate_macro _fasttab_8p_alloc_table_haddr?, _fasttab_8p_alloc_procedure_number?
    								
    @__fasttab_8p_allocate_table_haddr = _fasttab_8p_alloc_table_haddr?
    @__fasttab_8p_allocate_procedure_number = _fasttab_8p_alloc_procedure_number?
    
    								
    		lua pass1
    								
    		lua_fasttab_8p_allocate_procedure_start_addr[(_c("__fasttab_8p_allocate_table_haddr"))][(_c("__fasttab_8p_allocate_procedure_number"))] = _c("$")	
    											
    		endlua
    		lua allpass
    		lua_function_fasttab_8p_allocate((_c("__fasttab_8p_allocate_table_haddr")),(_c("__fasttab_8p_allocate_procedure_number")))
    		endlua
    		
    		lua pass2	;copy
    		if lua_fasttab_8p_allocator_page_finded == 1 then
    					for lua_fasttab_8p_32dup = 0,255,8 do
    								
    			_pc(string.format("org $%04x", _c("__fasttab_8p_allocate_table_haddr * 256") + (_c("__fasttab_8p_allocate_procedure_number"))+(lua_fasttab_8p_32dup)))
    								
    			_pc(string.format("defb $%02x", lua_fasttab_8p_allocator_new_h_org))
    					end
    								
    			_pc(string.format("org $%04x", lua_fasttab_8p_allocator_new_h_org*256 + (_c("__fasttab_8p_allocate_procedure_number"))))
    		end 
    		endlua
    		lua pass3	;
    		if lua_fasttab_8p_allocator_page_finded == 1 then
    					for lua_fasttab_8p_32dup = 0,255,8 do
    								
    			_pc(string.format("org $%04x", _c("__fasttab_8p_allocate_table_haddr * 256") + (_c("__fasttab_8p_allocate_procedure_number"))+(lua_fasttab_8p_32dup)))
    								
    			_pc(string.format("defb $%02x", lua_fasttab_8p_allocator_new_h_org))
    					end
    								
    			_pc(string.format("org $%04x", lua_fasttab_8p_allocator_new_h_org*256 + (_c("__fasttab_8p_allocate_procedure_number"))))		
    		end 
    		endlua
    	endm
    	
    ;------------------------------------------------------------------------------
    	
    		macro end_fasttab_8p_allocate_macro
    		lua pass1	
    								
    		lua_fasttab_8p_allocate_end_addr[(_c("__fasttab_8p_allocate_table_haddr"))][(_c("__fasttab_8p_allocate_procedure_number"))] = _c("$")
    		--lua_fasttab_8p_allocate_end_addr[lua_fasttab_8p_table_haddr][lua_fasttab_8p_procedure_number] = _c("$")
    								
    		endlua
    		lua allpass
    		lua_function_fasttab_8p_allocate_end(_c("__fasttab_8p_allocate_procedure_number"))
    		endlua
    	endm
    
    ;------------------------------------------------------------------------------
    ;FAST TAB 8P lua
    
            lua allpass
    	
    	function lua_function_fasttab_8p_allocate(lua_fasttab_8p_table_haddr,lua_fasttab_8p_procedure_number)
    								
    		
    		fasttab_8p_allocate_size = (lua_fasttab_8p_allocate_end_addr[(_c("__fasttab_8p_allocate_table_haddr"))][(_c("__fasttab_8p_allocate_procedure_number"))]-lua_fasttab_8p_allocate_procedure_start_addr[(_c("__fasttab_8p_allocate_table_haddr"))][(_c("__fasttab_8p_allocate_procedure_number"))])
    								
    			--free page search
    			lua_fasttab_8p_allocator_page_finded = 0
    			fasttab_8p_allocator_page_free_bytes = 1
    
    			for fasttab_8p_allocator_page_search = lua_code_allocator_start_page, lua_code_allocator_end_page, 1 do
    				if lua_fasttab_8p_allocator_page_finded == 0 then
    								
    				fasttab_8p_allocator_page_free_bytes = 1
    								
    					for fasttab_8p_allocator_byte_scan = ((fasttab_8p_allocator_page_search*256) + lua_fasttab_8p_procedure_number), ((fasttab_8p_allocator_page_search*256) + lua_fasttab_8p_procedure_number + fasttab_8p_allocate_size - 1), 1 do
    								
    						if lua_code_allocator_array[fasttab_8p_allocator_byte_scan] == 0 then
    							-- страница занята
    							
    							fasttab_8p_allocator_page_free_bytes = 0
    							--break
    						end
    					end
    				end
    				if lua_fasttab_8p_allocator_page_finded == 0 then
    					if fasttab_8p_allocator_page_free_bytes == 1 then
    								
    						for fasttab_8p_allocator_byte_fill = ((fasttab_8p_allocator_page_search*256) + lua_fasttab_8p_procedure_number), ((fasttab_8p_allocator_page_search*256) + fasttab_8p_allocate_size + lua_fasttab_8p_procedure_number - 1), 1 do
    						-- очистка свободных страниц
    						lua_code_allocator_array[fasttab_8p_allocator_byte_fill] = 0
    								
    						end
    			
    					lua_fasttab_8p_allocator_page_finded = 1
    					lua_fasttab_8p_allocator_new_h_org = fasttab_8p_allocator_page_search
    									
    						if (lua_code_allocator_start_page*256) > ((fasttab_8p_allocator_page_search*256) + lua_fasttab_8p_procedure_number) then
    							sj.error("OUT OF MEMORY !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("FAST TAB 8P")
    							print ("new_org < (lua_code_allocator_start_page*256)")
    							print (string.format("in procedure = $%02x",lua_fasttab_8p_procedure_number))
    							print (string.format("table = $%02x",lua_fasttab_8p_table_haddr))
    							sj.exit()
    						end
    						if ((lua_code_allocator_end_page*256)+255) < ((fasttab_8p_allocator_page_search*256) + fasttab_8p_allocate_size + lua_fasttab_8p_procedure_number - 1) then
    							sj.error("OUT OF MEMORY !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("FAST TAB 8P")
    							print("new_org > ((lua_code_allocator_end_page*256)+255)")
    							print (string.format("in procedure = $%02x",lua_fasttab_8p_procedure_number))
    							print (string.format("table = $%02x",lua_fasttab_8p_table_haddr))
    							sj.exit()
    						end
    					end
    				end
    			end
    			if lua_fasttab_8p_allocator_page_finded == 0 then
    				if fasttab_8p_allocator_page_free_bytes == 0 then
    					sj.error("FREE PAGE NOT FOUND !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("FAST TAB 8P")
    							print (string.format("procedure = $%02x",lua_fasttab_8p_procedure_number))
    							print (string.format("table = $%02x",lua_fasttab_8p_table_haddr))
    							sj.exit()
    				end
    			end
    			if lua_fasttab_8p_allocator_page_finded == 0 then
    				if fasttab_8p_allocator_page_free_bytes == 1 then
    					sj.error("FREE PAGE NOT FOUND !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("free_bytes = 1")
    							print ("FAST TAB 8P")
    							print (string.format("procedure = $%02x",lua_fasttab_8p_procedure_number))
    							print (string.format("table = $%02x",lua_fasttab_8p_table_haddr))
    							sj.exit()
    				end
    			end
    	end
    
    -- ----------------------------------------------------------------------------
    	
    	function lua_function_fasttab_8p_allocate_end(lua_fasttab_8p_procedure_number)
    								
    	end
    	
    	endlua
    
    ;==============================================================================
    
    
    ;==============================================================================
    ;==============================================================================
    ;==============================================================================
    ;==============================================================================
    ;==============================================================================
    
    ;PAGING
    
    ;==============================================================================
    
    
    
    
    
    
    ;копипастить и автозаменять
    ;когда нужны дополнительные 16к страницы
    
    
    
    
    
    ;								;paging
    ;==============================================================================
    ; FAST TAB pg00	
    ;==============================================================================
    ;FAST TAB macro pg00
    						;по окончанию PASS2 уже установлен новый org!
    	macro fasttab_allocate_macro_pg00 _fasttab_alloc_page_for_table_pg00?, _fasttab_alloc_table_haddr_pg00?, _fasttab_alloc_procedure_number_pg00?
    					
    @__fasttab_allocate_page_for_table_pg00 = _fasttab_alloc_page_for_table_pg00?					
    @__fasttab_allocate_table_haddr_pg00 = _fasttab_alloc_table_haddr_pg00?
    @__fasttab_allocate_procedure_number_pg00 = _fasttab_alloc_procedure_number_pg00?
    						
    @__fasttab_allocate_macro_current_addr_pg00 = $		;бекап адреса
    			;display "fasttab_allocate_macro_current_addr_pg00 ",@__fasttab_allocate_macro_current_addr_pg00
    
    							;чтение состояния слотов
    			org $0000
    @__fasttab_allocate_macro_current_slot0_pg00 = $$
    			;display "fasttab_allocate_macro_current_slot0_pg00 ",@__fasttab_allocate_macro_current_slot0_pg00
    			org $4000
    @__fasttab_allocate_macro_current_slot1_pg00 = $$
    			;display "fasttab_allocate_macro_current_slot1_pg00 ",@__fasttab_allocate_macro_current_slot1_pg00
    			org $8000
    @__fasttab_allocate_macro_current_slot2_pg00 = $$
    			;display "fasttab_allocate_macro_current_slot2_pg00 ",@__fasttab_allocate_macro_current_slot2_pg00
    			org $C000
    @__fasttab_allocate_macro_current_slot3_pg00 = $$
    			;display "fasttab_allocate_macro_current_slot3_pg00 ",@__fasttab_allocate_macro_current_slot3_pg00
    ;				
    ;							;востановление адреса
    			org @__fasttab_allocate_macro_current_addr_pg00
    ;			display "current addr check ",$
    				
    		lua pass1
    								
    		lua_fasttab_allocate_procedure_start_addr_pg00[(_c("__fasttab_allocate_table_haddr_pg00"))][(_c("__fasttab_allocate_procedure_number_pg00"))] = _c("$")	
    									
    		endlua
    		lua allpass
    		lua_function_fasttab_allocate_pg00((_c("__fasttab_allocate_table_haddr_pg00")),(_c("__fasttab_allocate_procedure_number_pg00")))
    		endlua
    		
    		lua pass2	;copy
    		if lua_fasttab_allocator_page_finded_pg00 == 1 then
    
    			_pc("slot 0")
    			_pc("page @__fasttab_allocate_page_for_table_pg00 ")
    			_pc("slot 1")
    			_pc("page @__fasttab_allocate_page_for_table_pg00 ")
    			_pc("slot 2")
    			_pc("page @__fasttab_allocate_page_for_table_pg00 ")	
    			_pc("slot 3")
    			_pc("page @__fasttab_allocate_page_for_table_pg00 ")
    			
    			_pc(string.format("org $%04x", _c("__fasttab_allocate_table_haddr_pg00 * 256") + (_c("__fasttab_allocate_procedure_number_pg00"))))
    								
    			_pc(string.format("defb $%02x", lua_fasttab_allocator_new_h_org_pg00))
    				
    			_pc("slot 0")
    			_pc("page @__fasttab_allocate_macro_current_slot0_pg00")
    			_pc("slot 1")
    			_pc("page @__fasttab_allocate_macro_current_slot1_pg00")	
    			_pc("slot 2")
    			_pc("page @__fasttab_allocate_macro_current_slot2_pg00")		
    			_pc("slot 3")
    			_pc("page @__fasttab_allocate_macro_current_slot3_pg00")
    			
    			_pc(string.format("org $%04x", lua_fasttab_allocator_new_h_org_pg00*256 + (_c("__fasttab_allocate_procedure_number_pg00"))))
    		end 
    		endlua
    		lua pass3	;
    		if lua_fasttab_allocator_page_finded_pg00 == 1 then
    			
    			_pc("slot 0")
    			_pc("page @__fasttab_allocate_page_for_table_pg00 ")
    			_pc("slot 1")
    			_pc("page @__fasttab_allocate_page_for_table_pg00 ")	
    			_pc("slot 2")
    			_pc("page @__fasttab_allocate_page_for_table_pg00 ")		
    			_pc("slot 3")
    			_pc("page @__fasttab_allocate_page_for_table_pg00 ")
    			
    			_pc(string.format("org $%04x", _c("__fasttab_allocate_table_haddr_pg00 * 256") + (_c("__fasttab_allocate_procedure_number_pg00"))))
    								
    			_pc(string.format("defb $%02x", lua_fasttab_allocator_new_h_org_pg00))
    			
    			_pc("slot 0")
    			_pc("page @__fasttab_allocate_macro_current_slot0_pg00")
    			_pc("slot 1")
    			_pc("page @__fasttab_allocate_macro_current_slot1_pg00")		
    			_pc("slot 2")
    			_pc("page @__fasttab_allocate_macro_current_slot2_pg00")			
    			_pc("slot 3")
    			_pc("page @__fasttab_allocate_macro_current_slot3_pg00")
    			
    			_pc(string.format("org $%04x", lua_fasttab_allocator_new_h_org_pg00*256 + (_c("__fasttab_allocate_procedure_number_pg00"))))
    		end 
    		endlua
    	endm
    	
    ;------------------------------------------------------------------------------
    	
    		macro end_fasttab_allocate_macro_pg00
    		lua pass1
    								
    		lua_fasttab_allocate_end_addr_pg00[(_c("__fasttab_allocate_table_haddr_pg00"))][(_c("__fasttab_allocate_procedure_number_pg00"))] = _c("$")
    		--lua_fasttab_allocate_end_addr_pg00[lua_fasttab_table_haddr_pg00][lua_fasttab_procedure_number_pg00] = _c("$")
    								
    		endlua
    		lua allpass
    		lua_function_fasttab_allocate_pg00_end(_c("__fasttab_allocate_procedure_number_pg00"))
    		endlua
    		
    		
    ;@__end_fasttab_allocate_macro_current_addr_pg00 = $		;бекап адреса
    ;			display "end_fasttab_allocate_macro_current_addr_pg00 ",@__end_fasttab_allocate_macro_current_addr_pg00
    ;
    ;							;чтение состояния слотов
    ;			org $0000
    ;@__end_fasttab_allocate_macro_current_slot0_pg00 = $$
    ;			display "end_fasttab_allocate_macro_current_slot0_pg00 ",@__end_fasttab_allocate_macro_current_slot0_pg00
    ;			org $4000
    ;@__end_fasttab_allocate_macro_current_slot1_pg00 = $$
    ;			display "end_fasttab_allocate_macro_current_slot1_pg00 ",@__end_fasttab_allocate_macro_current_slot1_pg00
    ;			org $8000
    ;@__end_fasttab_allocate_macro_current_slot2_pg00 = $$
    ;			display "end_fasttab_allocate_macro_current_slot2_pg00 ",@__end_fasttab_allocate_macro_current_slot2_pg00
    ;			org $C000
    ;@__end_fasttab_allocate_macro_current_slot3_pg00 = $$
    ;			display "end_fasttab_allocate_macro_current_slot3_pg00 ",@__end_fasttab_allocate_macro_current_slot3_pg00
    ;				
    ;							;востановление адреса
    ;			org @__end_fasttab_allocate_macro_current_addr_pg00
    ;			display "current end_addr check ",$
    ;		
    	endm
    
    ;------------------------------------------------------------------------------
    ;FAST TAB lua pg00
    
            lua allpass
    	
    	function lua_function_fasttab_allocate_pg00(lua_fasttab_table_haddr_pg00,lua_fasttab_procedure_number_pg00)
    								
    		fasttab_allocate_size_pg00 = (lua_fasttab_allocate_end_addr_pg00[(_c("__fasttab_allocate_table_haddr_pg00"))][(_c("__fasttab_allocate_procedure_number_pg00"))]-lua_fasttab_allocate_procedure_start_addr_pg00[(_c("__fasttab_allocate_table_haddr_pg00"))][(_c("__fasttab_allocate_procedure_number_pg00"))])
    								
    			--free page search
    			lua_fasttab_allocator_page_finded_pg00 = 0
    			fasttab_allocator_page_free_bytes_pg00 = 1
    
    			for fasttab_allocator_page_search_pg00 = lua_code_allocator_start_page_pg00, lua_code_allocator_end_page_pg00, 1 do
    				if lua_fasttab_allocator_page_finded_pg00 == 0 then
    								
    				fasttab_allocator_page_free_bytes_pg00 = 1
    								
    					for fasttab_allocator_byte_scan_pg00 = ((fasttab_allocator_page_search_pg00*256) + lua_fasttab_procedure_number_pg00), ((fasttab_allocator_page_search_pg00*256) + lua_fasttab_procedure_number_pg00 + fasttab_allocate_size_pg00 - 1), 1 do
    								
    						if lua_code_allocator_array_pg00[fasttab_allocator_byte_scan_pg00] == 0 then
    							-- страница занята
    							fasttab_allocator_page_free_bytes_pg00 = 0
    							--break
    						end
    					end
    				end
    				if lua_fasttab_allocator_page_finded_pg00 == 0 then
    					if fasttab_allocator_page_free_bytes_pg00 == 1 then
    								
    						for fasttab_allocator_byte_fill_pg00 = ((fasttab_allocator_page_search_pg00*256) + lua_fasttab_procedure_number_pg00), ((fasttab_allocator_page_search_pg00*256) + fasttab_allocate_size_pg00 + lua_fasttab_procedure_number_pg00 - 1), 1 do
    						-- очистка свободных страниц
    						lua_code_allocator_array_pg00[fasttab_allocator_byte_fill_pg00] = 0
    								
    						end
    			
    					lua_fasttab_allocator_page_finded_pg00 = 1
    					lua_fasttab_allocator_new_h_org_pg00 = fasttab_allocator_page_search_pg00
    								
    						if (lua_code_allocator_start_page_pg00*256) > ((fasttab_allocator_page_search_pg00*256) + lua_fasttab_procedure_number_pg00) then
    							sj.error("OUT OF MEMORY !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("FAST TAB pg00")
    							print ("new_org < (lua_code_allocator_start_page_pg00*256)")
    							print (string.format("in procedure = $%02x",lua_fasttab_procedure_number_pg00))
    							print (string.format("table = $%02x",lua_fasttab_table_haddr_pg00))
    							sj.exit()
    						end
    						if ((lua_code_allocator_end_page_pg00*256)+255) < ((fasttab_allocator_page_search_pg00*256) + fasttab_allocate_size_pg00 + lua_fasttab_procedure_number_pg00 - 1) then
    							sj.error("OUT OF MEMORY !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("FAST TAB pg00")
    							print("new_org > ((lua_code_allocator_end_page_pg00*256)+255)")
    							print (string.format("in procedure = $%02x",lua_fasttab_procedure_number_pg00))
    							print (string.format("table = $%02x",lua_fasttab_table_haddr_pg00))
    							sj.exit()
    						end
    					end
    				end
    			end
    			if lua_fasttab_allocator_page_finded_pg00 == 0 then
    				if fasttab_allocator_page_free_bytes_pg00 == 0 then
    					sj.error("FREE PAGE NOT FOUND !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("FAST TAB pg00")
    							print (string.format("procedure = $%02x",lua_fasttab_procedure_number_pg00))
    							print (string.format("table = $%02x",lua_fasttab_table_haddr_pg00))
    							sj.exit()
    				end
    			end
    			if lua_fasttab_allocator_page_finded_pg00 == 0 then
    				if fasttab_allocator_page_free_bytes_pg00 == 1 then
    					sj.error("FREE PAGE NOT FOUND !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("free_bytes = 1")
    							print ("FAST TAB pg00")
    							print (string.format("procedure = $%02x",lua_fasttab_procedure_number_pg00))
    							print (string.format("table = $%02x",lua_fasttab_table_haddr_pg00))
    							sj.exit()
    				end
    			end
    	end
    
    -- ----------------------------------------------------------------------------
    	
    	function lua_function_fasttab_allocate_pg00_end(lua_fasttab_procedure_number_pg00)
    								
    	end
    	
    	endlua
    
    ;==============================================================================
    ; FAST TAB RIGHT pg00
    ;==============================================================================
    ;FAST TAB RIGHT macro pg00
    					;по окончанию PASS2 уже установлен новый org!
    	macro fasttabright_allocate_macro_pg00 _fasttabright_alloc_page_for_table_pg00?, _fasttabright_alloc_table_haddr_pg00?, _fasttabright_alloc_procedure_number_pg00?
    	
    @__fasttabright_allocate_page_for_table_pg00 = _fasttabright_alloc_page_for_table_pg00?	
    @__fasttabright_allocate_table_haddr_pg00 = _fasttabright_alloc_table_haddr_pg00?
    @__fasttabright_allocate_procedure_number_pg00 = _fasttabright_alloc_procedure_number_pg00?
    
    			
    @__fasttabright_allocate_macro_current_addr_pg00 = $		;бекап адреса
    			;display "fasttabright_allocate_macro_current_addr_pg00 ",@__fasttabright_allocate_macro_current_addr_pg00
    
    			;чтение состояния слотов
    			org $0000
    @__fasttabright_allocate_macro_current_slot0_pg00 = $$
    			;display "fasttabright_allocate_macro_current_slot0_pg00 ",@__fasttabright_allocate_macro_current_slot0_pg00
    			org $4000
    @__fasttabright_allocate_macro_current_slot1_pg00 = $$
    			;display "fasttabright_allocate_macro_current_slot1_pg00 ",@__fasttabright_allocate_macro_current_slot1_pg00
    			org $8000
    @__fasttabright_allocate_macro_current_slot2_pg00 = $$
    			;display "fasttabright_allocate_macro_current_slot2_pg00 ",@__fasttabright_allocate_macro_current_slot2_pg00
    			org $C000
    @__fasttabright_allocate_macro_current_slot3_pg00 = $$
    			;display "fasttabright_allocate_macro_current_slot3_pg00 ",@__fasttabright_allocate_macro_current_slot3_pg00
    ;				
    ;							;востановление адреса
    			org @__fasttabright_allocate_macro_current_addr_pg00
    ;			display "current addr check ",$
    
    			
    				lua pass1		
    								
    		lua_fasttabright_allocate_procedure_start_addr_pg00[(_c("__fasttabright_allocate_table_haddr_pg00"))][(_c("__fasttabright_allocate_procedure_number_pg00"))] = _c("$")	
    								
    		endlua
    		lua allpass
    		lua_function_fasttabright_allocate_pg00((_c("__fasttabright_allocate_table_haddr_pg00")),(_c("__fasttabright_allocate_procedure_number_pg00")))
    		endlua
    		
    		lua pass2	;copy
    		if lua_fasttabright_allocator_page_finded_pg00 == 1 then
    						
    			_pc("slot 0")
    			_pc("page @__fasttabright_allocate_page_for_table_pg00 ")
    			_pc("slot 1")
    			_pc("page @__fasttabright_allocate_page_for_table_pg00 ")
    			_pc("slot 2")
    			_pc("page @__fasttabright_allocate_page_for_table_pg00 ")	
    			_pc("slot 3")
    			_pc("page @__fasttabright_allocate_page_for_table_pg00 ")
    						
    			_pc(string.format("org $%04x", _c("__fasttabright_allocate_table_haddr_pg00 * 256") + (_c("__fasttabright_allocate_procedure_number_pg00"))))
    								
    			_pc(string.format("defb $%02x", lua_fasttabright_allocator_new_h_org_pg00))
    			
    			_pc("slot 0")
    			_pc("page @__fasttabright_allocate_macro_current_slot0_pg00")
    			_pc("slot 1")
    			_pc("page @__fasttabright_allocate_macro_current_slot1_pg00")	
    			_pc("slot 2")
    			_pc("page @__fasttabright_allocate_macro_current_slot2_pg00")		
    			_pc("slot 3")
    			_pc("page @__fasttabright_allocate_macro_current_slot3_pg00")
    
    			
    			_pc(string.format("org $%04x", lua_fasttabright_allocator_new_h_org_pg00*256 + (_c("__fasttabright_allocate_procedure_number_pg00"))))
    		end 
    		endlua
    		lua pass3	;
    		if lua_fasttabright_allocator_page_finded_pg00 == 1 then
    		
    			_pc("slot 0")
    			_pc("page @__fasttabright_allocate_page_for_table_pg00 ")
    			_pc("slot 1")
    			_pc("page @__fasttabright_allocate_page_for_table_pg00 ")
    			_pc("slot 2")
    			_pc("page @__fasttabright_allocate_page_for_table_pg00 ")	
    			_pc("slot 3")
    			_pc("page @__fasttabright_allocate_page_for_table_pg00 ")
    		
    			_pc(string.format("org $%04x", _c("__fasttabright_allocate_table_haddr_pg00 * 256") + (_c("__fasttabright_allocate_procedure_number_pg00"))))
    								
    			_pc(string.format("defb $%02x", lua_fasttabright_allocator_new_h_org_pg00))
    		
    			_pc("slot 0")
    			_pc("page @__fasttabright_allocate_macro_current_slot0_pg00")
    			_pc("slot 1")
    			_pc("page @__fasttabright_allocate_macro_current_slot1_pg00")	
    			_pc("slot 2")
    			_pc("page @__fasttabright_allocate_macro_current_slot2_pg00")		
    			_pc("slot 3")
    			_pc("page @__fasttabright_allocate_macro_current_slot3_pg00")
    		
    			_pc(string.format("org $%04x", lua_fasttabright_allocator_new_h_org_pg00*256 + (_c("__fasttabright_allocate_procedure_number_pg00"))))
    		end 
    		endlua
    	endm
    	
    ;------------------------------------------------------------------------------
    	
    		macro end_fasttabright_allocate_macro_pg00
    		lua pass1
    								
    		lua_fasttabright_allocate_end_addr_pg00[(_c("__fasttabright_allocate_table_haddr_pg00"))][(_c("__fasttabright_allocate_procedure_number_pg00"))] = _c("$")
    		--lua_fasttabright_allocate_end_addr_pg00[lua_fasttabright_table_haddr_pg00][lua_fasttabright_procedure_number_pg00] = _c("$")
    								
    		endlua
    		lua allpass
    		lua_function_fasttabright_allocate_end_pg00(_c("__fasttabright_allocate_procedure_number_pg00"))
    		endlua
    		
    ;			
    ;@__end_fasttabright_allocate_macro_current_addr_pg00 = $		;бекап адреса
    ;			display "end_fasttabright_allocate_macro_current_addr_pg00 ",@__end_fasttabright_allocate_macro_current_addr_pg00
    ;
    ;							;чтение состояния слотов
    ;			org $0000
    ;@__end_fasttabright_allocate_macro_current_slot0_pg00 = $$
    ;			display "end_fasttabright_allocate_macro_current_slot0_pg00 ",@__end_fasttabright_allocate_macro_current_slot0_pg00
    ;			org $4000
    ;@__end_fasttabright_allocate_macro_current_slot1_pg00 = $$
    ;			display "end_fasttabright_allocate_macro_current_slot1_pg00 ",@__end_fasttabright_allocate_macro_current_slot1_pg00
    ;			org $8000
    ;@__end_fasttabright_allocate_macro_current_slot2_pg00 = $$
    ;			display "end_fasttabright_allocate_macro_current_slot2_pg00 ",@__end_fasttabright_allocate_macro_current_slot2_pg00
    ;			org $C000
    ;@__end_fasttabright_allocate_macro_current_slot3_pg00 = $$
    ;			display "end_fasttabright_allocate_macro_current_slot3_pg00 ",@__end_fasttabright_allocate_macro_current_slot3_pg00
    ;				
    ;							;востановление адреса
    ;			org @__end_fasttabright_allocate_macro_current_addr_pg00
    ;			display "current end_addr check ",$
    ;		
    				
    	endm
    
    ;------------------------------------------------------------------------------
    ;FAST TAB RIGHT lua
    
            lua allpass
    	
    	function lua_function_fasttabright_allocate_pg00(lua_fasttabright_table_haddr_pg00,lua_fasttabright_procedure_number_pg00)
    								
    		fasttabright_allocate_size_pg00 = (lua_fasttabright_allocate_end_addr_pg00[(_c("__fasttabright_allocate_table_haddr_pg00"))][(_c("__fasttabright_allocate_procedure_number_pg00"))]-lua_fasttabright_allocate_procedure_start_addr_pg00[(_c("__fasttabright_allocate_table_haddr_pg00"))][(_c("__fasttabright_allocate_procedure_number_pg00"))])
    								
    			--free page search
    			lua_fasttabright_allocator_page_finded_pg00 = 0
    			fasttabright_allocator_page_free_bytes_pg00 = 1
    
    			for fasttabright_allocator_page_search_pg00 = lua_code_allocator_end_page_pg00, lua_code_allocator_start_page_pg00, -1 do
    				if lua_fasttabright_allocator_page_finded_pg00 == 0 then
    								
    				fasttabright_allocator_page_free_bytes_pg00 = 1
    								
    					for fasttabright_allocator_byte_scan_pg00 = ((fasttabright_allocator_page_search_pg00*256) + lua_fasttabright_procedure_number_pg00), ((fasttabright_allocator_page_search_pg00*256) + lua_fasttabright_procedure_number_pg00 + fasttabright_allocate_size_pg00 - 1), 1 do
    								
    						if lua_code_allocator_array_pg00[fasttabright_allocator_byte_scan_pg00] == 0 then
    							-- страница занята
    							
    							fasttabright_allocator_page_free_bytes_pg00 = 0
    							--break
    						end
    					end
    				end
    				if lua_fasttabright_allocator_page_finded_pg00 == 0 then
    					if fasttabright_allocator_page_free_bytes_pg00 == 1 then
    								
    						for fasttabright_allocator_byte_fill_pg00 = ((fasttabright_allocator_page_search_pg00*256) + lua_fasttabright_procedure_number_pg00), ((fasttabright_allocator_page_search_pg00*256) + fasttabright_allocate_size_pg00 + lua_fasttabright_procedure_number_pg00 - 1), 1 do
    						-- очистка свободных страниц
    						lua_code_allocator_array_pg00[fasttabright_allocator_byte_fill_pg00] = 0
    								
    						end
    			
    					lua_fasttabright_allocator_page_finded_pg00 = 1
    					lua_fasttabright_allocator_new_h_org_pg00 = fasttabright_allocator_page_search_pg00
    								
    						if (lua_code_allocator_start_page_pg00*256) > ((fasttabright_allocator_page_search_pg00*256) + lua_fasttabright_procedure_number_pg00) then
    							sj.error("OUT OF MEMORY !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("FAST TAB RIGHT pg00")
    							print ("new_org < (lua_code_allocator_start_page_pg00*256)")
    							print (string.format("in procedure = $%02x",lua_fasttabright_procedure_number_pg00))
    							print (string.format("table = $%02x",lua_fasttabright_table_haddr_pg00))
    							sj.exit()
    						end
    						if ((lua_code_allocator_end_page_pg00*256)+255) < ((fasttabright_allocator_page_search_pg00*256) + fasttabright_allocate_size_pg00 + lua_fasttabright_procedure_number_pg00 - 1) then
    							sj.error("OUT OF MEMORY !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("FAST TAB RIGHT pg00")
    							print("new_org > ((lua_code_allocator_end_page_pg00*256)+255)")
    							print (string.format("in procedure = $%02x",lua_fasttabright_procedure_number_pg00))
    							print (string.format("table = $%02x",lua_fasttabright_table_haddr_pg00))
    							sj.exit()
    						end
    					end
    				end
    			end
    			if lua_fasttabright_allocator_page_finded_pg00 == 0 then
    				if fasttabright_allocator_page_free_bytes_pg00 == 0 then
    					sj.error("FREE PAGE NOT FOUND !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("FAST TAB RIGHT pg00")
    							print (string.format("procedure = $%02x",lua_fasttabright_procedure_number_pg00))
    							print (string.format("table = $%02x",lua_fasttabright_table_haddr_pg00))
    							sj.exit()
    				end
    			end
    			if lua_fasttabright_allocator_page_finded_pg00 == 0 then
    				if fasttabright_allocator_page_free_bytes_pg00 == 1 then
    					sj.error("FREE PAGE NOT FOUND !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("free_bytes = 1")
    							print ("FAST TAB RIGHT pg00")
    							print (string.format("procedure = $%02x",lua_fasttabright_procedure_number_pg00))
    							print (string.format("table = $%02x",lua_fasttabright_table_haddr_pg00))
    							sj.exit()
    				end
    			end
    	end
    
    -- ----------------------------------------------------------------------------
    	
    	function lua_function_fasttabright_allocate_end_pg00(lua_fasttabright_procedure_number_pg00)
    								
    	end
    	endlua
    
    ;==============================================================================
    ; ORG pg00
    ;==============================================================================
    ;ORG macro pg00
    					
    	macro org_allocate_macro_pg00 _org_alloc_addr_pg00?
    		
    @__org_allocate_addr_pg00 = _org_alloc_addr_pg00?
    
    		lua pass1				
    		lua_org_allocate_procedure_start_addr_pg00[lua_org_procedure_count_pg00] = _c("$")
    								
    		endlua
    		
    		lua allpass
    								
    		lua_function_org_allocate_pg00 (_c("__org_allocate_addr_pg00"))
    								
    		endlua
    		
    		lua pass2	;
    		if lua_org_allocator_addr_finded_pg00 == 1 then
    								
    			_pc(string.format("org $%04x", lua_org_allocator_new_org_pg00))
    		end 
    		endlua
    		lua pass3	;
    		if lua_org_allocator_addr_finded_pg00 == 1 then
    								
    			_pc(string.format("org $%04x", lua_org_allocator_new_org_pg00))
    		end 
    		endlua
    	endm
    
    ;------------------------------------------------------------------------------
    
    		macro end_org_allocate_macro_pg00
    		lua pass1
    								
    		lua_org_allocate_end_addr_pg00[lua_org_procedure_count_pg00] = (_c("$"))
    								
    		endlua
    		
    		lua allpass
    		lua_function_org_allocate_end_pg00(1)
    		
    		lua_org_procedure_count_pg00 = lua_org_procedure_count_pg00 + 1
    		endlua
    	endm
    
    ;------------------------------------------------------------------------------
    ;ORG lua pg00
    
            lua allpass
    	
    	function lua_function_org_allocate_pg00(lua_org_allocate_addr_pg00)
    								
    		org_allocate_size_pg00 = (lua_org_allocate_end_addr_pg00[lua_org_procedure_count_pg00] - lua_org_allocate_procedure_start_addr_pg00[lua_org_procedure_count_pg00])
    								
    			--free page search
    			lua_org_allocator_addr_finded_pg00 = 0
    			org_allocator_free_bytes_pg00 = 1
    			
    					lua_org_allocator_addr_finded_pg00 = 0
    					org_allocator_free_bytes_pg00 = 1
    					
    					if lua_org_allocator_addr_finded_pg00 == 0 then
    					for org_allocator_byte_scan_pg00 = lua_org_allocate_addr_pg00, (lua_org_allocate_addr_pg00 + org_allocate_size_pg00 - 1), 1 do
    								
    						if lua_code_allocator_array_pg00[org_allocator_byte_scan_pg00] == 0 then
    						org_allocator_free_bytes_pg00 = 0
    						end
    					end
    							if org_allocator_free_bytes_pg00 == 0 then
    								sj.error("ORG pg00 DATA OVERWRITE!!!!!!!!!!!!!!!!!!!!!!!!!!")
    								sj.warning("ORG pg00 DATA OVERWRITE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
    								print("new_org > ((lua_code_allocator_end_page_pg00*256)+255)")
    								print("procedure = ",lua_org_procedure_count_pg00)
    									if lua_org_overwrite_error_stop == 1 then
    										sj.exit()
    									end
    							end
    								
    							for org_allocator_byte_fill_pg00 = lua_org_allocate_addr_pg00,(lua_org_allocate_addr_pg00 + org_allocate_size_pg00 - 1), 1 do
    								
    							-- очистка свободной памяти
    							lua_code_allocator_array_pg00[org_allocator_byte_fill_pg00] = 0
    							end
    				
    						lua_org_allocator_addr_finded_pg00 = 1
    						lua_org_allocator_new_org_pg00 = lua_org_allocate_addr_pg00
    					end
    	end
    	
    -- ----------------------------------------------------------------------------
    	
    	function lua_function_org_allocate_end_pg00(temp)
    								
    	end
    		
    	endlua
    
    ;==============================================================================
    ; TAMP LEFT pg00
    ;==============================================================================
    ;TAMP LEFT macro pg00
    				
    	macro tampleft_allocate_macro_pg00
    		
    		lua pass1				
    		lua_tampleft_allocate_procedure_start_addr_pg00[lua_tampleft_procedure_count_pg00] = _c("$")
    								
    		endlua
    		
    		lua allpass
    								
    		lua_function_tampleft_allocate_pg00 (0)
    								
    		endlua
    		
    		lua pass2	;
    		if lua_tampleft_allocator_addr_finded_pg00 == 1 then
    								
    			_pc(string.format("org $%04x", lua_tampleft_allocator_new_org_pg00))
    		end 
    		endlua
    		lua pass3	;
    		if lua_tampleft_allocator_addr_finded_pg00 == 1 then
    								
    			_pc(string.format("org $%04x", lua_tampleft_allocator_new_org_pg00))
    		end 
    		endlua
    	endm
    
    ;------------------------------------------------------------------------------
    
    		macro end_tampleft_allocate_macro_pg00
    		lua pass1
    								
    		lua_tampleft_allocate_end_addr_pg00[lua_tampleft_procedure_count_pg00] = (_c("$"))
    								
    		endlua
    		
    		lua allpass
    		lua_function_tampleft_allocate_end_pg00(1)
    		
    		lua_tampleft_procedure_count_pg00 = lua_tampleft_procedure_count_pg00 + 1
    		endlua
    	endm
    
    ;------------------------------------------------------------------------------
    ;TAMP left lua pg00
    
            lua allpass
    	
    	function lua_function_tampleft_allocate_pg00(temp)
    								
    		tampleft_allocate_size_pg00 = (lua_tampleft_allocate_end_addr_pg00[lua_tampleft_procedure_count_pg00] - lua_tampleft_allocate_procedure_start_addr_pg00[lua_tampleft_procedure_count_pg00])
    								
    			--free page search
    			lua_tampleft_allocator_addr_finded_pg00 = 0
    			tampleft_allocator_free_bytes_pg00 = 1
    								
    				for tampleft_allocator_addr_search_pg00 = (lua_code_allocator_start_page_pg00*256),((lua_code_allocator_end_page_pg00*256)+255), 1 do
    
    					if lua_tampleft_allocator_addr_finded_pg00 == 0 then
    						tampleft_allocator_free_bytes_pg00 = 1
    								
    						for tampleft_allocator_byte_scan_pg00 = (tampleft_allocator_addr_search_pg00), (tampleft_allocator_addr_search_pg00 + tampleft_allocate_size_pg00 - 1), 1 do
    								
    						if lua_code_allocator_array_pg00[tampleft_allocator_byte_scan_pg00] == 0 then
    						tampleft_allocator_free_bytes_pg00 = 0
    						end
    						end
    					end
    					
    					if lua_tampleft_allocator_addr_finded_pg00 == 0 then
    						if tampleft_allocator_free_bytes_pg00 == 1 then
    								
    							for tampleft_allocator_byte_fill_pg00 = (tampleft_allocator_addr_search_pg00),(tampleft_allocator_addr_search_pg00 + tampleft_allocate_size_pg00 -1), 1 do
    								
    							-- очистка свободной памяти
    							lua_code_allocator_array_pg00[tampleft_allocator_byte_fill_pg00] = 0
    							end
    				
    						lua_tampleft_allocator_addr_finded_pg00 = 1
    			
    						lua_tampleft_allocator_new_org_pg00 = (tampleft_allocator_addr_search_pg00)
    								
    							if lua_tampleft_allocator_new_org_pg00 > ((lua_code_allocator_end_page_pg00*256)+255) then
    								sj.error("OUT OF MEMORY !!!!!!!!!!!!!!!!!!!!!11111")
    								print ("TAMP LEFT pg00")
    								print("new_org > ((lua_code_allocator_end_page_pg00*256)+255)")
    								print("in procedure = ",lua_tampleft_procedure_count_pg00)
    								sj.exit()
    							end
    							if (tampleft_allocator_addr_search_pg00 + tampleft_allocate_size_pg00 -1) > ((lua_code_allocator_end_page_pg00*256)+255) then
    								sj.error("OUT OF MEMORY !!!!!!!!!!!!!!!!!!!!!11111")
    								print ("TAMP LEFT pg00")
    								print("new_org+size > ((lua_code_allocator_end_page_pg00*256)+255)")
    								print("in procedure = ",lua_tampleft_procedure_count_pg00)
    								sj.exit()
    							end
    							if lua_tampleft_allocator_new_org_pg00 < (lua_code_allocator_start_page_pg00*256) then
    								sj.error("BUG?")
    								print ("TAMP LEFT pg00")
    								print("new_org < (lua_code_allocator_start_page_pg00*256)")
    								print("in procedure = ",lua_tampleft_procedure_count_pg00)
    								sj.exit()
    							end
    						end
    					end
    				end
    				
    				if lua_tampleft_allocator_addr_finded_pg00 == 0 then
    					if tampleft_allocator_free_bytes_pg00 == 0 then
    						sj.error("FREE BYTES NOT FOUND o_O !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("TAMP LEFT pg00")
    							print("procedure = ",lua_tampleft_procedure_count_pg00)
    							sj.exit()
    					end
    				end
    				if lua_tampleft_allocator_addr_finded_pg00 == 0 then
    					if tampleft_allocator_free_bytes_pg00 == 1 then
    						sj.error("FREE BYTES NOT FOUND o_O !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("free_bytes = 1")
    							print ("TAMP LEFT pg00")
    							print("procedure = ",lua_tampleft_procedure_count_pg00)
    							sj.exit()
    					end
    				end
    	end
    
    -- ----------------------------------------------------------------------------
    	
    	function lua_function_tampleft_allocate_end_pg00(temp)
    								
    	end
    	endlua
    
    ;==============================================================================
    ; TAMP LEFT ALIGN 256 pg00
    ;==============================================================================
    ;TAMP LEFT ALIGN 256 macro pg00
    					
    	macro tampleft_align256_allocate_macro_pg00
    		
    		lua pass1				
    		lua_tampleft_align256_allocate_procedure_start_addr_pg00[lua_tampleft_align256_procedure_count_pg00] = _c("$")
    								
    		endlua
    		
    		lua allpass
    								
    		lua_function_tampleft_align256_allocate_pg00 (0)
    								
    		endlua
    		
    		lua pass2	;
    		if lua_tampleft_align256_allocator_addr_finded_pg00 == 1 then
    								
    			_pc(string.format("org $%04x", lua_tampleft_align256_allocator_new_org_pg00))
    		end 
    		endlua
    		lua pass3	;
    		if lua_tampleft_align256_allocator_addr_finded_pg00 == 1 then
    								
    			_pc(string.format("org $%04x", lua_tampleft_align256_allocator_new_org_pg00))
    		end 
    		endlua
    	endm
    
    ;------------------------------------------------------------------------------
    
    		macro end_tampleft_align256_allocate_macro_pg00
    		lua pass1	
    								
    		lua_tampleft_align256_allocate_end_addr_pg00[lua_tampleft_align256_procedure_count_pg00] = (_c("$"))
    								
    		endlua
    		
    		lua allpass
    		lua_function_tampleft_align256_allocate_end_pg00(1)
    		
    		lua_tampleft_align256_procedure_count_pg00 = lua_tampleft_align256_procedure_count_pg00 + 1
    		endlua
    	endm
    
    ;------------------------------------------------------------------------------
    ;TAMP LEFT ALIGN 256 lua pg00
    
            lua allpass
    	
    	function lua_function_tampleft_align256_allocate_pg00(temp)
    								
    		tampleft_align256_allocate_size_pg00 = (lua_tampleft_align256_allocate_end_addr_pg00[lua_tampleft_align256_procedure_count_pg00] - lua_tampleft_align256_allocate_procedure_start_addr_pg00[lua_tampleft_align256_procedure_count_pg00])
    								
    			--free page search
    			lua_tampleft_align256_allocator_addr_finded_pg00 = 0
    			tampleft_align256_allocator_free_bytes_pg00 = 1
    								
    				for tampleft_align256_allocator_addr_search_pg00 = (lua_code_allocator_start_page_pg00*256), (lua_code_allocator_end_page_pg00*256), 256 do
    
    					if lua_tampleft_align256_allocator_addr_finded_pg00 == 0 then
    						tampleft_align256_allocator_free_bytes_pg00 = 1
    								
    						for tampleft_align256_allocator_byte_scan_pg00 = tampleft_align256_allocator_addr_search_pg00,((tampleft_align256_allocator_addr_search_pg00 + tampleft_align256_allocate_size_pg00)-1), 1 do
    								
    						if lua_code_allocator_array_pg00[tampleft_align256_allocator_byte_scan_pg00] == 0 then
    						tampleft_align256_allocator_free_bytes_pg00 = 0
    						end
    						end
    					end
    					
    					if lua_tampleft_align256_allocator_addr_finded_pg00 == 0 then
    						if tampleft_align256_allocator_free_bytes_pg00 == 1 then
    								if (tampleft_align256_allocator_addr_search_pg00 + tampleft_align256_allocate_size_pg00-1) < ((lua_code_allocator_end_page_pg00*256)+256) then
    									
    							for tampleft_align256_allocator_byte_fill_pg00 = tampleft_align256_allocator_addr_search_pg00,((tampleft_align256_allocator_addr_search_pg00 + tampleft_align256_allocate_size_pg00)-1), 1 do
    									
    							-- очистка свободной памяти
    							lua_code_allocator_array_pg00[tampleft_align256_allocator_byte_fill_pg00] = 0
    							end
    				
    						lua_tampleft_align256_allocator_addr_finded_pg00 = 1
    			
    						lua_tampleft_align256_allocator_new_org_pg00 = tampleft_align256_allocator_addr_search_pg00
    									
    							if lua_tampleft_align256_allocator_new_org_pg00 < (lua_code_allocator_start_page_pg00*256) then
    								sj.error("OUT OF MEMORY !!!!!!!!!!!!!!!!!!!!!11111")
    								print ("TAMP LEFT ALIGN 256 pg00")
    								print("new_org < (lua_code_allocator_start_page_pg00*256)")
    								print("in procedure = ",lua_tampleft_align256_procedure_count_pg00)
    								sj.exit()
    							end
    							if lua_tampleft_align256_allocator_new_org_pg00 > ((lua_code_allocator_end_page_pg00*256)+255) then
    								sj.error("BUG?")
    								print ("TAMP LEFT ALIGN 256 pg00")
    								print("new_org > ((lua_code_allocator_end_page_pg00*256)+255)")
    								print("in procedure = ",lua_tampleft_align256_procedure_count_pg00)
    								sj.exit()
    							end
    							if ((lua_tampleft_align256_allocator_new_org_pg00+tampleft_align256_allocate_size_pg00)-1) > ((lua_code_allocator_end_page_pg00*256)+255) then
    								sj.error("OUT OF MEMORY !!!!!!!!!!!!!!!!!!!!!11111")
    								print ("TAMP LEFT ALIGN 256 pg00")
    								print("new_org+size > ((lua_code_allocator_end_page_pg00*256)+255)")
    								print("in procedure = ",lua_tampleft_align256_procedure_count_pg00)
    								sj.exit()
    							end
    								end
    						end
    					end
    				end
    				
    				if lua_tampleft_align256_allocator_addr_finded_pg00 == 0 then
    					if tampleft_align256_allocator_free_bytes_pg00 == 0 then
    						sj.error("FREE BYTES NOT FOUND o_O !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("TAMP LEFT ALIGN 256 pg00")
    							
    							print("procedure = ",lua_tampleft_align256_procedure_count_pg00)
    							sj.exit()
    					end
    				end
    				if lua_tampleft_align256_allocator_addr_finded_pg00 == 0 then
    					if tampleft_align256_allocator_free_bytes_pg00 == 1 then
    					
    						sj.error("FREE BYTES NOT FOUND o_O !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("free_bytes = 1")
    							print ("TAMP LEFT ALIGN 256 pg00")
    							
    							print("procedure = ",lua_tampleft_align256_procedure_count_pg00)
    							sj.exit()
    					end
    				end			
    	end
    
    -- ----------------------------------------------------------------------------
    	
    	function lua_function_tampleft_align256_allocate_end_pg00(temp)
    								
    	end	
    	
    	endlua
    
    ;==============================================================================
    ; TAMP RIGHT pg00
    ;==============================================================================
    ;TAMP RIGHT macro pg00
    				
    	macro tampright_allocate_macro_pg00
    		
    		lua pass1				
    		lua_tampright_allocate_procedure_start_addr_pg00[lua_tampright_procedure_count_pg00] = _c("$")
    								
    		endlua
    		
    		lua allpass
    								
    		lua_function_tampright_allocate_pg00 (0)
    								
    		endlua
    		
    		lua pass2	;
    		if lua_tampright_allocator_addr_finded_pg00 == 1 then
    								
    			_pc(string.format("org $%04x", lua_tampright_allocator_new_org_pg00))
    		end 
    		endlua
    		lua pass3	;
    		if lua_tampright_allocator_addr_finded_pg00 == 1 then
    								
    			_pc(string.format("org $%04x", lua_tampright_allocator_new_org_pg00))
    		end 
    		endlua
    	endm
    
    ;------------------------------------------------------------------------------
    
    		macro end_tampright_allocate_macro_pg00
    		lua pass1	
    								
    		lua_tampright_allocate_end_addr_pg00[lua_tampright_procedure_count_pg00] = (_c("$"))
    								
    		endlua
    		
    		lua allpass
    		lua_function_tampright_allocate_end_pg00(1)
    		
    		lua_tampright_procedure_count_pg00 = lua_tampright_procedure_count_pg00 + 1
    		endlua
    	endm
    
    ;------------------------------------------------------------------------------
    ;TAMP RIGHT lua pg00
    
            lua allpass
    	
    	function lua_function_tampright_allocate_pg00(temp)
    								
    		tampright_allocate_size_pg00 = (lua_tampright_allocate_end_addr_pg00[lua_tampright_procedure_count_pg00] - lua_tampright_allocate_procedure_start_addr_pg00[lua_tampright_procedure_count_pg00])
    								
    			--free page search
    			lua_tampright_allocator_addr_finded_pg00 = 0
    			tampright_allocator_free_bytes_pg00 = 1
    								
    				for tampright_allocator_addr_search_pg00 = ((lua_code_allocator_end_page_pg00*256)+255),(lua_code_allocator_start_page_pg00*256), -1 do
    
    					if lua_tampright_allocator_addr_finded_pg00 == 0 then
    						tampright_allocator_free_bytes_pg00 = 1
    								
    						for tampright_allocator_byte_scan_pg00 = tampright_allocator_addr_search_pg00,((tampright_allocator_addr_search_pg00 - tampright_allocate_size_pg00)+1), -1 do
    								
    						if lua_code_allocator_array_pg00[tampright_allocator_byte_scan_pg00] == 0 then
    						tampright_allocator_free_bytes_pg00 = 0
    						end
    						end
    					end
    					
    					if lua_tampright_allocator_addr_finded_pg00 == 0 then
    						if tampright_allocator_free_bytes_pg00 == 1 then
    								
    							for tampright_allocator_byte_fill_pg00 = tampright_allocator_addr_search_pg00,((tampright_allocator_addr_search_pg00 - tampright_allocate_size_pg00)+1), -1 do
    								
    							-- очистка свободной памяти
    							lua_code_allocator_array_pg00[tampright_allocator_byte_fill_pg00] = 0
    							end
    				
    						lua_tampright_allocator_addr_finded_pg00 = 1
    			
    						lua_tampright_allocator_new_org_pg00 = ((tampright_allocator_addr_search_pg00 - tampright_allocate_size_pg00)+1)
    										
    							if lua_tampright_allocator_new_org_pg00 < (lua_code_allocator_start_page_pg00*256) then
    								sj.error("OUT OF MEMORY !!!!!!!!!!!!!!!!!!!!!11111")
    								print ("TAMP RIGHT pg00")
    								print("new_org < (lua_code_allocator_start_page_pg00*256)")
    								print("in procedure = ",lua_tampright_procedure_count_pg00)
    								sj.exit()
    							end
    							if lua_tampright_allocator_new_org_pg00 > ((lua_code_allocator_end_page_pg00*256)+255) then
    								sj.error("BUG?")
    								print ("TAMP RIGHT pg00")
    								print("new_org > ((lua_code_allocator_end_page_pg00*256)+255)")
    								print("in procedure = ",lua_tampright_procedure_count_pg00)
    								sj.exit()
    							end
    						end
    					end
    				end
    				
    				if lua_tampright_allocator_addr_finded_pg00 == 0 then
    					if tampright_allocator_free_bytes_pg00 == 0 then
    						sj.error("FREE BYTES NOT FOUND o_O !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("TAMP RIGHT pg00")
    							
    							print("procedure = ",lua_tampright_procedure_count_pg00)
    							sj.exit()
    					end
    				end
    				if lua_tampright_allocator_addr_finded_pg00 == 0 then
    					if tampright_allocator_free_bytes_pg00 == 1 then
    						sj.error("FREE BYTES NOT FOUND o_O !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("free_bytes = 1")
    							print ("TAMP RIGHT pg00")
    							
    							print("procedure = ",lua_tampright_procedure_count_pg00)
    							sj.exit()
    					end
    				end			
    	end
    
    -- ----------------------------------------------------------------------------
    
    	function lua_function_tampright_allocate_end_pg00(temp)
    								
    	end
    		
    	endlua
    
    ;==============================================================================
    ; TAMP RIGHT ALIGN 256 pg00
    ;==============================================================================
    ;TAMP RIGHT ALIGN 256 macro pg00
    				
    	macro tampright_align256_allocate_macro_pg00
    		
    		lua pass1				
    		lua_tampright_align256_allocate_procedure_start_addr_pg00[lua_tampright_align256_procedure_count_pg00] = _c("$")
    								
    		endlua
    		
    		lua allpass
    								
    		lua_function_tampright_align256_allocate_pg00 (0)
    								
    		endlua
    		
    		lua pass2	;
    		if lua_tampright_align256_allocator_addr_finded_pg00 == 1 then
    								
    			_pc(string.format("org $%04x", lua_tampright_align256_allocator_new_org_pg00))
    		end 
    		endlua
    		lua pass3	;
    		if lua_tampright_align256_allocator_addr_finded_pg00 == 1 then
    								
    			_pc(string.format("org $%04x", lua_tampright_align256_allocator_new_org_pg00))
    		end 
    		endlua
    	endm
    
    ;------------------------------------------------------------------------------
    
    		macro end_tampright_align256_allocate_macro_pg00
    		lua pass1	
    								
    		lua_tampright_align256_allocate_end_addr_pg00[lua_tampright_align256_procedure_count_pg00] = (_c("$"))
    								
    		endlua
    		
    		lua allpass
    		lua_function_tampright_align256_allocate_end_pg00(1)
    		
    		lua_tampright_align256_procedure_count_pg00 = lua_tampright_align256_procedure_count_pg00 + 1
    		endlua
    	endm
    
    ;------------------------------------------------------------------------------
    ;TAMP RIGHT ALIGN 256 lua pg00
    
            lua allpass
    	
    	function lua_function_tampright_align256_allocate_pg00(temp)
    								
    		tampright_align256_allocate_size_pg00 = (lua_tampright_align256_allocate_end_addr_pg00[lua_tampright_align256_procedure_count_pg00] - lua_tampright_align256_allocate_procedure_start_addr_pg00[lua_tampright_align256_procedure_count_pg00])
    								
    			--free page search
    			lua_tampright_align256_allocator_addr_finded_pg00 = 0
    			tampright_align256_allocator_free_bytes_pg00 = 1
    								
    				for tampright_align256_allocator_addr_search_pg00 = (lua_code_allocator_end_page_pg00*256),(lua_code_allocator_start_page_pg00*256), -256 do
    
    					if lua_tampright_align256_allocator_addr_finded_pg00 == 0 then
    						tampright_align256_allocator_free_bytes_pg00 = 1
    								
    						for tampright_align256_allocator_byte_scan_pg00 = tampright_align256_allocator_addr_search_pg00,((tampright_align256_allocator_addr_search_pg00 + tampright_align256_allocate_size_pg00)-1), 1 do
    							
    						if lua_code_allocator_array_pg00[tampright_align256_allocator_byte_scan_pg00] == 0 then
    						tampright_align256_allocator_free_bytes_pg00 = 0
    						end
    						end
    					end
    					
    					if lua_tampright_align256_allocator_addr_finded_pg00 == 0 then
    								
    						if tampright_align256_allocator_free_bytes_pg00 == 1 then
    								if (tampright_align256_allocator_addr_search_pg00 + tampright_align256_allocate_size_pg00-1) < ((lua_code_allocator_end_page_pg00*256)+256) then
    									
    							for tampright_align256_allocator_byte_fill_pg00 = tampright_align256_allocator_addr_search_pg00,((tampright_align256_allocator_addr_search_pg00 + tampright_align256_allocate_size_pg00)-1), 1 do
    								
    							-- очистка свободной памяти
    							lua_code_allocator_array_pg00[tampright_align256_allocator_byte_fill_pg00] = 0
    							end
    				
    						lua_tampright_align256_allocator_addr_finded_pg00 = 1
    			
    						lua_tampright_align256_allocator_new_org_pg00 = tampright_align256_allocator_addr_search_pg00
    									 	
    							if lua_tampright_align256_allocator_new_org_pg00 < (lua_code_allocator_start_page_pg00*256) then
    								sj.error("OUT OF MEMORY !!!!!!!!!!!!!!!!!!!!!11111")
    								print ("TAMP RIGHT pg00")
    								print("new_org < (lua_code_allocator_start_page_pg00*256)")
    								print("in procedure = ",lua_tampright_align256_procedure_count_pg00)
    								sj.exit()
    							end
    							if lua_tampright_align256_allocator_new_org_pg00 > ((lua_code_allocator_end_page_pg00*256)+255) then
    								sj.error("BUG?")
    								print ("TAMP RIGHT pg00")
    								print("new_org > ((lua_code_allocator_end_page_pg00*256)+255)")
    								print("in procedure = ",lua_tampright_align256_procedure_count_pg00)
    								sj.exit()
    							end
    							if ((lua_tampright_align256_allocator_new_org_pg00+tampright_align256_allocate_size_pg00)-1) > ((lua_code_allocator_end_page_pg00*256)+255) then
    								sj.error("OUT OF MEMORY !!!!!!!!!!!!!!!!!!!!!11111")
    								print ("TAMP RIGHT pg00")
    								print("new_org+size > ((lua_code_allocator_end_page_pg00*256)+255)")
    								print("in procedure = ",lua_tampright_align256_procedure_count_pg00)
    								sj.exit()
    							end
    								end
    						end
    					end
    				end
    				
    				if lua_tampright_align256_allocator_addr_finded_pg00 == 0 then
    					if tampright_align256_allocator_free_bytes_pg00 == 0 then
    						sj.error("FREE BYTES NOT FOUND o_O !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("TAMP RIGHT pg00")
    							
    							print("procedure = ",lua_tampright_align256_procedure_count_pg00)
    							sj.exit()
    					end
    				end
    				if lua_tampright_align256_allocator_addr_finded_pg00 == 0 then
    					if tampright_align256_allocator_free_bytes_pg00 == 1 then
    						sj.error("FREE BYTES NOT FOUND o_O !!!!!!!!!!!!!!!!!!!!!11111")
    							print ("free_bytes = 1")
    							print ("TAMP RIGHT pg00")
    							
    							print("procedure = ",lua_tampright_align256_procedure_count_pg00)
    							sj.exit()
    					end
    				end
    	end
    
    -- ----------------------------------------------------------------------------
    	
    	function lua_function_tampright_align256_allocate_end_pg00(temp)
    								
    	end
    		
    	endlua
    
    ;==============================================================================
    
    
    
    
    ;==============================================================================
    ;==============================================================================
    ;==============================================================================
    ;==============================================================================
    ;==============================================================================
    
    
    
    
    
    
    
    
    ;==============================================================================
    ; TEST
    ;==============================================================================
    
    	;slot 0
    	;slot 1
    	;slot 2
    	slot 3
    	page 0
    
    	org $C000	;особо и не нужен
    			;дальше генерируются свои org-и
    				
    
    		fasttab_allocate_macro $BE,$00
    		
    		defb %00000010
    		defb %00000010
    		defb %00000010
    		defg ########
    		defg #......#
    		defg #....#.#
    		defg #....#.#
    		defg #....#.#
    		defg #....#.#
    		defg #....#.#	
    		defg #......#
    		defg ########	
    		end_fasttab_allocate_macro
    
    		fasttab_allocate_macro $BE,$01
    		
    		defb %00000010
    		defb %00000010
    		defb %00000010
    		defg ########
    		defg #......#
    		defg #.####.#
    		defg #....#.#
    		defg #.####.#
    		defg #.#....#
    		defg #.####.#	
    		defg #......#
    		defg ########	
    		end_fasttab_allocate_macro
    
    		fasttabright_allocate_macro $BD,$02
    		nop
    		defb %00000010
    		defb %00000010
    		defb %00000010
    		defg ########
    		defg #......#
    		defg #.####.#
    		defg #....#.#
    		defg #.####.#
    		defg #....#.#
    		defg #.####.#	
    		defg #......#
    		defg ########		
    		end_fasttabright_allocate_macro
    		
    		fasttabright_allocate_macro $BD,$04
    		
    		defb %00000010
    		defb %00000010
    		defb %00000010
    		defg ########
    		defg #......#
    		defg #.#..#.#
    		defg #.#..#.#
    		defg #.####.#
    		defg #....#.#
    		defg #....#.#	
    		defg #......#
    		defg ########		
    		end_fasttabright_allocate_macro
    
    		org_allocate_macro $C534
    		
    		defb %00000010
    		defb %00000010
    		defb %00000010
    		defg ########
    		defg #......#
    		defg #.####.#
    		defg #.#....#
    		defg #.####.#
    		defg #....#.#
    		defg #.####.#	
    		defg #......#
    		defg ########	
    		end_org_allocate_macro
    		
    		org_allocate_macro $C60B
    		
    		defb %00000010
    		defb %00000010
    		defb %00000010
    		defg ########
    		defg #......#
    		defg #.####.#
    		defg #.#....#
    		defg #.####.#
    		defg #.#..#.#
    		defg #.####.#	
    		defg #......#
    		defg ########	
    		end_org_allocate_macro
    
    		tampleft_allocate_macro
    		
    		defb %00000010
    		defb %00000010
    		defb %00000010
    		defg ########
    		defg #......#
    		defg #.####.#
    		defg #....#.#
    		defg #....#.#
    		defg #....#.#
    		defg #....#.#	
    		defg #......#
    		defg ########	
    		end_tampleft_allocate_macro
    		
    		tampleft_allocate_macro
    		
    		defb %00000010
    		defb %00000010
    		defb %00000010
    		defg ########
    		defg #......#
    		defg #.####.#
    		defg #.#..#.#
    		defg #.####.#
    		defg #.#..#.#
    		defg #.####.#	
    		defg #......#
    		defg ########	
    		end_tampleft_allocate_macro
    		
    		tampleft_align256_allocate_macro
    		defb %00000010
    		defb %00000010
    		defb %00000010
    		defg ########
    		defg #......#
    		defg #.####.#
    		defg #.#..#.#
    		defg #.####.#
    		defg #....#.#
    		defg #.####.#	
    		defg #......#
    		defg ########	
    		end_tampleft_align256_allocate_macro
    		
    		tampleft_align256_allocate_macro
    		defb %00000010
    		defb %00000010
    		defb %00000010
    		defg ########
    		defg #......#
    		defg #.####.#
    		defg #.#..#.#
    		defg #.####.#
    		defg #.#..#.#
    		defg #.#..#.#	
    		defg #......#
    		defg ########	
    		end_tampleft_align256_allocate_macro
    		
    		tampright_allocate_macro
    		defb %00000010
    		defb %00000010
    		defb %00000010
    		defg ########
    		defg #......#
    		defg #.#....#
    		defg #.#....#
    		defg #.####.#
    		defg #.#..#.#
    		defg #.####.#	
    		defg #......#
    		defg ########	
    		end_tampright_allocate_macro
    		
    		tampright_allocate_macro
    		defb %00000010
    		defb %00000010
    		defb %00000010
    		defg ########
    		defg #......#
    		defg #.####.#
    		defg #.#....#
    		defg #.#....#
    		defg #.#....#
    		defg #.####.#	
    		defg #......#
    		defg ########	
    		end_tampright_allocate_macro
    			
    		tampright_align256_allocate_macro
    		defb %00000010
    		defb %00000010
    		defb %00000010
    		defg ########
    		defg #......#
    		defg #....#.#
    		defg #....#.#
    		defg #.####.#
    		defg #.#..#.#
    		defg #.####.#	
    		defg #......#
    		defg ########
    		end_tampright_align256_allocate_macro
    		
    		tampright_align256_allocate_macro
    		defb %00000010
    		defb %00000010
    		defb %00000010
    		defg ########
    		defg #......#
    		defg #.####.#
    		defg #.#....#
    		defg #.####.#
    		defg #.#....#
    		defg #.####.#	
    		defg #......#
    		defg ########
    		end_tampright_align256_allocate_macro
    		
    		tampleft_allocate_macro
    		defb %00000010
    		defb %00000010
    		defb %00000010
    		defg ########
    		defg #......#
    		defg #.####.#
    		defg #.#....#
    		defg #.#....#
    		defg #.#....#
    		defg #.####.#
    		defg #.#....#
    		defg #.#....#
    		defg #.#....#
    		defg #.#....#	
    		defg #......#
    		defg ########	
    		end_tampleft_allocate_macro	
    		
    
    		
    		fasttab_allocate_macro $BE,$20
    		defb %00000010
    		defb %00000010
    		defb %00000010
    l0		ld a,a
    		jp l0
    		nop
    		defg ########
    		defg #......#
    		defg #.#....#
    		defg #.#....#
    		defg #.####.#
    		defg #......#	
    		defg #.####.#
    		defg #.#..#.#
    		defg #.####.#	
    		defg #......#
    		defg ########	
    		end_fasttab_allocate_macro
    
    		fasttab_allocate_macro $BE,$21
    		defb %00000010
    		defb %00000010
    		defb %00000010
    l1		jp l1_2
    		ld a,b
    		ld a,b
    l1_2		jp l1_2
    		
    		defg ########
    		defg #......#
    		defg #.#....#
    		defg #.#....#
    		defg #.####.#
    		defg #......#	
    		defg #....#.#
    		defg #....#.#
    		defg #....#.#	
    		defg #......#
    		defg ########	
    		end_fasttab_allocate_macro
    
    		fasttabright_allocate_macro $BD,$40
    		defb %00000010
    		defb %00000010
    		defb %00000010
    l2		ld b,b
    		jr l2
    		jp l2
    		
    		defg ########
    		defg #......#
    		defg #.#....#
    		defg #.#....#
    		defg #.####.#
    		defg #......#	
    		defg #.###..#
    		defg #....#.#
    		defg #..##..#	
    		defg #.####.#
    		defg #......#
    		defg ########	
    		end_fasttabright_allocate_macro
    
    ;l3
    		fasttabright_allocate_macro $BD,$04
    		defb %00000010
    		defb %00000010
    		defb %00000010
    		ld b,c
    		ld b,c
    		ld b,c
    		jr $
    				
    		defg ########
    		defg #......#
    		defg #.#....#
    		defg #.#....#
    		defg #.####.#
    		defg #......#	
    		defg #.###..#
    		defg #....#.#
    		defg #..##..#	
    		defg #....#.#
    		defg #.###..#
    		defg #......#
    		defg ########	
    		end_fasttabright_allocate_macro
    
    		org_allocate_macro $C464
    		defb %00000010
    		defb %00000010
    		defb %00000010
    l4		ld hl,$
    		ld hl,$
    		ld hl,$
    		ld hl,$
    		jp l4
    			
    		defg ########
    		defg #......#
    		defg #.#....#
    		defg #.#....#
    		defg #.####.#
    		defg #......#	
    		defg #.#..#.#
    		defg #.####.#
    		defg #....#.#	
    		defg #......#
    		defg ########	
    		end_org_allocate_macro
    		
    		org_allocate_macro $D61B
    		
    		defb %00000010
    		defb %00000010
    		defb %00000010
    		defg ########
    		defg #......#
    		defg #.#....#
    		defg #.#....#
    		defg #.####.#
    		defg #......#	
    		defg #.#..#.#
    		defg #.####.#
    		defg #....#.#	
    		defg #......#
    		defg #....#.#	
    		defg #......#
    		defg #.####.#	
    		defg #.##...#	
    		defg #...##.#
    		defg #.###..#
    		defg #......#
    		defg ########	
    
    		ld hl,$
    		jp $
    		end_org_allocate_macro
    
    		tampleft_allocate_macro
    		defb %00000010
    		defb %00000010
    		defb %00000010
    l5		ld c,c
    		ld c,c
    		ld c,c
    		jp l5
    		jp l1
    		defg ########
    		defg #......#
    		defg #.#....#
    		defg #.#....#
    		defg #.####.#
    		defg #......#	
    		defg #.####.#
    		defg #.##...#
    		defg #...##.#	
    		defg #.###..#
    		defg #......#
    		defg ########	
    		end_tampleft_allocate_macro
    		
    		tampleft_allocate_macro
    		defb %00000010
    		defb %00000010
    		defb %00000010
    l6		ld c,d
    		jp l1
    		jp l2
    		jp l3
    		jp l4
    		jp l5
    		jp l6
    		jp l7
    		jp l8
    		jp l9
    		defg ########
    		defg #......#
    		defg #.#....#
    		defg #.#....#
    		defg #.####.#
    		defg #......#	
    		defg #..###.#
    		defg #.#....#
    		defg #.###..#
    		defg #.#..#.#	
    		defg #..##..#
    		defg #......#
    		defg ########	
    		end_tampleft_allocate_macro
    		
    		tampleft_align256_allocate_macro
    		defb %00000010
    		defb %00000010
    		defb %00000010
    l7		jp l7
    		defg ########
    		defg #......#
    		defg #.#....#
    		defg #.#....#
    		defg #.####.#
    		defg #......#	
    		defg #.####.#
    		defg #....#.#
    		defg #....#.#	
    		defg #......#
    		defg ########	
    		end_tampleft_align256_allocate_macro
    		
    		tampleft_align256_allocate_macro
    		defb %00000010
    		defb %00000010
    		defb %00000010
    l8		jp l8
    		defg ########
    		defg #......#
    		defg #.#....#
    		defg #.#....#
    		defg #.####.#
    		defg #......#	
    		defg #..##..#
    		defg #.#..#.#
    		defg #..##..#
    		defg #.#..#.#	
    		defg #..##..#
    		defg #......#
    		defg ########	
    		end_tampleft_align256_allocate_macro
    		
    		tampright_allocate_macro
    		defb %00000010
    		defb %00000010
    		defb %00000010
    l9		jr l9
    		defg ########
    		defg #......#
    		defg #.#....#
    		defg #.#....#
    		defg #.####.#
    		defg #......#	
    		defg #..##..#
    		defg #.#..#.#
    		defg #..###.#
    		defg #....#.#	
    		defg #..##..#
    		defg #......#
    		defg ########	
    		end_tampright_allocate_macro
    		
    		tampright_allocate_macro
    		defb %00000010
    		defb %00000010
    		defb %00000010
    l10		jp l10	
    		defg ########
    		defg #......#
    		defg #.#....#
    		defg #.#....#
    		defg #.####.#
    		defg #......#	
    		defg #....#.#
    		defg #....#.#
    		defg #....#.#	
    		defg #......#
    		defg #.####.#
    		defg #.#..#.#
    		defg #.####.#	
    		defg #......#
    		defg ########	
    		end_tampright_allocate_macro
    			
    		tampright_align256_allocate_macro
    		defb %00000010
    		defb %00000010
    		defb %00000010
    l11		jp l11
    		defg ########
    		defg #......#
    		defg #.#....#
    		defg #.#....#
    		defg #.####.#
    		defg #......#	
    		defg #....#.#
    		defg #....#.#
    		defg #....#.#	
    		defg #......#
    		defg #....#.#
    		defg #....#.#
    		defg #....#.#	
    		defg #......#
    		defg ########	
    		end_tampright_align256_allocate_macro
    		
    		tampright_align256_allocate_macro
    		defb %00000010
    		defb %00000010
    		defb %00000010
    l12		jp l12
    		jp l12
    		defg ########
    		defg #......#
    		defg #.#....#
    		defg #.#....#
    		defg #.####.#
    		defg #......#	
    		defg #....#.#
    		defg #....#.#
    		defg #....#.#	
    		defg #......#
    		defg #.###..#
    		defg #....#.#
    		defg #..##..#	
    		defg #.#....#
    		defg #.####.#
    		defg #......#
    		defg ########	
    		end_tampright_align256_allocate_macro
    		
    		tampleft_allocate_macro
    		defb %00000010
    		defb %00000010
    		defb %00000010
    l13		jp l13
    		jp l13
    		jp l13
    		jp l13
    		defg ########
    		defg #......#
    		defg #.#....#
    		defg #.#....#
    		defg #.####.#
    		defg #......#	
    		defg #....#.#
    		defg #....#.#
    		defg #....#.#	
    		defg #......#
    		defg #.###..#
    		defg #....#.#
    		defg #..##..#	
    		defg #....#.#
    		defg #.###..#
    		defg #......#
    		defg ########	
    		end_tampleft_allocate_macro	
    
    	
    ;		org_allocate_macro $C000
    ;overwrite	nop
    ;check		nop
    ;		nop
    ;		nop
    ;		jp l4
    ;		end_org_allocate_macro
    
    ;		fasttab_8p_allocate_macro $48,1
    ;		defb $FF
    ;		end_fasttab_8p_allocate_macro
    	
    	
    	
    	
    	
    ;==============================================================================
    ; PAGING TEST
    ;==============================================================================
    
    	;slot 0
    	;slot 1
    	;slot 2
    	slot 3
    	page 6
    
    	org $C000	;особо и не нужен
    			;дальше генерируются свои org-и
    	
    
    		fasttab_allocate_macro_pg00 5,$C1,$03
    		defg #......#
    		defg .######.
    		defg .####.#.
    		defg .####.#.
    		defg .####.#.
    		defg .####.#.
    		defg .####.#.	
    		defg .######.
    		defg #......#	
    		end_fasttab_allocate_macro_pg00
    
    		fasttab_allocate_macro_pg00 5,$C1,$07
    		defg #......#
    		defg .######.
    		defg .#....#.
    		defg .####.#.
    		defg .#....#.
    		defg .#.####.
    		defg .#....#.	
    		defg .######.
    		defg #......#	
    		end_fasttab_allocate_macro_pg00
    
    		fasttabright_allocate_macro_pg00 5,$C2,$05
    		defg #......#
    		defg .######.
    		defg .#....#.
    		defg .####.#.
    		defg .#....#.
    		defg .####.#.
    		defg .#....#.	
    		defg .######.
    		defg #......#		
    		end_fasttabright_allocate_macro_pg00
    		
    		fasttabright_allocate_macro_pg00 5,$C2,$04
    		defg #......#
    		defg .######.
    		defg .#.##.#.
    		defg .#.##.#.
    		defg .#....#.
    		defg .####.#.
    		defg .####.#.	
    		defg .######.
    		defg #......#		
    		end_fasttabright_allocate_macro_pg00
    
    		org_allocate_macro_pg00 $C334
    		defg #......#
    		defg .######.
    		defg .#....#.
    		defg .#.####.
    		defg .#....#.
    		defg .####.#.
    		defg .#....#.	
    		defg .######.
    		defg #......#	
    		end_org_allocate_macro_pg00
    		
    		org_allocate_macro_pg00 $C20B
    		defg #......#
    		defg .######.
    		defg .#....#.
    		defg .#.####.
    		defg .#....#.
    		defg .#.##.#.
    		defg .#....#.	
    		defg .######.
    		defg #......#	
    		end_org_allocate_macro_pg00
    
    		tampleft_allocate_macro_pg00
    		defg #......#
    		defg .######.
    		defg .#....#.
    		defg .####.#.
    		defg .####.#.
    		defg .####.#.
    		defg .####.#.	
    		defg .######.
    		defg #......#	
    		end_tampleft_allocate_macro_pg00
    		
    		tampleft_allocate_macro_pg00
    		defg #......#
    		defg .######.
    		defg .#....#.
    		defg .#.##.#.
    		defg .#....#.
    		defg .#.##.#.
    		defg .#....#.	
    		defg .######.
    		defg #......#	
    		end_tampleft_allocate_macro_pg00
    		
    		tampleft_align256_allocate_macro_pg00
    		defg #......#
    		defg .######.
    		defg .#....#.
    		defg .#.##.#.
    		defg .#....#.
    		defg .####.#.
    		defg .#....#.	
    		defg .######.
    		defg #......#	
    		end_tampleft_align256_allocate_macro_pg00
    		
    		tampleft_align256_allocate_macro_pg00
    		defg #......#
    		defg .######.
    		defg .#....#.
    		defg .#.##.#.
    		defg .#....#.
    		defg .#.##.#.
    		defg .#.##.#.	
    		defg .######.
    		defg #......#	
    		end_tampleft_align256_allocate_macro_pg00
    		
    		tampright_allocate_macro_pg00
    		defg #......#
    		defg .######.
    		defg .#.####.
    		defg .#.####.
    		defg .#....#.
    		defg .#.##.#.
    		defg .#....#.	
    		defg .######.
    		defg #......#	
    		end_tampright_allocate_macro_pg00
    		
    		tampright_allocate_macro_pg00
    		defg #......#
    		defg .######.
    		defg .#....#.
    		defg .#.####.
    		defg .#.####.
    		defg .#.####.
    		defg .#....#.	
    		defg .######.
    		defg #......#	
    		end_tampright_allocate_macro_pg00
    			
    		tampright_align256_allocate_macro_pg00
    		defg #......#
    		defg .######.
    		defg .####.#.
    		defg .####.#.
    		defg .#....#.
    		defg .#.##.#.
    		defg .#....#.	
    		defg .######.
    		defg #......#
    		end_tampright_align256_allocate_macro_pg00
    		
    		tampright_align256_allocate_macro_pg00
    		defg #......#
    		defg .######.
    		defg .#....#.
    		defg .#.####.
    		defg .#....#.
    		defg .#.####.
    		defg .#....#.	
    		defg .######.
    		defg #......#
    		end_tampright_align256_allocate_macro_pg00
    		
    		tampleft_allocate_macro_pg00
    		defg #......#
    		defg .######.
    		defg .#....#.
    		defg .#.####.
    		defg .#.####.
    		defg .#.####.
    		defg .#....#.
    		defg .#.####.
    		defg .#.####.
    		defg .#.####.
    		defg .#.####.	
    		defg .######.
    		defg #......#	
    		end_tampleft_allocate_macro_pg00	
    		
    
    		
    		fasttab_allocate_macro_pg00 5,$C1,$25
    l0_pg00		ld a,a
    		jp l0_pg00
    		end_fasttab_allocate_macro_pg00
    
    		fasttab_allocate_macro_pg00 5,$C1,$29
    l1_pg00		jp l1_2_pg00
    		ld a,b
    		ld a,b
    l1_2_pg00	jp l1_2_pg00
    		end_fasttab_allocate_macro_pg00
    
    		fasttabright_allocate_macro_pg00 5,$C2,$26
    l2_pg00		ld b,b
    		jr l2_pg00
    		jp l2_pg00
    		end_fasttabright_allocate_macro_pg00
    
    ;l3_pg00
    		
    		fasttabright_allocate_macro_pg00 5,$C2,$29
    		ld b,c
    		ld b,c
    		ld b,c
    		jr $
    		end_fasttabright_allocate_macro_pg00
    
    		org_allocate_macro_pg00 $c464
    l4_pg00		ld hl,$
    		ld hl,$
    		ld hl,$
    		ld hl,$
    		jp l4_pg00
    		end_org_allocate_macro_pg00
    		
    		org_allocate_macro_pg00 $c61B
    		ld hl,$
    		jp $
    		end_org_allocate_macro_pg00
    
    		tampleft_allocate_macro_pg00
    l5_pg00		ld c,c
    		ld c,c
    		ld c,c
    		jp l5_pg00
    		jp l1_pg00
    		end_tampleft_allocate_macro_pg00
    		
    		tampleft_allocate_macro_pg00
    l6_pg00		ld c,d
    		jp l1_pg00
    		jp l2
    		jp l3_pg00
    		jp l4_pg00
    		jp l5_pg00
    		jp l6_pg00
    		jp l7_pg00
    		jp l8_pg00
    		jp l9_pg00
    		end_tampleft_allocate_macro_pg00
    		
    		tampleft_align256_allocate_macro_pg00
    l7_pg00		jp l7_pg00
    		end_tampleft_align256_allocate_macro_pg00
    		
    		tampleft_align256_allocate_macro_pg00
    l8_pg00		jp l8_pg00
    		end_tampleft_align256_allocate_macro_pg00
    		
    		tampright_allocate_macro_pg00
    l9_pg00		jr l9_pg00
    		end_tampright_allocate_macro_pg00
    		
    		tampright_allocate_macro_pg00
    l10_pg00	jp l10_pg00
    		end_tampright_allocate_macro_pg00
    			
    		tampright_align256_allocate_macro_pg00
    l11_pg00	jp l11_pg00
    		end_tampright_align256_allocate_macro_pg00
    		
    		tampright_align256_allocate_macro_pg00
    l12_pg00	jp l12_pg00
    		end_tampright_align256_allocate_macro_pg00
    		
    		tampleft_allocate_macro_pg00
    l13_pg00	jp l13_pg00
    		end_tampleft_allocate_macro_pg00	
    
    
    
    
    
    	
    ;		org_allocate_macro_pg00 $8000
    ;overwrite	nop
    ;check		nop
    ;		nop
    ;		nop
    ;		jp l4
    ;		end_org_allocate_macro_pg00
    
    ;		fasttab_8p_allocate_macro_pg00 $48,1
    ;		defb $FF
    ;		end_fasttab_8p_allocate_macro_pg00
    
    
    
    	org $7155
    
    Test_Start
    
    	di
    	
    	ld bc,$7FFD
    	ld a,0
    	out (c),a	;щелкаем страницами
    	ld a,6		;чтобы смотреть в emuzwin, что и где в памяти
    	out (c),a
    	
    
    	jp Test_Start
    		
    
    ;===================================================================================
    
    
    	savesna "Test.sna",Test_Start
    Вложения Вложения
    Последний раз редактировалось NEO SPECTRUMAN; 30.03.2020 в 05:36.

  5. #25
    Guru Аватар для NEO SPECTRUMAN
    Регистрация
    22.05.2011
    Адрес
    Дзержинск
    Сообщений
    4,059
    Спасибо Благодарностей отдано 
    159
    Спасибо Благодарностей получено 
    224
    Поблагодарили
    183 сообщений
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    По умолчанию

    Цитата Сообщение от NEO SPECTRUMAN Посмотреть сообщение
    и да как выяснилось
    lua-льные генераторы таблиц
    внутри lua-льного утрамбовщика
    правильно неработают...
    как оказалось легко решается
    предварительным выделением места

    например так
    Код:
    		tampright_align256_allocate_macro_pg01
    tab_1
    tab_1_haddr = high $
    			dup 512
    			nop
    			edup
    tab_2
    tab_2_haddr = high $
    			dup 512
    			nop
    			edup
    		end_tampright_align256_allocate_macro_pg01
    
    
    		org tab_1
    		lua allpass
    			for temp_cnt = 0x00,0x1FFF,0x10 do
    			sj.add_byte(math.floor(temp_cnt % 256))
    			end
    		endlua
    
    		org tab_2
    		lua allpass
    			for temp_cnt = 0x00,0x1FFF,0x10 do
    			sj.add_byte(math.floor(temp_cnt / 256))
    			end
    		endlua

Страница 3 из 3 ПерваяПервая 123

Информация о теме

Пользователи, просматривающие эту тему

Эту тему просматривают: 1 (пользователей: 0 , гостей: 1)

Похожие темы

  1. Таблица переходов (computed goto)
    от Barmaley_m в разделе Программирование
    Ответов: 17
    Последнее: 03.07.2019, 22:31
  2. Быстрые 41256/4164
    от LeoN65816 в разделе Память
    Ответов: 5
    Последнее: 15.03.2019, 11:52
  3. Программы переходов экрана
    от AAA в разделе Софт
    Ответов: 2
    Последнее: 19.03.2013, 18:02
  4. Таблицы огибающих.
    от Robus в разделе Музыка
    Ответов: 9
    Последнее: 17.01.2013, 11:35
  5. Interference:построение таблицы
    от goblinish в разделе Программирование
    Ответов: 6
    Последнее: 17.11.2012, 13:43

Ваши права

  • Вы не можете создавать новые темы
  • Вы не можете отвечать в темах
  • Вы не можете прикреплять вложения
  • Вы не можете редактировать свои сообщения
  •