DragonVM/extra/dss/bios/display.dss
2024-09-17 07:32:24 +02:00

160 lines
No EOL
4.3 KiB
Text

@guard _DISPLAY_INFO_DSS_
.code
_print_string_text16: ## _print_string(String* str, Text16VModeCell* cell)
arg R1 ## @Param: String addr
arg R2 ## @Param: Cell addr
_print_string_text16_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_text16_loop, 0 ## Jump if current character is not 0 (NULL_TERM)
ret
_print_integer_text16: ## _print_integer_text16(int16_t number, TextCell16* cell)
arg ACC ## @Param: number
arg R2 ## @Param: cell
mov R3, R2
addip R3, 3 ## R3 is now a pointer to the X coord in the cell
mov R1, 0
jne $_print_integer_text16_loop, 0
push 48 ## '0' ASCII is 48
inc R1
jmp $_print_integer_text16_loop_end
_print_integer_text16_loop:
jeq $_print_integer_text16_loop_end, 0
divipu ACC, 10
addipu RV, 48
push RV
inc R1
jmp $_print_integer_text16_loop
_print_integer_text16_loop_end:
pop R4 ## Put next char in R4
dec R1
movb *R2, R4 ## Store next char in first byte of cell
mov R10, 0x21 ## int 0x30 param for write vram
mov R9, R2 ## int 0x30 param for textCell16
int 0x30
debug_break
movb R5, *R3 ## Retrieve current X coord from cell
inc R5 ## Increment X coord
movb *R3, R5 ## Store new X coord in cell
mov ACC, R1
jne $_print_integer_text16_loop_end, 0
ret
_print_integer_signle_color:
mov R1, 0
arg ACC
jne $_print_integer_signle_color_loop, 0
push 48 ## '0' ASCII is 48
inc R1
jmp $_print_integer_signle_color_loop_end
_print_integer_signle_color_loop:
jeq $_print_integer_signle_color_loop_end, 0
divipu ACC, 10
addipu RV, 48
push RV
inc R1
jmp $_print_integer_signle_color_loop
_print_integer_signle_color_loop_end:
pop R9
dec R1
movb [VGA_Registers.TEXT_SINGLE_CHAR], R9
movb [VGA_Registers.SIGNAL], reg(S_REG_1)
mov ACC, R1
jne $_print_integer_signle_color_loop_end, 0
ret
_print_machine_info_signle_color:
mov R9, $_bios_logo_2_line_1
mov R10, 0x0C
int 0x30 ## Print Next Logo Line
mov R10, 0x02
int 0x30 ## Print New Line
mov R9, $_bios_logo_2_line_2
mov R10, 0x0C
int 0x30 ## Print Next Logo Line
mov R10, 0x01
mov R9, 32
int 0x30 ## Print ' ' character
mov R10, 0x0B
int 0x30 ## Invert colors
mov R10, 0x0C
mov R9, $_bios_name
int 0x30 ## Print BIOS Name
mov R10, 0x04
mov R9, [$_bios_version_number_maj]
int 0x30 ## Print BIOS Version (Major)
mov R10, 0x01
mov R9, 46
int 0x30 ## Print '.' character
mov R10, 0x04
mov R9, [$_bios_version_number_min]
int 0x30 ## Print BIOS Version (Minor)
mov R10, 0x0B
int 0x30 ## Invert colors
mov R10, 0x02
int 0x30 ## Print New Line
mov R9, $_bios_logo_2_line_3
mov R10, 0x0C
int 0x30 ## Print Next Logo Line
mov R10, 0x0C
mov R9, $_clock_str
int 0x30 ## Print Clock label
mov R10, 0x04
mov R9, [CMOS_Settings.CLOCK_SPEED]
int 0x30 ## Print Clock speed
mov R10, 0x0C
mov R9, $_hz_str
int 0x30 ## Print hz label
mov R10, 0x02
int 0x30 ## Print New Line
mov R9, $_bios_logo_2_line_4
mov R10, 0x0C
int 0x30 ## Print Next Logo Line
mov R10, 0x0C
mov R9, $_mem_str
int 0x30 ## Print Memory label
mov R10, 0x04
mov R9, [CMOS_Settings.MEM_START]
int 0x30 ## Print Memory start
mov R10, 0x01
mov R9, 47
int 0x30 ## Print '/' character
mov R10, 0x04
mov R9, [CMOS_Settings.MEM_SIZE]
int 0x30 ## Print Memory size
mov R10, 0x0C
mov R9, $_byte_str
int 0x30 ## Print bytes label
mov R10, 0x02
int 0x30 ## Print New Line
mov R9, $_bios_logo_2_line_5
mov R7, 4
mov ACC, 19
_print_machine_info_logo_signle_color_loop:
inc R7
mov R10, 0x0C
int 0x30 ## Print Next Logo Line
addip R9, 54 ## 54 is the length of a line
mov R10, 0x02
int 0x30 ## Print New Line
jls $_print_machine_info_logo_signle_color_loop, R7
ret