;jp to menu, don't call it ;define (selected) somewhere ;##################################### ;do a menu ;input: hl = menu formatting start menu: set 7, (iy + 20) ;write to PlotSScreen push hl ld b, 7 ld l, 0 titleLoop1: call drawHorizLine inc l djnz titleLoop1 set 3, (iy + 5) ;inverse pop hl ld e, (hl) inc hl ld d, 0 ld (penCol), de bcall(_vPutS) res 3, (iy + 5) ;inverse doSelections: ld a, 1 ld (selected), a ld b, (hl) inc hl innerSelectionLoop: set 1, (iy + 5) ld de, 8*256+0 ld (penCol), de push hl push bc ld c, 1 selectsLoop: ld a, (selected) cp c jr nz, notSelected set 3, (iy + 5) ;inverse notSelected: ld a, ' ' bcall(_vPutMap) ld a, c add a, $30 bcall(_vPutMap) ld a, ':' bcall(_vPutMap) res 3, (iy + 5) ;inverse ld a, 10 ld (penCol), a bcall(_vPutS) ld a, (penRow) add a, 8 ld (penRow), a xor a ld (penCol), a inc c djnz selectsLoop res 1, (iy + 5) push hl bcall(_grBufCpy) pop hl ei keyLoop: halt push hl bcall(_GetCSC) pop hl or a jr z, keyLoop cp skDown jr nz, notDown ld a, (selected) pop bc push bc cp b jr nz, notLast xor a notLast: inc a ld (selected), a keyFound: pop bc pop hl jr innerSelectionLoop notDown: cp skUp jr nz, notUp ld a, (selected) dec a jr nz, notFirst pop af push af notFirst: ld (selected), a jr keyFound notUp: cp sk2nd jr nz, not2nd _2nd: ld a, (selected) numberEntry: pop bc push bc inc b cp b jr nc, keyLoop dec a rlca ld e, a ld d, 0 add hl, de ld e, (hl) inc hl ld d, (hl) ex de, hl pop af pop af jp (hl) not2nd: cp skClear jr nz, notClear pop af push af jr numberEntry notClear: cp skEnter jr z, _2nd sub sk3 jr c, keyLoop cp sk7+1 jr nc, keyLoop ld e, a ld d, 0 push hl ld hl, numChart add hl, de ld a, (hl) pop hl or a jr z, keyLoop jr numberEntry numChart: .db 3, 6, 9, 0, 0, 0, 0, 0 .db 2, 5, 8, 0, 0, 0, 0, 0 .db 1, 4, 7 mainMenu: .db 17 ;title X position .db "OS Patcher 2.55", 0 .db 3 ;number of options .db "Patch", 0 .db "Unpatch", 0 .db "Quit", 0 ;the last option has to be back .dw patch .dw unpatch .dw quit ;################################ ;Draws a horizonal line across whole screen ;Input: L = y height ;Output: Horizontal line ;Destorys: ALL but C and IX DrawHorizLine: push bc push hl ld h, 0 ld b, h ld c, l add hl, bc add hl, bc add hl, hl add hl, hl ld bc, plotSScreen add hl, bc LD B, 12 LD A, $FF DrawHorizLineLoop: LD (HL), A INC HL DJNZ DrawHorizLineLoop pop hl pop bc RET