flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > OS Construction > jmp [es:bx] - error: operand size not specified.

Author
Thread Post new topic Reply to topic
nkeck72



Joined: 28 May 2015
Posts: 78
Location: 0000:7C00
jmp [es:bx] - error: operand size not specified.
When I am creating a bootloader for a floppy disk to write an operating system, and i need to load the next sector, i try something like this right?

Code:

;begin loading the next sector of boot code
mov ah02h
mov al01d
mov ch00h
mov dh00h
mov cl01h
mov dl00h
mov bx04FEh
mov esbx
mov bx0000h
int 13h
mov ah01h
int 13h
cmp al00h
jne diskerr



Then i try to jump to the code:

Code:

;jump to next 512 bytes of code
mov bx04FEh
mov esbx
mov bx0000h
jmp [es:bx]



When i try to compile this, fasm fails with the message:
flat assembler version 1.71.39 (16384 kilobytes memory)
noahos.asm [62]:
jmp [es:bx]
error: operand size not specified.


A little help please?
-SOS from Noah

_________________
It may look hard, but it won't take long if you take it one byte at a time.

NOS: www.github.com/nkeck720/nos


Code:

org 100h
mov ah09h
mov dxmessage
int 21h
int 20h

message db "Hello FASM world!"0Dh0Ah"$"


Post 28 May 2015, 20:36
View user's profile Send private message Visit poster's website Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3415
Location: Bulgaria

Code:
; what you need?

jmp  far [es:bx]

; or 

jmp near [es:bx]

Post 28 May 2015, 21:04
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
nkeck72



Joined: 28 May 2015
Posts: 78
Location: 0000:7C00
I'll try that. This is my first OS so i have never had to jump to RAM addresses.
Post 28 May 2015, 21:07
View user's profile Send private message Visit poster's website Reply with quote
nkeck72



Joined: 28 May 2015
Posts: 78
Location: 0000:7C00
Went to test this:

Code:

;jump to next 512 bytes of code
mov bx04FEh
mov esbx
mov bx0000h
jmp  far [es:bx]



and Dosemu (using for testing) spits this at me after loading the sector:

Quote:

ERROR: unexpected CPU exception 0x06 err=0x00000000 cr2=00000000 while in vm86 (DOS)
Program=sigsegv.c, Line=175
EIP: 0000:00007d01 ESP: 0030:000000fe VFLAGS(b): 00000 00000010 10010111
EAX: 0000f5db EBX: 00000000 ECX: 00000000 EDX: 00000000 VFLAGS(h): 00000297
ESI: 00000008 EDI: 00000006 EBP: 00000000 DS: 0040 ES: 0000 FS: 0000 GS: 0000
FLAGS: CF PF AF SF IF RF VM VIF IOPL: 0
STACK: c1 00 ff 47 00 f8 02 02 61 e0 -> 0a 6d 00 00 00 00 00 00 00 00
OPS : 2c 20 30 39 68 0a 6d 6f 76 20 -> 63 78 2c 20 38 30 64 0a 6d 6f
63782c 0000:7d01 arpl [bx+si+2C],ax


_________________
It may look hard, but it won't take long if you take it one byte at a time.

NOS: www.github.com/nkeck720/nos


Code:

org 100h
mov ah09h
mov dxmessage
int 21h
int 20h

message db "Hello FASM world!"0Dh0Ah"$"


Post 28 May 2015, 21:11
View user's profile Send private message Visit poster's website Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3415
Location: Bulgaria
@nkeck72: Before writing OS, isn't it better to learn assembly language the easy way - by writing some applications for existing OS, where you will have normal debuggers?
Post 28 May 2015, 21:15
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
nkeck72



Joined: 28 May 2015
Posts: 78
Location: 0000:7C00
I did and i could use DOS to debug by reading the sectors and running the code in steps.

Other issues have come up: after using the jmp far opcode you gave me, the two sectors compiled to a 1022-byte .img, instead of 1024. Dosemu continues spitting errors, all of them different. (Ran dosemu 10 times, not going to waste your time posting all of the error reports here...)

Code for bootsector:

Code:

mov ax9ch
mov ssax
mov sp4096d
mov ax7c0h
mov dsax
mov ah00h
mov al03h
int 10h
mov ah02h
mov dx0000h
int 10h
;------------------------------------------------------
mov ah09h
mov cx1000h
mov al20h
mov bl17h
int 10h
mov ah09h
mov cx80d
mov al20h
mov bl80h
int 10h
mov ah02h
mov dl00d
mov dh01d
int 10h
;reset the disk system
beginstrap:
mov ah00h
mov dl00h
int 13h
mov ah01h
int 13h
cmp al00h
jne diskerr
mov ah00h
mov dl80h
int 13h
mov ah01h
int 13h
cmp al00h
jne diskerr
;begin loading the next sector of boot code
mov ah02h
mov al01d
mov ch00h
mov dh00h
mov cl01h
mov dl00h
mov bx04FEh
mov esbx
mov bx0000h
int 13h
mov ah01h
int 13h
cmp al00h
jne diskerr
;jump to next 512 bytes of code
mov bx04FEh
mov esbx
mov bx0000h
jmp far [es:bx]

diskerr:
mov ah01h
int 13h
cmp al00h
je  beginstrap
lp:
mov ah09h
mov al39h
mov bl02h
int 10h
jmp lp
;------------------------------------------------------
times 510-($-$$db 0
dw 0xAA55




Code for Cylinder 0, Head 0, Sector 1 of FD:

Code:

;set up the mouse
mov ah01h
mov cx0007h
int 10h
mov cx0001h
;set label for mouse scanner
mouser:
mov ah00h
int 16h
cmp al77h
je  up
cmp al61h
je  left
cmp al73h
je  down
cmp al64h
je  right
jmp mouser
;set labels to move mouse
up:
mov ah02h
sub dh01d
int 10h
jmp mouser
down:
mov ah02h
add dh01d
int 10h
jmp mouser
left:
mov ah02h
sub dl01d
int 10h
jmp mouser
right:
mov ah02h
add dl01h
int 10h
jmp mouser
;------------------------
times 512-($-$$db 0




Suggestions?

_________________
It may look hard, but it won't take long if you take it one byte at a time.

NOS: www.github.com/nkeck720/nos


Code:

org 100h
mov ah09h
mov dxmessage
int 21h
int 20h

message db "Hello FASM world!"0Dh0Ah"$"


Post 28 May 2015, 21:29
View user's profile Send private message Visit poster's website Reply with quote
SeproMan



Joined: 11 Oct 2009
Posts: 50
Location: Belgium

Code:
mov bx04FEh 
mov esbx 
mov bx0000h 
jmp [es:bx




You need to replace this code with


Code:
jmp 04FEh:0000h


_________________
Real Address Mode.
Post 31 May 2015, 17:50
View user's profile Send private message Reply with quote
nkeck72



Joined: 28 May 2015
Posts: 78
Location: 0000:7C00
Thanks. This helps a lot!

_________________
It may look hard, but it won't take long if you take it one byte at a time.

NOS: www.github.com/nkeck720/nos


Code:

org 100h
mov ah09h
mov dxmessage
int 21h
int 20h

message db "Hello FASM world!"0Dh0Ah"$"


Post 13 Jun 2015, 20:50
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.