How to resolve the algorithm FizzBuzz step by step in the VAX Assembly programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm FizzBuzz step by step in the VAX Assembly programming language

Table of Contents

Problem Statement

Write a program that prints the integers from   1   to   100   (inclusive).

But:

The   FizzBuzz   problem was presented as the lowest level of comprehension required to illustrate adequacy.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm FizzBuzz step by step in the VAX Assembly programming language

Source code in the vax programming language

                           00000008  0000     1 len	=8
                           00000008  0000     2 msg:	.blkb	len			;output buffer
                           0000000C  0008     3 desc:	.blkl	1			;descriptor lenght field
                           00000000' 000C     4 	.address msg			;pointer to buffer
                           00000012  0010     5 outlen:	.blkw	1
         4C 55 21 0000001A'010E0000' 0012     6 ctr:	.ascid	"!UL"
                                     001D     7 
                               0000  001D     8 .entry	start,0
                            52   7C  001F     9 	clrq	r2			;r2+r3 64bit
                            52   D6  0021    10 	incl	r2			;start index 1
                                     0023    11 loop:
                         E2 AF   B4  0023    12 	clrw	desc			;assume not fizz and or buzz
                    55   D7 AF   9E  0026    13 	movab	msg, r5			;pointer to message buffer
             54   50   52   03   7B  002A    14 	ediv	#3,r2,r0,r4		;divr.rl,divd.rq,quo.wl,rem.wl
                            54   D5  002F    15 	tstl	r4			;remainder
                            0B   12  0031    16 	bneq	not_fizz		;not equal zero
                                     0033    17 
              85   7A7A6966 8F   D0  0033    18 	movl	#^a"fizz", (r5)+	;add to message
                    CA AF   04   A0  003A    19 	addw2	#4, desc		;and update length
                                     003E    20 not_fizz:
             54   50   52   05   7B  003E    21 	ediv	#5,r2,r0,r4
                            54   D5  0043    22 	tstl	r4
                            0B   12  0045    23 	bneq	not_buzz
                                     0047    24 
              85   7A7A7562 8F   D0  0047    25 	movl	#^a"buzz", (r5)+
                    B6 AF   04   A0  004E    26 	addw2	#4, desc
                                     0052    27 not_buzz:
                         B3 AF   B5  0052    28 	tstw	desc			;fizz and or buzz?
                            1B   12  0055    29 	bneq	show_buffer		;neq - yes
                                     0057    30 
                    AD AF   08   B0  0057    31 	movw	#len, desc		;fao length limit
                                     005B    32 	$fao_s -			;eql -no
                                     005B    33 		 ctrstr = ctr, -	;show number
                                     005B    34 		 outlen = outlen, -
                                     005B    35 		 outbuf = desc, -
                                     005B    36 		 p1     = r2
                 96 AF   A0 AF   B0  006D    37 	movw	outlen, desc		;characters filled by fao
                                     0072    38 show_buffer:
                         93 AF   7F  0072    39 	pushaq	desc
              00000000'GF   01   FB  0075    40 	calls	#1, g^lib$put_output
           9F 52   00000064 8F   F3  007C    41 	AOBLEQ	#100,r2,loop		;limit.rl, index.ml
                                 04  0084    42 	ret
                                     0085    43 .end	start

  

You may also check:How to resolve the algorithm Bell numbers step by step in the ALGOL-M programming language
You may also check:How to resolve the algorithm Sort disjoint sublist step by step in the Arturo programming language
You may also check:How to resolve the algorithm Zero to the zero power step by step in the min programming language
You may also check:How to resolve the algorithm Super-Poulet numbers step by step in the C++ programming language
You may also check:How to resolve the algorithm Logical operations step by step in the Raku programming language