Quantcast
Channel: Cemetech
Viewing all articles
Browse latest Browse all 75747

z80 Assembly :: RE: Baby Steps in Drawing Sprites

$
0
0
Author: chickendude
Posted: 29 Nov 2012 02:20:26 am (GMT -5)

You've got some wild jumping going around there, you're not going to miss a keypress, the calculator is too quick. All i did was remove some of the jumps (changed no other code) and it works fine for me:

Code:
#include    "ti83plus.inc"
#include "ion.inc"
.org    $9D93
.db    $BB, $6D

   ret
   jr nc,start
.db "test",0

start:
   bcall(_clrLCDfull)
   bcall(_grbufclr)
   set fullScrnDraw, (IY + apiFlg4)
loop:            ;Wait for user input
   bcall(_getCSC)
   cp skEnter
   jp z,End
   cp skClear
   jp z,End
   cp skLeft
   jp z,Left
   cp skRight
   jp z,Right
   cp skUp
   jp z,Up
   cp skDown
   jp z,Down
   jp loop
Disp:
   ld b,8         ;Display the sprite at (X_COORD, Y_COORD)
   ld a,(Y_COORD)
   ld l,a
   ld a,(X_COORD)
   ld ix,smileyFace
   call ionPutSprite 
   call ionFastCopy
   jp loop

Left:
   ld a,(X_COORD)
   dec a
   ld (X_COORD),a
   jp Disp
Right:
   ld a,(X_COORD)
   inc a
   ld (X_COORD),a
   jp Disp
Up:
   ld a,(Y_COORD)
   dec a
   ld (Y_COORD),a
   jp Disp
Down:
   ld a,(Y_COORD)
   inc a
   ld (Y_COORD),a
   jp Disp
End:
   bcall(_clrLCDfull)
   ret

X_COORD:
   .db 17
Y_COORD:
   .db 0

smileyFace: 
  .db %00000000 
  .db %01100110 
  .db %01100110 
  .db %00000000 
  .db %00000000 
  .db %10000001 
  .db %01000010 
  .db %00111100


As for MirageOS, you have two options:
1. Simply use the ion header (MirageOS detects ion files, you could probably even use the MirageOS functions this way).
2. Put the MirageOS header, not that different from the ion header, at the start of your program.

Code:
#include   "ti83plus.inc"         ;General TI-83 Plus include file
#include   "mirage.inc"         ;MirageOS include file
   .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   %00000000,%00000000      ;15x15 button
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   %00000000,%00000000
   .db   "Description",0         ;Zero terminated description
                  ;Program code starts here


Viewing all articles
Browse latest Browse all 75747

Latest Images

Trending Articles



Latest Images