Text File | 1992-10-27 | 3.1 KB | 58 lines | [04] ASCII Text (0x0000)
Object Oriented Machine Language Environment (oospec) 11/27/92
- A bootstrap process will set up the OO environment by allocating memory from the operating system and relocating the OO driver code. Programs can then be loaded from disk and set up as entries in the Object Table.
- As objects are loaded into memory, their names and addresses will be maintained in an object table. Each entry in the Object Table will have a 6 byte object name and a 2 byte address pointer to its code. Up to 256 entries can be stored in the Object table. If first byte of entry = 00, then entry is free for use. Entry= 6 character name in hi-bit ascii + 2 byte adrs (lo/hi)
- Object code can only be invoked by sending messages. The message format and interpretation is completely determined by the receiving object. However, a protocol may be established to use the first byte of the message as a phase number to determine which part of the code gets executed.
- To send a message to an object:
JSR MESSAGE ;send a message
ASC 'xxxxxx' ;to object: XXXXXX
DFB $?? ?? ?? ?? ;describe the format of the message here
; ... ;code to execute after message is sent.
- The Message subroutine will copy the message into the receiving object's message data area, adjust the stack pointer to return to the code following
the message and JSR to the receiving object's code. When the receiving object
completes, it can do an RTS to return to the caller. It may pass a response back to the caller via the registers or status flags (the message handler will not alter them).
- The message handler address (symbolic: MESSAGE) will be set up as a jump vector in zero page. A basic interface will be provided via the & vector, so that a string may be passed containing the Object name and message data. The & vector will invoke code to read the string and invoke the object.
- The following is a sample object header and mainline code:
;=======================================
;OBJECT NAME: SAMPLE
;DESCRIPTION: SAMPLE OBJECT
;=======================================
OBSAMPLE JSR MESSAGE ;send a message to the OSETUP object, with
ASC 'OSETUP' ;the new object's name as the message parameter.
ASC 'SAMPLE'
RTS
; ;
JMP CDSAMPLE ;jump vector to mainline code of the object
MLSAMPLE DFB $?? ;Message Length: (0-255)
MDSAMPLE DFB $?? ?? ?? ;Message Data Area: depends on MSGLEN
;
;optional internal data maintained by object goes here:
;
;=======================================
;MAINLINE CODE FOR OBJECT: SAMPLE
;=======================================
CDSAMPLE LDA MDSAMPLE ;get phase number from 1st byte of message data
CMP #$00
BNE C1SAMPLE
JMP P0SAMPLE ;phase 0 jump
C1SAMPLE CMP #$01
BNE C2SAMPLE
JMP P1SAMPLE ;phase 1 jump
C2SAMPLE BRK ;any other phase, terminates with abend