flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > jmp [es:bx] - error: operand size not specified. |
Author |
|
nkeck72 28 May 2015, 20:36
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 |
|||
28 May 2015, 20:36 |
|
JohnFound 28 May 2015, 21:04
Code: ; what you need? jmp far [es:bx] ; or jmp near [es:bx] |
|||
28 May 2015, 21:04 |
|
nkeck72 28 May 2015, 21:07
I'll try that. This is my first OS so i have never had to jump to RAM addresses.
|
|||
28 May 2015, 21:07 |
|
nkeck72 28 May 2015, 21:11
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:
_________________ 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 |
|||
28 May 2015, 21:11 |
|
nkeck72 28 May 2015, 21:29
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 |
|||
28 May 2015, 21:29 |
|
SeproMan 31 May 2015, 17:50
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. |
|||
31 May 2015, 17:50 |
|
nkeck72 13 Jun 2015, 20:50
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 |
|||
13 Jun 2015, 20:50 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.