Added way to print a string in text16 mode

This commit is contained in:
OmniaX 2024-09-15 13:26:05 +02:00
parent bf4662e4b4
commit 69d9f49361
7 changed files with 59 additions and 6 deletions

View file

@ -4,10 +4,10 @@ CMOS = dragon/cmos.dr
cpuext = extmov, extalu cpuext = extmov, extalu
fixed_clock = false fixed_clock = false
clock_rate_sec = 2000 clock_rate_sec = 5000
memory_extension_pages = 16 memory_extension_pages = 16
screen_redraw_rate_per_second = 50 screen_redraw_rate_per_second = 10
SingleColor_foreground = #009900FF SingleColor_foreground = #009900FF
SingleColor_background = #111111FF SingleColor_background = #111111FF

Binary file not shown.

Binary file not shown.

View file

@ -5,13 +5,19 @@
@include <palette.dss> @include <palette.dss>
@include <disk.dss> @include <disk.dss>
.data .data
$string "Hello " $string "Hello "
$ddd <DiskDriverData> $ddd <DiskDriverData>
$dpt_block <DPTBlock> $dpt_block <DPTBlock>
$textCell <Text16VModeCell> $textCell <Text16VModeCell>
.code .code
_drake_bootsector_entry_point: _drake_bootsector_entry_point:
push 0 push 0
call $_load_dpt_block call $_load_dpt_block
@ -22,10 +28,37 @@ _drake_bootsector_entry_point:
push 2 push 2
call $_draw_palette call $_draw_palette
## mov R9, { $dpt_block + DPTStructure.ENTRIES_START + (2 * DPTStructure.ENTRY_SIZE_B) + DPTStructure.ENTRY_PART_LBL }
movb [$textCell.CoordX], 2
movb [$textCell.CoordY], 2
movb [$textCell.Foreground], DefaultPalette.Orange
movb [$textCell.Background], DefaultPalette.Black
push $string
push $textCell
push 2
call $_print_string
movb [$textCell.CoordX], 8
movb [$textCell.CoordY], 2
movb [$textCell.Foreground], DefaultPalette.Black
movb [$textCell.Background], DefaultPalette.Orange
push { $dpt_block + DPTStructure.ENTRIES_START + (2 * DPTStructure.ENTRY_SIZE_B) + DPTStructure.ENTRY_PART_LBL }
push $textCell
push 2
call $_print_string
hlt hlt
_load_dpt_block: _load_dpt_block:
mov [$ddd.Mode], DiskMode.READ mov [$ddd.Mode], DiskMode.READ
mov [$ddd.Disk], 0x00 mov [$ddd.Disk], 0x00
@ -40,5 +73,26 @@ _load_dpt_block:
_print_string: ## _print_string(String* str, Text16VModeCell* cell)
arg R1 ## @Param: String addr
arg R2 ## @Param: Cell addr
_print_string_loop:
mov R6, R2 ## Restore Cell addr
movb *R6, *R1 ## Move next character into cell
inc R1 ## Point address to next character
addip R6, 3 ## Offset to X coord of cell
movb R7, *R6 ## Store X coord in R7
inc R7 ## Increment X coord
movb *R6, R7 ## Store new X coord in cell
mov R10, 0x21 ## int 0x30 parameter for print_char_text16
mov R9, R2 ## int 0x30 parameter for text_cell address
int 0x30 ## bios_video_int
movb ACC, *R1 ## Copy current character in ACC
jne $_print_string_loop, 0 ## Jump if current character is not 0 (NULL_TERM)
ret
.fixed 5120, 0xFF .fixed 5120, 0xFF

View file

@ -41,6 +41,5 @@ _draw_palette_loop:
inc R5 inc R5
mov ACC, R5 mov ACC, R5
debug_break
jge $_draw_palette_loop, 15 jge $_draw_palette_loop, 15
ret ret

View file

@ -378,7 +378,7 @@ namespace dragon
avg_count++; avg_count++;
avg_tot += _time; avg_tot += _time;
s_avgInstTime = (uint64_t)std::round(avg_tot / avg_count); s_avgInstTime = (uint64_t)std::round(avg_tot / avg_count);
// out.fg(ostd::ConsoleColors::Red).p(s_avgInstTime).nl().reset(); // out.fg(ostd::ConsoleColors::Red).p(getAvgClockSpeed()).nl().reset();
acc = 0; acc = 0;
} }
if (acc2 == (1000 / screenRedrawRate)) if (acc2 == (1000 / screenRedrawRate))