Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Revert "Add VGA graphical text mode" This reverts commit f92e6b4. * started 2nd iteration of graphical text mode * fixed eslint complaints * include changes to main.js and cpu.js from f92e6b4, fix eslint error * added new methods in ScreenAdapter to DummyScreenAdapter * include changes to starter.js from f92e6b4 * changed text attribute BLINKING to FLAGS, introduced flags for BLINKING and FONT_PAGE_A * added support for cursor and blinking, made ScreenAdapter.FLAGS_* visible for VGAScreen * Variuos improvements and fixes. - improved implementation of the three display modes in ScreenAdapter - improved animation frame control (replaced "ScreenAdapter.stopped" with "cancelAnimationFrame()") - added method ScreenAdapter.grab_text_content() with documentation - fixed double-width (16px) font - improved detecting font plane 2 write access in VGAScreen (still work in progress) * fixed issues detected by eslint * fixed classical text mode * optimization: do not copy buffer to canvas when it's unmodified * invalidate all text rows when entering graphical text mode * Made sure that complete_redraw() is called whenever the state that put_char() depends on is modified. Method VGAScreen.put_char() depends on: 1. screen-wide BLINK_ENABLE bit 2. screen-wide PAGE_AB_ENABLE bit 3. VGAScreen.vga256_palette[] 4. VGAScreen.dac_mask 5. VGAScreen.dac_map For 1, 3 and 5 this was already the case. Added call to VGAScreen.complete_redraw() when PAGE_AB_ENABLE is changed. Added call to VGAScreen.complete_redraw() when VGAScreen.dac_map is changed. Added logic to mask out most significant foreground color bit if screen-wide PAGE_AB_ENABLE is true. * removed leftover comment * added new VGAScreen state variable font_page_ab_enabled to state[] * render internal font less often but more aggressively * fixed bug in ScreenAdapter.set_font_bitmap() * refactored ScreenAdapter - moved declarations of constants, member variables and methods into separate groups - moved scattered initialization code into init() method - removed redundant members and initialization code - refactored timer() method to simplify and clarify code - made control flow depend on three-state variable "mode" only * fixed bug in restoring state of graphical text: font_page was missing * restored accidentally lost cleanup code from commit f92e6b4 * narrowed scope of some variables * removed obsolete compatibility attributes from graphic_context * removed redundant initialization call to ScreenAdapter.set_mode() * allow overriding private member charmap[] to support external codepage mappings Introduce support for externally defined codepage mappings wherever charmap[] is used. - added member charmap_default[] with former content of charmap[] - made charmap[] initially point to charmap_default[] - added method set_charmap() to override or fall back to charmap_default[] * merged grab_text_content() into get_text_row()/get_text_screen() * removed comment as suggested * replaced boolean options.disable_autoscale with number options.scale options.scale defines the initial value for ScreenAdapter.scale_x and ScreenAdapter.scale_y. If undefined, options.scale defaults to 1. If options.scale is set to 0, 2x-upscale, scale_x, scale_y and HiDPI-adaption (window.devicePixelRatio) are all disabled in all three modes, they are in the responsibilty of host applications that define options.scale to be 0. * changed render_font_bitmap() to return void, reduced reallocation of font_bitmap[] * added guard to ensure that set_font_bitmap() is only called in text mode * changed text rendering method to glyph-blitting using canvas.drawImage() - replaced pixel-drawing with glyph-blitting - removed graphical_text_buffer - added 3 OffscreenCanvas objects for font bitmap, screen canvas and row helper - left state of canvas context ScreenAdapter.graphic_context untouched * improved cursor rendering * improved foreground color handling * minor changes * improved rendering of invisible glyphs An invisible glyph could be an ASCII Space (0x20) or Null (0x0) character, or any other empty glyph loaded into the VGA's font memory. Invisible glyphs (which are not rare) are currently drawn to the canvas exactly like regular glyphs, this patch handles that more efficiently. - added array with per-glyph visibility attribute - added invisible glyph detection in render_font_bitmap() - instead of drawing invisible glyphs in render_changed_rows(), now erase whole row buffer once per row and just skip invisible glyphs - removed one nested loop from render_font_bitmap() Characters hidden on screem caused by their blink attribute (rare) are also treated as invisible. * improved vga bit handling readabilty
- Loading branch information