[Coco] Re 6309 microprocessor project 01-22-2004

John Collyer johncollyer at zoominternet.net
Fri Jan 23 08:34:41 EST 2004


I seem to have overlooked something, but I guess no one even noticed it
though.
When you begin execution of the 80x86 32-bit hand assembly code, you will
not know where your 80x86 32-bit virtual registers are located in memory.
The special opcode $11FF is supposed to load the real 80x86 32-bit
registers on entry to your hand assembled 80x86 32-bit code.
I'll revise the code and send it for you to look at.

John Collyer

yff:    cmp word ptr native,564ah       ;if navtive instructions
        jnz yff_off                     ;else bad instruction
        test secur,-1                   ;if security = on
        jz yff_off                      ;
        push ebx                        ;save registers
        push ecx                        ;
        push edx                        ;
        push edi                        ;
        push ebp                        ;
        push esi                        ;
        mov eax,offset yff_return       ;get return address
        push eax                        ;save return address
        getptr                          ;find jump to code address
        push eax                        ;push for return from here
        mov si,regx                     ;get parameter pointer
        getptr                          ;make it 32-bits
        mov dd_aux1,eax                 ;save it for later
        mov esi,[eax]                   ;convert parameters
        bswap esi                       ;make little endian
        mov v86_eax,esi                 ; ***** should be real 32-bit
register *****
        mov esi,[eax+4]                 ;
        bswap esi                       ;make little endian
        mov v86_ebx,esi                 ; ***** should be real 32-bit
register *****
        mov esi,[eax+8]                 ;
        bswap esi                       ;make little endian
        mov v86_ecx,esi                 ; ***** should be real 32-bit
register *****
        mov esi,[eax+12]                ;
        bswap esi                       ;make little endian
        mov v86_edx,esi                 ; ***** should be real 32-bit
register *****
        mov esi,[eax+16]                ;
        bswap esi                       ;make little endian
        mov v86_edi,esi                 ; ***** should be real 32-bit
register *****
        mov esi,[eax+20]                ;
        bswap esi                       ;make little endian
        mov v86_esi,esi                 ; ***** should be real 32-bit
register *****
        ret                             ;jump to 32-bit code
                                        ;
yff_return:                             ;return from the 32-bit code
        push esi                        ;push the 32-bit code size
        mov eax,dd_aux1                 ;get saved parameter pointer
        mov esi,v86_eax                 ;convert parameters
        bswap esi                       ;make big endian
        mov [eax],esi                   ;
        mov esi,v86_ebx                 ;
        bswap esi                       ;make big endian
        mov [eax+4],esi                 ;
        mov esi,v86_ecx                 ;
        bswap esi                       ;make big endian
        mov [eax+8],esi                 ;
        mov esi,v86_edx                 ;
        bswap esi                       ;make big endian
        mov [eax+12],esi                ;
        mov esi,v86_edi                 ;
        bswap esi                       ;make big endian
        mov [eax+16],esi                ;
        mov esi,v86_esi                 ;
        bswap esi                       ;make big endian
        mov [eax+20],esi                ;
        pop eax                         ;pop 32-bit code size
        pop esi                         ;pop program counter
        add esi,eax                     ;add 32-bit code size to program
counter
        and esi,0ffffh                  ;make it a 16-bit program counter
        pop ebp                         ;restore registers
        pop edi                         ;
        pop edx                         ;
        pop ecx                         ;
        pop ebx                         ;
        jmp main                        ;return
yff_off:                                ;else bad instruction,
        jmp bad                         ;jump to bad instruction label.





More information about the Coco mailing list