develop/asciivju: Post-SVN tidy
- Move source code from `trunk` into program root directory. - Update build files and ASM include paths. - Note: Line endings standardised from `CRLF` > `LF`, so best to view diffs with whitespace changes hidden.
This commit is contained in:
@@ -1,325 +1,329 @@
|
|||||||
use32
|
; SPDX-License-Identifier: NOASSERTION
|
||||||
org 0x0
|
;
|
||||||
db 'MENUET01'
|
|
||||||
dd 0x01,start,i_end,e_end,e_end,0,0
|
|
||||||
|
use32
|
||||||
include '../../../proc32.inc'
|
org 0x0
|
||||||
include '../../../macros.inc'
|
db 'MENUET01'
|
||||||
|
dd 0x01,start,i_end,e_end,e_end,0,0
|
||||||
BUTTON_SIDE = 28 ; button are squares
|
|
||||||
BUTTON_SPACE = 34 ; space between cols and rows
|
include '../../proc32.inc'
|
||||||
BUTTON_ID_SHIFT = 2 ; button_id = character + BUTTON_ID_SHIFT
|
include '../../macros.inc'
|
||||||
TABLE_BEGIN_X = 2
|
|
||||||
TABLE_BEGIN_Y = 2
|
BUTTON_SIDE = 28 ; button are squares
|
||||||
PANEL_Y = BUTTON_SPACE*8+TABLE_BEGIN_Y+TABLE_BEGIN_Y
|
BUTTON_SPACE = 34 ; space between cols and rows
|
||||||
|
BUTTON_ID_SHIFT = 2 ; button_id = character + BUTTON_ID_SHIFT
|
||||||
FOCUS_SQUARE_COLOR = 0x000080FF
|
TABLE_BEGIN_X = 2
|
||||||
SWITCHER_BLINK_COLOR = 0x00808080
|
TABLE_BEGIN_Y = 2
|
||||||
|
PANEL_Y = BUTTON_SPACE*8+TABLE_BEGIN_Y+TABLE_BEGIN_Y
|
||||||
FONT_SMALL = 0x01000000
|
|
||||||
FONT_BIG = 0x10000000
|
FOCUS_SQUARE_COLOR = 0x000080FF
|
||||||
|
SWITCHER_BLINK_COLOR = 0x00808080
|
||||||
|
|
||||||
start:
|
FONT_SMALL = 0x01000000
|
||||||
still:
|
FONT_BIG = 0x10000000
|
||||||
mcall 10
|
|
||||||
dec eax
|
|
||||||
jz redraw
|
start:
|
||||||
dec eax
|
still:
|
||||||
jz key
|
mcall 10
|
||||||
|
dec eax
|
||||||
button:
|
jz redraw
|
||||||
mcall 17
|
dec eax
|
||||||
shr eax, 8
|
jz key
|
||||||
|
|
||||||
cmp eax, 1
|
button:
|
||||||
je quit
|
mcall 17
|
||||||
cmp ax, 0xFFAA ; page switcher
|
shr eax, 8
|
||||||
je .switch_page ; any button with a character
|
|
||||||
cmp ax, 0xEEBB ; page switcher
|
cmp eax, 1
|
||||||
je .switch_font
|
je quit
|
||||||
.change_focus:
|
cmp ax, 0xFFAA ; page switcher
|
||||||
mov bl, [symbol_focused]
|
je .switch_page ; any button with a character
|
||||||
mov [symbol_unfocused], bl
|
cmp ax, 0xEEBB ; page switcher
|
||||||
sub ax, BUTTON_ID_SHIFT ; get the corresponding character
|
je .switch_font
|
||||||
mov [symbol_focused], al
|
.change_focus:
|
||||||
stdcall draw_table, 0
|
mov bl, [symbol_focused]
|
||||||
call draw_codes
|
mov [symbol_unfocused], bl
|
||||||
jmp still
|
sub ax, BUTTON_ID_SHIFT ; get the corresponding character
|
||||||
.switch_font:
|
mov [symbol_focused], al
|
||||||
cmp [font_type], FONT_SMALL
|
stdcall draw_table, 0
|
||||||
jne @f
|
call draw_codes
|
||||||
mov [font_type], FONT_BIG
|
jmp still
|
||||||
jmp redraw
|
.switch_font:
|
||||||
@@: mov [font_type], FONT_SMALL
|
cmp [font_type], FONT_SMALL
|
||||||
jmp redraw
|
jne @f
|
||||||
.switch_page:
|
mov [font_type], FONT_BIG
|
||||||
movzx bx, [symbol_start]
|
jmp redraw
|
||||||
add bx, BUTTON_ID_SHIFT
|
@@: mov [font_type], FONT_SMALL
|
||||||
mov cx, 128 ; half of page
|
jmp redraw
|
||||||
mov edx, 0x80000000
|
.switch_page:
|
||||||
mov dx, bx
|
movzx bx, [symbol_start]
|
||||||
@@: mcall 8
|
add bx, BUTTON_ID_SHIFT
|
||||||
inc edx
|
mov cx, 128 ; half of page
|
||||||
dec cx
|
mov edx, 0x80000000
|
||||||
jnz @b
|
mov dx, bx
|
||||||
|
@@: mcall 8
|
||||||
@@: add [symbol_start], 128 ; change page
|
inc edx
|
||||||
add [symbol_focused], 128
|
dec cx
|
||||||
stdcall draw_table, 1 ; 1 means redraw the whole table
|
jnz @b
|
||||||
call draw_codes
|
|
||||||
stdcall draw_page_switcher, 1 ; 1 means dark color, for blinking
|
@@: add [symbol_start], 128 ; change page
|
||||||
mcall 5, 10
|
add [symbol_focused], 128
|
||||||
stdcall draw_page_switcher, 0 ; 0 means usual light color
|
stdcall draw_table, 1 ; 1 means redraw the whole table
|
||||||
jmp still
|
call draw_codes
|
||||||
|
stdcall draw_page_switcher, 1 ; 1 means dark color, for blinking
|
||||||
redraw:
|
mcall 5, 10
|
||||||
mcall 9, proc_info, -1
|
stdcall draw_page_switcher, 0 ; 0 means usual light color
|
||||||
|
jmp still
|
||||||
mcall 12, 1
|
|
||||||
|
redraw:
|
||||||
mcall 48, 4 ; get skin height
|
mcall 9, proc_info, -1
|
||||||
mov ecx, 200*0x10000+PANEL_Y+33
|
|
||||||
add ecx, eax
|
mcall 12, 1
|
||||||
mov ebx, 200*0x10000+BUTTON_SPACE*16+TABLE_BEGIN_X+TABLE_BEGIN_X+9
|
|
||||||
mcall 0, , , 0x34AAAaaa, 0x80000000, window_title
|
mcall 48, 4 ; get skin height
|
||||||
test [proc_info.wnd_state], 0x04
|
mov ecx, 200*0x10000+PANEL_Y+33
|
||||||
jnz @f
|
add ecx, eax
|
||||||
|
mov ebx, 200*0x10000+BUTTON_SPACE*16+TABLE_BEGIN_X+TABLE_BEGIN_X+9
|
||||||
stdcall draw_table, 1
|
mcall 0, , , 0x34AAAaaa, 0x80000000, window_title
|
||||||
call draw_codes
|
test [proc_info.wnd_state], 0x04
|
||||||
stdcall draw_page_switcher, 0
|
jnz @f
|
||||||
stdcall draw_font_switcher
|
|
||||||
|
stdcall draw_table, 1
|
||||||
@@:
|
call draw_codes
|
||||||
mcall 12, 2
|
stdcall draw_page_switcher, 0
|
||||||
jmp still
|
stdcall draw_font_switcher
|
||||||
|
|
||||||
key:
|
@@:
|
||||||
mcall 2
|
mcall 12, 2
|
||||||
cmp ah, 0x09 ; TAB key
|
jmp still
|
||||||
je button.switch_page
|
|
||||||
|
key:
|
||||||
cmp ah, 0xB0 ; left
|
mcall 2
|
||||||
jne @f
|
cmp ah, 0x09 ; TAB key
|
||||||
mov bl, [symbol_focused]
|
je button.switch_page
|
||||||
mov [symbol_unfocused], bl
|
|
||||||
dec bl
|
cmp ah, 0xB0 ; left
|
||||||
and bl, 0x0f
|
jne @f
|
||||||
and [symbol_focused], 0xf0
|
mov bl, [symbol_focused]
|
||||||
or [symbol_focused], bl
|
mov [symbol_unfocused], bl
|
||||||
stdcall draw_table, 0
|
dec bl
|
||||||
call draw_codes
|
and bl, 0x0f
|
||||||
jmp still
|
and [symbol_focused], 0xf0
|
||||||
|
or [symbol_focused], bl
|
||||||
@@: cmp ah, 0xB1 ; down
|
stdcall draw_table, 0
|
||||||
jne @f
|
call draw_codes
|
||||||
mov bl, [symbol_focused]
|
jmp still
|
||||||
mov [symbol_unfocused], bl
|
|
||||||
add bl, 16
|
@@: cmp ah, 0xB1 ; down
|
||||||
and bl, 0x70
|
jne @f
|
||||||
and [symbol_focused], 0x8f
|
mov bl, [symbol_focused]
|
||||||
or [symbol_focused], bl
|
mov [symbol_unfocused], bl
|
||||||
stdcall draw_table, 0
|
add bl, 16
|
||||||
call draw_codes
|
and bl, 0x70
|
||||||
jmp still
|
and [symbol_focused], 0x8f
|
||||||
|
or [symbol_focused], bl
|
||||||
@@: cmp ah, 0xB2 ; up
|
stdcall draw_table, 0
|
||||||
jne @f
|
call draw_codes
|
||||||
mov bl, [symbol_focused]
|
jmp still
|
||||||
mov [symbol_unfocused], bl
|
|
||||||
sub bl, 16
|
@@: cmp ah, 0xB2 ; up
|
||||||
and bl, 0x70
|
jne @f
|
||||||
and [symbol_focused], 0x8f
|
mov bl, [symbol_focused]
|
||||||
or [symbol_focused], bl
|
mov [symbol_unfocused], bl
|
||||||
stdcall draw_table, 0
|
sub bl, 16
|
||||||
call draw_codes
|
and bl, 0x70
|
||||||
jmp still
|
and [symbol_focused], 0x8f
|
||||||
|
or [symbol_focused], bl
|
||||||
@@: cmp ah, 0xB3 ; righ
|
stdcall draw_table, 0
|
||||||
jne @f
|
call draw_codes
|
||||||
mov bl, [symbol_focused]
|
jmp still
|
||||||
mov [symbol_unfocused], bl
|
|
||||||
inc bl
|
@@: cmp ah, 0xB3 ; righ
|
||||||
and bl, 0x0f
|
jne @f
|
||||||
and [symbol_focused], 0xf0
|
mov bl, [symbol_focused]
|
||||||
or [symbol_focused], bl
|
mov [symbol_unfocused], bl
|
||||||
stdcall draw_table, 0
|
inc bl
|
||||||
call draw_codes
|
and bl, 0x0f
|
||||||
jmp still
|
and [symbol_focused], 0xf0
|
||||||
jne @f
|
or [symbol_focused], bl
|
||||||
|
stdcall draw_table, 0
|
||||||
@@:
|
call draw_codes
|
||||||
jmp still
|
jmp still
|
||||||
|
jne @f
|
||||||
|
|
||||||
|
@@:
|
||||||
proc draw_table _full_redraw
|
jmp still
|
||||||
|
|
||||||
mov al, [symbol_start]
|
|
||||||
mov [symbol_current], al
|
|
||||||
|
proc draw_table _full_redraw
|
||||||
.next_button:
|
|
||||||
|
mov al, [symbol_start]
|
||||||
xor edi, edi ; character focus flag
|
mov [symbol_current], al
|
||||||
mov al, [symbol_current]
|
|
||||||
cmp al, [symbol_focused]
|
.next_button:
|
||||||
jne @f
|
|
||||||
inc edi
|
xor edi, edi ; character focus flag
|
||||||
@@: cmp [_full_redraw], 1
|
mov al, [symbol_current]
|
||||||
je .draw
|
cmp al, [symbol_focused]
|
||||||
cmp al, [symbol_focused]
|
jne @f
|
||||||
je .draw
|
inc edi
|
||||||
cmp al, [symbol_unfocused] ; previously focused, should redraw to clear focus
|
@@: cmp [_full_redraw], 1
|
||||||
je .draw
|
je .draw
|
||||||
jmp .skip ; skip button if it isn't (un)focused
|
cmp al, [symbol_focused]
|
||||||
|
je .draw
|
||||||
.draw:
|
cmp al, [symbol_unfocused] ; previously focused, should redraw to clear focus
|
||||||
call draw_button
|
je .draw
|
||||||
.skip:
|
jmp .skip ; skip button if it isn't (un)focused
|
||||||
mov bl, [symbol_start]
|
|
||||||
add bl, 127 ; end of current page
|
.draw:
|
||||||
cmp [symbol_current], bl ; the last on page?
|
call draw_button
|
||||||
jne @f
|
.skip:
|
||||||
mov [button_x], TABLE_BEGIN_X
|
mov bl, [symbol_start]
|
||||||
mov [button_y], TABLE_BEGIN_Y
|
add bl, 127 ; end of current page
|
||||||
ret
|
cmp [symbol_current], bl ; the last on page?
|
||||||
@@: inc [symbol_current]
|
jne @f
|
||||||
add [button_x], BUTTON_SPACE
|
mov [button_x], TABLE_BEGIN_X
|
||||||
cmp [button_x], BUTTON_SPACE*16+TABLE_BEGIN_X ; the last in row?
|
mov [button_y], TABLE_BEGIN_Y
|
||||||
jne .next_button
|
ret
|
||||||
add [button_y], BUTTON_SPACE ; next row
|
@@: inc [symbol_current]
|
||||||
mov [button_x], TABLE_BEGIN_X
|
add [button_x], BUTTON_SPACE
|
||||||
jmp .next_button
|
cmp [button_x], BUTTON_SPACE*16+TABLE_BEGIN_X ; the last in row?
|
||||||
ret
|
jne .next_button
|
||||||
endp
|
add [button_y], BUTTON_SPACE ; next row
|
||||||
|
mov [button_x], TABLE_BEGIN_X
|
||||||
|
jmp .next_button
|
||||||
proc draw_button
|
ret
|
||||||
mov edx, 0x80000000
|
endp
|
||||||
mov dl, [symbol_current]
|
|
||||||
add edx, BUTTON_ID_SHIFT
|
|
||||||
mov esi, 0xFFFfff
|
proc draw_button
|
||||||
mcall 8, <[button_x],BUTTON_SIDE>, <[button_y],BUTTON_SIDE>
|
mov edx, 0x80000000
|
||||||
and edx, 0x7FFFFFFF
|
mov dl, [symbol_current]
|
||||||
or edx, 0x20000000
|
add edx, BUTTON_ID_SHIFT
|
||||||
mcall
|
mov esi, 0xFFFfff
|
||||||
|
mcall 8, <[button_x],BUTTON_SIDE>, <[button_y],BUTTON_SIDE>
|
||||||
test edi, edi ; is focused?
|
and edx, 0x7FFFFFFF
|
||||||
jz .symbol ; draw only character, not selection square
|
or edx, 0x20000000
|
||||||
.focus_frame: ; draw a blue square (selection), 8 segments
|
mcall
|
||||||
mov esi, [button_x]
|
|
||||||
mov edi, [button_y]
|
test edi, edi ; is focused?
|
||||||
|
jz .symbol ; draw only character, not selection square
|
||||||
mov bx, si
|
.focus_frame: ; draw a blue square (selection), 8 segments
|
||||||
shl ebx, 16
|
mov esi, [button_x]
|
||||||
mov bx, si
|
mov edi, [button_y]
|
||||||
add bx, BUTTON_SIDE
|
|
||||||
mov cx, di
|
mov bx, si
|
||||||
shl ecx, 16
|
shl ebx, 16
|
||||||
mov cx, di
|
mov bx, si
|
||||||
mcall 38, , , FOCUS_SQUARE_COLOR
|
add bx, BUTTON_SIDE
|
||||||
add ecx, 0x00010001
|
mov cx, di
|
||||||
mcall
|
shl ecx, 16
|
||||||
add ecx, (BUTTON_SIDE-2)*0x10000+(BUTTON_SIDE-2)
|
mov cx, di
|
||||||
mcall
|
mcall 38, , , FOCUS_SQUARE_COLOR
|
||||||
add ecx, 0x00010001
|
add ecx, 0x00010001
|
||||||
mcall
|
mcall
|
||||||
|
add ecx, (BUTTON_SIDE-2)*0x10000+(BUTTON_SIDE-2)
|
||||||
mov bx, si
|
mcall
|
||||||
shl ebx, 16
|
add ecx, 0x00010001
|
||||||
mov bx, si
|
mcall
|
||||||
mov cx, di
|
|
||||||
shl ecx, 16
|
mov bx, si
|
||||||
mov cx, di
|
shl ebx, 16
|
||||||
add ecx, 2*0x10000+(BUTTON_SIDE-2)
|
mov bx, si
|
||||||
mcall 38, , ,
|
mov cx, di
|
||||||
add ebx, 0x00010001
|
shl ecx, 16
|
||||||
mcall
|
mov cx, di
|
||||||
add ebx, (BUTTON_SIDE-2)*0x10000+(BUTTON_SIDE-2)
|
add ecx, 2*0x10000+(BUTTON_SIDE-2)
|
||||||
mcall
|
mcall 38, , ,
|
||||||
add ebx, 0x00010001
|
add ebx, 0x00010001
|
||||||
mcall
|
mcall
|
||||||
|
add ebx, (BUTTON_SIDE-2)*0x10000+(BUTTON_SIDE-2)
|
||||||
.symbol:
|
mcall
|
||||||
mov ebx, [button_x]
|
add ebx, 0x00010001
|
||||||
add ebx, 9
|
mcall
|
||||||
shl ebx, 16
|
|
||||||
add ebx, [button_y]
|
.symbol:
|
||||||
add ebx, 7
|
mov ebx, [button_x]
|
||||||
mov ecx, [font_type]
|
add ebx, 9
|
||||||
mcall 4, , , symbol_current, 1
|
shl ebx, 16
|
||||||
|
add ebx, [button_y]
|
||||||
ret
|
add ebx, 7
|
||||||
endp
|
mov ecx, [font_type]
|
||||||
|
mcall 4, , , symbol_current, 1
|
||||||
|
|
||||||
proc draw_page_switcher _blinking
|
ret
|
||||||
|
endp
|
||||||
mcall 8, , , 0x8000FFAA
|
|
||||||
mov esi, 0xCCCccc
|
|
||||||
cmp [_blinking], 1 ; blinking?
|
proc draw_page_switcher _blinking
|
||||||
jne @f
|
|
||||||
mov esi, SWITCHER_BLINK_COLOR
|
mcall 8, , , 0x8000FFAA
|
||||||
@@: mcall , <2,98>, <PANEL_Y+1,23>, 0x0000FFAA
|
mov esi, 0xCCCccc
|
||||||
|
cmp [_blinking], 1 ; blinking?
|
||||||
mov ecx, 0x81000000
|
jne @f
|
||||||
mov edx, string_000_127
|
mov esi, SWITCHER_BLINK_COLOR
|
||||||
cmp [symbol_start], 0 ; first page?
|
@@: mcall , <2,98>, <PANEL_Y+1,23>, 0x0000FFAA
|
||||||
je @f
|
|
||||||
mov edx, string_128_255 ; ok, the second one
|
mov ecx, 0x81000000
|
||||||
@@: mcall 4, <10,PANEL_Y+6>,
|
mov edx, string_000_127
|
||||||
mcall , <278,PANEL_Y+6>, 0x81000000, string_ASCII_CODE
|
cmp [symbol_start], 0 ; first page?
|
||||||
|
je @f
|
||||||
ret
|
mov edx, string_128_255 ; ok, the second one
|
||||||
endp
|
@@: mcall 4, <10,PANEL_Y+6>,
|
||||||
|
mcall , <278,PANEL_Y+6>, 0x81000000, string_ASCII_CODE
|
||||||
proc draw_font_switcher
|
|
||||||
|
ret
|
||||||
mcall 8, <120,136>, <PANEL_Y+1,23>, 0x0000EEBB
|
endp
|
||||||
|
|
||||||
mov edx, string_font_small
|
proc draw_font_switcher
|
||||||
cmp [font_type], FONT_SMALL
|
|
||||||
je @f
|
mcall 8, <120,136>, <PANEL_Y+1,23>, 0x0000EEBB
|
||||||
mov edx, string_font_big
|
|
||||||
@@: mcall 4, <130,PANEL_Y+6>,,,10
|
mov edx, string_font_small
|
||||||
|
cmp [font_type], FONT_SMALL
|
||||||
ret
|
je @f
|
||||||
endp
|
mov edx, string_font_big
|
||||||
|
@@: mcall 4, <130,PANEL_Y+6>,,,10
|
||||||
|
|
||||||
proc draw_codes
|
ret
|
||||||
|
endp
|
||||||
movzx ecx, [symbol_focused]
|
|
||||||
mcall 47, 0x00030000, , <339,PANEL_Y+6>, 0x41000000, 0xAAAaaa
|
|
||||||
mcall , 0x00020100, , <508,PANEL_Y+6>,
|
proc draw_codes
|
||||||
|
|
||||||
ret
|
movzx ecx, [symbol_focused]
|
||||||
endp
|
mcall 47, 0x00030000, , <339,PANEL_Y+6>, 0x41000000, 0xAAAaaa
|
||||||
|
mcall , 0x00020100, , <508,PANEL_Y+6>,
|
||||||
|
|
||||||
quit:
|
ret
|
||||||
mcall -1
|
endp
|
||||||
|
|
||||||
|
|
||||||
szZ window_title ,'ASCIIVju'
|
quit:
|
||||||
szZ string_000_127 ,'000-127'
|
mcall -1
|
||||||
szZ string_128_255 ,'128-255'
|
|
||||||
szZ string_font_small ,'Font1 6x9 '
|
|
||||||
szZ string_font_big ,'Font2 8x14'
|
szZ window_title ,'ASCIIVju'
|
||||||
szZ string_ASCII_CODE ,'Code: Hex-Code:'
|
szZ string_000_127 ,'000-127'
|
||||||
|
szZ string_128_255 ,'128-255'
|
||||||
button_x dd 2
|
szZ string_font_small ,'Font1 6x9 '
|
||||||
button_y dd 2
|
szZ string_font_big ,'Font2 8x14'
|
||||||
|
szZ string_ASCII_CODE ,'Code: Hex-Code:'
|
||||||
font_type dd FONT_SMALL
|
|
||||||
|
button_x dd 2
|
||||||
symbol_current db 0
|
button_y dd 2
|
||||||
symbol_start db 0
|
|
||||||
|
font_type dd FONT_SMALL
|
||||||
symbol_unfocused db 0
|
|
||||||
symbol_focused db 0
|
symbol_current db 0
|
||||||
i_end:
|
symbol_start db 0
|
||||||
proc_info process_information
|
|
||||||
rb 0x400 ;stack
|
symbol_unfocused db 0
|
||||||
e_end:
|
symbol_focused db 0
|
||||||
|
i_end:
|
||||||
|
proc_info process_information
|
||||||
|
rb 0x400 ;stack
|
||||||
|
e_end:
|
Reference in New Issue
Block a user