[Coco] 6309 microprocessor project 01-22-2004
John Collyer
johncollyer at zoominternet.net
Thu Jan 22 16:35:22 EST 2004
Here the code for special opcode $11FF
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 ;
mov esi,[eax+4] ;
bswap esi ;make little endian
mov v86_ebx,esi ;
mov esi,[eax+8] ;
bswap esi ;make little endian
mov v86_ecx,esi ;
mov esi,[eax+12] ;
bswap esi ;make little endian
mov v86_edx,esi ;
mov esi,[eax+16] ;
bswap esi ;make little endian
mov v86_edi,esi ;
mov esi,[eax+20] ;
bswap esi ;make little endian
mov v86_esi,esi ;
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