keyboard control, split to files

This commit is contained in:
2026-07-13 22:13:36 +02:00
parent 96b7961681
commit 0e4546fe26
8 changed files with 892 additions and 765 deletions
+200
View File
@@ -0,0 +1,200 @@
; -----------------------------------------------------------
; common.asm - routines, tables and variables shared by the
; slides: screen clearing, text printing, big 3x5 block font
; -----------------------------------------------------------
; ---- clear screen RAM, fill color RAM with white ----
clear_screen:
ldx #0
cls_loop:
lda #$20 ; space
sta SCREEN,x
sta SCREEN+$100,x
sta SCREEN+$200,x
sta SCREEN+$2e8,x
lda #WHITE
sta COLRAM,x
sta COLRAM+$100,x
sta COLRAM+$200,x
sta COLRAM+$2e8,x
inx
bne cls_loop
rts
; ---- print a text line: txtlo/hi, prow, pcol, pcolor, plen ----
print_text:
ldx prow
lda mul40lo,x
clc
adc pcol
sta scrlo
sta collo
lda mul40hi,x
adc #>SCREEN ; carry still valid from the low-byte add
sta scrhi
clc
adc #$d4 ; COLRAM - SCREEN high byte distance
sta colhi
ldy #0
pt_loop:
lda (txtlo),y
sta (scrlo),y
lda pcolor
sta (collo),y
iny
cpy plen
bne pt_loop
rts
; ---- draw a text line with big 3x5 block letters ----
; txtlo/hi = text (screen codes), bigrow/bigcol = top-left cell,
; bigcolor = color, biglen = char count; each letter is 3 cells
; wide + 1 gap, 5 cells tall
draw_big:
lda #0
sta bigi
db_char:
ldy bigi
lda (txtlo),y
cmp #$20 ; space: leave the cell empty
beq db_next
tax
lda bigmap,x ; screen code -> glyph index
sta glyphbase
asl ; glyph base = index * 5
asl
clc
adc glyphbase
sta glyphbase
lda bigi ; cell x = bigcol + charindex * 4
asl
asl
clc
adc bigcol
sta charx
lda #0
sta rowidx
db_row:
lda bigrow ; row pointers from the row*40 tables
clc
adc rowidx
tax
lda mul40lo,x
sta scrlo
sta collo
lda mul40hi,x
clc
adc #>SCREEN
sta scrhi
clc
adc #$d4
sta colhi
lda glyphbase
clc
adc rowidx
tax
lda bigglyphs,x
asl ; 3-bit pattern up to bits 7-5
asl
asl
asl
asl
sta curbits
ldy charx
lda #3
sta bitcnt
db_bit:
asl curbits ; leftmost pixel first
bcc db_nobit
lda #$a0 ; inverse space = solid block
sta (scrlo),y
lda bigcolor
sta (collo),y
db_nobit:
iny
dec bitcnt
bne db_bit
inc rowidx
lda rowidx
cmp #5
bne db_row
db_next:
inc bigi
lda bigi
cmp biglen
beq db_done
jmp db_char ; too far for a relative branch
db_done:
rts
; ---- shared tables ----
; row * 40 lookup tables (25 rows)
mul40lo:
!byte $00, $28, $50, $78, $a0, $c8, $f0, $18, $40, $68
!byte $90, $b8, $e0, $08, $30, $58, $80, $a8, $d0, $f8
!byte $20, $48, $70, $98, $c0
mul40hi:
!byte $00, $00, $00, $00, $00, $00, $00, $01, $01, $01
!byte $01, $01, $01, $02, $02, $02, $02, $02, $02, $02
!byte $03, $03, $03, $03, $03
; 3x5 block font for the big slide titles (5 bytes per glyph,
; low 3 bits used, MSB side = left)
bigglyphs:
!byte 0, 0, 0, 0, 0 ; 0 space
!byte 2, 5, 7, 5, 5 ; 1 A
!byte 3, 4, 4, 4, 3 ; 2 C
!byte 6, 5, 5, 5, 6 ; 3 D
!byte 7, 4, 6, 4, 7 ; 4 E
!byte 7, 4, 6, 4, 4 ; 5 F
!byte 7, 2, 2, 2, 7 ; 6 I
!byte 4, 4, 4, 4, 7 ; 7 L
!byte 5, 7, 7, 5, 5 ; 8 M
!byte 6, 5, 5, 5, 5 ; 9 N
!byte 7, 5, 5, 5, 7 ; 10 O
!byte 6, 5, 6, 4, 4 ; 11 P
!byte 6, 5, 6, 5, 5 ; 12 R
!byte 3, 4, 2, 1, 6 ; 13 S
!byte 7, 2, 2, 2, 2 ; 14 T
!byte 5, 5, 2, 2, 2 ; 15 Y
!byte 3, 4, 5, 5, 7 ; 16 G
bigmap: ; screen code (a=1..z=26) -> glyph index
!byte 0 ; (unused)
!byte 1, 0, 2, 3, 4, 5, 16, 0, 6, 0 ; a-j
!byte 0, 7, 8, 9, 10, 11, 0, 12, 13, 14 ; k-t
!byte 0, 0, 0, 0, 15, 0 ; u-z
washtbl: ; gold glow ramp (16 entries, cyclic)
!byte $09, $02, $08, $0a, $07, $07, $01, $01
!byte $01, $01, $07, $07, $0a, $08, $02, $09
pulsetbl: ; grey-white pulse (8 entries, cyclic)
!byte $0b, $0c, $0f, $01, $01, $0f, $0c, $0b
fadetbl: ; fade-to-black: each color -> one shade darker,
; every chain reaches black in at most 4 steps
; (e.g. white -> lgrey -> mgrey -> dgrey -> black)
; blk wht red cyn pur grn blu yel
!byte $00, $0f, $09, $0e, $06, $0b, $00, $08
; org brn lrd dgr mgr lgn lbl lgr
!byte $02, $00, $02, $00, $0b, $05, $06, $0c
; ---- shared variables ----
framectr: !byte 0 ; frame counter, driven by the slide updates
washphase: !byte 0 ; gold wash offset (slides 1 and 2)
curbits: !byte 0 ; current bit pattern in the letter renderers
prow: !byte 0 ; print_text: row, column, color, length
pcol: !byte 0
pcolor: !byte 0
plen: !byte 0
bigrow: !byte 0 ; draw_big: row, column, color, length
bigcol: !byte 0
bigcolor: !byte 0
biglen: !byte 0
bigi: !byte 0 ; draw_big internals
glyphbase: !byte 0
charx: !byte 0
rowidx: !byte 0
bitcnt: !byte 0
+90
View File
@@ -0,0 +1,90 @@
; -----------------------------------------------------------
; defs.asm - hardware registers, constants, zero page, macros
; included first by main.asm
; -----------------------------------------------------------
; ---- hardware registers ----
SCRCTRL = $d011 ; vertical control: bit 4 switches the display on/off
BORDER = $d020 ; border color register
BG = $d021 ; background color register
RASTER = $d012 ; current raster line
XCTRL = $d016 ; horizontal fine scroll + 38/40 column mode
SCREEN = $0400 ; screen RAM (40x25 chars)
COLRAM = $d800 ; color RAM
CIA1_PA = $dc00 ; CIA1 port A: keyboard matrix column select
CIA1_PB = $dc01 ; CIA1 port B: keyboard matrix row read
; ---- colors ----
BLACK = 0
WHITE = 1
CYAN = 3
YELLOW = 7
DGREY = 11
LGREEN = 13
LGREY = 15
; ---- screen layout (slide 1) ----
BIGROW = 2 ; top row of the giant letters
BIGCOL = 6 ; left column (3*8 + 2*2 = 28 wide, centered)
TITLE_POS = 12*40 + 13 ; "TELETYPE GAMES" (14 chars, centered)
SCROLLROW = 14 ; scroller row
; ---- timing ----
SCROLL_STEP = 2 ; pixels per frame (8 px / 4 frames = 1 char)
RAS_SCRTOP = 160 ; just above the scroller row (row 14 = lines 162-169)
RAS_SCRBOT = 171 ; just below it (rows 13 and 15 are blank, so
; a line of jitter here is invisible)
RAS_BOTTOM = 248 ; lower border: safe time for screen updates
RAS_BARTOP = 16 ; first raster line of the bar area (slide 3):
; starts in the upper border
BAR_STEPS = 57 ; 57 steps * 4 lines = up to line 244
NUM_SLIDES = 5
SLIDE_TIME = 300 ; 6 seconds per slide (PAL, 50 frames/s)
FADE_STEPS = 5 ; fade steps (longest fadetbl chain is 4)
FADE_SPEED = 4 ; frames between two fade steps
FADEBUF = $c000 ; snapshot of color RAM for the fade-in
; ---- zero page pointers ----
txtlo = $f5 ; text pointer for the print routines (2 bytes)
txthi = $f6
vec = $f7 ; slide init vector (2 bytes)
updvec = $f9 ; slide update vector (2 bytes)
scrlo = $fb
scrhi = $fc
collo = $fd
colhi = $fe
; ---- helper macros: print a normal / big text line ----
!macro prtext .row, .col, .color, .txt, .len {
lda #<.txt
sta txtlo
lda #>.txt
sta txthi
lda #.row
sta prow
lda #.col
sta pcol
lda #.color
sta pcolor
lda #.len
sta plen
jsr print_text
}
!macro prbig .row, .col, .color, .txt, .len {
lda #<.txt
sta txtlo
lda #>.txt
sta txthi
lda #.row
sta bigrow
lda #.col
sta bigcol
lda #.color
sta bigcolor
lda #.len
sta biglen
jsr draw_big
}
+105 -765
View File
@@ -2,11 +2,17 @@
; main.asm - C64 demo: slide show (6 seconds per slide)
; slide 1: giant TTG logo + credits scroller
; slide 2: OUR FIRST GAME - Definitely not an Impostor
; slide 3: OUR SECOND GAME IS COMING (full-screen raster bars)
; slide 3: OUR SECOND GAME IS COMING (border raster bars)
; slide 4: CONTACT
; slide 5: the assembly confession
; slides cross-fade through black between switches
; all timed by polling the raster beam
;
; Files:
; defs.asm - constants, zero page, macros
; common.asm - shared routines, tables, variables
; slideN.asm - one file per slide: sN_init, sN_update + data
;
; Build: acme -f cbm -o main.prg main.asm
; -----------------------------------------------------------
@@ -25,89 +31,7 @@
* = $0810 ; = 2064 in decimal
; ---- hardware registers ----
SCRCTRL = $d011 ; vertical control: bit 4 switches the display on/off
BORDER = $d020 ; border color register
BG = $d021 ; background color register
RASTER = $d012 ; current raster line
XCTRL = $d016 ; horizontal fine scroll + 38/40 column mode
SCREEN = $0400 ; screen RAM (40x25 chars)
COLRAM = $d800 ; color RAM
; ---- colors ----
BLACK = 0
WHITE = 1
CYAN = 3
YELLOW = 7
DGREY = 11
LGREEN = 13
LGREY = 15
; ---- screen layout (slide 1) ----
BIGROW = 2 ; top row of the giant letters
BIGCOL = 6 ; left column (3*8 + 2*2 = 28 wide, centered)
TITLE_POS = 12*40 + 13 ; "TELETYPE GAMES" (14 chars, centered)
SCROLLROW = 14 ; scroller row
; ---- timing ----
SCROLL_STEP = 2 ; pixels per frame (8 px / 4 frames = 1 char)
RAS_SCRTOP = 160 ; just above the scroller row (row 14 = lines 162-169)
RAS_SCRBOT = 171 ; just below it (rows 13 and 15 are blank, so
; a line of jitter here is invisible)
RAS_BOTTOM = 248 ; lower border: safe time for screen updates
RAS_BARTOP = 16 ; first raster line of the bar area (slide 3):
; starts in the upper border
BAR_STEPS = 57 ; 57 steps * 4 lines = up to line 244
NUM_SLIDES = 5
SLIDE_TIME = 300 ; 6 seconds per slide (PAL, 50 frames/s)
FADE_STEPS = 5 ; fade steps (longest fadetbl chain is 4)
FADE_SPEED = 4 ; frames between two fade steps
FADEBUF = $c000 ; snapshot of color RAM for the fade-in
; ---- zero page pointers ----
txtlo = $f5 ; text pointer for the print routines (2 bytes)
txthi = $f6
vec = $f7 ; slide init vector (2 bytes)
updvec = $f9 ; slide update vector (2 bytes)
scrlo = $fb
scrhi = $fc
collo = $fd
colhi = $fe
; ---- helper macros: print a normal / big text line ----
!macro prtext .row, .col, .color, .txt, .len {
lda #<.txt
sta txtlo
lda #>.txt
sta txthi
lda #.row
sta prow
lda #.col
sta pcol
lda #.color
sta pcolor
lda #.len
sta plen
jsr print_text
}
!macro prbig .row, .col, .color, .txt, .len {
lda #<.txt
sta txtlo
lda #>.txt
sta txthi
lda #.row
sta bigrow
lda #.col
sta bigcol
lda #.color
sta bigcolor
lda #.len
sta biglen
jsr draw_big
}
!src "defs.asm"
start:
sei ; no KERNAL IRQ - raster polling must not jitter
@@ -124,6 +48,38 @@ start:
main:
jsr call_update
; 'p' toggles pause - edge detected, so holding the key
; does not keep flipping the state
jsr scan_p
bne p_up
lda pheld
bne p_done
lda #1
sta pheld
jsr toggle_pause
jmp p_done
p_up:
lda #0
sta pheld
p_done:
lda paused ; paused: keep the marker in the top-right
beq no_pdraw ; corner alive (slide switches clear it)
lda #$10 ; screen code of 'p'
sta SCREEN+39
lda #WHITE
sta COLRAM+39
no_pdraw:
jsr scan_del ; backspace: one slide back
beq go_back
jsr scan_space ; space: next slide right away
beq advance
lda paused ; paused: the countdown stands still
bne main
lda durlo ; 16-bit frame countdown
bne dur_dec
dec durhi
@@ -133,7 +89,11 @@ dur_dec:
ora durhi
bne main
jsr fade_out ; time's up: fade the old slide to black
advance:
jsr fade_out ; fade the old slide to black
adv_release:
jsr scan_space ; a held space must not race through
beq adv_release ; the whole show
ldx slide ; advance to the next slide
inx
@@ -145,6 +105,56 @@ slide_ok:
jsr show_slide ; draw it hidden, then fade it in
jmp main
go_back:
jsr fade_out
back_release:
jsr scan_del
beq back_release
ldx slide ; step back one slide, wrap to the last
dex
bpl back_ok
ldx #NUM_SLIDES-1
back_ok:
stx slide
jsr show_slide
jmp main
; ---- flip the pause state, remove the marker when resuming ----
toggle_pause:
lda paused
eor #1
sta paused
bne tp_done ; turned on: the main loop draws the marker
lda #$20 ; turned off: clear it
sta SCREEN+39
tp_done:
rts
; ---- keyboard matrix scanning ----
; in: A = column select mask, Y = row mask
; out: Z set if the key is held down (rows read active low)
scan_key:
sta CIA1_PA
tya
and CIA1_PB
rts
scan_space: ; space: column 7, row 4
lda #$7f
ldy #$10
jmp scan_key
scan_p: ; 'p': column 5, row 1
lda #$df
ldy #$02
jmp scan_key
scan_del: ; inst/del: column 0, row 0
lda #$fe
ldy #$01
jmp scan_key
call_update:
jmp (updvec) ; each update runs exactly one frame, ends with rts
@@ -327,512 +337,17 @@ am_loop:
bne am_loop
rts
; ---- clear screen RAM, fill color RAM with white ----
clear_screen:
ldx #0
cls_loop:
lda #$20 ; space
sta SCREEN,x
sta SCREEN+$100,x
sta SCREEN+$200,x
sta SCREEN+$2e8,x
lda #WHITE
sta COLRAM,x
sta COLRAM+$100,x
sta COLRAM+$200,x
sta COLRAM+$2e8,x
inx
bne cls_loop
rts
; ---- print a text line: txtlo/hi, prow, pcol, pcolor, plen ----
print_text:
ldx prow
lda mul40lo,x
clc
adc pcol
sta scrlo
sta collo
lda mul40hi,x
adc #>SCREEN ; carry still valid from the low-byte add
sta scrhi
clc
adc #$d4 ; COLRAM - SCREEN high byte distance
sta colhi
ldy #0
pt_loop:
lda (txtlo),y
sta (scrlo),y
lda pcolor
sta (collo),y
iny
cpy plen
bne pt_loop
rts
; ---- draw a text line with big 3x5 block letters ----
; txtlo/hi = text (screen codes), bigrow/bigcol = top-left cell,
; bigcolor = color, biglen = char count; each letter is 3 cells
; wide + 1 gap, 5 cells tall
draw_big:
lda #0
sta bigi
db_char:
ldy bigi
lda (txtlo),y
cmp #$20 ; space: leave the cell empty
beq db_next
tax
lda bigmap,x ; screen code -> glyph index
sta glyphbase
asl ; glyph base = index * 5
asl
clc
adc glyphbase
sta glyphbase
lda bigi ; cell x = bigcol + charindex * 4
asl
asl
clc
adc bigcol
sta charx
lda #0
sta rowidx
db_row:
lda bigrow ; row pointers from the row*40 tables
clc
adc rowidx
tax
lda mul40lo,x
sta scrlo
sta collo
lda mul40hi,x
clc
adc #>SCREEN
sta scrhi
clc
adc #$d4
sta colhi
lda glyphbase
clc
adc rowidx
tax
lda bigglyphs,x
asl ; 3-bit pattern up to bits 7-5
asl
asl
asl
asl
sta curbits
ldy charx
lda #3
sta bitcnt
db_bit:
asl curbits ; leftmost pixel first
bcc db_nobit
lda #$a0 ; inverse space = solid block
sta (scrlo),y
lda bigcolor
sta (collo),y
db_nobit:
iny
dec bitcnt
bne db_bit
inc rowidx
lda rowidx
cmp #5
bne db_row
db_next:
inc bigi
lda bigi
cmp biglen
beq db_done
jmp db_char ; too far for a relative branch
db_done:
rts
; ---- draw the giant TTG letters from 8x8 bitmaps ----
draw_logo:
lda #0
sta letter
letter_loop:
ldx letter
lda letter_off,x
clc
adc #<(SCREEN + BIGROW*40 + BIGCOL)
sta scrlo
lda #>(SCREEN + BIGROW*40 + BIGCOL)
adc #0
sta scrhi
lda letter_off,x
clc
adc #<(COLRAM + BIGROW*40 + BIGCOL)
sta collo
lda #>(COLRAM + BIGROW*40 + BIGCOL)
adc #0
sta colhi
lda letter ; bitmap index = letter * 8
asl
asl
asl
tax
lda #8
sta rowcount
row_loop:
lda bigfont,x
sta curbits
ldy #0
bit_loop:
asl curbits ; leftmost pixel first
bcc no_plot
lda #$a0 ; inverse space = solid block
sta (scrlo),y
lda #YELLOW
sta (collo),y
no_plot:
iny
cpy #8
bne bit_loop
lda scrlo ; advance both pointers one screen row
clc
adc #40
sta scrlo
bcc scr_nocarry
inc scrhi
scr_nocarry:
lda collo
clc
adc #40
sta collo
bcc col_nocarry
inc colhi
col_nocarry:
inx
dec rowcount
bne row_loop
inc letter
lda letter
cmp #3
bne letter_loop
rts
; ============================================================
; slide 1: giant logo + credits scroller
; shared routines and the slides
; ============================================================
s1_init:
jsr clear_screen
jsr draw_logo
!src "common.asm"
!src "slide1.asm"
!src "slide2.asm"
!src "slide3.asm"
!src "slide4.asm"
!src "slide5.asm"
+prtext 12, 13, WHITE, txt_title, txt_title_end - txt_title
+prtext 17, 9, LGREEN, txt_www, txt_www_end - txt_www
+prtext 19, 14, LGREY, txt_city, txt_city_end - txt_city
; scroller row color
ldx #39
lda #CYAN
scrollcol_loop:
sta COLRAM+SCROLLROW*40,x
dex
bpl scrollcol_loop
lda #6 ; multiple of SCROLL_STEP -> clean 4-frame cycle
sta xscroll
lda #0
sta scrollidx
sta washphase
rts
s1_update:
; switch on fine scroll + 38-column mode for the scroller row only
wait_scrtop:
lda RASTER
cmp #RAS_SCRTOP
bne wait_scrtop
lda xscroll ; bits 0-2 = x scroll, bit 3 = 0 -> 38 columns
sta XCTRL
wait_scrbot:
lda RASTER
cmp #RAS_SCRBOT
bne wait_scrbot
lda #$c8 ; back to default: 40 columns, no scroll
sta XCTRL
; beam is in the lower border: do all updates now, invisibly
wait_bottom:
lda RASTER
cmp #RAS_BOTTOM
bne wait_bottom
inc framectr
; smooth scroll: move SCROLL_STEP pixels, shift chars on wrap
lda xscroll
sec
sbc #SCROLL_STEP
bcs xs_store ; still 0..7: just store
adc #8 ; wrap (carry clear, so this adds exactly 8)
sta xscroll
jsr shift_row
jmp xs_done
xs_store:
sta xscroll
xs_done:
lda framectr ; wash moves one column every 2nd frame
and #1
bne wash_hold
inc washphase
wash_hold:
jsr do_wash
jsr do_pulse
rts
; ---- shift the scroller row one char left, feed in the next char ----
shift_row:
ldx #0
sr_loop:
lda SCREEN+SCROLLROW*40+1,x
sta SCREEN+SCROLLROW*40,x
inx
cpx #39
bne sr_loop
ldx scrollidx
lda scrolltext,x
sta SCREEN+SCROLLROW*40+39
inx
cpx #scrolltext_end - scrolltext
bne sr_nowrap
ldx #0
sr_nowrap:
stx scrollidx
rts
; ---- color wash: gold gradient running across the logo columns ----
do_wash:
ldx #27 ; 28 logo columns
dw_loop:
txa
clc
adc washphase
and #15
tay
lda washtbl,y
sta COLRAM + (BIGROW+0)*40 + BIGCOL,x
sta COLRAM + (BIGROW+1)*40 + BIGCOL,x
sta COLRAM + (BIGROW+2)*40 + BIGCOL,x
sta COLRAM + (BIGROW+3)*40 + BIGCOL,x
sta COLRAM + (BIGROW+4)*40 + BIGCOL,x
sta COLRAM + (BIGROW+5)*40 + BIGCOL,x
sta COLRAM + (BIGROW+6)*40 + BIGCOL,x
sta COLRAM + (BIGROW+7)*40 + BIGCOL,x
dex
bpl dw_loop
rts
; ---- pulsing title: grey-white ramp, one step per 8 frames ----
do_pulse:
lda framectr
lsr
lsr
lsr
and #7
tay
lda pulsetbl,y
ldx #txt_title_end - txt_title - 1
dp_loop:
sta COLRAM+TITLE_POS,x
dex
bpl dp_loop
rts
; ============================================================
; slide 2: OUR FIRST GAME - Definitely not an Impostor
; big letters with the gold wash running across them
; ============================================================
s2_init:
jsr clear_screen
+prtext 1, 13, WHITE, txt_firstgame, txt_firstgame_end - txt_firstgame
+prbig 4, 0, YELLOW, big_definitely, 10
+prbig 10, 8, YELLOW, big_notan, 6
+prbig 16, 4, YELLOW, big_impostor, 8
+prtext 23, 10, LGREY, txt_tic80, txt_tic80_end - txt_tic80
rts
s2_update:
lda RASTER
cmp #RAS_BOTTOM
bne s2_update
inc framectr
lda framectr ; wash moves one column every 2nd frame
and #1
bne s2_hold
inc washphase
s2_hold:
; gold wash across all 15 big-letter rows (4-8, 10-14, 16-20)
ldx #39
s2_loop:
txa
clc
adc washphase
and #15
tay
lda washtbl,y
sta COLRAM + 4*40,x
sta COLRAM + 5*40,x
sta COLRAM + 6*40,x
sta COLRAM + 7*40,x
sta COLRAM + 8*40,x
sta COLRAM + 10*40,x
sta COLRAM + 11*40,x
sta COLRAM + 12*40,x
sta COLRAM + 13*40,x
sta COLRAM + 14*40,x
sta COLRAM + 16*40,x
sta COLRAM + 17*40,x
sta COLRAM + 18*40,x
sta COLRAM + 19*40,x
sta COLRAM + 20*40,x
dex
bpl s2_loop
rts
; ============================================================
; slide 3: OUR SECOND GAME IS COMING
; full-screen raster bars (background + border) behind the text
; ============================================================
s3_init:
jsr clear_screen
+prtext 4, 12, WHITE, txt_secondgame, txt_secondgame_end - txt_secondgame
+prbig 8, 3, DGREY, big_iscoming, 9 ; drop shadow first (+1 row, +1 col)
+prbig 7, 2, YELLOW, big_iscoming, 9 ; then the letters on top of it
+prtext 15, 4, WHITE, txt_pointclick, txt_pointclick_end - txt_pointclick
+prtext 18, 7, LGREY, txt_steam, txt_steam_end - txt_steam
lda #0
sta s3phase
rts
s3_update:
inc framectr
lda framectr ; bars scroll one step every 2nd frame
and #1
bne s3_hold
inc s3phase
s3_hold:
; chase the beam: every 4th raster line from RAS_BARTOP down,
; set the BORDER color from the cyclic 64-entry bar table;
; the background stays black so the text remains readable
lda #RAS_BARTOP
sta s3line
ldx #0 ; bar step counter
s3_bar:
lda s3line
s3_wait:
cmp RASTER
bne s3_wait
txa
clc
adc s3phase
and #63
tay
lda rastbl,y
sta BORDER
lda s3line
clc
adc #4
sta s3line
inx
cpx #BAR_STEPS
bne s3_bar
lda #BLACK ; below the bar area: back to black
sta BORDER
s3_wbot: ; keep the one-call-per-frame contract
lda RASTER
cmp #RAS_BOTTOM
bne s3_wbot
rts
; ============================================================
; slide 4: CONTACT
; pulsing big title, contact lines below
; ============================================================
s4_init:
jsr clear_screen
+prbig 2, 6, WHITE, big_contact, 7
+prtext 10, 7, LGREEN, txt_web, txt_web_end - txt_web
+prtext 13, 6, YELLOW, txt_bbs, txt_bbs_end - txt_bbs
+prtext 16, 4, CYAN, txt_irc, txt_irc_end - txt_irc
rts
s4_update:
lda RASTER
cmp #RAS_BOTTOM
bne s4_update
inc framectr
lda framectr ; grey-white pulse on the big title rows (2-6)
lsr
lsr
lsr
and #7
tay
lda pulsetbl,y
ldx #39
s4_loop:
sta COLRAM + 2*40,x
sta COLRAM + 3*40,x
sta COLRAM + 4*40,x
sta COLRAM + 5*40,x
sta COLRAM + 6*40,x
dex
bpl s4_loop
rts
; ============================================================
; slide 5: the assembly confession
; ============================================================
s5_init:
jsr clear_screen
+prtext 3, 11, WHITE, txt_conf1, txt_conf1_end - txt_conf1
+prtext 7, 5, LGREY, txt_conf2, txt_conf2_end - txt_conf2
+prtext 9, 4, LGREY, txt_conf3, txt_conf3_end - txt_conf3
+prtext 12, 5, WHITE, txt_conf4, txt_conf4_end - txt_conf4
+prtext 15, 5, LGREY, txt_conf5, txt_conf5_end - txt_conf5
+prtext 17, 5, LGREY, txt_conf6, txt_conf6_end - txt_conf6
+prtext 21, 11, CYAN, txt_conf7, txt_conf7_end - txt_conf7
rts
s5_update:
lda RASTER
cmp #RAS_BOTTOM
bne s5_update
inc framectr
lda framectr ; pulse on the "(the ai says hi.)" line
lsr
lsr
lsr
and #7
tay
lda pulsetbl,y
ldx #txt_conf7_end - txt_conf7 - 1
s5_loop:
sta COLRAM + 21*40 + 11,x
dex
bpl s5_loop
rts
; ---- data ----
; slide table: init vector, update vector, duration in frames
; ---- slide table: init vector, update vector, duration ----
slide_init_lo:
!byte <s1_init, <s2_init, <s3_init, <s4_init, <s5_init
slide_init_hi:
@@ -846,187 +361,12 @@ slide_dur_lo:
slide_dur_hi:
!byte >SLIDE_TIME, >SLIDE_TIME, >SLIDE_TIME, >SLIDE_TIME, >SLIDE_TIME
; row * 40 lookup tables (25 rows)
mul40lo:
!byte $00, $28, $50, $78, $a0, $c8, $f0, $18, $40, $68
!byte $90, $b8, $e0, $08, $30, $58, $80, $a8, $d0, $f8
!byte $20, $48, $70, $98, $c0
mul40hi:
!byte $00, $00, $00, $00, $00, $00, $00, $01, $01, $01
!byte $01, $01, $01, $02, $02, $02, $02, $02, $02, $02
!byte $03, $03, $03, $03, $03
; 8x8 bitmaps of the giant letters (one byte per row, MSB = left pixel)
bigfont:
; T
!byte $ff, $ff, $3c, $3c, $3c, $3c, $3c, $3c
; T
!byte $ff, $ff, $3c, $3c, $3c, $3c, $3c, $3c
; G
!byte $7e, $c3, $c0, $c0, $cf, $c3, $c3, $7e
letter_off: ; column offset of each letter (8 wide + 2 gap)
!byte 0, 10, 20
; 3x5 block font for the big slide titles (5 bytes per glyph,
; low 3 bits used, MSB side = left)
bigglyphs:
!byte 0, 0, 0, 0, 0 ; 0 space
!byte 2, 5, 7, 5, 5 ; 1 A
!byte 3, 4, 4, 4, 3 ; 2 C
!byte 6, 5, 5, 5, 6 ; 3 D
!byte 7, 4, 6, 4, 7 ; 4 E
!byte 7, 4, 6, 4, 4 ; 5 F
!byte 7, 2, 2, 2, 7 ; 6 I
!byte 4, 4, 4, 4, 7 ; 7 L
!byte 5, 7, 7, 5, 5 ; 8 M
!byte 6, 5, 5, 5, 5 ; 9 N
!byte 7, 5, 5, 5, 7 ; 10 O
!byte 6, 5, 6, 4, 4 ; 11 P
!byte 6, 5, 6, 5, 5 ; 12 R
!byte 3, 4, 2, 1, 6 ; 13 S
!byte 7, 2, 2, 2, 2 ; 14 T
!byte 5, 5, 2, 2, 2 ; 15 Y
!byte 3, 4, 5, 5, 7 ; 16 G
bigmap: ; screen code (a=1..z=26) -> glyph index
!byte 0 ; (unused)
!byte 1, 0, 2, 3, 4, 5, 16, 0, 6, 0 ; a-j
!byte 0, 7, 8, 9, 10, 11, 0, 12, 13, 14 ; k-t
!byte 0, 0, 0, 0, 15, 0 ; u-z
washtbl: ; gold glow ramp (16 entries, cyclic)
!byte $09, $02, $08, $0a, $07, $07, $01, $01
!byte $01, $01, $07, $07, $0a, $08, $02, $09
pulsetbl: ; grey-white pulse (8 entries, cyclic)
!byte $0b, $0c, $0f, $01, $01, $0f, $0c, $0b
fadetbl: ; fade-to-black: each color -> one shade darker,
; every chain reaches black in at most 4 steps
; (e.g. white -> lgrey -> mgrey -> dgrey -> black)
; blk wht red cyn pur grn blu yel
!byte $00, $0f, $09, $0e, $06, $0b, $00, $08
; org brn lrd dgr mgr lgn lbl lgr
!byte $02, $00, $02, $00, $0b, $05, $06, $0c
rastbl: ; raster bar colors (64 entries, cyclic):
; red, green, blue, grey ramps
!byte $00, $00, $02, $02, $08, $08, $0a, $01
!byte $0a, $08, $08, $02, $02, $00, $00, $00
!byte $00, $00, $05, $05, $0d, $0d, $07, $01
!byte $07, $0d, $0d, $05, $05, $00, $00, $00
!byte $00, $00, $06, $06, $0e, $0e, $03, $01
!byte $03, $0e, $0e, $06, $06, $00, $00, $00
!byte $00, $00, $0b, $0b, $0c, $0c, $0f, $01
!byte $0f, $0c, $0c, $0b, $0b, $00, $00, $00
; texts in screen codes (!scr); lowercase source shows as uppercase on C64
; slide 1
txt_title:
!scr "teletype games"
txt_title_end:
txt_www:
!scr "www.teletypegames.org"
txt_www_end:
txt_city:
!scr "szeged, 2026"
txt_city_end:
scrolltext:
!scr "mr.zero - tasnadi zsolt / mr.one - tari balazs / "
!scr "mr.two - timar zoltan / mr.three - mezo bela / "
scrolltext_end:
; slide 2
txt_firstgame:
!scr "our first game"
txt_firstgame_end:
big_definitely:
!scr "definitely"
big_notan:
!scr "not an"
big_impostor:
!scr "impostor"
txt_tic80:
!scr "introduced on tic-80"
txt_tic80_end:
; slide 3
txt_secondgame:
!scr "our second game"
txt_secondgame_end:
big_iscoming:
!scr "is coming"
txt_pointclick:
!scr "a new point and click adventure"
txt_pointclick_end:
txt_steam:
!scr "will be available on steam"
txt_steam_end:
; slide 4
big_contact:
!scr "contact"
txt_web:
!scr "web: www.teletypegames.org"
txt_web_end:
txt_bbs:
!scr "bbs: teletypegames.org 2323"
txt_bbs_end:
txt_irc:
!scr "irc: libera.chat #teletypegames"
txt_irc_end:
; slide 5
txt_conf1:
!scr "a quick confession"
txt_conf1_end:
txt_conf2:
!scr "we speak c, c++, python, java,"
txt_conf2_end:
txt_conf3:
!scr "php, javascript and even pascal."
txt_conf3_end:
txt_conf4:
!scr "but 6502 assembly? not a word."
txt_conf4_end:
txt_conf5:
!scr "so this slideshow was written"
txt_conf5_end:
txt_conf6:
!scr "with a little help from an ai."
txt_conf6_end:
txt_conf7:
!scr "(the ai says hi.)"
txt_conf7_end:
; ---- variables ----
letter: !byte 0
rowcount: !byte 0
curbits: !byte 0
framectr: !byte 0
xscroll: !byte 0
washphase: !byte 0
scrollidx: !byte 0
slide: !byte 0 ; current slide index
durlo: !byte 0 ; frames left on this slide (16 bit)
durhi: !byte 0
s3phase: !byte 0 ; raster bar scroll offset
s3line: !byte 0 ; current raster line while drawing bars
prow: !byte 0 ; print_text: row, column, color, length
pcol: !byte 0
pcolor: !byte 0
plen: !byte 0
bigrow: !byte 0 ; draw_big: row, column, color, length
bigcol: !byte 0
bigcolor: !byte 0
biglen: !byte 0
bigi: !byte 0 ; draw_big internals
glyphbase: !byte 0
charx: !byte 0
rowidx: !byte 0
bitcnt: !byte 0
fadecnt: !byte 0 ; fade step counter
bmcnt: !byte 0 ; build_map inner counter
curmap: !fill 16, 0 ; current fade-in color map
paused: !byte 0 ; 1 = slide countdown frozen
pheld: !byte 0 ; 'p' key edge detection state
+235
View File
@@ -0,0 +1,235 @@
; -----------------------------------------------------------
; slide1.asm - giant TTG logo + credits scroller
; effects: gold wash on the logo, smooth pixel scroll,
; pulsing title
; -----------------------------------------------------------
s1_init:
jsr clear_screen
jsr draw_logo
+prtext 12, 13, WHITE, txt_title, txt_title_end - txt_title
+prtext 17, 9, LGREEN, txt_www, txt_www_end - txt_www
+prtext 19, 14, LGREY, txt_city, txt_city_end - txt_city
; scroller row color
ldx #39
lda #CYAN
scrollcol_loop:
sta COLRAM+SCROLLROW*40,x
dex
bpl scrollcol_loop
lda #6 ; multiple of SCROLL_STEP -> clean 4-frame cycle
sta xscroll
lda #0
sta scrollidx
sta washphase
rts
s1_update:
; switch on fine scroll + 38-column mode for the scroller row only
wait_scrtop:
lda RASTER
cmp #RAS_SCRTOP
bne wait_scrtop
lda xscroll ; bits 0-2 = x scroll, bit 3 = 0 -> 38 columns
sta XCTRL
wait_scrbot:
lda RASTER
cmp #RAS_SCRBOT
bne wait_scrbot
lda #$c8 ; back to default: 40 columns, no scroll
sta XCTRL
; beam is in the lower border: do all updates now, invisibly
wait_bottom:
lda RASTER
cmp #RAS_BOTTOM
bne wait_bottom
inc framectr
; smooth scroll: move SCROLL_STEP pixels, shift chars on wrap
lda xscroll
sec
sbc #SCROLL_STEP
bcs xs_store ; still 0..7: just store
adc #8 ; wrap (carry clear, so this adds exactly 8)
sta xscroll
jsr shift_row
jmp xs_done
xs_store:
sta xscroll
xs_done:
lda framectr ; wash moves one column every 2nd frame
and #1
bne wash_hold
inc washphase
wash_hold:
jsr do_wash
jsr do_pulse
rts
; ---- draw the giant TTG letters from 8x8 bitmaps ----
draw_logo:
lda #0
sta letter
letter_loop:
ldx letter
lda letter_off,x
clc
adc #<(SCREEN + BIGROW*40 + BIGCOL)
sta scrlo
lda #>(SCREEN + BIGROW*40 + BIGCOL)
adc #0
sta scrhi
lda letter_off,x
clc
adc #<(COLRAM + BIGROW*40 + BIGCOL)
sta collo
lda #>(COLRAM + BIGROW*40 + BIGCOL)
adc #0
sta colhi
lda letter ; bitmap index = letter * 8
asl
asl
asl
tax
lda #8
sta rowcount
row_loop:
lda bigfont,x
sta curbits
ldy #0
bit_loop:
asl curbits ; leftmost pixel first
bcc no_plot
lda #$a0 ; inverse space = solid block
sta (scrlo),y
lda #YELLOW
sta (collo),y
no_plot:
iny
cpy #8
bne bit_loop
lda scrlo ; advance both pointers one screen row
clc
adc #40
sta scrlo
bcc scr_nocarry
inc scrhi
scr_nocarry:
lda collo
clc
adc #40
sta collo
bcc col_nocarry
inc colhi
col_nocarry:
inx
dec rowcount
bne row_loop
inc letter
lda letter
cmp #3
bne letter_loop
rts
; ---- shift the scroller row one char left, feed in the next char ----
shift_row:
ldx #0
sr_loop:
lda SCREEN+SCROLLROW*40+1,x
sta SCREEN+SCROLLROW*40,x
inx
cpx #39
bne sr_loop
ldx scrollidx
lda scrolltext,x
sta SCREEN+SCROLLROW*40+39
inx
cpx #scrolltext_end - scrolltext
bne sr_nowrap
ldx #0
sr_nowrap:
stx scrollidx
rts
; ---- color wash: gold gradient running across the logo columns ----
do_wash:
ldx #27 ; 28 logo columns
dw_loop:
txa
clc
adc washphase
and #15
tay
lda washtbl,y
sta COLRAM + (BIGROW+0)*40 + BIGCOL,x
sta COLRAM + (BIGROW+1)*40 + BIGCOL,x
sta COLRAM + (BIGROW+2)*40 + BIGCOL,x
sta COLRAM + (BIGROW+3)*40 + BIGCOL,x
sta COLRAM + (BIGROW+4)*40 + BIGCOL,x
sta COLRAM + (BIGROW+5)*40 + BIGCOL,x
sta COLRAM + (BIGROW+6)*40 + BIGCOL,x
sta COLRAM + (BIGROW+7)*40 + BIGCOL,x
dex
bpl dw_loop
rts
; ---- pulsing title: grey-white ramp, one step per 8 frames ----
do_pulse:
lda framectr
lsr
lsr
lsr
and #7
tay
lda pulsetbl,y
ldx #txt_title_end - txt_title - 1
dp_loop:
sta COLRAM+TITLE_POS,x
dex
bpl dp_loop
rts
; ---- data ----
; 8x8 bitmaps of the giant letters (one byte per row, MSB = left pixel)
bigfont:
; T
!byte $ff, $ff, $3c, $3c, $3c, $3c, $3c, $3c
; T
!byte $ff, $ff, $3c, $3c, $3c, $3c, $3c, $3c
; G
!byte $7e, $c3, $c0, $c0, $cf, $c3, $c3, $7e
letter_off: ; column offset of each letter (8 wide + 2 gap)
!byte 0, 10, 20
; texts in screen codes (!scr); lowercase source shows as uppercase on C64
txt_title:
!scr "teletype games"
txt_title_end:
txt_www:
!scr "www.teletypegames.org"
txt_www_end:
txt_city:
!scr "szeged, 2026"
txt_city_end:
scrolltext:
!scr "mr.zero - tasnadi zsolt / mr.one - tari balazs / "
!scr "mr.two - timar zoltan / mr.three - mezo bela / "
scrolltext_end:
; ---- variables ----
letter: !byte 0
rowcount: !byte 0
xscroll: !byte 0
scrollidx: !byte 0
+67
View File
@@ -0,0 +1,67 @@
; -----------------------------------------------------------
; slide2.asm - OUR FIRST GAME: Definitely not an Impostor
; big block letters with the gold wash running across them
; -----------------------------------------------------------
s2_init:
jsr clear_screen
+prtext 1, 13, WHITE, txt_firstgame, txt_firstgame_end - txt_firstgame
+prbig 4, 0, YELLOW, big_definitely, 10
+prbig 10, 8, YELLOW, big_notan, 6
+prbig 16, 4, YELLOW, big_impostor, 8
+prtext 23, 10, LGREY, txt_tic80, txt_tic80_end - txt_tic80
rts
s2_update:
lda RASTER
cmp #RAS_BOTTOM
bne s2_update
inc framectr
lda framectr ; wash moves one column every 2nd frame
and #1
bne s2_hold
inc washphase
s2_hold:
; gold wash across all 15 big-letter rows (4-8, 10-14, 16-20)
ldx #39
s2_loop:
txa
clc
adc washphase
and #15
tay
lda washtbl,y
sta COLRAM + 4*40,x
sta COLRAM + 5*40,x
sta COLRAM + 6*40,x
sta COLRAM + 7*40,x
sta COLRAM + 8*40,x
sta COLRAM + 10*40,x
sta COLRAM + 11*40,x
sta COLRAM + 12*40,x
sta COLRAM + 13*40,x
sta COLRAM + 14*40,x
sta COLRAM + 16*40,x
sta COLRAM + 17*40,x
sta COLRAM + 18*40,x
sta COLRAM + 19*40,x
sta COLRAM + 20*40,x
dex
bpl s2_loop
rts
; ---- data ----
txt_firstgame:
!scr "our first game"
txt_firstgame_end:
big_definitely:
!scr "definitely"
big_notan:
!scr "not an"
big_impostor:
!scr "impostor"
txt_tic80:
!scr "introduced on tic-80"
txt_tic80_end:
+87
View File
@@ -0,0 +1,87 @@
; -----------------------------------------------------------
; slide3.asm - OUR SECOND GAME: IS COMING
; raster bars running on the border only, drop-shadowed
; big letters in the middle
; -----------------------------------------------------------
s3_init:
jsr clear_screen
+prtext 4, 12, WHITE, txt_secondgame, txt_secondgame_end - txt_secondgame
+prbig 8, 3, DGREY, big_iscoming, 9 ; drop shadow first (+1 row, +1 col)
+prbig 7, 2, YELLOW, big_iscoming, 9 ; then the letters on top of it
+prtext 15, 4, WHITE, txt_pointclick, txt_pointclick_end - txt_pointclick
+prtext 18, 7, LGREY, txt_steam, txt_steam_end - txt_steam
lda #0
sta s3phase
rts
s3_update:
inc framectr
lda framectr ; bars scroll one step every 2nd frame
and #1
bne s3_hold
inc s3phase
s3_hold:
; chase the beam: every 4th raster line from RAS_BARTOP down,
; set the BORDER color from the cyclic 64-entry bar table;
; the background stays black so the text remains readable
lda #RAS_BARTOP
sta s3line
ldx #0 ; bar step counter
s3_bar:
lda s3line
s3_wait:
cmp RASTER
bne s3_wait
txa
clc
adc s3phase
and #63
tay
lda rastbl,y
sta BORDER
lda s3line
clc
adc #4
sta s3line
inx
cpx #BAR_STEPS
bne s3_bar
lda #BLACK ; below the bar area: back to black
sta BORDER
s3_wbot: ; keep the one-call-per-frame contract
lda RASTER
cmp #RAS_BOTTOM
bne s3_wbot
rts
; ---- data ----
rastbl: ; raster bar colors (64 entries, cyclic):
; red, green, blue, grey ramps
!byte $00, $00, $02, $02, $08, $08, $0a, $01
!byte $0a, $08, $08, $02, $02, $00, $00, $00
!byte $00, $00, $05, $05, $0d, $0d, $07, $01
!byte $07, $0d, $0d, $05, $05, $00, $00, $00
!byte $00, $00, $06, $06, $0e, $0e, $03, $01
!byte $03, $0e, $0e, $06, $06, $00, $00, $00
!byte $00, $00, $0b, $0b, $0c, $0c, $0f, $01
!byte $0f, $0c, $0c, $0b, $0b, $00, $00, $00
txt_secondgame:
!scr "our second game"
txt_secondgame_end:
big_iscoming:
!scr "is coming"
txt_pointclick:
!scr "a new point and click adventure"
txt_pointclick_end:
txt_steam:
!scr "will be available on steam"
txt_steam_end:
; ---- variables ----
s3phase: !byte 0 ; raster bar scroll offset
s3line: !byte 0 ; current raster line while drawing bars
+49
View File
@@ -0,0 +1,49 @@
; -----------------------------------------------------------
; slide4.asm - CONTACT
; pulsing big title, contact lines below
; -----------------------------------------------------------
s4_init:
jsr clear_screen
+prbig 2, 6, WHITE, big_contact, 7
+prtext 10, 7, LGREEN, txt_web, txt_web_end - txt_web
+prtext 13, 6, YELLOW, txt_bbs, txt_bbs_end - txt_bbs
+prtext 16, 4, CYAN, txt_irc, txt_irc_end - txt_irc
rts
s4_update:
lda RASTER
cmp #RAS_BOTTOM
bne s4_update
inc framectr
lda framectr ; grey-white pulse on the big title rows (2-6)
lsr
lsr
lsr
and #7
tay
lda pulsetbl,y
ldx #39
s4_loop:
sta COLRAM + 2*40,x
sta COLRAM + 3*40,x
sta COLRAM + 4*40,x
sta COLRAM + 5*40,x
sta COLRAM + 6*40,x
dex
bpl s4_loop
rts
; ---- data ----
big_contact:
!scr "contact"
txt_web:
!scr "web: www.teletypegames.org"
txt_web_end:
txt_bbs:
!scr "bbs: teletypegames.org 2323"
txt_bbs_end:
txt_irc:
!scr "irc: libera.chat #teletypegames"
txt_irc_end:
+59
View File
@@ -0,0 +1,59 @@
; -----------------------------------------------------------
; slide5.asm - the assembly confession
; -----------------------------------------------------------
s5_init:
jsr clear_screen
+prtext 3, 11, WHITE, txt_conf1, txt_conf1_end - txt_conf1
+prtext 7, 3, LGREY, txt_conf2, txt_conf2_end - txt_conf2
+prtext 9, 3, LGREY, txt_conf3, txt_conf3_end - txt_conf3
+prtext 12, 3, WHITE, txt_conf4, txt_conf4_end - txt_conf4
+prtext 15, 3, LGREY, txt_conf5, txt_conf5_end - txt_conf5
+prtext 17, 3, LGREY, txt_conf6, txt_conf6_end - txt_conf6
+prtext 21, 11, CYAN, txt_conf7, txt_conf7_end - txt_conf7
rts
s5_update:
lda RASTER
cmp #RAS_BOTTOM
bne s5_update
inc framectr
lda framectr ; pulse on the "(the ai says hi.)" line
lsr
lsr
lsr
and #7
tay
lda pulsetbl,y
ldx #txt_conf7_end - txt_conf7 - 1
s5_loop:
sta COLRAM + 21*40 + 11,x
dex
bpl s5_loop
rts
; ---- data ----
txt_conf1:
!scr "a quick confession"
txt_conf1_end:
; body lines are justified: extra spaces pad each line to
; exactly 34 chars, so both edges line up at columns 3 and 36
txt_conf2:
!scr "we speak c/c++, lua, python, java,"
txt_conf2_end:
txt_conf3:
!scr "go, ruby, js, elixir, pascal."
txt_conf3_end:
txt_conf4:
!scr "but 6502 assembly? not a word."
txt_conf4_end:
txt_conf5:
!scr "so this slideshow was written"
txt_conf5_end:
txt_conf6:
!scr "with a little help from an ai."
txt_conf6_end:
txt_conf7:
!scr "(the ai says hi.)"
txt_conf7_end: