[A83] Re: Mirage Sprite Calls


[Prev][Next][Index][Thread]

[A83] Re: Mirage Sprite Calls




9/15/02 7:32:36 PM, Nicolas Tarleton <jp_prongs@yahoo.com> wrote:

>
>1. Search for IonGuru and download it. It covers ION
>programming.
>2. On the MirageOS Development page, download the .ZIP
>at the bottom.
>--- James Maier <maierj@optonline.net> wrote:
>> 
>> I'm new to Mirage (or any shell), as well as Z80
>> spritage, and would appreciate any advice regarding
>> sprite calls 
>> to use and how to use them.  Thanks.
>> 
>> - James Maier <maierj@optonline.net>
>> http://cgi-bin.spaceports.com/~jmw/
>> 
>> 
>> 
>
>
>=====
>"The consequences of our actions are always so complicated,
>so diverse, that predicting the future is a very difficult
>business indeed."
>
>__________________________________________________
>Do you Yahoo!?
>Yahoo! News - Today's headlines
>http://news.yahoo.com
>
>
Thank you very much for all your help so far...when I display a sprite and use the _GetKey call the program runs 
fine.  However, when I run this program it crashes on exit:

; extension of my macro test with sprites
; James Maier
; maierj@optonline.net
; 9/15/02

#include    "ti83plus.inc"          ;General TI-83 Plus include file
#include    "mirage.inc"            ;MirageOS include file
#include    "JMmacros.inc"          ;MyMacros

    .org    $9d93               ;Origin (set back two to account for AsmPrgm)
    .db $BB,$6D             ;Compiled AsmPrgm token
    ret                 ;So TIOS wont run the program
    .db 1               ;Identifier as MirageOS program
    .db %11111111,%11111110     ;15x15 button
    .db %11000000,%00000110
    .db %11100000,%00001110
    .db %11111111,%11111110
    .db %11111111,%11111110
    .db %11110111,%11011110
    .db %11110011,%10011110
    .db %11110001,%00011110
    .db %11110011,%10011110
    .db %11110111,%11011110
    .db %11111111,%11111110
    .db %11111111,%11111110
    .db %11100000,%00001110
    .db %11000000,%00000110
    .db %11111111,%11111110
    .db "MacTest2",0         ;Zero terminated description
                        ;Program code starts here
    ld              d,1
    ld              e,1
    ld              hl,String
    call            setvputs                    ; draw String at (d,e)
    ld b,8                  ;the sprite is 8 high
    ld a,0                  ;make register equal zero (0)
    ld l,a                  ;now make register l equal (0)
    ld ix,BoxSprt                ;load the sprite into register ix
    call isprite           ;call the library
    bcall(_grbufcpy)            ;copy the graph buffer to the screen--displays the sprite!
Wait:
    ld              a,$BF                       ; top row (directin)
    call            directin                    ; Mirage direct input
    ifneq           TopRow                      ; if nz set, statement TopRow
        ifb(6,a)        Mode                    ; if bit 6 set in a, statement Mode
            ret                                 ; quit
        endif(Mode)                             ; end Mode
    endif(TopRow)                               ; end TopRow
    jp              Wait                        ; jump to Wait
String:
    .db             "Hello World",0
BoxSprt:
    .db %11111111
    .db %10000001
    .db %10000001
    .db %10000001
    .db %10000001
    .db %10000001
    .db %10000001
    .db %11111111
.end
END

The program works fine just displaying the string, or it did...If you wish to see the macros I made for whatever 
reason (I doubt they're the problem since they work alone, but who knows?), here they are:

; Macros written by James Maier
; maierj@optonline.net
; 9/11/02 *Gone but not forgotten*
;
;
;

#define cjpgte(n1,n2) ld a,n1 \ sub n2 \ jp nc,     ; compare + jp if n1>=n2
#define cjplt(n1,n2) ld a,n1 \ sub n2 \ jp c,       ; compare + jp if n1<n2
#define cjpeq(n1,n2) ld a,n1 \ sub n2 \ jp z,       ; compare + jp if n1==n2
#define cjpneq(n1,n2) ld a,n1 \ sub n2 \ jp nz,     ; compare + jp if n1!=n2

#define comp(n1,n2) ld a,n1 \ sub n2                ; compare n1 + n2
#define jpgte jp nc,                                ; jp if n1>=n2
#define jplt jp c,                                  ; jp if n1<n2
#define jpeq jp z,                                  ; jp if n1==n2
#define jpneq jp nz,                                ; jp if n1!=n2

#define ifeq jp nz,                                 ; jp if !=, in effect, if ==
#define ifneq jp z,                                 ; jp if ==, in effect, if !=
#define ifgte jp c,                                 ; jp if <, in effect if >=
#define iflt jp nc,                                 ; jp if >=, in effect if <
#define ifb(b,r) bit b,r\ jp z,                     ; jp if bit not set, in effect if bit set
#define ifnb(b,r) bit b,r\ jp nz,                   ; jp if bit set, in effect if bit not set
#define endif(label) \label:                        ; create label to jump to

This is a first for publishing ASM source...so please feel free to help me get used to criticism. :-) (I'm right-
handed)  Thanks again.

- James Maier <maierj@optonline.net>
http://cgi-bin.spaceports.com/~jmw/





References: