flat assembler
Message board for the users of flat assembler.

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: 83
Location: 0000:7C00
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 ah, 02h mov al, 01d mov ch, 00h mov dh, 00h mov cl, 01h mov dl, 00h mov bx, 04FEh mov es, bx mov bx, 0000h int 13h mov ah, 01h int 13h cmp al, 00h jne diskerr

Then i try to jump to the code:
Code:
;jump to next 512 bytes of code mov bx, 04FEh mov es, bx mov bx, 0000h 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
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: 3475
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: 83
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: 83
Location: 0000:7C00
Went to test this:
Code:
;jump to next 512 bytes of code mov bx, 04FEh mov es, bx mov bx, 0000h 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
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: 3475
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: 83
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 ax, 9ch mov ss, ax mov sp, 4096d mov ax, 7c0h mov ds, ax mov ah, 00h mov al, 03h int 10h mov ah, 02h mov dx, 0000h int 10h ;------------------------------------------------------ mov ah, 09h mov cx, 1000h mov al, 20h mov bl, 17h int 10h mov ah, 09h mov cx, 80d mov al, 20h mov bl, 80h int 10h mov ah, 02h mov dl, 00d mov dh, 01d int 10h ;reset the disk system beginstrap: mov ah, 00h mov dl, 00h int 13h mov ah, 01h int 13h cmp al, 00h jne diskerr mov ah, 00h mov dl, 80h int 13h mov ah, 01h int 13h cmp al, 00h jne diskerr ;begin loading the next sector of boot code mov ah, 02h mov al, 01d mov ch, 00h mov dh, 00h mov cl, 01h mov dl, 00h mov bx, 04FEh mov es, bx mov bx, 0000h int 13h mov ah, 01h int 13h cmp al, 00h jne diskerr ;jump to next 512 bytes of code mov bx, 04FEh mov es, bx mov bx, 0000h jmp far [es:bx] diskerr: mov ah, 01h int 13h cmp al, 00h je beginstrap lp: mov ah, 09h mov al, 39h mov bl, 02h 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 ah, 01h mov cx, 0007h int 10h mov cx, 0001h ;set label for mouse scanner mouser: mov ah, 00h int 16h cmp al, 77h je up cmp al, 61h je left cmp al, 73h je down cmp al, 64h je right jmp mouser ;set labels to move mouse up: mov ah, 02h sub dh, 01d int 10h jmp mouser down: mov ah, 02h add dh, 01d int 10h jmp mouser left: mov ah, 02h sub dl, 01d int 10h jmp mouser right: mov ah, 02h add dl, 01h 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
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: 54
Location: Belgium
Code:
mov bx, 04FEh mov es, bx mov bx, 0000h 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: 83
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
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


Copyright © 2004-2018, Tomasz Grysztar.

Powered by rwasa.