home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Archive Magazine 1995
/
ARCHIVE95.iso
/
discs
/
shareware
/
share_46
/
sasm
/
Demo
/
MainCode
< prev
next >
Wrap
Text File
|
1994-03-21
|
4KB
|
102 lines
;xxxxxxxxxxxxxxxxxxxxxxxxxxxx
; Actual application code
;xxxxxxxxxxxxxxxxxxxxxxxxxxxx
.entry adrl r1,task
ldr r1,[r1] ;load 'TASK' into r1
mov r0,200 ;will work with Wimp version 2.00
adrl r2,title ;r2 points to title string
swi Wimp_Initialise ;declare task to Wimp
adrl dp,data ;set up Data Pointer register
str r1,[dp,#TaskHandle] ;store task handle returned by Wimp
adrl sp,stack+&40 ;set up stack pointer to top of stack
adrl r1,block
str r1,[dp,#BlockPtr] ;store pointer to Wimp transfer block
;----- put the icon on the icon bar -----
adrl r1,icon_data ;point to icon data
swi Wimp_CreateIcon ;declare icon to Wimp
str r0,[dp,#IconHandle] ;store icon handle returned from Wimp
;----- main Wimp Poll loop -----
.poll_loop
mov r0,#PollMask
ldr r1,[dp,#BlockPtr]
swi Wimp_Poll
;----- check the reason codes returned by Wimp -----
cmp r0,1
beq redraw_request ;redraw window request returned
cmp r0,2
beq openwindow_request ;open window request returned
cmp r0,3
beq closewindow_request ;close window request returned
cmp r0,6
beq click ;mouse click
cmp r0,9
beq menu_selection ;mouse click on the menu
cmp r0,17
cmpne r0,18
bne poll_loop ;nothing to do
;----- Message received -----
ldr r0,[r1,#16] ;get message type at block+16
cmp r0,0
beq die ;shut-down request
bal poll_loop ;no other messages expected
;----- Mouse click on an icon -----
.click ldr r2,[r1,#12] ;get window handle at block+12
cmn r2,#2 ;if it's -1 it's the icon bar
bne poll_loop ;only the icon bar valid
.00 ldrb r0,[r1,#8] ;get mouse button (dummy 00 label)
cmp r0,2
beq 10 ;'menu' used so open the menu
cmp r0,4
beq 20 ;'select' used
bal poll_loop
;----- Mouse click on icon with 'menu' ------
.10 ldr r2,[r1] ;get mouse X position
sub r2,r2,#100
mov r3,260 ;r3 = height of menu
adrl r1,main_menu ;point to menu structure
swi Wimp_CreateMenu ;open the menu
bal poll_loop
;----- Mouse click on icon with 'select' ------
.20 mov r1,2
bal report ;display the message box
;----- Selection made from menu -----
.menu_selection
ldr r0,[r1] ;get item number at block+0
cmp r0,0
cmpne r0,1 ;if it's item 0 or 1 then transfer the
moveq r1,r0 ;menu item selected to r1 to show the
beq report ;appropriate message and go to 'report'
cmp r0,2
beq die ;quit selected
bal poll_loop
;---- Close down the task -----
.die adrl r1,task
ldr r1,[r1] ;put 'TASK' in r1
ldr r0,[dp,#TaskHandle] ;put task handle in r0
swi Wimp_CloseDown ;quit
swi OS_Exit
.redraw_request
swi Wimp_RedrawWindow ;actually no windows to redraw
bal poll_loop ;so just refer the call back to the Wimp
.openwindow_request
swi Wimp_CloseWindow ;actually no windows to close
bal poll_loop ;so just refer the call back to the Wimp
.closewindow_request
swi Wimp_OpenWindow ;actually no windows to open
bal poll_loop ;so just refer the call back to the Wimp