<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.temlib.org/AtariForumWiki/index.php?action=history&amp;feed=atom&amp;title=CW_PROG4MAC.S</id>
	<title>CW PROG4MAC.S - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.temlib.org/AtariForumWiki/index.php?action=history&amp;feed=atom&amp;title=CW_PROG4MAC.S"/>
	<link rel="alternate" type="text/html" href="https://www.temlib.org/AtariForumWiki/index.php?title=CW_PROG4MAC.S&amp;action=history"/>
	<updated>2026-05-13T17:38:51Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.2</generator>
	<entry>
		<id>https://www.temlib.org/AtariForumWiki/index.php?title=CW_PROG4MAC.S&amp;diff=11649&amp;oldid=prev</id>
		<title>&gt;Wongck at 12:16, 13 October 2011</title>
		<link rel="alternate" type="text/html" href="https://www.temlib.org/AtariForumWiki/index.php?title=CW_PROG4MAC.S&amp;diff=11649&amp;oldid=prev"/>
		<updated>2011-10-13T12:16:06Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 08:16, 13 October 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l461&quot;&gt;Line 461:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 461:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Back to [[CW_CHAPTER_4]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Back to [[CW_CHAPTER_4]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Programming&lt;/del&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category: &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Assembly Language Workshop&lt;/ins&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>&gt;Wongck</name></author>
	</entry>
	<entry>
		<id>https://www.temlib.org/AtariForumWiki/index.php?title=CW_PROG4MAC.S&amp;diff=11648&amp;oldid=prev</id>
		<title>&gt;Silver Surfer: Added category</title>
		<link rel="alternate" type="text/html" href="https://www.temlib.org/AtariForumWiki/index.php?title=CW_PROG4MAC.S&amp;diff=11648&amp;oldid=prev"/>
		<updated>2009-05-02T17:29:03Z</updated>

		<summary type="html">&lt;p&gt;Added category&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 13:29, 2 May 2009&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l461&quot;&gt;Line 461:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 461:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Back to [[CW_CHAPTER_4]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Back to [[CW_CHAPTER_4]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Programming]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>&gt;Silver Surfer</name></author>
	</entry>
	<entry>
		<id>https://www.temlib.org/AtariForumWiki/index.php?title=CW_PROG4MAC.S&amp;diff=11647&amp;oldid=prev</id>
		<title>&gt;Zorro 2 at 14:03, 24 October 2006</title>
		<link rel="alternate" type="text/html" href="https://www.temlib.org/AtariForumWiki/index.php?title=CW_PROG4MAC.S&amp;diff=11647&amp;oldid=prev"/>
		<updated>2006-10-24T14:03:13Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
;---------------------------------------------------------------------&lt;br /&gt;
; THE ST ASSEMBLY LANGUAGE WORKSHOP, VOLUME 2&lt;br /&gt;
; PROGRAM 4&lt;br /&gt;
;&lt;br /&gt;
; COPYRIGHT 1992 BY CLAYTON WALNUM&lt;br /&gt;
;---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
.include &amp;quot;SAMPLE.H&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FINGER          equ     3&lt;br /&gt;
&lt;br /&gt;
PTERM0          equ     0&lt;br /&gt;
MSHRINK         equ     74&lt;br /&gt;
AES_OPCODE      equ     200&lt;br /&gt;
&lt;br /&gt;
FMD_START       equ     0&lt;br /&gt;
FMD_GROW        equ     1&lt;br /&gt;
FMD_SHRINK      equ     2&lt;br /&gt;
FMD_FINISH      equ     3&lt;br /&gt;
&lt;br /&gt;
;--------------------------------------------------------------------&lt;br /&gt;
; MACROS&lt;br /&gt;
;--------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
;--------------------------------------------------------------------&lt;br /&gt;
; This macro gets the address of an object's string. It requires two &lt;br /&gt;
; parameters: the address of the resource tree and the object's&lt;br /&gt;
; number. The string address is returned in a5.&lt;br /&gt;
;-------------------------------------------------------------------- &lt;br /&gt;
.macro tedinfo_str&lt;br /&gt;
        move.l  \1,a5                   ; Get address of dialog.&lt;br /&gt;
        add.l   #(\2*24)+12,a5          ; Calc. addr of ob_spec.&lt;br /&gt;
        move.l  (a5),a5                 ; Get address of tedinfo.&lt;br /&gt;
.endm&lt;br /&gt;
&lt;br /&gt;
;--------------------------------------------------------------------&lt;br /&gt;
; This macro calls up a simple, one-button GEM alert box, using the&lt;br /&gt;
; form_alert AES function. It requires two parameters: the default&lt;br /&gt;
; button number and the address of the alert-box string. Because this&lt;br /&gt;
; alert box will have only one button, the value for the default&lt;br /&gt;
; button must be 0 for no default or 1 for button 1.&lt;br /&gt;
;-------------------------------------------------------------------- &lt;br /&gt;
.macro alert&lt;br /&gt;
        move.l  #form_alert,apb&lt;br /&gt;
        move    #\1,int_in&lt;br /&gt;
        move.l  #\2,addr_in&lt;br /&gt;
        bsr     aes&lt;br /&gt;
.endm&lt;br /&gt;
&lt;br /&gt;
;--------------------------------------------------------------------&lt;br /&gt;
; MAIN PROGRAM&lt;br /&gt;
;--------------------------------------------------------------------&lt;br /&gt;
        text&lt;br /&gt;
&lt;br /&gt;
; Calculate the size of the program area.&lt;br /&gt;
&lt;br /&gt;
        move.l  a7,a5                   ; Save addr of TPA.&lt;br /&gt;
        lea     stack,sp                ; Load addr of our stack.&lt;br /&gt;
        &lt;br /&gt;
        move.l  4(a5),a5                ; Get addr of TPA.              &lt;br /&gt;
        move.l  12(a5),d0               ; Get len of text segment.&lt;br /&gt;
        add.l   20(a5),d0               ; Add len of data segment.&lt;br /&gt;
        add.l   28(a5),d0               ; Add len of BSS segment.&lt;br /&gt;
        add.l   #$100,d0                ; Add len of TPA. &lt;br /&gt;
&lt;br /&gt;
; Release unused memory back to the system.&lt;br /&gt;
        &lt;br /&gt;
        move.l  d0,-(sp)                ; Push size of program on stack.&lt;br /&gt;
        move.l  a5,-(sp)                ; Push program addr on stack.&lt;br /&gt;
        clr     -(sp)                   ; Clear dummy word on stack.    &lt;br /&gt;
        move    #MSHRINK,-(sp)          ; Push Mshrink opcode.&lt;br /&gt;
        trap    #1                      ; Call GEMDOS.&lt;br /&gt;
        add.l   #12,sp                  ; Reset stack pointer.&lt;br /&gt;
&lt;br /&gt;
; Clear some fields of the global array.&lt;br /&gt;
&lt;br /&gt;
        clr.l   ap_ptree        &lt;br /&gt;
        clr.l   ap_1resv&lt;br /&gt;
        clr.l   ap_2resv&lt;br /&gt;
        clr.l   ap_3resv&lt;br /&gt;
        clr.l   ap_4resv&lt;br /&gt;
&lt;br /&gt;
; Call appl_init to initialize application.&lt;br /&gt;
&lt;br /&gt;
        move.l  #appl_init,apb&lt;br /&gt;
        bsr     aes&lt;br /&gt;
        cmpi    #$FFFF,ap_id            ; Error?&lt;br /&gt;
        beq     end                     ; Yep.  Outta here.&lt;br /&gt;
&lt;br /&gt;
; Load resource file.&lt;br /&gt;
&lt;br /&gt;
        move.l  #rsrc_load,apb&lt;br /&gt;
        move.l  #rsrc_file,addr_in      ; Addr of resource file name.&lt;br /&gt;
        bsr     aes&lt;br /&gt;
        tst     int_out                 ; Did the resource load okay?&lt;br /&gt;
        bne     rsrc_okay               ; Yep.&lt;br /&gt;
        alert   1,alert1                ; &amp;quot;Resource load error!&amp;quot;&lt;br /&gt;
        bra     exit&lt;br /&gt;
&lt;br /&gt;
; Get resource address.&lt;br /&gt;
        &lt;br /&gt;
rsrc_okay:&lt;br /&gt;
        move.l  #rsrc_gaddr,apb&lt;br /&gt;
        move    #R_TREE,int_in          ; Type number of data.&lt;br /&gt;
        move    #SAMPLE,int_in+2        ; Array index of data.&lt;br /&gt;
        bsr     aes&lt;br /&gt;
        tst     int_out                 ; Was there an error?&lt;br /&gt;
        bne     addr_okay               ; Nope.&lt;br /&gt;
        alert   1,alert2                ; &amp;quot;Resource address error!&amp;quot;&lt;br /&gt;
        bra     exit&lt;br /&gt;
&lt;br /&gt;
addr_okay:&lt;br /&gt;
        move.l  addr_out,dialog_addr    ; Save dialog's address.&lt;br /&gt;
&lt;br /&gt;
; Center dialog for screen.&lt;br /&gt;
&lt;br /&gt;
        move.l  #form_center,apb        ; form_center control array.&lt;br /&gt;
        move.l  dialog_addr,addr_in     ; Dialog's address.&lt;br /&gt;
        bsr     aes     &lt;br /&gt;
        move    int_out+2,dial_x        ; Save dialog's X coordinate.&lt;br /&gt;
        move    int_out+4,dial_y        ; Save dialog's Y coordinate.&lt;br /&gt;
        move    int_out+6,dial_w        ; Save dialog's width.&lt;br /&gt;
        move    int_out+8,dial_h        ; Save dialog's height.&lt;br /&gt;
&lt;br /&gt;
; Get coordinates of the NUMBERS object.&lt;br /&gt;
&lt;br /&gt;
        move.l  #objc_offset,apb        ; objc_offset control array.&lt;br /&gt;
        move    #NUMBERS,int_in         ; Object to find.&lt;br /&gt;
        move.l  dialog_addr,addr_in     ; Dialog's address.&lt;br /&gt;
        bsr     aes     &lt;br /&gt;
        move    int_out+2,num_x         ; Save object's X coordinate.&lt;br /&gt;
        move    int_out+4,num_y         ; Save object's Y coordinate.&lt;br /&gt;
&lt;br /&gt;
; Replace old dialog string with new dialog string.&lt;br /&gt;
&lt;br /&gt;
        tedinfo_str dialog_addr,NUMBERS ; Get pointer to dialog string.&lt;br /&gt;
        move.l  #number_str,(a5)        ; Point tedinfo to new string.&lt;br /&gt;
&lt;br /&gt;
; Reserve screen space for dialog box.&lt;br /&gt;
&lt;br /&gt;
        move.l  #form_dial,apb          ; form_dial control array.&lt;br /&gt;
        move    #FMD_START,int_in       ; Operation type.&lt;br /&gt;
        move    #0,int_in+2             ; Small rectangle X.&lt;br /&gt;
        move    #0,int_in+4             ; Small rectangle Y.&lt;br /&gt;
        move    #10,int_in+6            ; Small rectangle width.&lt;br /&gt;
        move    #10,int_in+8            ; Small rectangle height.&lt;br /&gt;
        move    dial_x,int_in+10        ; Dialog's X.&lt;br /&gt;
        move    dial_y,int_in+12        ; Dialog's Y.&lt;br /&gt;
        move    dial_w,int_in+14        ; Dialog's width.&lt;br /&gt;
        move    dial_h,int_in+16        ; Dialog's height.&lt;br /&gt;
        bsr     aes&lt;br /&gt;
&lt;br /&gt;
; Animate expanding rectangle.&lt;br /&gt;
&lt;br /&gt;
        move    #FMD_GROW,int_in        ; Operation type.&lt;br /&gt;
        bsr     aes&lt;br /&gt;
&lt;br /&gt;
; Draw dialog box on screen.&lt;br /&gt;
        &lt;br /&gt;
        move.l  #objc_draw,apb          ; objc_draw control array.&lt;br /&gt;
        move    #0,int_in               ; First object to draw.&lt;br /&gt;
        move    #2,int_in+2             ; Depth of draw.&lt;br /&gt;
        move    dial_x,int_in+4         ; Clipping rectangle X.&lt;br /&gt;
        move    dial_y,int_in+6         ; Clipping rectangle Y.&lt;br /&gt;
        move    dial_w,int_in+8         ; Clipping rectangle width.&lt;br /&gt;
        move    dial_h,int_in+10        ; Clipping rectangle height.&lt;br /&gt;
        move.l  dialog_addr,addr_in     ; Dialog's address.&lt;br /&gt;
        bsr     aes&lt;br /&gt;
&lt;br /&gt;
; Change mouse to finger pointer.&lt;br /&gt;
        &lt;br /&gt;
        move.l  #graf_mouse,apb         ; graf_mouse control array.&lt;br /&gt;
        move    #FINGER,int_in          ; Pointer type.&lt;br /&gt;
        clr.l   addr_in                 ; Dummy mouse address.&lt;br /&gt;
        bsr     aes&lt;br /&gt;
&lt;br /&gt;
; Activate dialog to accept user input.&lt;br /&gt;
&lt;br /&gt;
do_dialog:      &lt;br /&gt;
        move.l  #form_do,apb            ; form_do control array.&lt;br /&gt;
        move    #NAME,int_in            ; First edit field.&lt;br /&gt;
        move.l  dialog_addr,addr_in     ; Dialog's address.&lt;br /&gt;
        bsr     aes&lt;br /&gt;
&lt;br /&gt;
; Determine which exit button clicked.&lt;br /&gt;
&lt;br /&gt;
        cmpi    #RADIO1,int_out         ; Was RADIO1 clicked?&lt;br /&gt;
        bne     chk_but1                ; Nope.&lt;br /&gt;
        move.b  #'1',alert3+9           ; Yes. Prepare alert string.&lt;br /&gt;
        alert   1,alert3                ; Show alert.&lt;br /&gt;
chk_but1:&lt;br /&gt;
        cmpi    #RADIO2,int_out         ; Was RADIO2 clicked?&lt;br /&gt;
        bne     chk_but2                ; No.&lt;br /&gt;
        move.b  #'2',alert3+9           ; Yes. Prepare alert string.&lt;br /&gt;
        alert   1,alert3                ; Show alert.&lt;br /&gt;
chk_but2:&lt;br /&gt;
        cmpi    #RADIO3,int_out         ; Was RADIO3 clicked?&lt;br /&gt;
        bne     chk_but3                ; Nope.&lt;br /&gt;
        move.b  #'3',alert3+9           ; Yep. Prepare alert string.&lt;br /&gt;
        alert   1,alert3                ; Show alert.&lt;br /&gt;
chk_but3:&lt;br /&gt;
        cmpi    #RADIO4,int_out         ; Was RADIO4 clicked?&lt;br /&gt;
        bne     chk_but4                ; No.&lt;br /&gt;
        move.b  #'4',alert3+9           ; Yes, Prepare alert string.&lt;br /&gt;
        alert   1,alert3                ; Show alert.&lt;br /&gt;
chk_but4:&lt;br /&gt;
        cmpi    #RADIO5,int_out         ; Was RADIO5 clicked?&lt;br /&gt;
        bne     chk_but5                ; No.&lt;br /&gt;
        move.b  #'5',alert3+9           ; Yes, Prepare alert string.&lt;br /&gt;
        alert   1,alert3                ; Show alert.&lt;br /&gt;
chk_but5:&lt;br /&gt;
        cmpi    #RADIO6,int_out         ; Was RADIO6 clicked?&lt;br /&gt;
        bne     chk_but6                ; Nope.&lt;br /&gt;
        move.b  #'6',alert3+9           ; Yes. Prepare alert string.&lt;br /&gt;
        alert   1,alert3                ; Show alert.&lt;br /&gt;
chk_but6:&lt;br /&gt;
        cmpi    #OPTION1,int_out        ; Was OPTION1 clicked?&lt;br /&gt;
        bne     chk_but7                ; No.&lt;br /&gt;
        move.b  #'1',alert4+10          ; Yes. Prepare alert string.&lt;br /&gt;
        alert   1,alert4                ; Show alert.&lt;br /&gt;
chk_but7:&lt;br /&gt;
        cmpi    #OPTION2,int_out        ; Was OPTION2 clicked?&lt;br /&gt;
        bne     chk_but8                ; No.&lt;br /&gt;
        move.b  #'2',alert4+10          ; Yes. Prepare alert string.&lt;br /&gt;
        alert   1,alert4                ; Show alert.&lt;br /&gt;
chk_but8:&lt;br /&gt;
        cmpi    #UPARROW,int_out        ; Was UPARROW clicked?&lt;br /&gt;
        bne     chk_but9                ; No.&lt;br /&gt;
        cmpi    #9999,num               ; Yes. Check if num maxed.&lt;br /&gt;
        beq     num_at_max              ; Num at max value. Skip add.&lt;br /&gt;
        addi    #1,num                  ; Increment num.&lt;br /&gt;
num_at_max:&lt;br /&gt;
        bsr     change_number           ; Change number in dialog.&lt;br /&gt;
chk_but9:&lt;br /&gt;
        cmpi    #DWNARROW,int_out       ; Was DWNARROW clicked?&lt;br /&gt;
        bne     chk_but10               ; No.&lt;br /&gt;
        tst     num                     ; Yes. Is num already 0?&lt;br /&gt;
        beq     num_at_min              ; If 0, skip decrement.&lt;br /&gt;
        subi    #1,num                  ; Decrement num.&lt;br /&gt;
num_at_min:&lt;br /&gt;
        bsr     change_number           ; Change number in dialog.&lt;br /&gt;
chk_but10:&lt;br /&gt;
        cmpi    #CANCEL,int_out         ; Was CANCEL clicked?&lt;br /&gt;
        bne     chk_but11               ; No.&lt;br /&gt;
        bra     dialog_done             ; Yes. Close dialog.&lt;br /&gt;
chk_but11:&lt;br /&gt;
        cmpi    #OK,int_out             ; Was OK clicked?&lt;br /&gt;
        bne     do_dialog               ; No. Reactivate dialog.&lt;br /&gt;
&lt;br /&gt;
dialog_done:&lt;br /&gt;
        move.l  #form_dial,apb          ; form_dial control array.&lt;br /&gt;
        move    #FMD_SHRINK,int_in      ; Operation code.&lt;br /&gt;
        move    #0,int_in+2             ; Small rectangle X.&lt;br /&gt;
        move    #0,int_in+4             ; Small rectangle Y.&lt;br /&gt;
        move    #10,int_in+6            ; Small rectangle width.&lt;br /&gt;
        move    #10,int_in+8            ; Small rectangle height.&lt;br /&gt;
        move    dial_x,int_in+10        ; Dialog's X.&lt;br /&gt;
        move    dial_y,int_in+12        ; Dialog's Y.&lt;br /&gt;
        move    dial_w,int_in+14        ; Dialog's width.&lt;br /&gt;
        move    dial_h,int_in+16        ; Dialog's height.&lt;br /&gt;
        bsr     aes&lt;br /&gt;
        &lt;br /&gt;
        move    #FMD_FINISH,int_in      ; Operation Code.&lt;br /&gt;
        bsr     aes&lt;br /&gt;
quit:&lt;br /&gt;
        &lt;br /&gt;
; Release resource space.&lt;br /&gt;
&lt;br /&gt;
        move.l  #rsrc_free,apb          ; rsrc_free control array.&lt;br /&gt;
        bsr     aes&lt;br /&gt;
        &lt;br /&gt;
; Close down application.&lt;br /&gt;
&lt;br /&gt;
exit:&lt;br /&gt;
        move.l  #appl_exit,apb          ; appl_exit control array.&lt;br /&gt;
        bsr     aes&lt;br /&gt;
        &lt;br /&gt;
end:&lt;br /&gt;
        move.w  #PTERM0,-(sp)           ; Back to desktop.&lt;br /&gt;
        trap    #1&lt;br /&gt;
&lt;br /&gt;
;--------------------------------------------------------------------&lt;br /&gt;
; This subroutine changes the NUMBER object in the dialog box to a &lt;br /&gt;
; new value.&lt;br /&gt;
;--------------------------------------------------------------------&lt;br /&gt;
change_number:&lt;br /&gt;
&lt;br /&gt;
; Restore dialog number string to '0000'.&lt;br /&gt;
&lt;br /&gt;
        lea     number_str+4,a3         ; Get addr of 1st number character.&lt;br /&gt;
        move.l  #3,d3                   ; Init loop counter.&lt;br /&gt;
place_zero:&lt;br /&gt;
        move.b  #'0',(a3)+              ; Put '0' in string.&lt;br /&gt;
        dbra    d3,place_zero           ; Go place next '0'.&lt;br /&gt;
&lt;br /&gt;
; Convert new value for dialog to ASCII string.&lt;br /&gt;
        &lt;br /&gt;
        move    num,d0                  ; Get new value into work reg.&lt;br /&gt;
        lea     strg,a3                 ; Get addr of string buffer.&lt;br /&gt;
        bsr     int2ascii16             ; Convert value to ASCII string.&lt;br /&gt;
&lt;br /&gt;
; Count number of chars in new number string.&lt;br /&gt;
&lt;br /&gt;
        clr     d3                      ; Init counter.&lt;br /&gt;
.check_char:&lt;br /&gt;
        tst.b   (a3)+                   ; Check for end of string.&lt;br /&gt;
        beq     .found_null             ; if found null, branch.&lt;br /&gt;
        addq    #1,d3                   ; Increment counter.&lt;br /&gt;
        bra     .check_char             ; Go check next char.&lt;br /&gt;
        &lt;br /&gt;
.found_null:&lt;br /&gt;
&lt;br /&gt;
; Move new number string into new dialog string.&lt;br /&gt;
&lt;br /&gt;
        subi    #1,d3                   ; Init loop counter.&lt;br /&gt;
        sub.l   #1,a3                   ; Init string address.&lt;br /&gt;
        lea     number_str,a4           ; Get addr of new dialog string.&lt;br /&gt;
        move    #3,d4                   ; Init addr index.&lt;br /&gt;
.move_char:&lt;br /&gt;
        move.b  -(a3),4(a4,d4)          ; Move character into dialog string.&lt;br /&gt;
        subi    #1,d4                   ; Decrement addr index.&lt;br /&gt;
        dbra    d3,.move_char           ; Go move next character.&lt;br /&gt;
&lt;br /&gt;
; Draw NUMBERS object so new string is displayed.&lt;br /&gt;
        &lt;br /&gt;
        move.l  #objc_draw,apb          ; objc_draw control array.&lt;br /&gt;
        move    #NUMBERS,int_in         ; First object to draw.&lt;br /&gt;
        move    #1,int_in+2             ; Depth of draw.&lt;br /&gt;
        move    num_x,int_in+4          ; Clipping rectangle X.&lt;br /&gt;
        move    num_y,int_in+6          ; Clipping rectangle Y.&lt;br /&gt;
        move    #96,int_in+8            ; Clipping rectangle width.&lt;br /&gt;
        move    #32,int_in+10           ; Clipping rectangle height.&lt;br /&gt;
        move.l  dialog_addr,addr_in     ; Address of dialog.&lt;br /&gt;
        bsr     aes&lt;br /&gt;
        rts&lt;br /&gt;
end_change_number:&lt;br /&gt;
&lt;br /&gt;
;--------------------------------------------------------------------&lt;br /&gt;
; This subroutine converts a 16-bit unsigned integer into a &lt;br /&gt;
; null-terminated string.&lt;br /&gt;
;&lt;br /&gt;
; Input: Address of buffer in a3.&lt;br /&gt;
;        Integer to convert in d0.&lt;br /&gt;
; Output: The buffer will contain the resultant null-terminated string.&lt;br /&gt;
; Registers changed: NONE.&lt;br /&gt;
;--------------------------------------------------------------------&lt;br /&gt;
int2ascii16:&lt;br /&gt;
        movem.l a0-a7/d0-d7,-(sp)       ; save registers.&lt;br /&gt;
        clr.l   d3                      ; init leading-zero flag.&lt;br /&gt;
        move.l  #10000,d1               ; init divisor.&lt;br /&gt;
.convrt:&lt;br /&gt;
        divu    d1,d0                   ; calculate place value.&lt;br /&gt;
        cmpi.l  #1,d1                   ; are we at the one's place?&lt;br /&gt;
        beq     .zero_ok                ; if so, &amp;quot;0&amp;quot; always ok.&lt;br /&gt;
        tst.w   d3                      ; already have a non-zero char?&lt;br /&gt;
        bne     .zero_ok                ; yes, so zeroes okay.&lt;br /&gt;
        tst.w   d0                      ; is result zero?&lt;br /&gt;
        beq     .next_digit             ; yes.&lt;br /&gt;
        moveq   #1,d3                   ; set leading-zero flag.&lt;br /&gt;
.zero_ok:&lt;br /&gt;
        move.b  d0,(a3)                 ; move result to buffer.&lt;br /&gt;
        add.b   #'0',(a3)+              ; change digit to ascii.&lt;br /&gt;
.next_digit:&lt;br /&gt;
        divu    #10,d1                  ; calculate next divisor.&lt;br /&gt;
        tst.w   d1                      ; are we done yet?&lt;br /&gt;
        beq     .add_null               ; sure are.&lt;br /&gt;
        move.w  #0,d0                   ; clear result from low word.&lt;br /&gt;
        swap    d0                      ; put remainder in low word.&lt;br /&gt;
        bra     .convrt                 ; convert next digit.&lt;br /&gt;
.add_null:&lt;br /&gt;
        move.b  #0,(a3)+                ; add null to string.&lt;br /&gt;
        movem.l (sp)+,a0-a7/d0-d7       ; restore registers.&lt;br /&gt;
        rts&lt;br /&gt;
end_int2ascii16:&lt;br /&gt;
&lt;br /&gt;
;--------------------------------------------------------------------&lt;br /&gt;
; This subroutine calls the AES.  Before calling this subroutine, the&lt;br /&gt;
; program must have correctly initialized the AES control, int_in,&lt;br /&gt;
; and addr_in arrays.&lt;br /&gt;
;&lt;br /&gt;
; Input:        Appropriate values in the int_in, addr_in, and&lt;br /&gt;
;               control arrays.&lt;br /&gt;
; Output:       Appropriate values in the int_out, addr_out, and&lt;br /&gt;
;               global arrays.&lt;br /&gt;
; Regs changed: NONE&lt;br /&gt;
; Uses: apb, global, int_in, int_out, addr_in, addr_out&lt;br /&gt;
;--------------------------------------------------------------------&lt;br /&gt;
aes:&lt;br /&gt;
        movem.l a0-a7/d0-d7,-(sp)       ; Save registers.&lt;br /&gt;
        move.l  #apb,d1                 ; Load addr of apb.&lt;br /&gt;
        move.l  #AES_OPCODE,d0          ; Load AES opcode.&lt;br /&gt;
        trap    #2                      ; Call AES.&lt;br /&gt;
        movem.l (sp)+,a0-a7/d0-d7       ; Restore registers.&lt;br /&gt;
        rts&lt;br /&gt;
&lt;br /&gt;
.data&lt;br /&gt;
        &lt;br /&gt;
.even&lt;br /&gt;
&lt;br /&gt;
num:            dc.w    0&lt;br /&gt;
        &lt;br /&gt;
apb:            dc.l    0,global,int_in,int_out,addr_in,addr_out&lt;br /&gt;
&lt;br /&gt;
appl_init:      dc.w    10,0,1,0,0&lt;br /&gt;
appl_exit:      dc.w    19,0,1,0,0&lt;br /&gt;
form_alert:     dc.w    52,1,1,1,0&lt;br /&gt;
form_center:    dc.w    54,0,5,1,0&lt;br /&gt;
form_dial:      dc.w    51,9,1,0,0&lt;br /&gt;
form_do:        dc.w    50,1,1,1,0&lt;br /&gt;
graf_mouse:     dc.w    78,1,1,1,0&lt;br /&gt;
objc_draw:      dc.w    42,6,1,1,0&lt;br /&gt;
objc_offset:    dc.w    44,1,3,1,0&lt;br /&gt;
rsrc_free:      dc.w    111,0,1,0,0&lt;br /&gt;
rsrc_gaddr:     dc.w    112,2,1,0,1&lt;br /&gt;
rsrc_load:      dc.w    110,0,1,1,0&lt;br /&gt;
&lt;br /&gt;
rsrc_file:      dc.b    &amp;quot;SAMPLE.RSC&amp;quot;,0&lt;br /&gt;
number_str:     dc.b    &amp;quot;    0000    &amp;quot;,0&lt;br /&gt;
alert1:         dc.b    &amp;quot;[0][Resource load error!  ][  OK  ]&amp;quot;,0&lt;br /&gt;
alert2:         dc.b    &amp;quot;[0][Resource address error!][  OK  ]&amp;quot;,0&lt;br /&gt;
alert3:         dc.b    &amp;quot;[0][RADIO ][  OK  ]&amp;quot;,0&lt;br /&gt;
alert4:         dc.b    &amp;quot;[0][OPTION   ][  OK  ]&amp;quot;,0&lt;br /&gt;
alert5:         dc.b    &amp;quot;[0][UP ARROW  ][  OK  ]&amp;quot;,0&lt;br /&gt;
alert6:         dc.b    &amp;quot;[0][DOWN ARROW  ][  OK  ]&amp;quot;,0&lt;br /&gt;
&lt;br /&gt;
                bss&lt;br /&gt;
&lt;br /&gt;
                even&lt;br /&gt;
&lt;br /&gt;
dialog_addr:    ds.l    1&lt;br /&gt;
num_x:          ds.w    1&lt;br /&gt;
num_y:          ds.w    1&lt;br /&gt;
dial_x:         ds.w    1&lt;br /&gt;
dial_y:         ds.w    1&lt;br /&gt;
dial_w:         ds.w    1&lt;br /&gt;
dial_h:         ds.w    1&lt;br /&gt;
strg:           ds.w    10&lt;br /&gt;
        &lt;br /&gt;
global:&lt;br /&gt;
ap_version:     ds.w    1&lt;br /&gt;
ap_count:       ds.w    1&lt;br /&gt;
ap_id:          ds.w    1&lt;br /&gt;
ap_private:     ds.l    1&lt;br /&gt;
ap_ptree:       ds.l    1&lt;br /&gt;
ap_1resv:       ds.l    1&lt;br /&gt;
ap_2resv:       ds.l    1&lt;br /&gt;
ap_3resv:       ds.l    1&lt;br /&gt;
ap_4resv:       ds.l    1&lt;br /&gt;
&lt;br /&gt;
int_in:         ds.w    9&lt;br /&gt;
int_out:        ds.w    5&lt;br /&gt;
addr_in:        ds.l    2&lt;br /&gt;
addr_out:       ds.l    1&lt;br /&gt;
&lt;br /&gt;
                ds.l    255&lt;br /&gt;
stack:          ds.l    1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Back to [[CW_CHAPTER_4]]&lt;/div&gt;</summary>
		<author><name>&gt;Zorro 2</name></author>
	</entry>
</feed>