Language Assembler (6510)
| Date: | 04/20/05 |
| Author: | Johannes Tevessen |
| URL: | n/a |
| Comments: | 2 |
| Info: | n/a |
| Score: |
; 99 bottles of beer - C64 6510 assembler version ; written 2001 by Johannes Tevessen <j.tevessen@gmx.net> ; ; Self-modifying code. ; Compiled size: 192 byte plus 2 byte loading offset. ; If you can make a shorter version doing the same, ; please contact me. ; ; Compile, for example, to $C000 and start ; using: ; LOAD "64BEER",8,1 ; NEW ; SYS 49152 ; ; for example: as64 -sC000 64beer.S -o 64beer ; ; This code is downloadable: ; ; Source: http://www.dummy.de/c64/64beer.S ; Compiled: http://www.dummy.de/c64/64beer.bin ; ; The code looks like this: ; ; $ ./thex <64beer ; 000000: 00C0A263 2054C0A9 5EA01C20 44C0A9BC ...c T..^.. D... ; 000010: A0022044 C02054C0 A95EA010 2044C0A9 .. D. T..^.. D.. ; 000020: 7AA02120 44C0CA20 54C0A95E A01C2044 z.! D.. T..^.. D ; 000030: C0A97AA0 022044C0 8AD0C9A9 9BA02520 ..z.. D.......% ; 000040: 44C0A95E A01E8D48 C0AD00C0 20D2FFEE D..^...H.... ... ; 000050: 48C088D0 F4608A48 A90020CD BD68AA60 H.....H.. ..h... ; 000060: 20424F54 544C4553 204F4620 42454552 BOTTLES OF BEER ; 000070: 204F4E20 54484520 57414C4C 2E0D5441 ON THE WALL..TA ; 000080: 4B45204F 4E452044 4F574E2C 20504153 KE ONE DOWN, PAS ; 000090: 53204954 2041524F 554E442C 0D474F20 S IT AROUND,.GO ; 0000A0: 544F2054 48452053 544F5245 20414E44 TO THE STORE AND ; 0000B0: 20425559 20534F4D 45204D4F 52452C0D BUY SOME MORE,. ; 0000C0: 3939 99 ; .org $C000 org: ldx #99 bloop: jsr xout lda #<bobot ldy #28 jsr strout lda #<comcr ldy #2 jsr strout jsr xout lda #<bobot ldy #16 jsr strout lda #<bobpa ldy #33 jsr strout dex jsr xout lda #<bobot ldy #28 jsr strout lda #<bobpa ldy #2 jsr strout txa bne bloop lda #<endtx ldy #37 jsr strout lda #<bobot ldy #30 strout: sta ldins+1 ldins: lda org jsr $ffd2 inc ldins+1 dey bne ldins outdon: rts xout: txa pha lda #0 jsr $bdcd pla tax rts bobot: .text " BOTTLES OF BEER ON THE WALL" bobpa: .text "." .byte 13 .text "TAKE ONE DOWN, PASS IT AROUND," .byte 13 endtx: .text "GO TO THE STORE AND BUY SOME MORE" comcr: .text "," .byte 13 .text "99"
Download Source | Write Comment
Download Source | Write Comment
Add Comment
Please provide a value for the fields Name,
Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.
Please don't post large portions of code here! Use the form to submit new examples or updates instead!
Comments
From the rules to be known.. :
"Real programmers write self-modifying code, espacially if it can safe 20 nanoseconds in the middle of a tight loop"
xtr
Shortens the code like this
LDA #<ENDTX
LDY #37
JSR STROUT
LDA #<BOBOT
LDY #30
becomes
LDA #<ENDTX
LDY #67