James Hunkins wrote:
> Has anyone setup C68 wrappers for the Home thing?  Also, any sample C
> code using it?

I wanted to, but didn't find the time. I only did a wrapper for
setting the directory (see below), which I used in Qascade. However,
the other functions can be wrapped accordingly.

Marcel

;/*---------------------------------------------------------------------.
;| home.s                                                               |
;|                                                                      |
;|  Copyright (c) 2005 Jonathan Hudson & Wolfgang Lenerz & Marcel Kilgus|
;|                                                                      |
;|  You may distribute under the terms of either the GNU General Public |
;|  License or the Artistic License, as specified in the README file.   |
;£---------------------------------------------------------------------*/

    .text
    .even
    .globl _sethome ; (char * fnam, int jobID)

thing_name:
        dc.w    4
        dc.b    'HOME'

NAMESPACE equ 64                        ; Size of space to reserve for name

_sethome:
        link    a5,#-NAMESPACE          ; reserve space for file name
        movem.l a2-a4/d2-d7,-(sp)       ; save lots of registers        
        moveq   #$28,d0                 ; use thing
        lea     thing_name,a0
        moveq   #-1,d1                  ; parameter
        moveq   #-1,d3                  ;  ditto
        move.l  #$53455448,d2           ; extension to use "SETH"
        jsr     ThingTrap               ; ... do it
        bne     fin                     ; disaster ....
        move.l  a1,d7                   ; save thing address
        move.l  4+4(a5),-(a7)           ; file name     
        pea.l   -NAMESPACE(a5)          ; space
        jsr     __cstr_to_ql            ; convert to qlstr
        addq.l  #8,a7                   ; restore stack
        sub.w   #12,a7                  ; some more work space
        move.l  a7,a1
        move.l  8+4(a5),(a1)            ; jobID
        move.l  #$c1000000,4(a1)        ; thp.call+thp.str
        move.l  d0,8(a1)                ; filename
        move.l  d7,a0
        jsr     $18(a0)                 ; call extension (thh_code)
        add.w   #12,a7
        moveq   #$29,d0                 ; un use
        lea     thing_name,a0
        moveq   #-1,d1                  ; parameter
        moveq   #-1,d3                  ; parameter
        jsr     ThingTrap               ; ... do it
        moveq   #0,d0                   ; ignore error
fin:
        movem.l (sp)+,a2-a4/d2-d7       ; unsave lots of registers              
        unlk    a5
        rts

        end



_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to