My Assembly code is longer than 512 lines but if times
' value is bigger than 512, VirtualBox gives me VERR_VD_RAW_SIZE_MODULO_512
error (and it fails to load the image file). How can I solve this?
Code:
BITS 16
disk_buffer equ 24576
mov sp, 4096d
mov ax, 7c0h
mov ds, ax
;mov ah, 09h
;mov cx, 1000h
;mov al, 20h
;mov bl, 17h
;mov bl, 07h
;int 10h
;mov ax, dialog_string_1 ; Ask if user wants app selector or command-line
;mov bx, dialog_string_2
;mov cx, dialog_string_3
;mov dx, 1 ; We want a two-option dialog box (OK or Cancel)
;call os_dialog_box
mov si, bootmsg
call printstring
;ah
;01 - waits key press, displays key
;08 - waits key press, hides key
;09 - displays strings
print_input:
call nl
mov si, inputmsg
call printstring
input:
mov ah, 00h
int 16h
cmp al, 13 ;ENTER
je proc_cmd
cmp al, 8 ;BACKSPACE
je proc_backspace
cmp al, 97 ;a
jl input
cmp al, 122 ;z
ja input
;mov ah, 00
;mov si, ax
mov si, inputkey
call printstring
jmp input
proc_cmd:
call nl
mov si, errormsg
call printstring
jmp print_input
proc_backspace:
call bs
jmp input
os_draw_block:
pusha
.more:
call os_move_cursor ; Move to block starting position
mov ah, 09h ; Draw colour section
mov bh, 0
mov cx, si
mov al, ' '
int 10h
inc dh ; Get ready for next line
mov ax, 0
mov al, dh ; Get current Y position into DL
cmp ax, di ; Reached finishing point (DI)?
jne .more ; If not, keep drawing
popa
ret
os_wait_for_key:
mov ah, 0x11
int 0x16
jnz .key_pressed
hlt
jmp os_wait_for_key
.key_pressed:
mov ah, 0x10
int 0x16
ret
os_show_cursor:
pusha
mov ch, 6
mov cl, 7
mov ah, 1
mov al, 3
int 10h
popa
ret
os_hide_cursor:
pusha
mov ch, 32
mov ah, 1
mov al, 3 ; Must be video mode for buggy BIOSes!
int 10h
popa
ret
os_move_cursor:
pusha
mov bh, 0
mov ah, 2
int 10h
popa
ret
os_draw_background:
pusha
push ax ; Store params to pop out later
push bx
push cx
mov dl, 0
mov dh, 0
call os_move_cursor
mov ah, 09h ; Draw white bar at top
mov bh, 0
mov cx, 80
mov bl, 01110000b
mov al, ' '
int 10h
mov dh, 1
mov dl, 0
call os_move_cursor
mov ah, 09h ; Draw colour section
mov cx, 1840
pop bx ; Get colour param (originally in CX)
mov bh, 0
mov al, ' '
int 10h
mov dh, 24
mov dl, 0
call os_move_cursor
mov ah, 09h ; Draw white bar at bottom
mov bh, 0
mov cx, 80
mov bl, 01110000b
mov al, ' '
int 10h
mov dh, 24
mov dl, 1
call os_move_cursor
pop bx ; Get bottom string param
mov si, bx
call printstring
mov dh, 0
mov dl, 1
call os_move_cursor
pop ax ; Get top string param
mov si, ax
call printstring
mov dh, 1 ; Ready for app text
mov dl, 0
call os_move_cursor
popa
ret
bs:
mov al, 8 ;BACKSPACE
mov ah, 0eh
int 10h
mov al, 32 ;SPACE
mov ah, 0eh
int 10h
mov al, 8 ;BACKSPACE
mov ah, 0eh
int 10h
ret
nl:
mov al, 0ah ;10
mov ah, 0eh
int 10h
mov al, 0dh ;13
mov ah, 0eh
int 10h
ret
printstring:
lodsb
cmp al, 0h
je printstring_eof
mov ah, 0eh
int 10h
jmp printstring
printstring_eof:
ret
os_init_msg db 'AdvOS a hos geldiniz', 0
os_version_msg db 'Versiyon 0.1', 0
dialog_string_1 db 'Thanks for trying out MikeOS!', 0
dialog_string_2 db 'Please select an interface: OK for the', 0
dialog_string_3 db 'program menu, Cancel for command line.', 0
bootmsg db 'AdvOS', 10, 13, 'v0.1', 0
inputmsg db '> ', 0
inputkey db 'f', 0
errormsg db 'Hata', 0
cursorp db ''
inputstring db ''
dw 0xaa55
times 450 - ($ - $$) db 0