mirror of
https://github.com/Ed94/bare_x86.git
synced 2025-02-02 09:13:49 -08:00
cleanup of out_dump routine
This commit is contained in:
parent
7a6799d2c7
commit
fb3b3aa33d
BIN
16bit.Scratch
BIN
16bit.Scratch
Binary file not shown.
@ -21,6 +21,8 @@
|
|||||||
;=============================================================================================================
|
;=============================================================================================================
|
||||||
start:
|
start:
|
||||||
Video_SetTextMode_80x25
|
Video_SetTextMode_80x25
|
||||||
|
; Video_SetGraphicsMode_320x200
|
||||||
|
; Video_SetGraphicsMode_640x200
|
||||||
|
|
||||||
; Exclusive-OR (xor'ing a value to itself zeros the value)
|
; Exclusive-OR (xor'ing a value to itself zeros the value)
|
||||||
xor AX, AX
|
xor AX, AX
|
||||||
@ -42,11 +44,11 @@ int SystemService
|
|||||||
|
|
||||||
; Hex Testing
|
; Hex Testing
|
||||||
String_Out HexTest, [HexTest_len]
|
String_Out HexTest, [HexTest_len]
|
||||||
Hex16_ToString [HexNum], HexString
|
Hex16_ToString [HexNumA], HexStringA
|
||||||
Hex16_ToString [HexNumT], HexStringT
|
Hex16_ToString [HexNumB], HexStringB
|
||||||
String_Out ResultStr, [ResultStr_len]
|
String_Out ResultStr, [ResultStr_len]
|
||||||
String_Out HexString, 4
|
String_Out HexStringA, 4
|
||||||
String_Out HexStringT, 4
|
String_Out HexStringB, 4
|
||||||
|
|
||||||
mov AH, BIOS_Wait
|
mov AH, BIOS_Wait
|
||||||
mov CX, 0x10
|
mov CX, 0x10
|
||||||
@ -55,84 +57,13 @@ int SystemService
|
|||||||
Char_Out char_LF
|
Char_Out char_LF
|
||||||
Char_Out char_CR
|
Char_Out char_CR
|
||||||
|
|
||||||
mov BX, 0x7C00
|
DumpOut 0x7C00, 512
|
||||||
; sub BX, 0x7DFF
|
|
||||||
; mov BX, 0x0000
|
|
||||||
mov DX, 512
|
|
||||||
call dump_out
|
|
||||||
|
|
||||||
; Idle
|
; Idle
|
||||||
hang :
|
hang :
|
||||||
jmp short hang
|
jmp short hang
|
||||||
|
|
||||||
|
|
||||||
dump_out:
|
|
||||||
; Args:
|
|
||||||
; BX = StartLocation
|
|
||||||
; CX = ByteCount
|
|
||||||
%define StartLocation BX
|
|
||||||
%define ByteCount DX
|
|
||||||
push BX
|
|
||||||
push SI
|
|
||||||
; xor BX, BX
|
|
||||||
xor SI, SI
|
|
||||||
|
|
||||||
.loop:
|
|
||||||
cmp SI, ByteCount
|
|
||||||
je .break
|
|
||||||
|
|
||||||
|
|
||||||
push BX
|
|
||||||
push DX
|
|
||||||
push SI
|
|
||||||
mov AX, StartLocation
|
|
||||||
add AX, SI
|
|
||||||
|
|
||||||
Hex16_ToString AX, .HexStr
|
|
||||||
String_Out .HexStr, 4
|
|
||||||
|
|
||||||
pop SI
|
|
||||||
pop DX
|
|
||||||
pop BX
|
|
||||||
|
|
||||||
mov AH, [StartLocation + SI]
|
|
||||||
add SI, 1
|
|
||||||
|
|
||||||
mov AL, [StartLocation + SI]
|
|
||||||
mov [.HexNum], AX
|
|
||||||
|
|
||||||
push BX
|
|
||||||
push DX
|
|
||||||
push SI
|
|
||||||
Char_Out ' '
|
|
||||||
|
|
||||||
Hex16_ToString [.HexNum], .HexStr
|
|
||||||
String_Out .HexStr, 4
|
|
||||||
pop SI
|
|
||||||
pop DX
|
|
||||||
pop BX
|
|
||||||
|
|
||||||
Char_Out ' '
|
|
||||||
|
|
||||||
mov AH, BIOS_Wait
|
|
||||||
mov CX, 0x02
|
|
||||||
int SystemService
|
|
||||||
|
|
||||||
; add SI, 4
|
|
||||||
inc SI
|
|
||||||
jmp .loop
|
|
||||||
|
|
||||||
.break:
|
|
||||||
pop SI
|
|
||||||
pop BX
|
|
||||||
ret
|
|
||||||
|
|
||||||
.HexNum : dw 0x0000
|
|
||||||
.HexStr : dw ' '
|
|
||||||
%undef StartLocation
|
|
||||||
%undef WordCount
|
|
||||||
|
|
||||||
|
|
||||||
%include "AAL.x86.routines.s"
|
%include "AAL.x86.routines.s"
|
||||||
|
|
||||||
|
|
||||||
@ -145,10 +76,10 @@ TestStr_len : dw 13
|
|||||||
HexTest : db 'Hex Test', char_LF, char_CR
|
HexTest : db 'Hex Test', char_LF, char_CR
|
||||||
HexTest_len : dw 10
|
HexTest_len : dw 10
|
||||||
|
|
||||||
HexNum : dw 0x1994
|
HexNumA : dw 0x1994
|
||||||
HexNumT : dw 0x2022
|
HexNumB : dw 0x2022
|
||||||
HexString : db '0000'
|
HexStringA : db '0000'
|
||||||
HexStringT : db '0000'
|
HexStringB : db '0000'
|
||||||
|
|
||||||
ResultStr : db 'Result: '
|
ResultStr : db 'Result: '
|
||||||
ResultStr_len : db 8
|
ResultStr_len : db 8
|
||||||
|
@ -12,10 +12,28 @@
|
|||||||
int VideoService
|
int VideoService
|
||||||
%endmacro
|
%endmacro
|
||||||
|
|
||||||
|
%macro Video_SetGraphicsMode_320x200 0
|
||||||
|
mov AH, Video_SetMode
|
||||||
|
mov AL, VideoMode_Graphics_320x200
|
||||||
|
int VideoService
|
||||||
|
%endmacro
|
||||||
|
|
||||||
|
%macro Video_SetGraphicsMode_640x200 0
|
||||||
|
mov AH, Video_SetMode
|
||||||
|
mov AL, VideoMode_Graphics_640x200
|
||||||
|
int VideoService
|
||||||
|
%endmacro
|
||||||
|
|
||||||
;=============================================================================================================
|
;=============================================================================================================
|
||||||
; Routines
|
; Routines
|
||||||
;=============================================================================================================
|
;=============================================================================================================
|
||||||
|
|
||||||
|
%macro DumpOut 2
|
||||||
|
mov BX, %1
|
||||||
|
mov DX, %2
|
||||||
|
call out_Dump
|
||||||
|
%endmacro
|
||||||
|
|
||||||
%macro Hex16_ToString 2
|
%macro Hex16_ToString 2
|
||||||
mov DX, %1
|
mov DX, %1
|
||||||
mov CX, %2
|
mov CX, %2
|
||||||
@ -25,10 +43,9 @@ call h16_toString
|
|||||||
%endmacro
|
%endmacro
|
||||||
|
|
||||||
%macro Char_Out 1
|
%macro Char_Out 1
|
||||||
mov AX, %1
|
mov AH, Video_TeleType
|
||||||
push AX
|
mov AL, %1
|
||||||
call out_char
|
int VideoService
|
||||||
pop AX
|
|
||||||
%endmacro
|
%endmacro
|
||||||
|
|
||||||
%macro String_Out 2
|
%macro String_Out 2
|
||||||
|
@ -7,6 +7,67 @@
|
|||||||
; Routines
|
; Routines
|
||||||
;=============================================================================================================
|
;=============================================================================================================
|
||||||
|
|
||||||
|
out_Dump:
|
||||||
|
; Args:
|
||||||
|
; BX = StartLocation
|
||||||
|
; CX = ByteCount
|
||||||
|
%define StartLocation BX
|
||||||
|
%define ByteCount DX
|
||||||
|
push BX
|
||||||
|
push SI
|
||||||
|
xor SI, SI
|
||||||
|
|
||||||
|
.loop:
|
||||||
|
cmp SI, ByteCount
|
||||||
|
je .break
|
||||||
|
|
||||||
|
|
||||||
|
push BX
|
||||||
|
push DX
|
||||||
|
push SI
|
||||||
|
mov AX, StartLocation
|
||||||
|
add AX, SI
|
||||||
|
Hex16_ToString AX, .HexStr
|
||||||
|
String_Out .HexStr, 4
|
||||||
|
pop SI
|
||||||
|
pop DX
|
||||||
|
pop BX
|
||||||
|
Char_Out ' '
|
||||||
|
|
||||||
|
; Get next set of byte, organize to big endian.
|
||||||
|
mov AH, [StartLocation + SI]
|
||||||
|
add SI, 1
|
||||||
|
mov AL, [StartLocation + SI]
|
||||||
|
mov [.HexNum], AX
|
||||||
|
|
||||||
|
push BX
|
||||||
|
push DX
|
||||||
|
push SI
|
||||||
|
Hex16_ToString [.HexNum], .HexStr
|
||||||
|
String_Out .HexStr, 4
|
||||||
|
pop SI
|
||||||
|
pop DX
|
||||||
|
pop BX
|
||||||
|
Char_Out ' '
|
||||||
|
|
||||||
|
mov AH, BIOS_Wait
|
||||||
|
mov CX, 0x02
|
||||||
|
int SystemService
|
||||||
|
|
||||||
|
inc SI
|
||||||
|
jmp .loop
|
||||||
|
|
||||||
|
.break:
|
||||||
|
pop SI
|
||||||
|
pop BX
|
||||||
|
ret
|
||||||
|
|
||||||
|
.HexNum : dw 0x0000
|
||||||
|
.HexStr : dw ' '
|
||||||
|
%undef StartLocation
|
||||||
|
%undef ByteCount
|
||||||
|
|
||||||
|
|
||||||
; Prints out a 16-bit hex value.
|
; Prints out a 16-bit hex value.
|
||||||
h16_toString:
|
h16_toString:
|
||||||
; Arg - DX : Hex Num
|
; Arg - DX : Hex Num
|
||||||
@ -59,23 +120,6 @@ h16_toString:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
; Print out an ASCII character.
|
|
||||||
out_char:
|
|
||||||
%define arg1 BP + 6
|
|
||||||
push BX
|
|
||||||
push BP
|
|
||||||
mov BP, SP
|
|
||||||
|
|
||||||
mov AH, Video_TeleType
|
|
||||||
mov AL, [arg1]
|
|
||||||
int VideoService
|
|
||||||
|
|
||||||
pop BP
|
|
||||||
pop BX
|
|
||||||
%undef arg1
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
; Print out an ascii string of speicifed length
|
; Print out an ascii string of speicifed length
|
||||||
out_string:
|
out_string:
|
||||||
; Arg - BX: String
|
; Arg - BX: String
|
||||||
|
Loading…
x
Reference in New Issue
Block a user