Palm OS 68k asm help needed
- From: Al Leitch <aleitch@3*&comcast.net>
- Date: Sun, 25 Dec 2005 11:46:27 -0800
I'm trying to make a PalmOS program that changes the background to black and draws '1' and '0' all over the screen in random positions, alternating between light and dark green to create the matrix movie look. I borrowed this idea from Polaris, who wrote a C++ demo coding tutorial for Hugi #31. Anyway, nothing is displaying when I try to run this thing under Palm OS Garnet Simulator (5.4.0) Thankfully no crashing happens and I can exit the program fine. Thanks.
--------------------------------------------------------------------------
Appl "Mtxeffect", 'MTX1'
include "c:\program files\pila\inc\Palm4.inc"
include "c:\program files\pila\inc\Startup.inc"
include "c:\program files\pila\inc\Window.inc"MyAlert equ 1000 ; Some Constants
struct Coord x.l y.l endstruct
data
strNumber dc.b '01',0
code
proc PilotMain(cmd.w, cmdPBP.l, launchFlags.w)
local evt.EventType
local pos.Coord
local screenrect.Coord
local txtcolor.RGBColorType
local bkcolor.RGBColorTypebeginproc
; trap #8 ; this is the equivalent of 80x86 int 3h
TST.W cmd(a6)
BNE PmReturn; ================ preserve screen state ====================
systrap WinPushDrawState()
; ================ get current screen dimensions ==================
systrap WinGetWindowExtent(&screenrect.x(a6).l, &screenrect.y(a6).l)
lp:
; ================ set up random x,y coordinates ==================
systrap SysRandom(#0.l)
divs screenrect.x(a6), d0 ; screenrect.x(a6) % d0
lsr.l #8, d0 ; shift remained in high word to ; low word
addq #1, d0
move d0, pos.x(a6)
systrap SysRandom(#0.l) divs screenrect.y(a6), d0 lsr.l #8, d0 addq #1, d0 move d0, pos.y(a6)
; ================= set background color ==================
move.l #0, bkcolor.unused(a6) ; entire struct is 4 bytes long
systrap WinSetBackColorRGB(&bkcolor(a6).l, #NULL.l)
bra event_lp ; this is placed here for troubleshooting ; purposes, will remove when background sets ; correctly
; ================= determine green color ================
set_color: systrap SysRandom(#0) andi #0, d0 tst d0 beq setLightGreen move #$0000FF00.l, txtcolor.unused(a6) systrap WinSetTextColorRGB(&txtcolor(a6).l,#0) bra draw_num setLightGreen: move #$00005500.l, txtcolor.unused(a6) systrap WinSetTextColorRGB(&txtcolor(a6).l,#0) ; ================= draw 0 or 1 =====================
draw_num: systrap SysRandom(#0) movea.l strNumber(a5), a1 andi #0, d0 ; d0 % 2 = test for even/odd number tst d0 beq draw1 draw_0: systrap WinDrawChars(a1.l,#1.w,pos.x(a6).l,pos.y(a6).l) bra event_lp draw1: movea.l strNumber(a5), a1 addq.l #1, a1 systrap WinDrawChars(a1.l,#1.w,pos.x(a6).l,pos.y(a6).l)
; ================= event processing ==================
event_lp:
systrap EvtGetEvent(&evt(a6).l, #0.l)
systrap SysHandleEvent(&evt(a6).l)
cmpi.w #appStopEvent, evt+EventType.eType(a6)
bne event_lpPmReturn ; Just a Label
; ================ restore screen state ====================
systrap WinPopDrawState()
endproc ;-----------------------Resources---------------------------------------------------------------
; We now declare the resources being used by Hello.asm
; the keyword 'res' is first placed; followed by the TYPE of the
; resource.
;-=Version Resource=-
res 'tver', 1
dc.b '1.0', 0; This resource defines launch flags, stack and heap size :)
res 'pref', 1
dc.w sysAppLaunchFlagNewStack|sysAppLaunchFlagNewGlobals|sysAppLaunchFlagUIApp|sysAppLaunchFlagSubCall
dc.l $1000 ; stack size
dc.l $1000 ; heap size
.
- Follow-Ups:
- Re: Palm OS 68k asm help needed
- From: Evenbit
- Re: Palm OS 68k asm help needed
- From: Herbert Kleebauer
- Re: Palm OS 68k asm help needed
- Prev by Date: Re: Hi Beth
- Next by Date: Re: Palm OS 68k asm help needed
- Previous by thread: Hi Beth
- Next by thread: Re: Palm OS 68k asm help needed
- Index(es):