; Astrocade Z-80 "CRITTER" source file ; ; Revisions: ; * December 7, 2011 ; - Fixed the way comments on the Critter's shape ; * June 5, 2004 ; - Noted that this will only run under MLM ; * December 6, 2003 ; - Updated so it works with HVGLIB.H ; * January 28, 2002 ; - Slight Modifications ; * November 11, 2001 ; - Re-typed by Adam Trionfo ; ; To assemble this Z-80 source code using ZMAC: ; ; zmac -d -o -x ; ; For example, assemble this Astrocade Z-80 ROM file: ; ; zmac -i -m -o critter.bin -x critter.lst critter.asm ; ; The following program ("Critter," by Brett Bilbrey) is ; from the "Machine Language Manager" manual, page 7-2. ; It, in turn, is a modified version of the "CRITTER" prog- ; ram from the Oct. 80 issue CURSOR of the Cursor newsletter ; ; Turn KN(1) to change the speed of the "critter." ; ; Note: This will NOT run as a cartridge-- it's meant ; to be run un MLM. CRITV EQU $4FB2 ; Screen interrupt vector INCLUDE "HVGLIB.H" ORG $2000 ; First byte of Cartridge DB $55 ; Bally System Sentinel ; Menu Selection Choice #1 DW MENUST ; Next Menu Link DW MTITLE ; Menu Title for Critter DW $2007 ; Beginning of Critter program ORG $2007 DI IM 2 ; Set Interrupt Control LD A,$4F ; Load I with page of interrupt LD I,A ; vector interrupt vector (MSB) LD A,$B2 ; Load custom chips with line of OUT ($0D),A ; interrupt vector (LSB) LD A,$C8 ; Bottom line OUT ($0F),A ; Interrupt Line SYSTEM (INTPC) DO (SETOUT) DB $B0 ; Vertical Blanking Line DB $2C ; Left/Right Color Boundary DB $18 ; Interrupt Mode ; Setup the screen colors DO (COLSET) DW COLTAB ; Color Table #1 ; Set Stack Pointer LD SP,$4FEA ; Set stack for Astro BASIC EXIT EI BEGIN: JP PRGSRT JP PRGLOP ; Infinite loop PRGLOP: NOP ; Do nothing, just burning time RET ; for interrupt PRGSRT: DI PUSH HL LD HL,CRITTR ; Load screen interrupt vector LD (CRITV),HL ; with address of routine ; Clear the whole screen SYSSUK (FILL) DW NORMEM ; Destination DW 3600D ; Fill for # of bytes DW $00 ; Fill with zeros POP HL EI RET CRITTR: PUSH AF ; First Byte of Interrupt Routine PUSH BC PUSH DE PUSH HL PUSH IX PUSH IY IN A,(POT0) ; Get KNOB(1) value LD ($4E97),A ; Put in Vector Block (Time Base) SYSTEM (INTPC) ; Start interpreter DO (MCALL) DW VWRITE ; Jump to Vector Write DO (VECT) DW VECBLK ; Vector Block Address DW LIMTAB ; Limit Table DO (MCALL) DW VWRITE ; Jump to Vector Write EXIT ; Stop interpreter POP IY ; Clean up and go home POP IX POP HL POP DE POP BC POP AF EI RET VWRITE: DB VWRITR+1 ; Vector Write DW VECBLK ; Address of Vector block DW PATERN ; Pattern DB $08 ; Returns for subroutines ; Limit table LIMTAB: DW $9800 ; X Boundaries DW $5000 ; Y boundaries DW $0000 ; Pattern 0,0 position DW $0802 ; 2 byte wide, 8 line long pattern ; size pattern ; Critter Pattern PATERN: DB 00001010B,10100000B ; . . 2 2 2 2 . . DB 00100010B,10001000B ; . 2 . 2 2 . 2 . DB 10101010B,10101010B ; 2 2 2 2 2 2 2 2 DB 00101010B,10101000B ; . 2 2 2 2 2 2 . DB 00001000B,00100000B ; . . 2 . . 2 . . DB 00100000B,00001000B ; . 2 . . . . 2 . DB 00001000B,00100000B ; . . 2 . . 2 . . DB 00000000B,00000000B ; . . . . . . . . ; VECTOR BLOCK VECBLK: DB $20 ; Magic Register value DB $80 ; Vector Status DB $00 ; Time Base - Holds KN(1) value DW $0005 ; Delta X DW $0000 ; X Position DB $03 ; X Checks Mask DW $0005 ; Delta Y DW $0000 ; Y Position DB $03 ; Checks Mask (Ending at ; address $4EA1) ; Color Table COLTAB: DB $00 ; Color 0 Right DB $00 ; Color 1 Right DB $07 ; Color 2 Right DB $07 ; Color 3 Right DB $5A ; Color 0 Left DB $84 ; Color 1 Left DB $06 ; Color 2 Left DB $00 ; Color 3 Left ; Critter Title for Menu MTITLE: DB 'C','R','I','T','T','E','R' ; End of Program