[Coco] 6309 microproccessor project - 10-18-2003
John Collyer
johncollyer at zoominternet.net
Sat Oct 18 12:38:01 EDT 2003
Some mistakes in example, sigh.
Mywin32_4 fcb $11,$FD,$04 *
fcb $39 * return
MyFile fcb "Filename" *
dwDAccess fcb 0,0,0,0 *
dwSMode fcb 0,0,0,0 *
lpSAttr fdb Attrib * pointer to security attributes note: 16-bit
address
dwCreat fcb 0,0,0,0 *
dwFlagA fcb 0,0,0,0 *
hTmpFile fcb 0,0,0,0 *
Some more on: (lpSAttr fdb Attrib * pointer to security attributes note:
16-bit address)
Remember pointers are 16-bit in emulator, so the pointers will be expanded
to point to
the real offset before calling win32 functions.
----- Original Message -----
From: "John Collyer" <johncollyer at zoominternet.net>
To: <coco at maltedmedia.com>
Sent: Saturday, October 18, 2003 12:19 PM
Subject: [Coco] 6309 microproccessor project - 10-18-2003
> 6309 microprocessor project.
>
> Hello,
>
> The 32-bit 6309.asm enhanced instruction opcodes are coming along nicely.
I
> came up with a switch option called security. This means that I can
include
> the powerful but maybe harmful enhanced opcodes, which include special
> opcode $11FD and special opcode $11FF. The other two enhanced opcodes
have
> been moved to their permanent positions in the 6309 interpreter and
include;
> special opcode $11FC (breakpoint) and special opcode $11FE (exit the
> emulator). Because of the security switch, I can let the user of the
> emulator decide whether to use these special opcodes or not.
>
> The win32 functions for special opcode $11FD include:
>
> 1. CloseHandle
> 2. CopyFile
> 3. CreateDirectory
> 4. CreateFile
> 5. DeleteFile
> 6. FindClose
> 7. FindFirstFile
> 8. FindNextFile
> 9. FlushFileBuffers
> 10. GetCurrentDirectory
> 11. GetDiskFreeSpace
> 12. GetFileAttributes
> 13. GetFileSize
> 14. GetFileTime
> 15. GetFullPathName
> 16. GetLastError
> 17. GetLongPathName
> 18. GetShortPathName
> 19. GetTempFileName
> 20. GetTempPath
> 21. OpenFile
> 22. ReadFile
> 23. RemoveDirectory
> 24. SearchPath
> 25. SetCurrentDirectory
> 26. SetEndOfFile
> 27. SetFileAttributes
> 28. SetFilePointer
> 29. SetFileTime
> 30. WriteFile
>
> You interface with these functions by using opcode $11FD followed by a
> postbyte of the function call number (1 - 30) and register x pointing to
the
> parameter block (Register X contains the address of the first parameter of
> the parameters needed for the win32 function call).
>
> To set up the parameters look at the win32.api documentation and save any
> parameters in memory just as you see in the win32.api definition.
>
> Here is an example:
>
>
> BeginEx leax MyFile,pcr * the x register has to point to the
parameters
> jsr Mywin32_4 * create file
> stq MyHandle * save file handle
> * do something to the file
> leax MyHandle,pcr * the x register has to point to the
parameters
> jsr Mywin32_1 * close the file
> testw * If there are no errors
> bne noerror *
> os9 F$Exit * Else exit with the error
> noerror os9 F$Exit * exit with no errors
> end BeginEx * done with example
> *
> * HANDLE CreateFile(
> *
> * LPCTSTR lpFileName, // pointer to name of the
> file
> * DWORD dwDesiredAccess, // access (read-write) mode
> * DWORD dwShareMode, // share mode
> * LPSECURITY_ATTRIBUTES lpSecurityAttributes, // pointer to security
> attributes
> * DWORD dwCreationDistribution, // how to create
> * DWORD dwFlagsAndAttributes, // file attributes
> * HANDLE hTemplateFile // handle to file with attributes
to
> copy
> * );
> *
> *
> Mywin32_4 fcb $11,$FD,$04 *
> lpFName fcb "Filename" *
> dwDAccess fcb 0,0,0,0 *
> dwSMode fcb 0,0,0,0 *
> lpSAttr fdb Attrib * pointer to security attributes note: 16-bit
> address
> dwCreat fcb 0,0,0,0 *
> dwFlagA fcb 0,0,0,0 *
> hTmpFile fcb 0,0,0,0 *
> fcb $39 * return
> *
> Attrib fcb 0,0,0,0 * 32-bit security attributes
> *
> * BOOL CloseHandle(
> *
> * HANDLE hObject // handle to object to close
> * );
> *
> *
> Mywin32_1 fcb $11,$FD,$01 *
> fcb $39 * return
> *
> MyHandle fcb 0,0,0,0 * win32 handles are 32 bits
> *****************************
>
> The enhanced instruction opcode $11FF will as before let you run code, but
> this code will be Intel 32-bit flat assembly code. You return to the
> emulator after your finished with the code. The code can be located
> anywhere in the emulator's physical memory space, but it must also be in
the
> emulator's virtual memory space. You do that by writing the page number
> into the Memory management registers. All this can be accomplished
because
> win32 lets you allocate memory designated as read/write/execute.
>
> Again if you are concerned about security you can set a switch not
allowing
> enhanced opcodes.
>
> More later.
>
> John Collyer
>
> _______________________________________________
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
>
More information about the Coco
mailing list