;############# CMonster by Patrick Davidson - title screen title_show_highscore: call show_highscores call Clear_Screen Show_Title_Screen: xor a ld (Draw_Char_Line_Duplicate),a ld hl,title_screen call Draw_Strings ld a,$C9 ld (Draw_Char_Line_Duplicate),a ld hl,$b000 ld (wait_count),hl loop_title: ld hl,(wait_count) inc hl ld (wait_count),hl ld a,h or l ld c,1 ret z ld hl,(delay_amount) inc hl inc hl ld a,h and 31 ld h,a ld (delay_amount),hl ld hl,0 ; HL = X coordinate of segment of scroll being drawn loop_scroll_message: push hl push hl ld a,(delay_amount) sub l ld hl,scroll_table #ifdef TI84CE ld de,0 #else ld d,0 #endif ld e,a add hl,de ld b,(hl) ; B = Y coordinate for character pop hl ; HL = X coordinate for character push hl ld hl,(delay_amount) pop de ; DE = X coordinate for character add hl,de ex de,hl ; HL = X coordinate, DE = X coordinate + adjust amount ld a,e and 7 ld c,a ; C = X coordinate within character srl d rr e srl d rr e srl d rr e push hl ld hl,scroll_message add hl,de ld a,(hl) pop hl call Draw_Vertical_Subchar pop hl inc hl ld a,h dec a jr nz,loop_scroll_message ld a,l cp 64 jr nz,loop_scroll_message call GET_KEY ld c,5 cp sk1 jr z,slowest cp sk2 jr z,slowerspeed cp sk3 jr z,slow cp sk4 jr z,medium cp sk5 jr z,fast cp sk6 jr z,faster cp sk7 jr z,fastest cp skAlpha jp z,title_show_highscore cp skClear jp nz,loop_title exit_game: ld c,1 ret slowest: ld a,'1' ld l,46 ret slowerspeed: ld a,'2' ld l,41 ret slow: ld a,'3' ld l,36 ret medium: ld a,'4' ld l,31 ret fast: ld a,'5' ld l,26 ret faster: ld a,'7' ld l,21 ret fastest: ld a,'9' ld l,16 ret ; ############# Draw a vertical slice of a character ; HL = X coordinate ; A = character ; B = Y coordinate ; C = slice (0 - 7) Draw_Vertical_Subchar: #ifdef TI84CE push hl sub 32 ld de,0 add a,a add a,a ld e,a ld hl,tileData add hl,de add hl,de ; HL -> start of char ex de,hl pop hl ; HL = X coordinate push de ; save character pointer on stack push hl ; save X coordinate on stack ld a,c add a,a add a,a add a,a xor %01111111 ld (smc_bit_selection+1),a ld hl,0 ld de,0 ld e,b ld l,b add hl,hl add hl,hl add hl,de ; HL = 5 * Y add hl,hl add hl,hl ; HL = 20 * Y add hl,hl add hl,hl ; HL = 80 * Y add hl,hl add hl,hl ; HL = 320 * Y pop de add hl,de ; HL = 320 * Y + X add hl,hl ; HL = 640 * Y + 2 * X ld de,$D40000 add hl,de call blank_6_rows pop de ld b,8 loop_char_main_slice: ld a,(de) inc de smc_bit_selection: bit 0,a ld a,$ff jr z,char_slice_set xor a char_slice_set: push bc ld bc,320*2-1 ld (hl),a inc hl ld (hl),a add hl,bc ld (hl),a inc hl ld (hl),a add hl,bc pop bc djnz loop_char_main_slice blank_6_rows: ld bc,320*2-1 ld a,6 loop_verticalsub: ld (hl),0 inc hl ld (hl),0 add hl,bc dec a jr nz,loop_verticalsub ret #else push af push bc ld a,$52 ; minimum X call Write_Display_Control ld a,$21 ; current X call Write_Display_Control ld a,$53 ; maximum X call Write_Display_Control pop bc push bc ld h,0 ld l,b ld a,$50 ; minimum Y call Write_Display_Control ld a,$20 ; current Y call Write_Display_Control ld a,27 add a,l ld l,a ld a,$51 ; maximum Y call Write_Display_Control ld a,$22 out ($10),a out ($10),a pop bc ld a,c add a,a add a,a add a,a xor %01111111 ld (smc_bit_selection+1),a call blank_6_rows pop af sub 32 add a,a add a,a ld e,a ld d,0 ld hl,tileData add hl,de add hl,de ld b,8 loop_char_main_slice: ld a,(hl) inc hl smc_bit_selection: bit 0,a ld a,$ff jr z,char_slice_set xor a char_slice_set: out ($11),a out ($11),a out ($11),a out ($11),a djnz loop_char_main_slice blank_6_rows: ld b,3 xor a loop_verticalsub: out ($11),a out ($11),a out ($11),a out ($11),a djnz loop_verticalsub ret #endif GET_KEY: #ifdef TI84CE push hl push de push bc di ld hl,$F50004 ld (hl),8 inc hl ld (hl),8 ld l,0 ld (hl),2 xor a wait_for_keys: cp (hl) jr nz,wait_for_keys ld e,0 ; E = GET_KEY result ld d,e ; D = current key counter ld hl,getkeylastdata ld bc,$F5001E ; pointer to key input data scan_next_row: ld a,(bc) ; A = one row of key data push bc ld c,(hl) ; C = previous scan results ld (hl),a ; save the new results inc hl cpl ; bits set to 0 for pressed keys or c ; now 0 for newly pressed only ld b,8 scan_next_column: inc d ; D = next char value rrca jr c,key_not_pressed ld e,d key_not_pressed: djnz scan_next_column pop bc dec bc dec bc ld a,c cp $10 ; check if at port $F50010 jr nz,scan_next_row ; if so, done ei ld a,e pop bc pop de pop hl ret #else push hl push de push bc ld e,0 ; E = GET_KEY result ld hl,getkeylastdata ; HL = ptr to last read's table ld a,$fe ; A = key port mask ld c,e ; C = key number counter gkol: out (1),a ; select row to read rlca ; next row to read ld b,20 key_wait: djnz key_wait ld b,8 push af ld d,(hl) ; D = old mask in a,(1) ; A = new mask ld (hl),a gkl: inc c ; increment current key number rrca jr c,nokey ; not pressed now bit 0,d jr z,nokey ; already pressed ld e,c ; newly pressed nokey: rr d djnz gkl pop af inc hl cp $7F ; final row not present jr nz,gkol ld a,e pop bc pop de pop hl ret #endif getkeylastdata: .db $ff,$ff,$ff,$ff,$ff,$ff,$ff title_screen: .db 24,10 .db "CMONSTER BY PATRICK DAVIDSON",0 .db 40,30 .db "EEULPLEK@HOTMAIL.COM",0 .DB 14,50 .db "HTTP://WWW.OCF.BERKELEY.EDU/&[\\]/",0 .db 6,70 .db "IRC: PATRICKD ON EFNET #TI, #CEMETECH",0 .db 18,90 .db "EEULPLEK ON TWITTER AND YOUTUBE",0 .db 0,120 .db "TO START PRESS 1 (SLOW) THROUGH 7 (FAST)",0 .db 4,140 .db "ARROWS MOVE, CLEAR EXITS, P (8) PAUSES",0 .db 28,160 .db "ENTER SAVES GAME AND EXITS",0 .db -1 scroll_message: .fill 40,' ' #import "scroll.txt" .fill (scroll_message+1024+40-$),' '