flat assembler
Message board for the users of flat assembler.

Index > Heap > When your code goes crazy?

Author
Thread Post new topic Reply to topic
sid123



Joined: 30 Jul 2013
Posts: 340
Location: Asia, Singapore
sid123
All of us have written assembly code, and we've sometimes stumbled across somethings that we don't expect or in better words our code becomes crazy.
Here's mine:
Image
I still don't know what happened? I clearly set the segment registers to
0x9000, but they show up as 0x2000. And surprisingly the IVT at 0x6F IS modified, And the interrupt is run, will debug it tomorrow.
So what are your "crazy-codes" ?[/code]

_________________
"Those who can make you believe in absurdities can make you commit atrocities" -- Voltaire https://github.com/Benderx2/R3X
XD
Post 09 Jan 2014, 14:53
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
I coded a toaster that only toasted on one side

Just kidding. But seriously Twisted Evil. Do we need to know
Post 09 Jan 2014, 14:55
View user's profile Send private message Reply with quote
sid123



Joined: 30 Jul 2013
Posts: 340
Location: Asia, Singapore
sid123
@typedef
Cool
I like the idea. Should make a toaster that has an option to toast only
on one side.
Just made this thread cause sometimes certain code produces some really
weird results, which I guess is fun to see plus sometimes teaches us what to do
and what not to.
Will try something really weird tomorrow Twisted Evil

_________________
"Those who can make you believe in absurdities can make you commit atrocities" -- Voltaire https://github.com/Benderx2/R3X
XD
Post 09 Jan 2014, 15:12
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1412
Location: Toronto, Canada
AsmGuru62
Not all segments are set to 2000h -- one is set to a proper value.
Post 09 Jan 2014, 15:24
View user's profile Send private message Send e-mail Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1180
Location: Unknown
HaHaAnonymous
[ Post removed by author. ]


Last edited by HaHaAnonymous on 28 Feb 2015, 18:34; edited 1 time in total
Post 09 Jan 2014, 15:31
View user's profile Send private message Reply with quote
sid123



Joined: 30 Jul 2013
Posts: 340
Location: Asia, Singapore
sid123
Quote:
Not all segments are set to 2000h -- one is set to a proper value

My eyesight... Shocked
Thanks for pointing out, but I guess this is now some serious bug

_________________
"Those who can make you believe in absurdities can make you commit atrocities" -- Voltaire https://github.com/Benderx2/R3X
XD
Post 09 Jan 2014, 15:47
View user's profile Send private message Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1180
Location: Unknown
HaHaAnonymous
[ Post removed by author. ]


Last edited by HaHaAnonymous on 28 Feb 2015, 18:34; edited 1 time in total
Post 09 Jan 2014, 19:12
View user's profile Send private message Reply with quote
sid123



Joined: 30 Jul 2013
Posts: 340
Location: Asia, Singapore
sid123
Not serious, but dumb.
Code:
....
call MEM_TEST_OK
call KERNEL_SET_SEGMENT
call BOOT_KERNEL
mov ax, 0x2000
mov ds, ax
call POP_ALL
jmp 0x2000:0x0000
....
POP_ALL:
  pop cs
  pop ds
  pop es 
  pop fs 
  ret
    

Image
Just wanted to crack a joke :
Yo mama so dumb she knows the advantages of segmentation.

_________________
"Those who can make you believe in absurdities can make you commit atrocities" -- Voltaire https://github.com/Benderx2/R3X
XD
Post 10 Jan 2014, 11:26
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1412
Location: Toronto, Canada
AsmGuru62
Good one, but without segmentation - only 64Kb is addressable, and we all know that we need at least 640Kb!
Smile
Post 10 Jan 2014, 14:50
View user's profile Send private message Send e-mail Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
sid123 wrote:

Code:
....
call MEM_TEST_OK
call KERNEL_SET_SEGMENT
call BOOT_KERNEL
mov ax, 0x2000
mov ds, ax
call POP_ALL
jmp 0x2000:0x0000
....
POP_ALL:
  pop cs
  pop ds
  pop es 
  pop fs 
  ret
    

Code:
entrypoint: dd 2000h:0
....
call MEM_TEST_OK
call KERNEL_SET_SEGMENT
call BOOT_KERNEL
mov ds, [entrypoint+2] ;;;;;
call POP_ALL
jmp far dword [entrypoint] ;;;;;;
....
POP_ALL:
  pop cs
  pop ds
  pop es 
  pop fs 
  ret
    
Post 10 Jan 2014, 18:33
View user's profile Send private message Visit poster's website Reply with quote
MazeGen



Joined: 06 Oct 2003
Posts: 977
Location: Czechoslovakia
MazeGen
sid123, the POP CS instruction don't exist since 80186,188, are you sure you want to use it?
Post 15 Jan 2014, 15:26
View user's profile Send private message Visit poster's website Reply with quote
sid123



Joined: 30 Jul 2013
Posts: 340
Location: Asia, Singapore
sid123
@MazeGen Nice point, will remove it from my code since it requires a 386
Post 15 Jan 2014, 15:28
View user's profile Send private message Reply with quote
SeproMan



Joined: 11 Oct 2009
Posts: 58
Location: Belgium
SeproMan
sid123,
The first pop instruction at POP_ALL will pop the return address from the call that brought you there !

_________________
Real Address Mode.
Post 19 Jan 2014, 15:10
View user's profile Send private message Reply with quote
sid123



Joined: 30 Jul 2013
Posts: 340
Location: Asia, Singapore
sid123
lol.
This is clearly my OS's fault.
It's called an utter lie.
A JE and a JNE can make a big difference.
Image
Post 03 Feb 2014, 11:13
View user's profile Send private message 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 can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.