void tui_display(int x, int y, int len, const char *format, ...) { BYTE attr_byte = (BYTE)current_attr; unsigned long addr = screen_addr(x, y); char *buf; int i, buf_len; va_list vl; va_start(vl, format); buf = lib_mvsprintf(format, vl); buf_len = strlen(buf); if (len == 0) len = buf_len; else if (buf_len > len) buf_len = len; _farsetsel(_dos_ds); for (i = 0; i < buf_len; i++) { _farnspokeb(addr, buf[i]); _farnspokeb(addr + 1, attr_byte); addr += 2; } for (; i < len; i++) { _farnspokeb(addr, ' '); _farnspokeb(addr + 1, attr_byte); addr += 2; } lib_free(buf); }
void direct_stereo_sample8_handler(void) { uae_u32 data0 = audio_channel[0].current_sample; uae_u32 data1 = audio_channel[1].current_sample; uae_u32 data2 = audio_channel[2].current_sample; uae_u32 data3 = audio_channel[3].current_sample; DO_CHANNEL_1 (data0, 0); DO_CHANNEL_1 (data1, 1); DO_CHANNEL_1 (data2, 2); DO_CHANNEL_1 (data3, 3); data0 &= audio_channel[0].adk_mask; data1 &= audio_channel[1].adk_mask; data2 &= audio_channel[2].adk_mask; data3 &= audio_channel[3].adk_mask; data0 += data3; { uae_u32 data = SBASEVAL8(1) + data0; FINISH_DATA (8, 1); _farnspokeb(direct_sndbufpt++, data); } data1 += data2; { uae_u32 data = SBASEVAL8(1) + data1; FINISH_DATA (8, 1); _farnspokeb(direct_sndbufpt++, data); } direct_check_sound_buffers(); eventtab[ev_sample].evtime = cycles + sample_evtime; eventtab[ev_sample].oldcycles = cycles; }
void tui_put_char(int x, int y, BYTE c) { unsigned long addr = screen_addr(x, y); BYTE attr_byte = (BYTE)current_attr; _farsetsel(_dos_ds); if (c>127) _farnspokeb(addr, tui_ascii_conversion_table[c-128]); else _farnspokeb(addr, c); _farnspokeb(addr + 1, attr_byte); }
void tui_vline(int x, int y, BYTE c, int count) { unsigned long addr = screen_addr(x, y); BYTE attr_byte = (BYTE)current_attr; int i; _farsetsel(_dos_ds); for (i = 0; i < count; i++) { _farnspokeb(addr, c); _farnspokeb(addr + 1, attr_byte); addr += tui_num_cols(); } }
void vm_xputs(char x, char y, char attr, char *str) { char ofs; ofs = 0; while (*str) { unsigned long address; address = vm_screenaddress(x + ofs, y); _farnspokeb(address, *str); _farnspokeb(address + 1L, attr); str++; ofs++; } }
void putpixel(int x, int y, char col) { lwpEnterCriticalSection(); _farnspokeb(0xA0000+x+(y<<6)+(y<<8), col); lwpLeaveCriticalSection(); }
void fb_hFarMemSet(unsigned short selector, unsigned long dest, unsigned char char_to_set, size_t bytes) { unsigned long addr = dest; int i; _farsetsel(selector); for (i = 0; i < bytes; i++, addr++) { _farnspokeb(addr, char_to_set); } }
void tui_make_shadow(int x, int y, int width, int height) { int i, j; _farsetsel(_dos_ds); for (i = 0; i < height; i++) { int addr = screen_addr(x, y + i) + 1; for (j = 0; j < width; j++, addr += 2) { _farnspokeb(addr, make_attr(DARKGRAY, BLACK, 0)); } } }
void tui_area_put(tui_area_t a, int x, int y) { BYTE *p = a->mem; int i, j; _farsetsel(_dos_ds); for (i = 0; i < a->height; i++) { int addr = screen_addr(x, y + i); for (j = 0; j < 2 * a->width; j++) _farnspokeb(addr + j, *(p++)); } }
static void driver_update(void) { int plane; unsigned long screen; unsigned char *buffer; int x, y; _farsetsel(_dos_ds); for (plane = 0; plane < 4; plane++) { buffer = (unsigned char *)__fb_gfx->framebuffer + plane; outportw(SC_INDEX, (0x100 << plane) | 0x02); /* set write plane */ screen = 0xA0000; for (y = 0; y < fb_dos.h; y++) { if (__fb_gfx->dirty[y]) { for (x = 0; x < fb_dos.w; x += 4, screen++) { _farnspokeb(screen, buffer[x]); } } else { screen += fb_dos.w / 4; } buffer += fb_dos.w; } } }
/* Copy data into the clipboard, return zero if successful. */ unsigned set_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw) { __dpmi_regs regs; unsigned truelen; unsigned long xbuf_addr, buf_offset; unsigned char *dp = Data, *dstart = dp; if (Format != CF_OEMTEXT) return 3; /* need to know final size after '\r' chars are inserted (the standard CF_OEMTEXT clipboard format uses CRLF line endings, while Emacs uses just LF internally). */ truelen = Size + 1; /* +1 for the terminating null */ if (!Raw) { /* avoid using strchr because it recomputes the length everytime */ while ((dp = memchr (dp, '\n', Size - (dp - dstart))) != 0) { truelen++; dp++; } } if (clipboard_compact (truelen) < truelen) return 1; if ((xbuf_addr = alloc_xfer_buf (truelen)) == 0) return 1; /* Move the buffer into the low memory, convert LF into CR-LF if needed. */ if (Raw) { dosmemput (Data, Size, xbuf_addr); /* Terminate with a null, otherwise Windows does strange things when the text size is an integral multiple of 32 bytes. */ _farpokeb (_dos_ds, xbuf_addr + Size, '\0'); } else { dp = Data; buf_offset = xbuf_addr; _farsetsel (_dos_ds); while (Size--) { /* Don't allow them to put binary data into the clipboard, since it will cause yanked data to be truncated at the first null. */ if (*dp == '\0') return 2; if (*dp == '\n') _farnspokeb (buf_offset++, '\r'); _farnspokeb (buf_offset++, *dp++); } /* Terminate with a null, otherwise Windows does strange things when the text size is an integral multiple of 32 bytes. */ _farnspokeb (buf_offset, '\0'); } /* Stash away the data we are about to put into the clipboard, so we could later check inside get_clipboard_data whether the clipboard still holds our data. */ if (clipboard_storage_size < truelen) { clipboard_storage_size = truelen + 100; last_clipboard_text = (char *) xrealloc (last_clipboard_text, clipboard_storage_size); } if (last_clipboard_text) dosmemget (xbuf_addr, truelen, last_clipboard_text); /* Calls Int 2Fh/AX=1703h with: DX = WinOldAp-Supported Clipboard format ES:BX = Pointer to data SI:CX = Size of data in bytes Return Values AX == 0: Error occurred <> 0: OK. Data copied into the Clipboard. */ regs.x.ax = 0x1703; regs.x.dx = Format; regs.x.si = truelen >> 16; regs.x.cx = truelen & 0xffff; regs.x.es = xbuf_addr >> 4; regs.x.bx = xbuf_addr & 15; __dpmi_int (0x2f, ®s); free_xfer_buf (); /* If the above failed, invalidate the local copy of the clipboard. */ if (regs.x.ax == 0) *last_clipboard_text = '\0'; /* Zero means success, otherwise (1, 2, or 3) it's an error. */ return regs.x.ax > 0 ? 0 : 3; }