.include "zp.inc" FRAME = $60 TREE1X = $61 TREE2X = $62 LETTERL = $63 LETTERH = $64 LETTERX = $65 LETTERY = $66 LETTERD = $67 LETTER = $68 ;=================== ; init screen jsr TEXT jsr HOME ;================== ; Init vars lda #28 sta TREE1X lda #37 sta TREE2X lda #letters sta LETTERH lda #39 sta LETTERX lda #1 sta LETTERY lda #15 sta LETTERD lda #0 sta DISP_PAGE lda #0 sta DRAW_PAGE ;========================== ; setup mockingboard jsr mockingboard_detect_slot4 stx MB_DETECTED ldx MB_DETECTED beq no_init_mb jsr mockingboard_init no_init_mb: ;========================== ; setup text screen lda #0 sta CH sta CV lda #line1 sta OUTH jsr move_and_print inc CV jsr move_and_print inc CV jsr move_and_print inc CV jsr move_and_print inc CV jsr move_and_print inc CV jsr move_and_print ; draw the moon lda #0 sta CV lda #3 sta CH jsr htab_vtab ; vtab(1); htab(4) lda #32 ; inverse space ldy #0 sta (BASL),Y inc CV dec CH jsr htab_vtab lda #32 ldy #0 sta (BASL),Y inc CV jsr htab_vtab lda #32 ldy #0 sta (BASL),Y inc CV inc CH jsr htab_vtab lda #32 ldy #0 sta (BASL),Y ; test letters ;letter_loop: ; lda #80 ; jsr WAIT ; jsr move_letters ; jmp letter_loop ; Wait ; jsr wait_until_keypressed ; GR part bit LORES bit SET_GR bit FULLGR jsr draw_bottom_green ; 6 ; Wait ; jsr wait_until_keypressed bit HIRES ; Wait ; jsr wait_until_keypressed ;===================================================== ; attempt vapor lock ; by reading the "floating bus" we can see most recently ; written value of the display ; we look for $44 (which is the green grass on low-res) ;===================================================== ; See: ; Have an Apple Split by Bob Bishop ; Softalk, October 1982 ; Challenges: each scan line scans 40 bytes. ; The blanking happens at the *beginning* ; So 65 bytes are scanned, starting at adress of the line - 25 ; the scan takes 8 cycles, look for 4 repeats of the value ; to avoid false positive found if the horiz blanking is mirroring ; the line (max 3 repeats in that case) vapor_lock_loop: LDA #$A0 zxloop: LDX #$04 wiloop: CMP $C051 BNE zxloop DEX BNE wiloop LDA #$44 zloop: LDX #$04 qloop: CMP $C051 BNE zloop DEX BNE qloop ; found first line of low-res green, need to kill time ; until we can enter at top of screen ; so we want roughly 5200+4550 - 65 (for the scanline we missed) ; want 9685 ; Try X=34 Y=55 cycles=9681 lda #0 ; 2 lda #0 ; 2 ldy #55 ; 2 loopA: ldx #34 ; 2 loopB: dex ; 2 bne loopB ; 2nt/3 dey ; 2 bne loopA ; 2nt/3 jmp display_loop .align $100 ;===================================================== ;===================================================== ; Loop forever display loop ;===================================================== ;===================================================== display_loop: ; each scan line 65 cycles ; 1 cycle each byte (40cycles) + 25 for horizontal ; Total of 12480 cycles to draw screen ; Vertical blank = 4550 cycles (70 scan lines) ; Total of 17030 cycles to get back to where was ; 16666 = 17030 x=1021.8 ; 1000 x ; TODO: find beginning of scan ; Text mode for 6*8=48 scanlines (3120 cycles) ; hgr for 64 scalines (4160 cycles) ; gr for 80 scalines (5200 cycles) ; vblank = 4550 cycles ; text bit SET_TEXT ; 4 ;================ ; clear bottom green jsr draw_bottom_green ; 2209+6 ;================ ; Draw Small Tree lda #>small_tree ; 2 sta INH ; 3 lda #big_tree ; 2 sta INH ; 3 lda #bird_rider_stand_right ; 2 sta INH ; 3 lda #bird_rider_walk_right ; 2 sta INH ; 3 lda #