assembly - Virtual vs. Physical Computer -
i writing little lambda-calculus program in assembly. ran virtualbox , worked perfectly, when copied code bootsector of usb-drive , booted computer it, didn't work.
i've isolated problem in initial loading of sector containing function library. here code snippet in question:
push 0x2000 pop es ;segment 0x2000 mov bx, 0x0000 ;offset mov cx, 0x0002 ;sector 2 , track 0 mov dx, 0x0080 ;drive 80 , head 0 load: mov ax, 0x0201 ;read 1 sector int 0x13 ;read sector jc load ;repeat until no error mov bx, 0x0007 mov ah, 0x0e mov al, [es:0x0000] int 0x10 ;print '!' character test if process successful (purely debugging reasons) so virtualbox nice ! show loading process successful, yet on computer gives me black space (ascii 0x00). suggestions might problem here.
i found solution problem. turns out code located in first 2 sectors of logical disk. although there 1 logical disk on usb-drive, hex editor excludes first 2048 sector of physical disk when opening logical disk. windows sees distinction, cpu it's array of bits. when loaded second sector memory, instead of loading 2050th sector (for far knew @ time second sector) data located, loaded quite correctly actual second sector containing, apart stray bits, 0x00s.
now data in correct sector, works charm.
Comments
Post a Comment