Last active
March 1, 2022 21:20
-
-
Save classilla/5003c70ed0dd6c0205a620b026d89f88 to your computer and use it in GitHub Desktop.
Sorta-Wordle for the MOS/Commodore KIM-1, in 100% 6502 assembly language. Just 1K! https://oldvcr.blogspot.com/2022/02/kimdle-sorta-wordle-for-kim-1.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.word $4200 | |
* = $0200 | |
; kimdle version 3 | |
; guess letters a-f and 0 = o 1 = i 5 = s | |
; assembles into a KIMplement-compatible binary with xa65 | |
; (C)2022 cameron kaiser | |
; all rights reserved | |
; freeware under the floodgap free software license | |
inh = $f9 | |
pointl = $fa | |
pointh = $fb | |
scands = $1f1f | |
getkey = $1f6a | |
words = $03 | |
moven = $80 | |
basis = $81 ; $82, $83 | |
move = $84 ; $85, $86 | |
word = $87 ; $88, $89 | |
temp = $8a | |
; randomizer | |
jsr scands | |
rlup jsr getkey | |
cmp #$15 | |
bpl rlup | |
nugame lda #0 | |
sta moven | |
lda #$88 | |
sta basis | |
sta basis+1 | |
sta basis+2 | |
; get a random number from the interval timer | |
lda $1704 | |
and #63 | |
cmp #41 ; there are 41 words in the dictionary | |
bcc noshift | |
lsr | |
noshift sta temp | |
asl | |
clc | |
adc temp ; number * 3 for index into dictionary | |
tax | |
#if(0) | |
stx pointh | |
stx pointl | |
stx inh | |
lupx jsr scands | |
jsr getkey | |
cmp #$15 | |
bpl lupx | |
lda inh | |
#endif | |
; load selected word. it's not hard to figure out the | |
; encoding. don't cheat. | |
lda words,x | |
sta word | |
lda words+1,x | |
sta word+1 | |
lda words+2,x | |
and #$0f | |
sta word+2 | |
; set up display | |
nextmuv lda basis+2 | |
and #$f0 | |
ora moven | |
sta inh | |
lda basis+1 | |
sta pointl | |
lda basis | |
sta pointh | |
; letter 1 | |
jsr glup | |
cpx #$13 | |
beq nextmuv ; go reset | |
lda pointh | |
and #$0f | |
sta pointh | |
txa | |
asl | |
asl | |
asl | |
asl | |
ora pointh | |
sta pointh | |
tya | |
asl | |
asl | |
asl | |
asl | |
sta move | |
; letter 2 | |
jsr glup | |
cpx #$13 | |
beq nextmuv | |
lda pointh | |
and #$f0 | |
sta pointh | |
txa | |
ora pointh | |
sta pointh | |
lda move | |
and #$f0 | |
sta move | |
tya | |
ora move | |
sta move | |
; letter 3 | |
jsr glup | |
cpx #$13 | |
beq nextmuv | |
lda pointl | |
and #$0f | |
sta pointl | |
txa | |
asl | |
asl | |
asl | |
asl | |
ora pointl | |
sta pointl | |
tya | |
asl | |
asl | |
asl | |
asl | |
sta move+1 | |
; letter 4 | |
jsr glup | |
cpx #$13 | |
beq nextmuv | |
lda pointl | |
and #$f0 | |
sta pointl | |
txa | |
ora pointl | |
sta pointl | |
lda move+1 | |
and #$f0 | |
sta move+1 | |
tya | |
ora move+1 | |
sta move+1 | |
; letter 5 | |
jsr glup | |
cpx #$13 | |
bne *+5 | |
jmp nextmuv | |
txa | |
asl | |
asl | |
asl | |
asl | |
sta inh | |
sty move+2 | |
lda pointh | |
sta basis | |
lda pointl | |
sta basis+1 | |
lda inh | |
sta basis+2 | |
; compare | |
lda move | |
cmp word | |
bne wordc | |
lda move+1 | |
cmp word+1 | |
bne wordc | |
lda word+2 | |
and #$0f | |
cmp move+2 | |
bne wordc | |
jmp daymn | |
; never send a human to do a machine's job | |
; figure out how human screwed up and build new "screen" | |
; nybble 1 | |
wordc lda move | |
and #$f0 | |
sta temp | |
lda word | |
and #$f0 | |
cmp temp | |
beq ok1 | |
lda basis | |
and #$0f | |
ora #$80 | |
sta basis | |
; nybble 2 | |
ok1 lda move | |
and #$0f | |
sta temp | |
lda word | |
and #$0f | |
cmp temp | |
beq ok2 | |
lda basis | |
and #$f0 | |
ora #$08 | |
sta basis | |
; nybble 3 | |
ok2 lda move+1 | |
and #$f0 | |
sta temp | |
lda word+1 | |
and #$f0 | |
cmp temp | |
beq ok3 | |
lda basis+1 | |
and #$0f | |
ora #$80 | |
sta basis+1 | |
; nybble 4 | |
ok3 lda move+1 | |
and #$0f | |
sta temp | |
lda word+1 | |
and #$0f | |
cmp temp | |
beq ok4 | |
lda basis+1 | |
and #$f0 | |
ora #$08 | |
sta basis+1 | |
; nybble 5 | |
ok4 lda word+2 | |
and #$0f | |
sta temp | |
lda move+2 | |
cmp temp | |
beq ok5 | |
lda #$80 | |
sta basis+2 | |
ok5 inc moven | |
lda moven | |
cmp #7 | |
bcs haha | |
jmp nextmuv | |
haha ; you lost. decode word for stupid human | |
lda word | |
tax | |
cmp #$60 | |
bcc haha0 | |
clc | |
adc #$40 | |
haha0 and #$f0 | |
sta pointh | |
txa | |
and #$0f | |
cmp #$06 | |
bcc haha1 | |
clc | |
adc #$04 | |
haha1 ora pointh | |
sta pointh | |
lda word+1 | |
tax | |
cmp #$60 | |
bcc haha2 | |
clc | |
adc #$40 | |
haha2 and #$f0 | |
sta pointl | |
txa | |
and #$0f | |
cmp #$06 | |
bcc haha3 | |
clc | |
adc #$04 | |
haha3 ora pointl | |
sta pointl | |
lda word+2 | |
cmp #$06 | |
bcc haha4 | |
clc | |
adc #$04 | |
haha4 asl | |
asl | |
asl | |
asl | |
ora moven | |
hahao sta inh | |
hahalu jsr scands | |
jsr getkey | |
cmp #$15 | |
bmi hahalu | |
hahalu0 jsr scands | |
jsr getkey | |
cmp #$15 | |
bpl hahalu0 | |
jmp nugame | |
daymn ; you still should never send a human to do a machine's job even | |
; if human got it right | |
lda #$ac | |
sta pointh | |
lda #$ed | |
sta pointl | |
lda moven | |
jmp hahao | |
; game loop | |
; accept either 0, 1, 5, a-f or GO | |
; on exit, a = trashed | |
; y = copy of encoded nybble | |
; x = actual nybble | |
glup jsr scands | |
jsr getkey | |
cmp #$15 | |
bmi glup | |
glup0 jsr scands | |
jsr getkey | |
tay | |
tax | |
cmp #$13 ; go key - return | |
beq glup1 | |
cmp #$10 ; no other keys allowed above F | |
bpl glup0 | |
cmp #$00 ; 0 allowed | |
beq glup1 | |
cmp #$01 ; 1 allowed | |
beq glup1 | |
cmp #$05 ; 5 allowed | |
beq glup1 | |
cmp #$0a ; no other digits other than a-f | |
bcc glup0 | |
; encode a-f | |
sec | |
sbc #$04 | |
tay | |
glup1 rts | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.word $4003 | |
* = $0003 | |
words | |
.byt $67, $65, $9a | |
.byt $67, $76, $55 | |
.byt $67, $09, $aa | |
.byt $67, $19, $9a | |
.byt $69, $9a, $d9 | |
.byt $69, $07, $5a | |
.byt $61, $9a, $75 | |
.byt $65, $81, $a1 | |
.byt $65, $19, $ba | |
.byt $76, $70, $20 | |
.byt $76, $5a, $49 | |
.byt $76, $5a, $c5 | |
.byt $76, $51, $e8 | |
.byt $76, $51, $45 | |
.byt $70, $88, $6a | |
.byt $71, $b1, $39 | |
.byt $86, $86, $00 | |
.byt $86, $a8, $86 | |
.byt $86, $5a, $09 | |
.byt $8a, $65, $1a | |
.byt $80, $88, $91 | |
.byt $80, $80, $46 | |
.byt $80, $0a, $da | |
.byt $9a, $86, $29 | |
.byt $9a, $18, $ba | |
.byt $90, $5a, $15 | |
.byt $91, $09, $5a | |
.byt $a9, $91, $9a | |
.byt $b6, $8a, $69 | |
.byt $b6, $81, $f6 | |
.byt $b6, $9a, $f9 | |
.byt $ba, $8a, $d5 | |
.byt $b0, $55, $a6 | |
.byt $b1, $9a, $45 | |
.byt $06, $5a, $15 | |
.byt $06, $51, $f5 | |
.byt $07, $a5, $9a | |
.byt $58, $69, $75 | |
.byt $58, $0b, $ab | |
.byt $51, $9a, $a9 | |
.byt $51, $9a, $45 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment