From 681cbc350f29b1a396d7212c6bb24bcb996da3c2 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Wed, 11 Dec 2019 08:35:56 -0500 Subject: [PATCH] xmas2019: iniitial checkin --- xmas_2019/Makefile | 8 +-- xmas_2019/hardware.inc | 89 +++++++++++++++++++++++++++ xmas_2019/snow.s | 135 +++++++++++++++++++++++++++++++++++++++++ xmas_2019/snow_slow.s | 125 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 353 insertions(+), 4 deletions(-) create mode 100644 xmas_2019/hardware.inc create mode 100644 xmas_2019/snow.s create mode 100644 xmas_2019/snow_slow.s diff --git a/xmas_2019/Makefile b/xmas_2019/Makefile index 2a86ef8e..c85075de 100644 --- a/xmas_2019/Makefile +++ b/xmas_2019/Makefile @@ -6,10 +6,10 @@ PNG_TO_40x48D = ../gr-utils/png_to_40x48d all: xmas2019.dsk -xmas2019.dsk: SNOW +xmas2019.dsk: SNOW HELLO cp empty.dsk xmas2019.dsk $(DOS33) -y xmas2019.dsk BSAVE -a 0x1000 SNOW - $(DOS33) -y xmas2019.dsk SAVE A HELLO.BAS + $(DOS33) -y xmas2019.dsk SAVE A HELLO #### @@ -35,8 +35,8 @@ FIREWORKS.BAS: fireworks.bas #### -HELLO.BAS: hello.bas - ../asoft_basic-utils/tokenize_asoft < hello.bas > HELLO.BAS +HELLO: hello.bas + ../asoft_basic-utils/tokenize_asoft < hello.bas > HELLO clean: diff --git a/xmas_2019/hardware.inc b/xmas_2019/hardware.inc new file mode 100644 index 00000000..37327dbc --- /dev/null +++ b/xmas_2019/hardware.inc @@ -0,0 +1,89 @@ +;; HARDWARE LOCATIONS + +KEYPRESS = $C000 +KEYRESET = $C010 + +;; SOFT SWITCHES +CLR80COL = $C000 ; PAGE0/PAGE1 normal +SET80COL = $C001 ; PAGE0/PAGE1 switches PAGE0 in Aux instead +EIGHTYCOLOFF = $C00C +EIGHTYCOLON = $C00D +SPEAKER = $C030 +SET_GR = $C050 +SET_TEXT = $C051 +FULLGR = $C052 +TEXTGR = $C053 +PAGE0 = $C054 +PAGE1 = $C055 +LORES = $C056 ; Enable LORES graphics +HIRES = $C057 ; Enable HIRES graphics +AN3 = $C05E ; Annunciator 3 + +PADDLE_BUTTON0 = $C061 +PADDL0 = $C064 +PTRIG = $C070 + +; Language card +; C080 +; C08B + +;; BASIC ROUTINES + +;NORMAL = $F273 + +;; MONITOR ROUTINES + +;HLINE = $F819 ;; HLINE Y,$2C at A +;VLINE = $F828 ;; VLINE A,$2D at Y +;CLRSCR = $F832 ;; Clear low-res screen +;CLRTOP = $F836 ;; clear only top of low-res screen +;SETCOL = $F864 ;; COLOR=A +;TEXT = $FB36 +;TABV = $FB5B ;; VTAB to A +;BELL = $FBDD ;; ring the bell +;BASCALC= $FBC1 ;; +;VTAB = $FC22 ;; VTAB to CV +;HOME = $FC58 ;; Clear the text screen +WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us +;SETINV = $FE80 ;; INVERSE +;SETNORM= $FE84 ;; NORMAL +;COUT = $FDED ;; output A to screen +;COUT1 = $FDF0 ;; output A to screen + + + + + + +COLOR_BLACK = 0 +COLOR_RED = 1 +COLOR_DARKBLUE = 2 +COLOR_PURPLE = 3 +COLOR_DARKGREEN = 4 +COLOR_GREY = 5 +COLOR_MEDIUMBLUE = 6 +COLOR_LIGHTBLUE = 7 +COLOR_BROWN = 8 +COLOR_ORANGE = 9 +COLOR_GREY2 = 10 +COLOR_PINK = 11 +COLOR_LIGHTGREEN = 12 +COLOR_YELLOW = 13 +COLOR_AQUA = 14 +COLOR_WHITE = 15 + +COLOR_BOTH_BLACK = $00 +COLOR_BOTH_RED = $11 +COLOR_BOTH_DARKBLUE = $22 +COLOR_BOTH_DARKGREEN = $44 +COLOR_BOTH_GREY = $55 +COLOR_BOTH_MEDIUMBLUE = $66 +COLOR_BOTH_LIGHTBLUE = $77 +COLOR_BOTH_BROWN = $88 +COLOR_BOTH_ORANGE = $99 +COLOR_BOTH_PINK = $BB +COLOR_BOTH_LIGHTGREEN = $CC +COLOR_BOTH_YELLOW = $DD +COLOR_BOTH_AQUA = $EE +COLOR_BOTH_WHITE = $FF + diff --git a/xmas_2019/snow.s b/xmas_2019/snow.s new file mode 100644 index 00000000..f4e65672 --- /dev/null +++ b/xmas_2019/snow.s @@ -0,0 +1,135 @@ +; Display falling snow + +; by deater (Vince Weaver) + +; Zero Page +CH = $24 +CV = $25 +GBASL = $26 +GBASH = $27 +BASL = $28 +BASH = $29 +HGR_COLOR = $E4 +SNOWX = $F0 + +HGR = $F3E2 + +.include "hardware.inc" + + + ;================================== + ;================================== + + jsr HGR + bit FULLGR + +display_loop: + + ; 0 4 8 c 10 14 18 1c + ; 0 1 2 3 4 5 6 7 + + ;========================= + ; erase old snow + + ldx #0 +erase_loop: + lda snow_y,X + lsr + lsr + and #$fe +; lsr + tay + clc + lda hgr_offsets,Y + adc snow_x,X + sta GBASL + + lda snow_y,X + asl + asl + and #$1f + clc + adc hgr_offsets+1,Y + sta GBASH + + ldy #0 + lda #0 + sta (GBASL),Y + + inx + cpx #8 + bne erase_loop + + ;========================== + ; move snow + + ldx #0 +move_snow: + lda snow_y,X ; inc to next line + cmp #191 + bne just_inc + + lda #0 + sta snow_y,X + jmp done_inc + + +just_inc: + inc snow_y,X +done_inc: + inx + cpx #8 + bne move_snow + + + ;========================= + ; draw new snow + + ldx #0 +draw_loop: + lda snow_y,X + lsr + lsr +; lsr + and #$fe + tay + clc + lda hgr_offsets,Y + adc snow_x,X + sta GBASL + + lda snow_y,X + asl + asl + and #$1f + clc + adc hgr_offsets+1,Y + sta GBASH + + ldy #0 + lda #1 + sta (GBASL),Y + + inx + cpx #8 + bne draw_loop + + lda #100 + jsr WAIT + + jmp display_loop ; 3 + + +snow_x: + .byte 2,4,6,8,10,12,14,16 + +snow_offset: + .byte 0,1,2,3,4,5,6,7 + +snow_y: + .byte 0,0,0,0,0,0,0,0 + +hgr_offsets: +.word $2000,$2080,$2100,$2180,$2200,$2280,$2300,$2380 +.word $2028,$20A8,$2128,$21A8,$2228,$22A8,$2328,$23A8 +.word $2050,$20D0,$2150,$21D0,$2250,$22D0,$2350,$23D0 diff --git a/xmas_2019/snow_slow.s b/xmas_2019/snow_slow.s new file mode 100644 index 00000000..3d526b5f --- /dev/null +++ b/xmas_2019/snow_slow.s @@ -0,0 +1,125 @@ +; Display falling snow + +; by deater (Vince Weaver) + +; Zero Page +FRAMEBUFFER = $00 ; $00 - $0F +YPOS = $10 +YPOS_SIN = $11 +CH = $24 +CV = $25 +GBASL = $26 +GBASH = $27 +BASL = $28 +BASH = $29 +FRAME = $60 +WAITING = $62 +LETTERL = $63 +LETTERH = $64 +LETTERX = $65 +LETTERY = $66 +LETTERD = $67 +LETTER = $68 +BLARGH = $69 +HGR_COLOR = $E4 +STATE = $ED +DRAW_PAGE = $EE +LASTKEY = $F1 +PADDLE_STATUS = $F2 +TEMP = $FA + +SNOWX = $F0 + + +.include "hardware.inc" + + + ;================================== + ;================================== + + jsr hgr + + bit PAGE0 + bit SET_GR + bit FULLGR + bit HIRES + +display_loop: + + ;========================= + ; erase old snow + + ldx #0 + jsr hcolor_equals + ldx #0 +erase_loop: + stx SNOWX + ldx SNOWX + ldy snow_xhs,X + lda snow_ys,X + pha + lda snow_xls,X + tax + pla + jsr hplot0 + + inc SNOWX + ldx SNOWX + cpx #8 + bne erase_loop + + ;========================= + ; draw new snow + + + ldx #3 + jsr hcolor_equals + + ldx #0 +draw_loop: + stx SNOWX + ldx SNOWX + + inc snow_ys,X + lda snow_ys,X + cmp #192 + bne snow_done + + lda #0 + sta snow_ys,X + +snow_done: + ldy snow_xhs,X + lda snow_ys,X + pha + lda snow_xls,X + tax + pla + jsr hplot0 + + inc SNOWX + ldx SNOWX + cpx #8 + bne draw_loop + + + + jmp display_loop ; 3 + + +snow_xls: + .byte 10,30,50,70,90,110,0,10 +snow_xhs: + .byte 0,0,0,0,0,0,1,1 + +snow_ys: + .byte 0,0,0,0,0,0,0,0 + +;.include "state_machine.s" +;.include "gr_hline.s" +;.include "../asm_routines/keypress.s" +;.include "gr_copy.s" +;.include "random16.s" +;.include "fw.s" +.include "hgr.s" +