diff --git a/bos.inc b/bos.inc index a5993e3..105995f 100644 --- a/bos.inc +++ b/bos.inc @@ -569,7 +569,7 @@ namespace bos ?return_code_flags := ti.appData+30 ; flag byte that determines how to interpret the return value of the last run program. Is to be set within the program for non-default return interpretation. ?flashStatusByte := ti.appData+31 ; 1 byte ?filesystem_driver := ti.appData+32 ; 1 byte -?copy_buffer := ti.appData+33 ; 3 bytes, points to first copy buffer entry, or -1 if nothing is stored. +?copy_buffer := ti.appData+33 ; 3 bytes, points to first copy buffer entry, or 0 if nothing is stored. ?threading_enabled := ti.appData+36 ; 1 byte, determines if software threading is enabled and whether it should be used in OS routines ?current_thread := ti.appData+37 ; 1 byte, currently running thread ID ?gfx_string_temp := ti.appData+38 ; 16 bytes, temp location for integer printing diff --git a/convert_background.py b/convert_background.py index 05e83d8..bb34d2f 100644 --- a/convert_background.py +++ b/convert_background.py @@ -14,7 +14,7 @@ def convert(fnamein, fnameout, mode=None): with Image.open(fnamein) as img: img = img.resize((320, (img.height*320)//img.width)) if img.height > 220: - img = img.crop((0, 110-img.height//2, 320, 110+img.height//2)) + img = img.crop((0, 0, 320, 220)) # img = img.convert("RGB").quantize(palette=Image.open(os.path.join(os.path.dirname(__file__), "xlibc_palette.png")).convert("P")) img = img.convert("RGB").convert("P", palette=xlibc_palette) img.save(os.path.join(tmp, "image.png")) diff --git a/src/boot.asm b/src/boot.asm index c59d8a0..d677cbd 100644 --- a/src/boot.asm +++ b/src/boot.asm @@ -443,6 +443,8 @@ os_return_soft: ; set ti.bIntOSTmr,(hl) call gfx_Set8bpp xor a,a + sbc hl,hl + ld (copy_buffer),hl call gfx_SetDraw call os_check_recovery_key diff --git a/src/data/adrive/src/fs/bin/explorer/config.asm b/src/data/adrive/src/fs/bin/explorer/config.asm index f9c84de..525e23a 100644 --- a/src/data/adrive/src/fs/bin/explorer/config.asm +++ b/src/data/adrive/src/fs/bin/explorer/config.asm @@ -79,6 +79,10 @@ explorer_configure_theme: jq nz,.display_theme_loop_skip_4b_loop jq .display_themes_loop .done_displaying_themes: + ld hl,themes_option_strings + push hl + call draw_taskbar + pop bc ; ld hl,(.smc_y) ; ld de,display_margin_left+11 ; ld bc,str_CustomTheme @@ -118,6 +122,10 @@ explorer_configure_theme: call bos.sys_WaitKeyCycle cp a,ti.skClear ret z + cp a,ti.skYequ + jq z,.custom + cp a,ti.skWindow + jq z,.background_image cp a,ti.skEnter jq z,.select cp a,ti.skUp @@ -178,123 +186,129 @@ explorer_configure_theme: pop bc,bc,bc,bc ret -; .colors: - ; db 4 dup 0 -; .exit: - ; ld c,1 - ; push bc - ; call gfx_SetDraw - ; pop bc,bc ; pop caller of explorer_configure_theme.main - ; ret -; .custom: - ; ld a,(explorer_background_color) - ; ld (.colors+0),a - ; ld a,(explorer_statusbar_color) - ; ld (.colors+1),a - ; ld a,(explorer_foreground_color) - ; ld (.colors+2),a - ; ld a,(explorer_foreground2_color) - ; ld (.colors+3),a - ; ld hl,.colors -; .customloop: - ; push hl - ; ld c,1 - ; push bc - ; call gfx_SetDraw - ; pop bc - ; ld bc,10 - ; ld (.drawbox_x_smc),bc - ; ld a,(.colors+0) - ; ld (explorer_background_color),a - ; ld a,(.colors+1) - ; ld (explorer_statusbar_color),a - ; ld a,(.colors+2) - ; ld (explorer_foreground_color),a - ; ld a,(.colors+3) - ; ld (explorer_foreground2_color),a +.background_image: + ld hl,$FF0000 + ld de,str_ImageFilePrompt + call explorer_input_file_name + jp explorer_load_config.setbackgroundimage_entryhl - ; call draw_background - ; ld a,(explorer_background_color) - ; call .drawbox - ; ld a,(explorer_statusbar_color) - ; call .drawbox - ; ld a,(explorer_foreground_color) - ; call .drawbox - ; ld a,(explorer_foreground2_color) - ; call .drawbox - ; ld c,0 - ; push bc - ; call gfx_SetColor - ; pop bc - ; ld bc,16 - ; push bc - ; ld c,60 - ; push bc - ; ld bc,0 -; .custom_selected_x:=$-3 - ; push bc - ; call gfx_HorizLine - ; pop bc,bc,bc - ; call gfx_BlitBuffer - ; ld a,20 - ; call ti.DelayTenTimesAms - ; call bos.sys_WaitKey - ; pop hl - ; cp a,ti.skRight - ; jq nz,.dontprevcolor - ; dec hl -; .dontprevcolor: - ; cp a,ti.skLeft - ; jq nz,.dontnextcolor - ; inc hl -; .dontnextcolor: - ; ld c,a - ; ld a,l - ; cp a, (.colors-1) and $FF - ; jq nz,.notunder - ; ld l, (.colors+3) and $FF -; .notunder: - ; cp a, (.colors+4) and $FF - ; jq nz,.notover - ; ld l, .colors and $FF -; .notover: - ; ld a,c - ; cp a,ti.skUp - ; jq nz,.dontdecrementcolor - ; dec (hl) -; .dontdecrementcolor: - ; cp a,ti.skDown - ; jq nz,.dontincrementcolor - ; inc (hl) -; .dontincrementcolor: - ; cp a,ti.skClear - ; jq z,.exit - ; cp a,ti.skEnter - ; jq nz,.customloop - ; call explorer_write_config - ; pop hl - ; ret c ; return to caller of explorer_configure_theme if malloc failed - ; jp (hl) ; otherwise return to caller of explorer_configure_theme.main +.colors: + db 4 dup 0 +.exit: + ld c,1 + push bc + call gfx_SetDraw + pop bc,bc ; pop caller of explorer_configure_theme.main + ret +.custom: + ld a,(explorer_background_color) + ld (.colors+0),a + ld a,(explorer_statusbar_color) + ld (.colors+1),a + ld a,(explorer_foreground_color) + ld (.colors+2),a + ld a,(explorer_foreground2_color) + ld (.colors+3),a + ld hl,.colors +.customloop: + push hl + ld c,1 + push bc + call gfx_SetDraw + pop bc + ld bc,10 + ld (.drawbox_x_smc),bc + ld a,(.colors+0) + ld (explorer_background_color),a + ld a,(.colors+1) + ld (explorer_statusbar_color),a + ld a,(.colors+2) + ld (explorer_foreground_color),a + ld a,(.colors+3) + ld (explorer_foreground2_color),a -; .drawbox: - ; ld c,a - ; push bc - ; call gfx_SetColor - ; pop bc - ; ld bc,16 - ; push bc,bc - ; ld bc,40 - ; push bc - ; ld bc,0 -; .drawbox_x_smc:=$-3 - ; push bc - ; call gfx_FillRectangle - ; pop bc,bc,bc,de - ; ld hl,(.drawbox_x_smc) - ; add hl,bc - ; inc hl - ; ld (.drawbox_x_smc),hl - ; ret + call draw_background + ld a,(explorer_background_color) + call .drawbox + ld a,(explorer_statusbar_color) + call .drawbox + ld a,(explorer_foreground_color) + call .drawbox + ld a,(explorer_foreground2_color) + call .drawbox + ld c,0 + push bc + call gfx_SetColor + pop bc + ld bc,16 + push bc + ld c,60 + push bc + ld bc,0 +.custom_selected_x:=$-3 + push bc + call gfx_HorizLine + pop bc,bc,bc + call gfx_BlitBuffer + ld a,20 + call ti.DelayTenTimesAms + call bos.sys_WaitKey + pop hl + cp a,ti.skRight + jq nz,.dontprevcolor + dec hl +.dontprevcolor: + cp a,ti.skLeft + jq nz,.dontnextcolor + inc hl +.dontnextcolor: + ld c,a + ld a,l + cp a, (.colors-1) and $FF + jq nz,.notunder + ld l, (.colors+3) and $FF +.notunder: + cp a, (.colors+4) and $FF + jq nz,.notover + ld l, .colors and $FF +.notover: + ld a,c + cp a,ti.skUp + jq nz,.dontdecrementcolor + dec (hl) +.dontdecrementcolor: + cp a,ti.skDown + jq nz,.dontincrementcolor + inc (hl) +.dontincrementcolor: + cp a,ti.skClear + jq z,.exit + cp a,ti.skEnter + jq nz,.customloop + call explorer_write_config + pop hl + ret c ; return to caller of explorer_configure_theme if malloc failed + jp (hl) ; otherwise return to caller of explorer_configure_theme.main + +.drawbox: + ld c,a + push bc + call gfx_SetColor + pop bc + ld bc,16 + push bc,bc + ld bc,40 + push bc + ld bc,0 +.drawbox_x_smc:=$-3 + push bc + call gfx_FillRectangle + pop bc,bc,bc,de + ld hl,(.drawbox_x_smc) + add hl,bc + inc hl + ld (.drawbox_x_smc),hl + ret explorer_write_config: diff --git a/src/data/adrive/src/fs/bin/explorer/data.asm b/src/data/adrive/src/fs/bin/explorer/data.asm index c7e5746..5a29a66 100644 --- a/src/data/adrive/src/fs/bin/explorer/data.asm +++ b/src/data/adrive/src/fs/bin/explorer/data.asm @@ -63,7 +63,7 @@ new_file_option_strings: .l1: db "file",0 .l2: - db "dir",0 + db "dir" .l3: ; db "link",0 .l4: @@ -71,6 +71,24 @@ new_file_option_strings: .l5: db 0 +themes_option_strings: + dl .strings + db 4 dup $C9 + db 4 dup $C9 + db 4 dup $C9 + db 4 dup $C9 + db 4 dup $C9 +.strings: + dl .l1, .l2, .l3, .l4, .l5 +.l1: + db "Custom",0 +.l2: + db "Image" +.l3: +.l4: +.l5: + db 0 + explorer_themes_default: db "BOS Blue",0,$08,$11,$FF,$07 db "BOS Green",0,$04,$02,$AF,$C7 @@ -95,12 +113,14 @@ str_NewFileNamePrompt: db "File name? ",0 str_NewDirNamePrompt: db "Directory name? ",0 +str_ImageFilePrompt: + db "Image file? ",0 ; str_NewLinkPrompt: ; db "Link file name? ",0 ; str_NewImagePrompt: ; db "Image file name? ",0 str_CustomTheme: - db "Custom Theme",0 + db "Custom",0 ; str_UsbRecvExecutable: ; db "/bin/usbrecv",0 ; str_OffExecutable: diff --git a/src/data/adrive/src/fs/bin/explorer/display.asm b/src/data/adrive/src/fs/bin/explorer/display.asm index 019e86a..3a32bc7 100644 --- a/src/data/adrive/src/fs/bin/explorer/display.asm +++ b/src/data/adrive/src/fs/bin/explorer/display.asm @@ -205,7 +205,7 @@ explorer_display_diritems: pop hl jq .dont_draw_extension .main_draw_regular_file_name: - ld b,8 + ld b,10 .main_draw_file_name_loop: ld a,(hl) or a,a diff --git a/src/data/adrive/src/fs/bin/explorer/loadconfig.asm b/src/data/adrive/src/fs/bin/explorer/loadconfig.asm index 8734087..e2ef49c 100644 --- a/src/data/adrive/src/fs/bin/explorer/loadconfig.asm +++ b/src/data/adrive/src/fs/bin/explorer/loadconfig.asm @@ -9,7 +9,9 @@ explorer_load_config: jq z,.nextline .check: push hl,bc - ld bc,.next ; push this so we can conditionally "return" to .next instead of using many conditional jumps +; push this so we can conditionally "return" to .next instead of using many conditional jumps. +; also so that we can call some of the subroutines (namely .setbackgroundimage) externally. + ld bc,.next push bc ld bc,(hl) ld (ix-3),bc @@ -212,6 +214,7 @@ str_fg2:=$-3 .setbackgroundimage: ld hl,(ix-6) +.setbackgroundimage_entryhl: push hl call bos.fs_GetFilePtr pop de diff --git a/src/data/adrive/src/fs/bin/include/bos.inc b/src/data/adrive/src/fs/bin/include/bos.inc index a5993e3..105995f 100644 --- a/src/data/adrive/src/fs/bin/include/bos.inc +++ b/src/data/adrive/src/fs/bin/include/bos.inc @@ -569,7 +569,7 @@ namespace bos ?return_code_flags := ti.appData+30 ; flag byte that determines how to interpret the return value of the last run program. Is to be set within the program for non-default return interpretation. ?flashStatusByte := ti.appData+31 ; 1 byte ?filesystem_driver := ti.appData+32 ; 1 byte -?copy_buffer := ti.appData+33 ; 3 bytes, points to first copy buffer entry, or -1 if nothing is stored. +?copy_buffer := ti.appData+33 ; 3 bytes, points to first copy buffer entry, or 0 if nothing is stored. ?threading_enabled := ti.appData+36 ; 1 byte, determines if software threading is enabled and whether it should be used in OS routines ?current_thread := ti.appData+37 ; 1 byte, currently running thread ID ?gfx_string_temp := ti.appData+38 ; 16 bytes, temp location for integer printing diff --git a/src/data/adrive/src/fs/bin/include/defines.inc b/src/data/adrive/src/fs/bin/include/defines.inc index 7661097..af93f8a 100644 --- a/src/data/adrive/src/fs/bin/include/defines.inc +++ b/src/data/adrive/src/fs/bin/include/defines.inc @@ -54,7 +54,7 @@ running_program_ptr := ti.appData+27 ; 3 bytes. Stores pointer to currently r return_code_flags := ti.appData+30 ; flag byte that determines how to interpret the return value of the last run program. Is to be set within the program for non-default return interpretation. flashStatusByte := ti.appData+31 ; 1 byte filesystem_driver := ti.appData+32 ; 1 byte -copy_buffer := ti.appData+33 ; 3 bytes, points to first copy buffer entry, or -1 if nothing is stored. +copy_buffer := ti.appData+33 ; 3 bytes, points to first copy buffer entry, or 0 if nothing is stored. threading_enabled := ti.appData+36 ; 1 byte, determines if software threading is enabled and whether it should be used in OS routines current_thread := ti.appData+37 ; 1 byte, currently running thread ID gfx_string_temp := ti.appData+38 ; 16 bytes, temp location for integer printing diff --git a/src/data/adrive/src/fs/lib/include/bos.inc b/src/data/adrive/src/fs/lib/include/bos.inc index a5993e3..105995f 100644 --- a/src/data/adrive/src/fs/lib/include/bos.inc +++ b/src/data/adrive/src/fs/lib/include/bos.inc @@ -569,7 +569,7 @@ namespace bos ?return_code_flags := ti.appData+30 ; flag byte that determines how to interpret the return value of the last run program. Is to be set within the program for non-default return interpretation. ?flashStatusByte := ti.appData+31 ; 1 byte ?filesystem_driver := ti.appData+32 ; 1 byte -?copy_buffer := ti.appData+33 ; 3 bytes, points to first copy buffer entry, or -1 if nothing is stored. +?copy_buffer := ti.appData+33 ; 3 bytes, points to first copy buffer entry, or 0 if nothing is stored. ?threading_enabled := ti.appData+36 ; 1 byte, determines if software threading is enabled and whether it should be used in OS routines ?current_thread := ti.appData+37 ; 1 byte, currently running thread ID ?gfx_string_temp := ti.appData+38 ; 16 bytes, temp location for integer printing diff --git a/src/data/adrive/src/fs/lib/include/defines.inc b/src/data/adrive/src/fs/lib/include/defines.inc index 7661097..af93f8a 100644 --- a/src/data/adrive/src/fs/lib/include/defines.inc +++ b/src/data/adrive/src/fs/lib/include/defines.inc @@ -54,7 +54,7 @@ running_program_ptr := ti.appData+27 ; 3 bytes. Stores pointer to currently r return_code_flags := ti.appData+30 ; flag byte that determines how to interpret the return value of the last run program. Is to be set within the program for non-default return interpretation. flashStatusByte := ti.appData+31 ; 1 byte filesystem_driver := ti.appData+32 ; 1 byte -copy_buffer := ti.appData+33 ; 3 bytes, points to first copy buffer entry, or -1 if nothing is stored. +copy_buffer := ti.appData+33 ; 3 bytes, points to first copy buffer entry, or 0 if nothing is stored. threading_enabled := ti.appData+36 ; 1 byte, determines if software threading is enabled and whether it should be used in OS routines current_thread := ti.appData+37 ; 1 byte, currently running thread ID gfx_string_temp := ti.appData+38 ; 16 bytes, temp location for integer printing diff --git a/src/data/buildno.txt b/src/data/buildno.txt index b6956e0..a6ca4da 100644 --- a/src/data/buildno.txt +++ b/src/data/buildno.txt @@ -1 +1 @@ -1.19.1114 alpha \ No newline at end of file +1.19.1214 alpha \ No newline at end of file diff --git a/src/gui/Input.asm b/src/gui/Input.asm index bc45c1e..02bf1b1 100644 --- a/src/gui/Input.asm +++ b/src/gui/Input.asm @@ -60,6 +60,10 @@ gui_Input: jq z,.exit cp a,54 jq z,.nextmap + cp a,ti.skGraph + jq z,.paste + cp a,ti.skTrace + jq z,.copy cp a,9 jq z,.enter jq c,.keys @@ -266,6 +270,48 @@ gui_Input: pop hl jq ._printlines +.paste: + ld hl,(ix+9) + ld bc,(ix-11) + or a,a + sbc hl,bc + jr z,.dontpaste ; no room in buffer + push hl + ld hl,(ix+6) + add hl,bc ; buffer write offset + ex hl,de + pop bc ; characters remaining in buffer + ld hl,(copy_buffer) + add hl,bc + or a,a + sbc hl,bc + jr z,.dontpaste ; nothing to paste + push bc,hl,de + call ti._strncpy + pop bc,bc,bc +.dontpaste: + jq .draw + +.copy: + ld hl,(ix+6) + push hl + call ti._strlen + inc hl + push hl + call sys_Malloc.entryhl + pop bc + ex hl,de + pop hl + jr c,.dontcopy + push de + ldir + ld hl,(copy_buffer) + call sys_Free.entryhl + pop hl + ld (copy_buffer),hl +.dontcopy: + jq .draw + .keymaps: dl .keymap_A,.keymap_a,.keymap_1,.keymap_x .keymap_A: diff --git a/src/include/bos.inc b/src/include/bos.inc index a5993e3..105995f 100644 --- a/src/include/bos.inc +++ b/src/include/bos.inc @@ -569,7 +569,7 @@ namespace bos ?return_code_flags := ti.appData+30 ; flag byte that determines how to interpret the return value of the last run program. Is to be set within the program for non-default return interpretation. ?flashStatusByte := ti.appData+31 ; 1 byte ?filesystem_driver := ti.appData+32 ; 1 byte -?copy_buffer := ti.appData+33 ; 3 bytes, points to first copy buffer entry, or -1 if nothing is stored. +?copy_buffer := ti.appData+33 ; 3 bytes, points to first copy buffer entry, or 0 if nothing is stored. ?threading_enabled := ti.appData+36 ; 1 byte, determines if software threading is enabled and whether it should be used in OS routines ?current_thread := ti.appData+37 ; 1 byte, currently running thread ID ?gfx_string_temp := ti.appData+38 ; 16 bytes, temp location for integer printing diff --git a/src/include/defines.inc b/src/include/defines.inc index 7661097..af93f8a 100644 --- a/src/include/defines.inc +++ b/src/include/defines.inc @@ -54,7 +54,7 @@ running_program_ptr := ti.appData+27 ; 3 bytes. Stores pointer to currently r return_code_flags := ti.appData+30 ; flag byte that determines how to interpret the return value of the last run program. Is to be set within the program for non-default return interpretation. flashStatusByte := ti.appData+31 ; 1 byte filesystem_driver := ti.appData+32 ; 1 byte -copy_buffer := ti.appData+33 ; 3 bytes, points to first copy buffer entry, or -1 if nothing is stored. +copy_buffer := ti.appData+33 ; 3 bytes, points to first copy buffer entry, or 0 if nothing is stored. threading_enabled := ti.appData+36 ; 1 byte, determines if software threading is enabled and whether it should be used in OS routines current_thread := ti.appData+37 ; 1 byte, currently running thread ID gfx_string_temp := ti.appData+38 ; 16 bytes, temp location for integer printing