99 Bottles of Beer/Assembly: Difference between revisions

m
Sigh, still not right!
m (Sigh, still not right!)
 
(2 intermediate revisions by the same user not shown)
Line 4:
{{collection|99 Bottles of Beer}} [[implementation of task::99 Bottles of Beer| ]]
[[99 Bottles of Beer]] done in any of the assembler-languages.
 
<!--
See [[99 Bottles of Beer/Assembly]]
-->
 
<!-- still missing:
Line 15 ⟶ 11:
__toc__
 
=={{header|=360 Assembly}}===
For maximum compatibility, this program uses only the basic instruction set.
<langsyntaxhighlight lang="360asm">* 99 Bottles of Beer 04/09/2015
BOTTLES CSECT
USING BOTTLES,R12
Line 66 ⟶ 62:
DC H'0' must be binary zeroes
YREGS
END BOTTLES</lang>syntaxhighlight
>
{{out}}
<pre style="height:20ex">
Line 96 ⟶ 93:
</pre>
 
=={{header|=6502 Assembly}}===
IMPORTANT NOTE: This assembly language solution is targeted at the Apple 1.
 
Line 107 ⟶ 104:
and cannot be "fixed" due to non-compliance, only deleted.
 
<langsyntaxhighlight lang="6502 Assemblyassembly"> .CR 6502
.TF AP1BEER.O,AP1
.LF AP1BEER.LST
Line 263 ⟶ 260:
:4E 44 20 42 55 59 20 53 4F 4D 45 20 4D
:4F 52 45 2C 8D
BEER</langsyntaxhighlight>
 
=={{header|=6800 Assembly}}===
 
<langsyntaxhighlight lang="6800 Assemblyassembly"> .cr 6800
.tf beer6800.obj,AP1
.lf beer6800
Line 423 ⟶ 420:
e0FB0 74 68 65 20 73 74 6F 72 65 20 61 6E 64 20 62 75
e0FC0 79 20 73 6F 6D 65 20 6D 6F 72 65 2C A0
j0F00</langsyntaxhighlight>
 
=={{header|=68000 Assembly}}===
 
=={{header|68000 Assembly}}==
The following is a Sega Genesis cartridge that can be assembled and run on the Fusion emulator. Press the A button to advance to the next part of the song. The game freezes when finished. Thanks to Keith S. of Chibiakumas for the cartridge header and print routines.
 
<langsyntaxhighlight lang="68000devpac">;99 BOTTLES OF BEER
;Ram Variables
Cursor_X equ $00FF0000 ;Ram for Cursor Xpos
Line 913 ⟶ 911:
DC.B $80 ;23 DMA source address high (C=CMD) CCHHHHHH
VDPSettingsEnd:
even</langsyntaxhighlight>
 
=={{header|=8080 Assembly}}===
<langsyntaxhighlight lang="8080asm">;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 99 bottles of beer, in 8080 assembly ;;
;; Written to run under CP/M ;;
Line 1,019 ⟶ 1,017:
sstore: db 'Go to the store and buy some more,',13,10,0
 
</syntaxhighlight>
</lang>
=={{header|=ARM Assembly}}===
<!-- printf missing ? --->
<syntaxhighlight lang="arm_assembly">
<lang ARM_Assembly>
.global main
 
Line 1,056 ⟶ 1,054:
.ascii "No more bottles of beer on the wall, no more bottles of beer.\n"
.ascii "Go to the store and buy some more, 99 bottles of beer on the wall\n\000"
</syntaxhighlight>
</lang>
 
=={{header|=LLVM}}===
<langsyntaxhighlight lang="llvm">; "99 Bottles of Beer on the Wall" in LLVM Assembly
 
; This is not strictly LLVM, as it uses the C library function "printf".
Line 1,128 ⟶ 1,126:
break:
ret i32 0
}</langsyntaxhighlight>
 
<!-- missing here:
=={{header|=MMIX}}===
-->
 
=={{header|=OASYS Assembler}}===
The following example demonstrates the use of pointer variables (the argument <tt>,^#</tt> to the <tt>&VERSE#</tt> method), and therefore may not be as efficient as one which does not use pointer variables.
<langsyntaxhighlight lang="oasys_oaa">
; Beer program with OASYS assembler.
 
Line 1,153 ⟶ 1,151:
['QUIT]
GQ
</syntaxhighlight>
</lang>
 
=={{header|=X86 Assembly}}===
 
====Using Windows/MASM32====
<langsyntaxhighlight lang="asm">.386
.model flat, stdcall
option casemap :none
Line 1,200 ⟶ 1,198:
INVOKE StdOut, offset str4
INVOKE ExitProcess, 0
end start</langsyntaxhighlight>
 
====using DOS/BIOS====
<langsyntaxhighlight lang="asm">
[bits 16]
DrinkBeer:
Line 1,285 ⟶ 1,283:
.dataBeerSong3: db 0, " bottles of beer on the wall", 0
 
</syntaxhighlight>
</lang>
 
====Implemented in the nasm preprocessor====
<langsyntaxhighlight lang="asm">bits 32
 
section .data
Line 1,319 ⟶ 1,317:
mov ebx, 0
mov eax, 1
int 0x80</langsyntaxhighlight>
 
====x86_64 (GAS)====
Could maybe have done it all with macros, but I wanted to write my own itoa function. Plus I feel like using the preprocessor for its looping directives takes the challenge out of the problem. To extend to larger numbers, all you have to do is increase the size of the buffer and modify START_BOTTLES.
<syntaxhighlight lang="asm">// Compiles with `gcc -nostdlib`
#define SYS_EXIT $60
#define SYS_WRITE $1
Line 1,491 ⟶ 1,489:
regstring3:
.ascii " bottles of beer on the wall.\n\n"
</syntaxhighlight>
</lang>
 
=={{header|=Z80 Assembly}}===
For Sinclair ZX Spectrum.
<langsyntaxhighlight lang="z80">org 32768
 
start:
Line 1,565 ⟶ 1,563:
line1: defb ' bottles of beer on the wall,',13,'$'
line2_3: defb ' bottles of beer,',13,'Take one down, pass it around,',13,'$'
line4: defb ' bottles of beer on the wall.',13,13,'$'</langsyntaxhighlight>
9,476

edits