;het eerste menu menu: ld hl, $ ld (prevPagePointer), hl xor a;style menu ld l, 20 call menuCreate ;later weg(zet cursor meteen op Laad) ;ld a, 2 ;ld (menuIndex), a ; ;; titel en author ld hl, $0205 ld (pencol), hl ld hl, menutxt1 call dspStringSmall ld hl, $3707 ld (pencol), hl ld hl, menutxt2 call dspStringSmall ;ld hl, $2f04 ;ld (pencol), hl ;ld hl, menutxt3 ;call dspStringSmall ;; ld hl, item1 ld de, getNew call menuItemCreate ld de, load ld hl, item2 call menuItemCreate ld de, _end ld hl, item3 call menuItemCreate jp menuBegin ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; alle functies die worden gebruikt om het menu te maken, weer te geven en te gebruiken ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; menuCreate: ;in a = style ; l = menuYstart(vertical position of first item) ld (menuStyle), a ld a, l ld (menuYstart), a b_call (_clrLCDfull) ld hl, menuItems ld bc, 90 call clear ld a, 1 ld (menuIndex), a ret menuItemCreate: ;in hl = pointer naar tekst voor het item ; de = pointer naar de positie waar we heen gaan als er op het item wordt geklikt ld a, (menuStyle) cp 1 jr z, menuItemCreateStyle1 push de push hl ld a, (menuItems) inc a ld b, a ld a, (menuYstart) sub 10 onemore: add a, 10 djnz onemore ld d, a ld e, 2 push de menuItemData: ;style0 ;1st pop = pen pos ;2nd pop = pointer to button string ;3rd pop = pointer to jump when selecting item ;style1 ;1st pop = pen pos ;2nd pop = pointer to buffer ;3rd pop = ld a, (menuItems) inc a ld (menuItems), a ld b, a ld hl, menuItemBegin-6 ld de, 6 onemore2: add hl, de djnz onemore2 ld b, 3 driekeer: pop de ld a, d ld (hl), a inc hl ld a, e ld (hl), a inc hl djnz driekeer ret menuItemCreateStyle1: push de push hl ld a, (menuItems) inc a ld b, a ld a, -6 a03: add a, 6 djnz a03 ld h, 56 ld l, a push hl jp menuItemData menuBegin: SET apdAble,(IY+apdFlags) call menuShow menuLoop: b_call (_getCSC) or a jr z, menuLoop cp skClear jr z, menuExit cp skEnter jp z, menuItemClick cp skUp jr z, menuUp cp skLeft jr z, menuUp cp skDown jr z, menuDown cp skRight jr z, menuDown cp skDel jr z, menuDel cp skTrace jp z, _end sub skAdd ;alles voor de '+' eruit gooien jr c, menuLoop cp sk7 - skAdd + 1;en alles na de '7' jr nc, menuLoop menuNumKey: ld h, 0 ld l, a ld de, numtable add hl, de ld a, (hl) or a jr z, menuLoop sub $80 or a jr z, menuLoop ld hl, (menuItems) inc l cp l jr nc, menuLoop ld (menuIndex), a ld a, (menuStyle) cp 1 call z, menushow jp menuItemClick menuExit: ld a, (menuStyle) cp 1 jp z, menu ld a, (menuItems) ;dec a ld (menuIndex), a jp menuItemClick menuUp: ld a, (menuIndex) ld h, a cp 1 jr nz, notfirstitem ld a, (menuItems) inc a notfirstitem: dec a ld (menuIndex), a ld l, a call menuShowOnlyHL jr menuLoop menuDown: ld a, (menuItems) ld c, a ld a, (menuIndex) ld h, a cp c jr nz, notlastitem xor a notlastitem: inc a ld (menuIndex), a ld l, a call menuShowOnlyHL jp menuLoop menuDel: ld a, (menuStyle) cp 1 jp nz, menuLoop ;del uit memory ld a, (bfLength) inc a push af ld d, 0 ld e, a ld hl, (var+4) b_call (_delmem) ld hl, (appvarstart) b_call (_ldhlind) pop af ld d, 0 ld e, a or a sbc hl, de ex de, hl ld hl, (appvarstart) ld (hl), e inc hl ld (hl), d jp load menuShowOnlyHL: ld (var2+1), hl ld a, 1;aan jr menuShow2 menuShow: xor a menuShow2: ld (var2), a ;var = aan/uit (only show HL) ;var+1 = h(only show this number ;var+2 = l(and this one, if ON ld a, (menuStyle) cp 1 call z, menuShowStyle1 res fracdrawlfont, (iy + fontflags) ld a, (menuItems) ld b, a ld c, 0 ld hl, menuItemBegin nxt: inc c ;jr onlyShowHLoff ld a, (var2) ;call debugA or a jr z, onlyShowHLoff ld a, (var2+1) cp c jr z, onlyShowHLoff ld a, (var2+2) cp c jr z, onlyShowHLoff ld a, (menuStyle) or a jr z, niet ld a, (var) inc a ld (var), a niet: ld de, 6 add hl, de dec b ld a, b or a ret z jr nxt onlyShowHLoff: ld a, (menuIndex) cp c res textinverse, (iy + textflags) jr nz, notActiveItem set textinverse, (iy + textflags) notActiveItem: ld d, (hl) inc hl ld e, (hl) inc hl ld (penCol), de ld d, (hl) inc hl ld e, (hl) inc hl inc hl inc hl call menuItemShow djnz nxt ret menuItemShow: push hl push af push bc ;ld a, (menuStyle) ;cp 1 ;jr z, menuItemShowStyle1 ld a, (menuStyle) cp 1 call z, menuItemShowStyle1 ex de, hl ld a, $20 jr beginspace menuCharShowNxt: ld a, (hl) inc hl beginspace: or a jr z, menuItemShowEnd ld b, a;onthoud ex de, hl ld hl, (penCol) push hl ex de, hl ld a, (penRow) inc a ld (penRow), a ;ld a, b ld a, $06;2d b_call (_vputmap) pop de ld (penCol), de ld a, b b_call (_vputmap) jr menuCharShowNxt menuItemShowEnd: pop bc pop af pop hl ret menuShowStyle1: xor a ld (var), a ld (var+2), a;end of str ret menuItemShowStyle1: ld a, (menuIndex) cp c jr nz, notactive push hl push de push af push bc ld hl, (penCol) push hl ld hl, (flags + textflags) push hl ld hl, (flags + fontflags) push hl ex de, hl ld (var+4), hl;sla op voor functie loadselected ld de, buffer ;ld bc, 200 ;ldir ;of ldrzeroloop:;43 / 37 ldir = 21 / 16 :O:O ld a, (hl);7 ld (de), a;7 inc hl;6 inc de;6 or a;4 jr nz, ldrzeroloop;12/7 res textinverse, (iy + textflags) ld b, -1 ld hl, buffer stapje: ld a, (hl) inc hl inc b or a jr nz, stapje ld a, b ld (bfLength), a ld a, 255 ld (bfIX), a ld a, $20 ld hl, 0 ld (curRow), hl ld b, 16*7 clearScreen: b_call (_PutC) djnz clearScreen xor a ld (bf2ndpage), a;(cl002) call dispBuffer res fracdrawlfont, (iy + fontflags) pop hl ld (flags + fontflags), hl pop hl ld (flags + textflags), hl pop hl ld (penCol), hl pop bc pop af pop de pop hl notactive: ld a, (var) inc a ld (var), a add a, $30 cp $3a jr c, number add a, $41-$3a number: ld (var+1), a ld de, var+1 ret menuItemClick: ld a, (menuIndex) ld b, a ld hl, menuItemBegin - 2 ld de, 6 nxt2: add hl, de djnz nxt2 ld d, (hl) inc hl ld e, (hl) push de ret