flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > some more code that won't work |
Author |
|
jatos 05 Oct 2007, 12:26
Hi
I got some more code that fails to work correctly. This code worked when it was 16 bit code, and I now I have converted it to 32bit code it doesn't work Code: org 0x1600 use32 app_start: func_set_registers: MOV ax, 0xB800 MOV es, ax LEA ebp, [msg_1] MOV si, 0 MOV ax, 0x0000 MOV ds, ax MOV ebx, 0x0000 MOV ax, 0x0000 MOV cx, 0 func_print_string: MOV al, [ds:ebp] CMP al, 0 JE app_end MOV [es:ebx], al INC ebp ADD ebx, 2 JMP func_print_string jmp app_end app_data: msg_1 db "Hello World!", 0 app_end: NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP jmp app_end I can't actually see anything wrong with the program. the boot loader is loading the code at 1600h (its the fat 12 boot level downloaded http://flatassembler.net/examples.php). While I am it: is there anything it might be advisable for me to read, apart from the IA-32 dev manuals, which I have already read. _________________ Jamie |
|||
05 Oct 2007, 12:26 |
|
Dex4u 05 Oct 2007, 16:28
In pmode you would use something like this:
Code: org 0x1600use32app_start:func_set_registers: mov esi,msg_1 mov edi,0xB8000 mov ah,' 'func_print_string: mov al, byte[ds:esi] cmp al,0 JE app_end mov word[es:edi],ax inc esi add edi,2 JMP func_print_stringjmp app_endapp_data: msg_1 db "Hello World!", 0 app_end: NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP jmp app_end The above code assumes data descriptor are 0 based. You should also look up lodsb and stosw etc. |
|||
05 Oct 2007, 16:28 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.