flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Compiler Internals > POP CS complied successful while MOV CS,AX doesn't

Author
Thread Post new topic Reply to topic
l4m2



Joined: 15 Jan 2015
Posts: 591
POP CS complied successful while MOV CS,AX doesn't
What for? Or bug?


Description:
Filesize: 9.93 KB
Viewed: 4476 Time(s)

0.png




Last edited by l4m2 on 27 Jul 2015, 08:51; edited 1 time in total
Post 26 Jul 2015, 04:00
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15241
Location: 1I/ʻOumuamua
fasm can compile for 8086 CPUs also.
Post 26 Jul 2015, 05:07
View user's profile Send private message Visit poster's website Reply with quote
l4m2



Joined: 15 Jan 2015
Posts: 591

revolution wrote:
fasm can compile for 8086 CPUs also.

if so why no Mov cs,ax
Post 26 Jul 2015, 05:47
View user's profile Send private message Reply with quote
El Tangas



Joined: 11 Oct 2003
Posts: 120
Location: Sunset Empire
I've read pop cs worked on the 8086 (the opcode 0x0F was later recycled for other instructions, as a kind of prefix, for example for SIMD instructions), not sure about mov cs,reg. It will be difficult to find a 8086 to test it Smile
If it works, fasm should be modified to assemble it...
Post 27 Jul 2015, 02:39
View user's profile Send private message Reply with quote
l4m2



Joined: 15 Jan 2015
Posts: 591

El Tangas wrote:
I've read pop cs worked on the 8086 (the opcode 0x0F was later recycled for other instructions, as a kind of prefix, for example for SIMD instructions), not sure about mov cs,reg. It will be difficult to find a 8086 to test it Smile
If it works, fasm should be modified to assemble it...

At that time you know transistors just few so I think the maker won't let the instruction not to work as it disobey the rule
Post 27 Jul 2015, 03:14
View user's profile Send private message Reply with quote
El Tangas



Joined: 11 Oct 2003
Posts: 120
Location: Sunset Empire
In this thread in another forum, there is a guy with access to these old cpu's saying that it works:


sergey wrote:
I actually tested POP CS and MOV CS,reg/mem some time ago. All 8088 processors and NEC V20 execute these instructions as unconditional JMP - CS is changed with the new value, IP is advanced to the next instruction. This includes Intersil 80C88 for which the datasheet specifically says that "MOV CS, REG/MEMORY not allowed." (page 36). And by the way it doesn't say anything about POP CS (page 29 of the same datasheet).




http://www.vintage-computer.com/vcforum/showthread.php?36284-Undocumented-Instructions-on-Intel-8088-and-NEC-V20&s=2dd38681b5045060d5bf3ca2b18cb1e6
Post 27 Jul 2015, 11:47
View user's profile Send private message Reply with quote
shutdownall



Joined: 02 Apr 2010
Posts: 518
Location: Munich
Okay - 8088 is not really 8086. Wink
Post 27 Jul 2015, 12:36
View user's profile Send private message Send e-mail Reply with quote
l4m2



Joined: 15 Jan 2015
Posts: 591
D8086 INTEL CPU LOT OF 1
£7.71
+ £*.** postage
From United States
Customs services and international tracking provided

...
Post 27 Jul 2015, 16:35
View user's profile Send private message Reply with quote
shutdownall



Joined: 02 Apr 2010
Posts: 518
Location: Munich
And do you have a mother board with a socket for 8086 ?
EGA or CGA adapter ?
I think this is retro stuff. Cool
Post 28 Jul 2015, 12:17
View user's profile Send private message Send e-mail Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15241
Location: 1I/ʻOumuamua
I think a video adapter is not needed. Just an LED would be enough. Program an EPROM/FLASH chip with a simple test program to check whether mov cs,ax is successful and turn on/off the LED accordingly.
Post 28 Jul 2015, 12:19
View user's profile Send private message Visit poster's website Reply with quote
shutdownall



Joined: 02 Apr 2010
Posts: 518
Location: Munich
Is this maybe more a plain academic approach ? Razz
Post 28 Jul 2015, 12:21
View user's profile Send private message Send e-mail Reply with quote
El Tangas



Joined: 11 Oct 2003
Posts: 120
Location: Sunset Empire
So, lets see... A 8086 CPU, a breadboard, programmable ROM with test program, needs to be 16 bit interface, a MCU to feed signals to the 8086 under controlled conditions... Not gonna be easy... Wink

Or buy a vintage 8086 system, I think I may get a Sinclair PC200 for 50€. I will try to get it Cool if its working 100%.

Then a floppy drive with DOS, and we are game Wink
Post 28 Jul 2015, 23:15
View user's profile Send private message Reply with quote
l4m2



Joined: 15 Jan 2015
Posts: 591
Still I found samples of 8086 in Proteus
Post 29 Jul 2015, 01:55
View user's profile Send private message Reply with quote
El Tangas



Joined: 11 Oct 2003
Posts: 120
Location: Sunset Empire

l4m2 wrote:
Still I found samples of 8086 in Proteus



You're right, I wonder if it is an 100% accurate simulation.

Also, here is a macro to assemble mov cs, by first assembling mov es and then modify it.


Code:
        macro   mov     destsrc {
                if dest eq cs
                        recode = $+1
                        mov     essrc
                        ;read original opcode
                        load a byte from recode
                        ;convert es to cs
                        store byte a or 8 at recode
                else
                        mov     destsrc
                end if
        }  



update:

Well, already tested on Proteus simulation and it works. Here is my test program:


Code:
        macro   mov     destsrc {
                if dest eq cs
                        recode = $+1
                        mov     essrc
                        ;read original opcode
                        load a byte from recode
                        ;convert es to cs
                        store byte a or 8 at recode
                else
                        mov     destsrc
                end if
        }


j1:     mov     ax,1
        mov     cs,ax
        jmp     near j1
        align   16
j2:     mov     ax,0
        mov     cs,ax
        jmp     near j2 



I loaded at entry point CS:IP = 0000:0000 and it toggles between the 2 cycles, as expected Wink kind of crazy.
Post 29 Jul 2015, 11:38
View user's profile Send private message Reply with quote
shutdownall



Joined: 02 Apr 2010
Posts: 518
Location: Munich

l4m2 wrote:
D8086 INTEL CPU LOT OF 1
£7.71
+ £*.** postage
From United States
Customs services and international tracking provided

...



I wonder if United States has a new currency or do you mean the United States more near to Europe with the Tower Bridge ? Wink
Post 29 Jul 2015, 12:23
View user's profile Send private message Send e-mail Reply with quote
Hayden



Joined: 06 Oct 2005
Posts: 132
pop cs
from memory i think the intel books say that mov cs, reg or mov cs, [mem] not allowed. You can push pop segment addresses into cs. also look at lds, les instructions

_________________
New User.. Hayden McKay.
Post 10 Dec 2015, 12:37
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 cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.