org &a000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; This program prints the '99 bottles of beer' lyrics. It was lovingly ; handcrafted, assembled and tested using the WinAPE Amstrad CPC ; Emulator, version 2.0 Alpha 6. ; ; This program is Free Software, and may be used and redistributed under ; the terms of the GNU LGPL. ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ld a,&02 call &bc0e; ; set high-res mode for 80-column text ld hl,count ld (hl),&63 ; this is the starting number of bottles .nextbottle ld a,(count) ld hl,str_plural push hl ld a,(count) ld h,&00 ld l,a push hl ld hl,str_plural push hl ld a,(count) ld h,&00 ld l,a push hl ld hl,str_bottles1 push hl call printf ; print the first line ld a,(count) dec a ; decrement the count cp &01 jr nz,notone ld hl,str_plural ; null the plural string if we're down to one bottle ld (hl),&00 .notone cp &00 jr z,finish ld (count),a ld hl,str_plural push hl ld a,(count) ld h,&00 ld l,a push hl ld hl,str_bottles2 push hl call printf ; print the second line jr nextbottle .finish ld hl,str_finish push hl call printf ; print the final three lines ret ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; This is a simple version of printf. It works on a null-termi