flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Turn off NMI ??? Goto page Previous 1, 2 |
Author |
|
mikegonta 24 Jan 2009, 22:46
[ Post removed by author. ]
Last edited by mikegonta on 28 Jan 2009, 09:16; edited 1 time in total |
|||
24 Jan 2009, 22:46 |
|
LocoDelAssembly 24 Jan 2009, 23:01
Quote:
I have seen you wrote a similar code somewhere else. Do you know what's going to happen when that code is executed? |
|||
24 Jan 2009, 23:01 |
|
Coddy41 24 Jan 2009, 23:23
since you put it that way, no
|
|||
24 Jan 2009, 23:23 |
|
LocoDelAssembly 24 Jan 2009, 23:59
I suppose you are expecting that it will print "hi\n" infinite times, right? Well, it turns out to be that the "db 'hi',10,5" part will be interpreted as CPU instructions so it will end up doing unexpected things.
For example, this is the listing provided by the debug program of your code: Code: -e 100 'hi', 10, 5 -a 104 0D1C:0104 jmp 100 0D1C:0106 -u100 0D1C:0100 68 DB 68 0D1C:0101 69 DB 69 0D1C:0102 1005 ADC [DI],AL 0D1C:0104 EBFA JMP 0100 . . . -r AX=0000 BX=0000 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000 DS=0D1C ES=0D1C SS=0D1C CS=0D1C IP=0100 NV UP EI PL NZ NA PO NC 0D1C:0100 68 DB 68 -t AX=0000 BX=0000 CX=0000 DX=0000 SP=FFEC BP=0000 SI=0000 DI=0000 DS=0D1C ES=0D1C SS=0D1C CS=0D1C IP=0103 NV UP EI PL NZ NA PO NC 0D1C:0103 05EBFA ADD AX,FAEB -t AX=FAEB BX=0000 CX=0000 DX=0000 SP=FFEC BP=0000 SI=0000 DI=0000 DS=0D1C ES=0D1C SS=0D1C CS=0D1C IP=0106 NV UP EI NG NZ NA PE NC 0D1C:0106 206163 AND [BX+DI+63],AH DS:0063=20 As you can see in the trace command, the address of "jmp 100" was already exceeded but it was never executed and now the program is out of control. Also note that the disassembly has a "jmp 100" only because it was not able to interpret the code as my CPU does because it couldn't recognize them as valid (debug disassembles for 8086, but the push imm16 appeared later in 80188 or so). |
|||
24 Jan 2009, 23:59 |
|
Coddy41 25 Jan 2009, 00:17
hm, so what do I use to loop infinite times?
|
|||
25 Jan 2009, 00:17 |
|
DJ Mauretto 25 Jan 2009, 09:12
Quote: hm, so what do I use to loop infinite times? Code:
Infinite_Loop:
jmp Infinite_Loop
_________________ Nil Volentibus Arduum |
|||
25 Jan 2009, 09:12 |
|
Coddy41 25 Jan 2009, 13:32
o,k --Takes notes--
|
|||
25 Jan 2009, 13:32 |
|
edfed 26 Jan 2009, 18:42
hem...
you don't need to reenable interrupts each loop. if your system is'nt able to save the execution context, it should be corrected in order to recover the state before task switch. then, Code:
sti
@@:
hlt
jmp @b
is correct. |
|||
26 Jan 2009, 18:42 |
|
revolution 26 Jan 2009, 19:01
edfed wrote: hem... |
|||
26 Jan 2009, 19:01 |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.