vereijken@rulcri.leidenuniv.nl (Jan Joris Vereijken) (04/05/91)
Hi :-) Is there someone out there who has hands-on experience with kicking a V20/V30 CPU into 8080-emulation mode? I don't mean running a fancy piece of code that does trick for you, no I mean doing it yourself, by writing it yourself in assembly. Beware, it gets hairy now! I hooked the $F1 interrupt to point to a piece of 8080-code that does this: ADD HL,BC { Add BC to HL } RETEM { Return from emulation } I called it using: BRKEM $F1 { enter emulation mode } Unnecessary to say my machine hung :-( When I replaced the above code with: ADD BX,CX { Add CX to BX } IRET { Return from interrupt } Using: INT $F1 Everthing ran like a charm!!! So hooking the INT $F1 went fine, and my assembler function Add8080 works fine - the parameterpassing and stuff that is. Try the above replacement to see it for yourself. Darn :-( Anybody got a clue??? My program is appended to this mail (Turbo Pascal 6.0). Oh, a few things: YES I did read NEC's V30 datasheet a dozen times up and down, and YES it felt sure I understood it all, and YES I *do* have a V30 in my machine, I installed it myself :-) Please, let somebody say what goes wrong - I feel so stupid :-( Quite sure that I understand the whole thing perfectly, but the code just won't run... Thanks in advance! - Jan Joris - vereijken@rulcri.LeidenUniv.NL ------------------------------------------------------------------------------- PROGRAM Use8080; (* Put a V20/V30 into 8080 emulation mode, an do some arithmetic *) {$A-} { No word alignment! It would screw up our 8080 instructions... } USES Dos; PROCEDURE Init8080; ASSEMBLER; { Set up INT $F1 to handle 8080 code. } ASM MOV AX,0 MOV ES,AX { $0000 = segment of interrupt vector table } { Now hook interrupt $F1, located at ES:[$03C4] } MOV AX, OFFSET @8080code MOV WORD PTR ES:[$03C4],AX MOV AX, SEG @8080code MOV WORD PTR ES:[$03C6],AX JMP @Done @8080code: { We are in 8080 mode now! } DB $09 { ADD HL,BC to make the addition } DB $ED,$ED { RETEM, return from emulation } @Done: END; FUNCTION Add8080(a, b : WORD) : WORD; ASSEMBLER; { Add two words in 8080 mode... } ASM MOV BX,a { Store a in BX, this will be HL in 8080 mode. } MOV CX,b { Store a in CX, this will be BC in 8080 mode. } DB $0F,$FF,$F1 { BRKEM $F1, enter 8080 emulation mode... } MOV AX,BX { Result was in HL, or BX, make it the functionvalue. } END; BEGIN Init8080; WriteLn('123 + 456 = ', Add8080(123,456)); END.
wilker@gauss.math.purdue.edu (Clarence Wilkerson) (04/05/91)
In the simtel2- archives under msdos.emulators is an archive I wrote about 5 years ago when the V20-30 came out. It is a CP/M emulator all in Turbo Pascal except for a couple of line of assembler on the 8088 end. I believe the name is V20BOOT. In it I enter 8080 mode, execute 8080 code for awhile, then call Turbo routines to execute bdos and bios functions, and finally leave 8080 mode and return to 8088 mode. Clarence Wilkerson