ED: Gotten l (list) working, need to work more on d (delete) as there's a bug with deleting lines that are not line 1.
This commit is contained in:
@@ -106,39 +106,42 @@ string_join:
|
||||
ret
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; TODO
|
||||
; Converts a string to an integer
|
||||
; IN: SI = string location (max 5 chars, up to '65536')
|
||||
; OUT: AX = number
|
||||
; OUT: AX = number, DX = length of int string
|
||||
string_cast_to_int:
|
||||
pusha
|
||||
push cx
|
||||
push bx
|
||||
push dx
|
||||
xor cx,cx
|
||||
.loop:
|
||||
xor ax,ax
|
||||
lodsb
|
||||
|
||||
cmp al, 30h
|
||||
; Exit if the character is not a number
|
||||
cmp al,'0'
|
||||
jl .finish
|
||||
cmp al, 39h
|
||||
cmp al,'9'
|
||||
jg .finish
|
||||
|
||||
sub al, 30h
|
||||
|
||||
sub al, '0'
|
||||
mov bx, ax
|
||||
|
||||
mov ax, 10
|
||||
mul cx ; Multiple the current value by 10
|
||||
add ax, bx ; Then add the new digit
|
||||
mov cx, ax
|
||||
jmp .loop
|
||||
.finish:
|
||||
mov [int_tmp], cx
|
||||
popa
|
||||
mov ax, [int_tmp]
|
||||
mov ax,cx
|
||||
pop dx
|
||||
pop bx
|
||||
pop cx
|
||||
ret
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; IN: AX = integer (unsigned)
|
||||
; OUT: AX -> null-terminated string
|
||||
|
||||
string_cast_from_int:
|
||||
pusha
|
||||
cld ; Write backwards
|
||||
|
||||
Reference in New Issue
Block a user