Code on - menu with endless nesting.

Funeral #1.5
music: Midisoft/Energy Minds (C) Eraser/Delirium Tremens ---------------------------------FUNeral--
рочитав статейку в DJV#05 о
журнальной оболочке, у меня вкралось сомнение насчет "оптимизации". Енто куда же годно,gentlemen!!!The magazine offers about this kind of crap: LD IX,Win1 ; main window CALL WIN ; drew CALL SELECT ; survey LD A,(OPC) ; option number LD HL,TABLICA_1 ; transition by JP JP_HL ; table Win1 DEFB x,у,len,high,something else DEFB "Shnyaga 1", 13 DEFB "Shnyaga 2", 13 DEFB "Шняга 3",13 DEFB "Шняга 4",13 DEFB "Шняга 5",0 TABLICA_1 DEFW OPC_1 ; таблица DEFW OPC_2 DEFW OPC_3 ... OPC_1 ... ; загружаем данные очень ; примитивным образом: LD A,1 ; к примеру, CALL RAM_PAGE ; музыку LD HL,ХХХХ LD DE,YYYY LD В,10 CALL LOAD CALL DEPACK_MUS LD A,3 ; текст CALL RAM_PAGE LD HL,ZZZZ LD DE,NNNN LD В,10 CALL LOAD CALL DEPACK_TXT ... JP VIEW ; запуск ; листалки... People! After all, it's all full speed ahead!!! This isLamerz Must Die!!!Or is it not??? Thinking that the author of the article moved out attic, I went into the magazine shells... and I see - hewas not the only one who moved out :( So, sickened by the evacuated attics, Eraser decided to fix them... The window vector has the following form: Win1 DEFB x,у,len,high,... DEFW Txt1,Mus1,Spr1; it is possible without ; this DEFB "OPC_1",13 ; опция 1 DEFB "OPC_2",13 ; опция 2 DEFB "OPC_3",13 ; опция 3 DEFB "OPC_4",13 ; опция 4 DEFB "OPC_5",0 ; опция 5 ... ;описатель данных для текстов, к примеру: ; ; DEFW TrkSec1 ; DEFB Blk1 ; DEFW TrkSec2 ; DEFB Blk2 ; ... ;если Blk=#00, то данная опция имеет;nesting with the Win2 descriptor, and if #FF ;(as in FUNearl), then this application... Txt1 DEFW #aaaa ; TXT_LEN DEFB #aa ; TXT_BLK DEFW Win2 ; there are 2 options DEFB #00 ; nesting DEFW #льь DEFB #ль DEFW #0000 ; and here we have DEFB #FF ; application ... ;descriptor of music, similar to the previous one, ;only if #00, then there is no music... Mus1 DEFW #cccc DEFB #dd DEFW #hhhh DEFB #hh DEFW #eeee DEFB #ee DEFW #ffff DEFB #ff ... ;описатель cпарайтoв ;если Blk=0, то cпарйты absent... Spr1 DEFW #gggg DEFB #gg DEFW #mmmm DEFB #mm DEFW #nnnn DEFB #nn DEFW #oooo DEFB #oo ;.. Win2 DEFB x,у,len,high,... DEFW Txt2,Mus2,Spr2 DEFB "ZX_1",13 ; опция 1 DEFB "ZX_2",13 ; опция 2 DEFB "ZX_3",13 ; опция 3 DEFB "ZX_4",13 ; опция 4 DEFB "ZX_5",0 ; опция 5 Txt2 DEFW WinЗ DEFB #00 DEFW #аааа DEFB #аа DEFW #ЬЬЬЬ DEFB #ЬЬ DEFW #zzzz DEFB #zz Mus2 DEFW #cccc DEFB #dd DEFW #hhhh DEFB #hh DEFW #ееее DEFB #ее DEFW #ffff DEFB #ff Spr2 DEFW #gggg DEFB #gg DEFW #mmmm DEFB #mm DEFW #nnnn DEFB #nn DEFW #oooo DEFB #oo WinЗ .... ; и так далее... We've sorted out the descriptor . I think that everything here is clear , and it won’t be a problem for you work to make a shell supporting this window. Now let's move directly to shell core... LD IX,MainWin ; main window handle CALL OPEN_W ; remember the window vector on the window stack, ; for future access CALL DRAW_W ; drew CONT_1 CALL WINSEL ; selector LD A,(OPC) ; option number CP #FF ; if you “poke” past the option, then close ; we wai JR Z,CLOSE_W ; last window CALL INIT_DAT ; setting up data to load ; or opening a window LD A,(TXT_BLK) ; if BLK=0, then it means there is OR A ; nesting, JR NZ,LOAD ; otherwise we load the data CALL OPEN_W ; open okkho (in IX we have the address ; window taken from the current handle ; windows CALL DRAW_W ; let's draw it JR CONT_1 ; selector... DRAW_W draw a window RET OPEN_W put on the window stack window vector, for subsequent Public access RET CLOSE_W closing the window - deleting the vector of the last window If the last window is matepuhckum, then go to address CONT_1, call the REFRESH procedure RET REFRESH the procedure takes sequentially all vectors (from the very first to last) and builds them on the screen (although if you use If you remove the buffer for windows, you will restore pourarea under the last approx. nom) RET LOAD loading, pre-configured real data ... CALL REFRESH JP CONT_1 If you neednestingfor the program, then window descriptor will look like this: in a simpleway: Win1 DEFBx,у,len,high,... DEFB "OPC_1",13 ; опция 1 DEFB "OPC_2",13 ; опция 2 DEFB "OPC_3",13 ; опция 3 DEFB "OPC_4",13 ; опция 4 DEFB "OPC_5",0 ; опция 5 ;описатель адресов для перехода в опциях DEFW #аааа ; переход на адрес #аааа, DEFB #00 ; т.к. здесь #00 DEFW #zzzz DEFB #00 ;descriptor of addresses for transition in options DEFW #aaaa ; go to address #aaaa, DEFB #00 ; because here #00 DEFW #zzzz DEFB #00 DEFW Win2 ; there is nesting, because DEFB #01 ; here #01 DEFW #ььь DEFB #b ... It seems everything is clear. The core is similar to previous, but only with the difference that procedure LOAD should be replaced with procedure JP_HL, i.e. JP_HL must take from the variableJP_Adr,which contains address of the transition, taken from the descriptor transition addresses, and go to (JP_Adr). Well, that seems to be all for today...

Share your thoughts about the article