diff --git a/basic/appleiibot/Makefile b/basic/appleiibot/Makefile index bb1dc2a2..2a4eaa9a 100644 --- a/basic/appleiibot/Makefile +++ b/basic/appleiibot/Makefile @@ -15,7 +15,7 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS HELLO \ FASTAR2.BAS BIN.BAS FALLING.BAS SNOW.BAS XMAS.BAS AN3.BAS PLASMA.BAS \ C64.BAS SIERPINSKI.BAS FAKES.BAS SIER.BAS DROPS.BAS RR.BAS RR_HGR.BAS \ COMBO.BAS WIRES.BAS PATTERN.BAS BALL.BAS LINES.BAS MOD9.BAS \ - XOR_ZOOM.BAS MOD9_HGR.BAS SIER_HGR.BAS + XOR_ZOOM.BAS MOD9_HGR.BAS SIER_HGR.BAS MOVE.BAS # cp $(EMPTY_DISK)/empty.dsk appleiibot.dsk cp empty.dsk appleiibot.dsk $(DOS33) -y appleiibot.dsk BSAVE -a 0x0300 LOAD @@ -76,6 +76,7 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS HELLO \ $(DOS33) -y appleiibot.dsk SAVE A XOR_ZOOM.BAS $(DOS33) -y appleiibot.dsk SAVE A MOD9_HGR.BAS $(DOS33) -y appleiibot.dsk SAVE A SIER_HGR.BAS + $(DOS33) -y appleiibot.dsk SAVE A MOVE.BAS #### @@ -194,6 +195,11 @@ SNOW.BAS: snow.bas #### +MOVE.BAS: move.bas + $(TOKENIZE) < move.bas > MOVE.BAS + +#### + XMAS.BAS: xmas.bas $(TOKENIZE) < xmas.bas > XMAS.BAS diff --git a/basic/appleiibot/convert_tgreene.c b/basic/appleiibot/convert_tgreene.c index f8bf84b1..3f8be60a 100644 --- a/basic/appleiibot/convert_tgreene.c +++ b/basic/appleiibot/convert_tgreene.c @@ -14,8 +14,8 @@ int main(int argc, char **argv) { -// int mode=END_AT_3F5; - int mode=BEGIN_AT_3F5; + int mode=END_AT_3F5; +// int mode=BEGIN_AT_3F5; int i = 0; int e = 0,filesize; int val,pv,final; diff --git a/basic/appleiibot/move.bas b/basic/appleiibot/move.bas new file mode 100644 index 00000000..227fb8f6 --- /dev/null +++ b/basic/appleiibot/move.bas @@ -0,0 +1,2 @@ +1FORI=0TO133:POKE882+I,4*PEEK(2125+I)-192+(PEEK(2259+I/3)-35)/4^(I-INT(I/3)*3):NEXT +2&"SkQQYdKlowtr_fake +; lda #>our_cout ; should be same + sta LOWTR+1 + sta CSWL+1 + + jsr HGR ; clear $2000 to 0 + ; A=0 at end sta DRAW_PAGE + sta FORPTR ; used to trick LIST - jsr SETTXT - + jsr SETTXT ; set lo-res text mode next_frame: ldx #0 next_text: - lda xpos,X - bne not_new + lda xpos,X ; load next text xpos + bne not_new ; if not zero, continue new_text: - jsr random8 - and #$1f - adc #$4 - sta xpos,X jsr random8 and #$f - sta ypos,X + adc #$8 + sta xpos,X ; get random X value 4...35 jsr random8 - and #$7f - sta COUNT + and #$f + sta ypos,X ; get random Y 0..15 - lda #$d0 ; token table at $D0D0 - sta FACL - sta FACH + jsr random8 + ora #$80 + sta which,X ; random token - ldy #0 -find_token_loop: - dec COUNT - bmi found_token -find_token_inner: - inc FACL - bne blargh - inc FACH -blargh: - lda (FACL),Y - bpl find_token_inner - bmi find_token_loop - -found_token: - inc FACL - lda FACL - sta textl,X - lda FACH - sta texth,X not_new: + lda ypos,X + jsr BASCALC ; (basl) is now right + lda xpos,X sta CH - lda ypos,X - sta CV - - jsr MON_VTAB lda BASH clc adc DRAW_PAGE sta BASH - lda textl,X - sta text_smc+1 - lda texth,X - sta text_smc+2 + lda which,X - txa - pha + stx XSAVE ; save X - ldx #0 -print_loop: + tsx + stx STACKSAVE ; save stack -text_smc: - lda $dddd,X + jmp TOKEN ; call ROM token code - php +after_token: - ora #$80 - jsr STORADV ; trashes Y :( + ldx STACKSAVE ; restore stack + txs - inx + ldx XSAVE ; restore X - plp + dec xpos,X ; move left - bpl print_loop - -big_done: - - pla - tax - - dec xpos,X - - inx - cpx #32 + inx ; move to next one + cpx #16 bne next_text + ; X is 16 here + flip_pages: - ldx #0 +; ldx #0 lda DRAW_PAGE beq done_page inx done_page: - ldy PAGE0,X ; set display page to PAGE1 or PAGE2 + ldy PAGE0-16,X ; set display page to PAGE1 or PAGE2 eor #$4 ; flip draw page between $400/$800 sta DRAW_PAGE - clc - adc #$4 - sta BASH - lda #$0 - sta BASL + ;=============== + ; clear screen -clear_screen_outer: - ldy #$f8 -clear_screen_inner: - lda #$A0 ; space char - sta (BASL),Y ; 100 101 110 111 - dey - cpy #$FF - bne clear_screen_inner - inc BASH + ldx #24 +clear_screen_loop: + txa + jsr BASCALC ; A is BASL at end lda BASH - and #$3 - bne clear_screen_outer + clc + adc DRAW_PAGE + sta BASH - lda #200 - jsr WAIT + ldy #0 + jsr CLREOLZ + dex + bpl clear_screen_loop - jmp next_frame + + ; pause + +; lda #100 +; jsr WAIT + + bmi next_frame + + +our_cout: + cmp #$8d ; list thinks end of line + bne regular_print + pla ; fake rts + pla + jmp after_token + +regular_print: + sty YSAV + ldy CH + sta (BASL),Y + inc BASL + ldy YSAV + rts ;============================= @@ -176,15 +185,17 @@ clear_screen_inner: ; http://codebase64.org/doku.php?id=base:small_fast_8-bit_prng random8: - lda SEEDL ; 2 - beq doEor ; 2 - asl ; 1 - beq noEor ; if the input was $80, skip the EOR ; 2 - bcc noEor ; 2 -doEor: eor #$1d ; 2 -noEor: sta SEEDL ; 2 + lda SEEDL ; 2 + beq doEor ; 2 + asl ; 1 + beq noEor ; if the input was $80, skip the EOR ; 2 + bcc noEor ; 2 +doEor: eor #$1d ; 2 +noEor: sta SEEDL ; 2 rts +lowtr_fake: + .byte $00,$00 ; fake end to BASIC program - + jmp move diff --git a/textmode/textscroll/move_bot.s b/textmode/textscroll/move_bot.s new file mode 100644 index 00000000..eaee0103 --- /dev/null +++ b/textmode/textscroll/move_bot.s @@ -0,0 +1,204 @@ +; TOKEN D734 +; OUTDO (print char in A), calls COUT +; COUT calls ($0036) + +CH = $24 +CV = $25 +BASL = $28 +BASH = $29 +CSWL = $36 +SEEDL = $4E +FORPTR = $85 +LOWTR = $9B +FACL = $9D +FACH = $9E + +FRAME = $FA +XSAVE = $FB +STACKSAVE = $FC +YSAV = $FD +COUNT = $FE +DRAW_PAGE = $FF + +PAGE0 = $C054 +GETCHAR = $D72C ; loads (FAC),Y and increments FAC +TOKEN = $D734 +HGR = $F3E2 +SETTXT = $FB39 +TABV = $FB5B ; store A in CV and call MON_VTAB +BASCALC = $FBC1 +STORADV = $FBF0 ; store A at (BASL),CH, advancing CH, trash Y +MON_VTAB = $FC22 ; VTAB to CV +VTABZ = $FC24 ; VTAB to value in A +HOME = $FC58 +CLREOL = $FC9C ; clear (BASL),CH to end of line +CLREOLZ = $FC9E ; clear (BASL),Y to end of line + +WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us + +COUT = $FDED +COUT1 = $FDF0 +COUTZ = $FDF6 ; cout but ignore inverse flag + +ypos = $2000 +xpos = $2100 +textl = $2200 +texth = $2300 +which = $2400 + +move: + lda #lowtr_fake +; lda #>our_cout ; should be same + sta LOWTR+1 + sta CSWL+1 + + jsr HGR ; clear $2000 to 0 + ; A=0 at end + + sta DRAW_PAGE + sta FORPTR ; used to trick LIST + + jsr SETTXT ; set lo-res text mode + +next_frame: + ldx #0 +next_text: + lda xpos,X ; load next text xpos + bne not_new ; if not zero, continue + +new_text: + + jsr random8 + and #$f + adc #$8 + sta xpos,X ; get random X value 4...35 + + jsr random8 + and #$f + sta ypos,X ; get random Y 0..15 + + jsr random8 + ora #$80 + sta which,X ; random token + + +not_new: + lda ypos,X + jsr BASCALC ; (basl) is now right + + lda xpos,X + sta CH + +; lda BASH +; clc +; adc DRAW_PAGE +; sta BASH + + lda which,X + + stx XSAVE ; save X + + tsx + stx STACKSAVE ; save stack + + jmp TOKEN ; call ROM token code + +after_token: + + ldx STACKSAVE ; restore stack + txs + + ldx XSAVE ; restore X + + dec xpos,X ; move left + + inx ; move to next one + cpx #16 + bne next_text + + ; X is 16 here + +flip_pages: +; ldx #0 + +; lda DRAW_PAGE +; beq done_page +; inx +;done_page: +; ldy PAGE0-16,X ; set display page to PAGE1 or PAGE2 + +; eor #$4 ; flip draw page between $400/$800 +; sta DRAW_PAGE + + ;=============== + ; clear screen + +; ldx #24 +clear_screen_loop: +; txa +; jsr BASCALC ; A is BASL at end +; lda BASH +; clc +; adc DRAW_PAGE +; sta BASH + +; ldy #0 +; jsr CLREOLZ +; dex +; bpl clear_screen_loop + + + ; pause + +; lda #100 +; jsr WAIT + + jmp next_frame + + +our_cout: + cmp #$8d ; list thinks end of line + bne regular_print + pla ; fake rts + pla + jmp after_token + +regular_print: + sty YSAV + ldy CH + sta (BASL),Y + inc BASL + ldy YSAV + rts + + + ;============================= + ; random8 + ;============================= + ; 8-bit 6502 Random Number Generator + ; Linear feedback shift register PRNG by White Flame + ; http://codebase64.org/doku.php?id=base:small_fast_8-bit_prng + +random8: + lda SEEDL ; 2 + beq doEor ; 2 + asl ; 1 + beq noEor ; if the input was $80, skip the EOR ; 2 + bcc noEor ; 2 +doEor: eor #$1d ; 2 +noEor: sta SEEDL ; 2 + rts + +lowtr_fake: + .byte $00,$00 ; fake end to BASIC program + + ; want jump to live at $3F5 + ; currently at $383 + ; so want to load at $372 +blah: + jmp move