diff --git a/src/lib/serial/asm/simple_serial_io.s b/src/lib/serial/asm/simple_serial_io.s index 60fc863d..beaa9b65 100644 --- a/src/lib/serial/asm/simple_serial_io.s +++ b/src/lib/serial/asm/simple_serial_io.s @@ -20,6 +20,7 @@ .export _simple_serial_write .export _simple_serial_flush .export simple_serial_compute_ptr_end + .export throbber_on, throbber_off, _serial_throbber_set .ifdef SIMPLE_SERIAL_DUMP .export _simple_serial_dump @@ -39,6 +40,8 @@ .segment "LOWCODE" .endif +SCRN_THROB = $0427 + ;void __fastcall__ simple_serial_puts(const char *buf) { .proc _simple_serial_puts: near jsr pushax @@ -96,21 +99,23 @@ ; void __fastcall__ simple_serial_write(const char *ptr, size_t nmemb) { .proc _simple_serial_write: near jsr simple_serial_compute_ptr_end + jsr throbber_on + bne write_check ; A not 0 there (throbber) write_again: ldy #$00 lda (ptr4),y jsr _serial_putc_direct - inc ptr4 - bne :+ + bne write_check inc ptr4+1 -: lda ptr4 +write_check: + lda ptr4 cmp ptr3 bne write_again ldx ptr4+1 cpx ptr3+1 bne write_again - rts + jmp throbber_off .endproc .proc _simple_serial_flush: near @@ -119,3 +124,30 @@ write_again: bne _simple_serial_flush rts .endproc + +_serial_throbber_set: + sta throbber_store+1 + sta throbber_on+1 + stx throbber_store+2 + stx throbber_on+2 + rts + + .code + ; Patched functions +throbber_on: + lda SCRN_THROB + sta SCREEN_CONTENTS + .ifdef __APPLE2ENH__ + lda #'C' + .else + lda #('*'|$80) + .endif + bne throbber_store +throbber_off: + lda SCREEN_CONTENTS +throbber_store: + sta SCRN_THROB + rts + + .bss +SCREEN_CONTENTS: .byte $00 diff --git a/src/lib/serial/asm/simple_serial_read.s b/src/lib/serial/asm/simple_serial_read.s index cdb047ab..8403d9c2 100644 --- a/src/lib/serial/asm/simple_serial_read.s +++ b/src/lib/serial/asm/simple_serial_read.s @@ -18,6 +18,7 @@ .export _simple_serial_read .import simple_serial_compute_ptr_end + .import throbber_on, throbber_off .import _ser_get .importzp ptr3, ptr4 @@ -33,6 +34,7 @@ ;void __fastcall__ simple_serial_read(char *ptr, size_t nmemb) { .proc _simple_serial_read: near jsr simple_serial_compute_ptr_end + jsr throbber_on lda #$00 beq check_bound @@ -57,5 +59,5 @@ check_bound: cpx ptr3+1 bne read_again_axok - rts + jmp throbber_off .endproc diff --git a/src/lib/simple_serial.h b/src/lib/simple_serial.h index f0299fcc..2f6ec39d 100644 --- a/src/lib/simple_serial.h +++ b/src/lib/simple_serial.h @@ -63,6 +63,7 @@ void __fastcall__ simple_serial_setup_no_irq_regs(void); unsigned char __fastcall__ serial_read_byte_no_irq(void); void __fastcall__ serial_putc_direct(unsigned char c); void __fastcall__ simple_serial_read(char *ptr, size_t nmemb); +void __fastcall__ serial_throbber_set(void *addr); #define tty_speed_to_str(speed) \ ((speed == SER_BAUD_2400) ? "2400": \ @@ -84,6 +85,8 @@ void simple_serial_flush_fd(int fd); #define simple_serial_configure() #define simple_serial_setup_no_irq_regs() #define simple_serial_set_irq(i) +#define serial_throbber_set(i) + unsigned char __fastcall__ simple_serial_putc(char c); char *tty_speed_to_str(int speed); void __fastcall__ simple_serial_read(char *ptr, size_t nmemb); diff --git a/src/lib/surl/asm/surl_read_with_barrier.s b/src/lib/surl/asm/surl_read_with_barrier.s index 42a7babb..0519231e 100644 --- a/src/lib/surl/asm/surl_read_with_barrier.s +++ b/src/lib/surl/asm/surl_read_with_barrier.s @@ -3,6 +3,7 @@ .import _serial_putc_direct .import _simple_serial_set_irq + .import throbber_on, throbber_off .import popax .importzp ptr3, ptr4 @@ -29,6 +30,8 @@ sta ptr4 ; Store buffer stx ptr4+1 + jsr throbber_on + ldy #0 ; Inner loop counter lda #0 @@ -46,6 +49,7 @@ bne :- ; next byte inc ptr4+1 + dex bne :- ; next page @@ -64,5 +68,5 @@ done: jsr _simple_serial_set_irq plp - rts + jmp throbber_off .endproc diff --git a/src/lib/surl/c/surl_core.c b/src/lib/surl/c/surl_core.c index 656672f3..1e31231c 100644 --- a/src/lib/surl/c/surl_core.c +++ b/src/lib/surl/c/surl_core.c @@ -43,6 +43,9 @@ char surl_connect_proxy(void) { if (proxy_opened) { return 0; } + #ifndef __CC65__ + simple_serial_read_opts(); + #endif r = simple_serial_open(); //DEBUG("connected proxy: %d\n", r); proxy_opened = (r == 0); diff --git a/src/lib/vsdrive.s b/src/lib/vsdrive.s index c7220ec2..3211a830 100644 --- a/src/lib/vsdrive.s +++ b/src/lib/vsdrive.s @@ -2,6 +2,8 @@ .import _serial_read_byte_no_irq .import serial_read_byte_no_irq_timeout .import _serial_putc_direct + .import throbber_on, throbber_off + .export _vsdrive_install, _vsdrive_uninstall .destructor _vsdrive_uninstall, 9 @@ -30,8 +32,6 @@ WPERR = $2B DATE = $BF90 ; Date storage TIME = $BF92 ; Time storage -SCRN_THROB = $0427 - .segment "RT_ONCE" _vsdrive_install: @@ -182,8 +182,7 @@ CALC_CHECKSUM: rts READFAIL: - lda SCREEN_CONTENTS ; Restore screen contents - sta SCRN_THROB + jsr throbber_off lda #IOERR sec rts @@ -195,9 +194,7 @@ READBLK: sta CURCMD ; SEND COMMAND TO PC jsr COMMAND_ENVELOPE -; Grab the screen contents, remember it - lda SCRN_THROB - sta SCREEN_CONTENTS + jsr throbber_on ; Pull and verify command envelope from host jsr serial_read_byte_no_irq_timeout ; Command envelope begin bcs READFAIL @@ -242,7 +239,6 @@ READBLK: ; READ BLOCK AND VERIFY ldx #$00 ldy #$00 - stx SCRN_THROB RDLOOP: jsr _serial_read_byte_no_irq sta (BUFLO),Y @@ -251,16 +247,13 @@ RDLOOP: inc BUFHI inx - stx SCRN_THROB cpx #$02 bne RDLOOP dec BUFHI dec BUFHI ; Bring BUFHI back down to where it belongs - lda SCREEN_CONTENTS ; Restore screen contents - sta SCRN_THROB - + jsr throbber_off jsr _serial_read_byte_no_irq ; Checksum pha ; Push checksum for now ldx #$00 @@ -274,8 +267,7 @@ RDLOOP: rts WRITEFAIL: - lda SCREEN_CONTENTS ; Restore screen contents - sta SCRN_THROB + jsr throbber_off lda #IOERR sec rts @@ -289,6 +281,8 @@ WRITEBLK: sta CURCMD jsr COMMAND_ENVELOPE + jsr throbber_on + ; WRITE BLOCK AND CHECKSUM ldx #$00 stx CHECKSUM @@ -296,8 +290,6 @@ WRBKLOOP: ldy #$00 WRLOOP: lda (BUFLO),Y -; Write screen throbber - sta SCRN_THROB jsr _serial_putc_direct iny bne WRLOOP @@ -331,6 +323,8 @@ WRLOOP: jsr _serial_read_byte_no_irq ; Checksum of block - not the command envelope cmp CHECKSUM bne WRITEFAIL + + jsr throbber_off lda #$00 clc rts @@ -364,7 +358,6 @@ VS_SLOT_DEV1: .byte $00 VS_SLOT_DEV2: .byte $00 UNIT2: .byte $00 CHECKSUM: .byte $00 -SCREEN_CONTENTS: .byte $00 TEMPDT: .byte $00,$00,$00,$00 CURCMD: .byte $00 original_driver: .byte $00,$00 diff --git a/src/mastodon/api/api.c b/src/mastodon/api/api.c index cf6566a7..643f3521 100644 --- a/src/mastodon/api/api.c +++ b/src/mastodon/api/api.c @@ -184,7 +184,7 @@ char api_interact(char *id, char type, char *action) { get_surl_for_endpoint(SURL_METHOD_POST, endpoint_buf); surl_send_data_params((uint32)0, SURL_DATA_X_WWW_FORM_URLENCODED_RAW); - /* No need to send data */ + surl_send_data_chunk(NULL, 0); surl_read_response_header(); if (surl_response_ok()) diff --git a/src/mastodon/cli/tl.c b/src/mastodon/cli/tl.c index f4c8e6e1..76e12b64 100644 --- a/src/mastodon/cli/tl.c +++ b/src/mastodon/cli/tl.c @@ -393,12 +393,6 @@ static int show_search(void) { return 0; } -static void __fastcall__ load_indicator(char on) { -#if NUMCOLS == 80 - gotoxy(LEFT_COL_WIDTH - 4, scrh - 1); - dputs(on ? "...":" "); -#endif -} /* root is either an account or status id, depending on kind. * leaf_root is a reblogged status id */ @@ -407,8 +401,6 @@ static list *build_list(char *root, char *leaf_root, char kind) { char i, found_root; char n_posts; - load_indicator(1); - l = malloc0(sizeof(list)); if (kind == SHOW_PROFILE) { @@ -445,8 +437,6 @@ static list *build_list(char *root, char *leaf_root, char kind) { } l->n_posts = n_posts; - load_indicator(0); - return l; } @@ -938,11 +928,7 @@ static char background_load(list *l) { char i; for (i = 0; i < l->n_posts; i++) { if (l->displayed_posts[i] == NULL) { - load_indicator(1); - l->displayed_posts[i] = item_get(l, i, 0); - - load_indicator(0); return 0; /* background load one by one to check kb */ } } @@ -1017,10 +1003,8 @@ static void show_list(list *l) { print_header(l, root_status, root_notif); - load_indicator(1); print_list(l, limit); limit = 0; - load_indicator(0); while (!kbhit() && background_load(l) == 0) { /* keep loading */ @@ -1377,6 +1361,7 @@ int main(int argc, char **argv) { register_start_device(); #ifdef __APPLE2ENH__ + serial_throbber_set((void *)0x07D8); videomode(VIDEOMODE_80COL); #endif diff --git a/src/surl-server/surl_protocol.h b/src/surl-server/surl_protocol.h index 6825203d..532c915c 100644 --- a/src/surl-server/surl_protocol.h +++ b/src/surl-server/surl_protocol.h @@ -3,7 +3,7 @@ /* Update in .inc too! */ #define SURL_PROTOCOL_VERSION 22 -#define VERSION "22.0.0" +#define VERSION "22.0.1" #define SURL_CLIENT_READY 0x2F #define HGR_LEN 8192U diff --git a/src/wozamp/main.c b/src/wozamp/main.c index 0c63c3be..8ec57dd1 100644 --- a/src/wozamp/main.c +++ b/src/wozamp/main.c @@ -722,6 +722,7 @@ void main(void) { #ifdef __APPLE2ENH__ videomode(VIDEOMODE_80COL); #endif + serial_throbber_set((void *)0x07F7); clrscr(); init_hgr(1); diff --git a/src/wozamp/radio-browser.c b/src/wozamp/radio-browser.c index ed2b7096..7ef63b8c 100644 --- a/src/wozamp/radio-browser.c +++ b/src/wozamp/radio-browser.c @@ -129,15 +129,6 @@ void show_radio_metadata (char *data) { cputs(value); } -static void load_indicator(char on) { -#ifdef __APPLE2ENH__ - gotoxy(77, 0); -#else - gotoxy(37, 0); -#endif - cputs(on ? "...":" "); -} - static char do_server_screen = 0; static char cmd_cb(char c) { char prev_cursor = cursor(0); @@ -300,7 +291,6 @@ static void show_results(void) { bzero((char *)HGR_PAGE, HGR_LEN); if (lines[cur_line+IDX_FAVICON][0] != '\0') { - load_indicator(1); surl_start_request(NULL, 0, lines[cur_line+IDX_FAVICON], SURL_METHOD_GET); if (surl_response_ok()) { simple_serial_putc(SURL_CMD_HGR); @@ -317,7 +307,6 @@ static void show_results(void) { } } } - load_indicator(0); } else { backup_restore_logo("r"); } diff --git a/src/woztubes/main.c b/src/woztubes/main.c index 12650d51..57f6a44c 100644 --- a/src/woztubes/main.c +++ b/src/woztubes/main.c @@ -50,15 +50,6 @@ char search_str[80] = ""; #pragma code-name(push, "LC") -static void load_indicator(char on) { -#ifdef __APPLE2ENH__ - gotoxy(76, 3); -#else - gotoxy(36, 3); -#endif - cputs(on ? "...":" "); -} - #ifdef __APPLE2ENH__ #define SEARCH_SAVE_FILE "/RAM/WTSRCH" #define LOGO_SAVE_FILE "/RAM/LOGO.HGR" @@ -148,8 +139,6 @@ static void load_video(char *host, InstanceTypeId instance_type, char *id) { strcpy(tmp_buf, id); /* Make it safe, id points to BUF_8K */ n_host = strdup(host); /* Same for host */ - load_indicator(1); - /* Build video details URL */ sprintf((char *)BUF_1K_ADDR, video_provider_get_protocol_string(instance_type, VIDEO_DETAILS_ENDPOINT), @@ -229,8 +218,6 @@ static void load_video(char *host, InstanceTypeId instance_type, char *id) { } } - load_indicator(0); - /* Peertube videos streamingPlaylists files */ if (m3u8_ptr = strstr(video_url, "-fragmented.mp4")) { /* Is there an m3u8 playlist? libav* opens them much quicker. */ @@ -254,7 +241,6 @@ static void load_video(char *host, InstanceTypeId instance_type, char *id) { } out: free(n_host); - load_indicator(0); } #pragma code-name(push, "LOWCODE") @@ -312,7 +298,6 @@ static void search_results(InstanceTypeId instance_type) { (cur_line/N_VIDEO_DETAILS)+1, n_lines/N_VIDEO_DETAILS); print_menu(); - load_indicator(1); init_text(); bzero((char *)HGR_PAGE, HGR_LEN); @@ -332,7 +317,6 @@ static void search_results(InstanceTypeId instance_type) { } } } - load_indicator(0); read_kbd: init_hgr(1); @@ -379,13 +363,10 @@ static void search(char *host, InstanceTypeId instance_type) { video_provider_get_protocol_string(instance_type, VIDEO_SEARCH_ENDPOINT), host, search_str); - load_indicator(1); - surl_start_request(NULL, 0, (char *)BUF_1K_ADDR, SURL_METHOD_GET); if (!surl_response_ok()) { clrscr(); printf("Error %d", surl_response_code()); - load_indicator(0); cgetc(); return; } @@ -395,12 +376,10 @@ static void search(char *host, InstanceTypeId instance_type) { translit_charset, SURL_HTMLSTRIP_NONE, BUF_8K_SIZE) > 0) { - load_indicator(0); search_results(instance_type); } else { clrscr(); printf("No results."); - load_indicator(0); cgetc(); } } @@ -515,6 +494,9 @@ int main(void) { backup_restore_logo("w"); #endif + serial_throbber_set((void *)0x07F7); + + screensize(&scrw, &scrh); surl_ping(); surl_user_agent = "WozTubes "VERSION"/Apple II";