mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-06-16 07:29:29 +00:00
appleiibot: wasted a lot of time getting assembly fitting in a tweet
This commit is contained in:
parent
4c982dff4f
commit
13aed3fe6f
|
@ -51,6 +51,15 @@ fire_extreme.o: fire_extreme.s
|
||||||
|
|
||||||
####
|
####
|
||||||
|
|
||||||
|
FIRE_HIGH: fire_high.o
|
||||||
|
ld65 -o FIRE_HIGH fire_high.o -C ../linker_scripts/apple2_c00.inc
|
||||||
|
|
||||||
|
fire_high.o: fire_high.s
|
||||||
|
ca65 -o fire_high.o fire_high.s -l fire_high.lst
|
||||||
|
|
||||||
|
|
||||||
|
####
|
||||||
|
|
||||||
FIRE_QKUMBA: fire_qkumba.o
|
FIRE_QKUMBA: fire_qkumba.o
|
||||||
ld65 -o FIRE_QKUMBA fire_qkumba.o -C ../linker_scripts/apple2_70.inc
|
ld65 -o FIRE_QKUMBA fire_qkumba.o -C ../linker_scripts/apple2_70.inc
|
||||||
|
|
||||||
|
|
153
fire/fire_high.s
Normal file
153
fire/fire_high.s
Normal file
|
@ -0,0 +1,153 @@
|
||||||
|
; Apple ][ Lo-res fire animation, size-optimized to 64 bytes
|
||||||
|
|
||||||
|
; by deater (Vince Weaver) <vince@deater.net>
|
||||||
|
|
||||||
|
; originally based on code described here
|
||||||
|
; http://fabiensanglard.net/doom_fire_psx/
|
||||||
|
; but this is a slightly different algorithm (but still cool looking)
|
||||||
|
|
||||||
|
; Optimization history:
|
||||||
|
; 80 bytes -- the size of tire_tiny.s
|
||||||
|
; 64 bytes -- use the firmware SCROLL routine to handle the scrolling
|
||||||
|
; this adds some flicker but saves many bytes
|
||||||
|
; 63 bytes -- qkumba noted that SCROLL leaves BAS2L:BAS2H pointing at $7d0
|
||||||
|
; 66 bytes -- tried on real hardware. Found that the original firmware
|
||||||
|
; never sets MIXCLR on boot, and my II+ machine was leaving
|
||||||
|
; it off so for correctness need to add it on.
|
||||||
|
; 66 bytes -- wasted a lot of time trying to either find clever ways to
|
||||||
|
; get $C050/C052 accessed, or to shorten the lookup table
|
||||||
|
; in half by lsr. Nothing panned out.
|
||||||
|
; 64 bytes -- realized I could save/restore the random SEEDL on the stack!
|
||||||
|
; doesn't seem to affect the output pattern either.
|
||||||
|
|
||||||
|
|
||||||
|
; Zero Page
|
||||||
|
|
||||||
|
WNDTOP = $22
|
||||||
|
WNDBTM = $23
|
||||||
|
CV = $25
|
||||||
|
BASL = $28
|
||||||
|
BASH = $29
|
||||||
|
BAS2L = $2A
|
||||||
|
BAS2H = $2B
|
||||||
|
SEEDL = $4E
|
||||||
|
|
||||||
|
; Soft Switches
|
||||||
|
SET_GR = $C050 ; Enable graphics
|
||||||
|
MIXCLR = $C052 ; Full screen, no text at bottom
|
||||||
|
LORES = $C056 ; Enable LORES graphics
|
||||||
|
|
||||||
|
; Monitor ROM routines. Try to use well-known entry points as
|
||||||
|
; these did sometimes change with newer models
|
||||||
|
SCROLL = $FC70
|
||||||
|
VTAB = $FC22 ; takes row in CV, Result is in BASL:BASH ($28/$29)
|
||||||
|
VTABZ = $FC24 ; VTABZ variant takes row in Accumulator
|
||||||
|
|
||||||
|
fire_demo:
|
||||||
|
|
||||||
|
; Set lores graphics
|
||||||
|
|
||||||
|
bit SET_GR ; force graphics mode ; 3
|
||||||
|
; LORES and LOWSCR (lo-res page1)
|
||||||
|
; are set by the boot rom
|
||||||
|
|
||||||
|
bit MIXCLR ; want full-screen graphics w/o mixed ; 3
|
||||||
|
; text the boot process doesn't set this
|
||||||
|
; (it doesn't matter in text mode)
|
||||||
|
; and while IIe and emulators come up clear
|
||||||
|
; my Apple II+ doesn't
|
||||||
|
|
||||||
|
; Set window. This seems to be set properly at boot though
|
||||||
|
; lda #0
|
||||||
|
; sta WNDTOP
|
||||||
|
; lda #24
|
||||||
|
; sta WNDBTM
|
||||||
|
|
||||||
|
|
||||||
|
scroll_loop:
|
||||||
|
|
||||||
|
jsr SCROLL ; scrolls screen up one row ; 3
|
||||||
|
|
||||||
|
|
||||||
|
;======================================
|
||||||
|
; re-draw bottom line (row 23) as white
|
||||||
|
|
||||||
|
|
||||||
|
; Y is left at 40 after SCROLL
|
||||||
|
; also BAS2L:BAS2H is left at $7d0
|
||||||
|
; this code over-writes $7F8 (the MSLOT screen hole value)
|
||||||
|
; but this should not matter for this demo
|
||||||
|
|
||||||
|
lda #$ff ; top/bottom white ; 2
|
||||||
|
w_loop:
|
||||||
|
sta (BAS2L),Y ; hline 23 (46+47) ; 2
|
||||||
|
dey ; 1
|
||||||
|
bpl w_loop ; 2
|
||||||
|
;============
|
||||||
|
; 8
|
||||||
|
|
||||||
|
fire_loop:
|
||||||
|
|
||||||
|
lda #22 ; start at line 22 ; 2
|
||||||
|
sta CV ; store in Row location ; 2
|
||||||
|
|
||||||
|
yloop:
|
||||||
|
; puts address of row CV into BASL:BASH
|
||||||
|
jsr VTAB ; 3
|
||||||
|
|
||||||
|
|
||||||
|
; loop for X values 39 ... 0
|
||||||
|
ldy #39 ; 2
|
||||||
|
xloop:
|
||||||
|
|
||||||
|
;=============================
|
||||||
|
; 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:
|
||||||
|
pla
|
||||||
|
; 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
|
||||||
|
pha
|
||||||
|
|
||||||
|
; end inlined RNG
|
||||||
|
|
||||||
|
; Randomly either use current value, or decay by one
|
||||||
|
bmi no_change ; assume bit 7 is as random as bit 0 ; 2
|
||||||
|
|
||||||
|
; Lookup the new color in table
|
||||||
|
lda (BASL),Y ; load value ; 2
|
||||||
|
and #$7 ; mask off ; 2
|
||||||
|
tax ; 1
|
||||||
|
; lda <(color_progression),X ; 2
|
||||||
|
lda color_progression,X ; 3
|
||||||
|
sta (BASL),Y ; 2
|
||||||
|
no_change:
|
||||||
|
|
||||||
|
dey ; 1
|
||||||
|
bpl xloop ; 2
|
||||||
|
|
||||||
|
dec CV ; 2
|
||||||
|
|
||||||
|
bpl yloop ; 2
|
||||||
|
|
||||||
|
bmi scroll_loop ; 2
|
||||||
|
|
||||||
|
color_progression:
|
||||||
|
.byte $00 ; 8->0 ; 1000 -> 0000 ; needed
|
||||||
|
.byte $bb ; 9->11 ; 1001 -> 1011
|
||||||
|
.byte $00 ; 10->0 ; 1010 -> 0000 ; needed
|
||||||
|
.byte $aa ; 11->10 ; 1011 -> 1010
|
||||||
|
.byte $00 ; 12->0 ; 1100 -> 0000 ; don't care
|
||||||
|
.byte $99 ; 13->9 ; 1101 -> 1001
|
||||||
|
.byte $00 ; 14->0 ; 1110 -> 0000 ; don't care
|
||||||
|
.byte $dd ; 15->13 ; 1111 -> 1101
|
||||||
|
|
|
@ -9,7 +9,7 @@ B2D = ../bmp2dhr/b2d
|
||||||
all: memories.dsk
|
all: memories.dsk
|
||||||
|
|
||||||
memories.dsk: HELLO CIRCLES.BAS CIRCLES CHECKERS CHECKERS_SMALL PLANE \
|
memories.dsk: HELLO CIRCLES.BAS CIRCLES CHECKERS CHECKERS_SMALL PLANE \
|
||||||
SIER TUNNEL TNM
|
SIER TUNNEL TNM CIRCLES_NORMAL
|
||||||
cp empty.dsk memories.dsk
|
cp empty.dsk memories.dsk
|
||||||
$(DOS33) -y memories.dsk SAVE A HELLO
|
$(DOS33) -y memories.dsk SAVE A HELLO
|
||||||
$(DOS33) -y memories.dsk SAVE A CIRCLES.BAS
|
$(DOS33) -y memories.dsk SAVE A CIRCLES.BAS
|
||||||
|
@ -20,6 +20,7 @@ memories.dsk: HELLO CIRCLES.BAS CIRCLES CHECKERS CHECKERS_SMALL PLANE \
|
||||||
$(DOS33) -y memories.dsk BSAVE -a 0x1000 SIER
|
$(DOS33) -y memories.dsk BSAVE -a 0x1000 SIER
|
||||||
$(DOS33) -y memories.dsk BSAVE -a 0x1000 TUNNEL
|
$(DOS33) -y memories.dsk BSAVE -a 0x1000 TUNNEL
|
||||||
$(DOS33) -y memories.dsk BSAVE -a 0x1000 TNM
|
$(DOS33) -y memories.dsk BSAVE -a 0x1000 TNM
|
||||||
|
$(DOS33) -y memories.dsk BSAVE -a 0x300 CIRCLES_NORMAL
|
||||||
|
|
||||||
CIRCLES: circles.o
|
CIRCLES: circles.o
|
||||||
ld65 -o CIRCLES circles.o -C ../linker_scripts/apple2_70_zp.inc
|
ld65 -o CIRCLES circles.o -C ../linker_scripts/apple2_70_zp.inc
|
||||||
|
@ -27,6 +28,12 @@ CIRCLES: circles.o
|
||||||
circles.o: circles.s
|
circles.o: circles.s
|
||||||
ca65 -o circles.o circles.s -l circles.lst
|
ca65 -o circles.o circles.s -l circles.lst
|
||||||
|
|
||||||
|
CIRCLES_NORMAL: circles_normal.o
|
||||||
|
ld65 -o CIRCLES_NORMAL circles_normal.o -C ../linker_scripts/apple2_300.inc
|
||||||
|
|
||||||
|
circles_normal.o: circles_normal.s
|
||||||
|
ca65 -o circles_normal.o circles_normal.s -l circles_normal.lst
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
CHECKERS: checkers.o
|
CHECKERS: checkers.o
|
||||||
|
|
157
hellmood_memories/circles_normal.s
Normal file
157
hellmood_memories/circles_normal.s
Normal file
|
@ -0,0 +1,157 @@
|
||||||
|
; Zooming Circles, based on the code in Hellmood's Memories
|
||||||
|
|
||||||
|
; by deater (Vince Weaver) <vince@deater.net>
|
||||||
|
|
||||||
|
; Zero Page
|
||||||
|
BASL = $28
|
||||||
|
BASH = $29
|
||||||
|
H2 = $2C
|
||||||
|
COLOR = $30
|
||||||
|
|
||||||
|
X1 = $F0
|
||||||
|
X2 = $F1
|
||||||
|
Y1 = $F2
|
||||||
|
Y2 = $F3
|
||||||
|
|
||||||
|
TEMP = $FA
|
||||||
|
TEMPY = $FB
|
||||||
|
FRAME = $FC
|
||||||
|
TEMPX = $FD
|
||||||
|
|
||||||
|
|
||||||
|
; Soft Switches
|
||||||
|
KEYPRESS= $C000
|
||||||
|
KEYRESET= $C010
|
||||||
|
SET_GR = $C050 ; Enable graphics
|
||||||
|
FULLGR = $C052 ; Full screen, no text
|
||||||
|
PAGE0 = $C054 ; Page0
|
||||||
|
PAGE1 = $C055 ; Page1
|
||||||
|
LORES = $C056 ; Enable LORES graphics
|
||||||
|
|
||||||
|
; ROM routines
|
||||||
|
|
||||||
|
PLOT = $F800 ; plot, horiz=y, vert=A (A trashed, XY Saved)
|
||||||
|
SETCOL = $F864
|
||||||
|
TEXT = $FB36 ;; Set text mode
|
||||||
|
BASCALC = $FBC1
|
||||||
|
SETGR = $FB40
|
||||||
|
HOME = $FC58 ;; Clear the text screen
|
||||||
|
WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
|
||||||
|
HLINE = $F819
|
||||||
|
|
||||||
|
; 103 bytes
|
||||||
|
|
||||||
|
; attempted HLINE, not much help (122 bytes, slow)
|
||||||
|
|
||||||
|
; quad plot, also 122
|
||||||
|
|
||||||
|
|
||||||
|
;.globalzp squares_table_y
|
||||||
|
;.globalzp color_lookup
|
||||||
|
;.globalzp smc1,smc2,smc3,smc4
|
||||||
|
|
||||||
|
;.zeropage
|
||||||
|
|
||||||
|
zooming_circles:
|
||||||
|
|
||||||
|
;===================
|
||||||
|
; init screen
|
||||||
|
; jsr SETGR ; 3
|
||||||
|
bit FULLGR ; 3
|
||||||
|
;====
|
||||||
|
; 6
|
||||||
|
circle_forever:
|
||||||
|
|
||||||
|
inc FRAME ; 2
|
||||||
|
|
||||||
|
ldx #24 ; 2
|
||||||
|
stx Y2 ; 2
|
||||||
|
dex ; 1
|
||||||
|
|
||||||
|
yloop:
|
||||||
|
ldy #20 ; 2
|
||||||
|
sty X2 ; 2
|
||||||
|
dey ; 1
|
||||||
|
|
||||||
|
xloop:
|
||||||
|
|
||||||
|
clc ; 1
|
||||||
|
lda squares_table_y+4,y ; 3
|
||||||
|
asl ; 1
|
||||||
|
asl ; 1
|
||||||
|
adc squares_table_y,x ; 2
|
||||||
|
|
||||||
|
lsr ; 1
|
||||||
|
adc FRAME ; 2
|
||||||
|
and #$1f ; 2
|
||||||
|
|
||||||
|
; and #$18
|
||||||
|
; 00, 10 = black
|
||||||
|
; 01 = grey 55 or aa
|
||||||
|
; 11 = light blue 77
|
||||||
|
|
||||||
|
lsr ; 1
|
||||||
|
lsr ; 1
|
||||||
|
lsr ; 1
|
||||||
|
sty TEMPY ; 2
|
||||||
|
tay ; 1
|
||||||
|
lda color_lookup,Y ; 3
|
||||||
|
sta COLOR ; 2
|
||||||
|
|
||||||
|
ldy X2 ; Y==X2 ; 2
|
||||||
|
txa ; A==Y1 ; 1
|
||||||
|
jsr PLOT ; (X2,Y1) ; 3
|
||||||
|
lda Y2 ; A==Y2 ; 2
|
||||||
|
jsr PLOT ; (X2,Y2) ; 3
|
||||||
|
|
||||||
|
ldy TEMPY ; Y==X1 ; 2
|
||||||
|
txa ; A==Y1 ; 1
|
||||||
|
jsr PLOT ; (X1,Y1) ; 3
|
||||||
|
lda Y2 ; A==Y2 ; 2
|
||||||
|
jsr PLOT ; (X1,Y2) ; 3
|
||||||
|
|
||||||
|
inc X2 ; 2
|
||||||
|
|
||||||
|
dey ; 1
|
||||||
|
bpl xloop ; 2
|
||||||
|
|
||||||
|
inc Y2 ; 2
|
||||||
|
|
||||||
|
dex ; 1
|
||||||
|
bpl yloop ; 2
|
||||||
|
|
||||||
|
bmi circle_forever ; 2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; 24 bytes
|
||||||
|
squares_table_y:
|
||||||
|
.byte $24,$21,$1e,$1b,$19,$16,$14,$12
|
||||||
|
.byte $10,$0e,$0c,$0a,$09,$07,$06,$05
|
||||||
|
.byte $04,$03,$02,$01,$01,$00,$00
|
||||||
|
|
||||||
|
color_lookup:
|
||||||
|
.byte $00 ; also last byte of squares table
|
||||||
|
.byte $55,$00,$77
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;.byte $00,$00,$00,$00,$01,$01,$02,$03
|
||||||
|
;.byte $04,$05,$06,$07,$09,$0a,$0c,$0e
|
||||||
|
;.byte $10,$12,$14,$16,$19,$1b,$1e,$21
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; 40 bytes
|
||||||
|
;squares_table_x:
|
||||||
|
;.byte $71,$6a,$64,$5d,$57,$51,$4b,$45
|
||||||
|
;.byte $40,$3a,$35,$31,
|
||||||
|
;.byte $2c,$28,$24,$20
|
||||||
|
;.byte $1c,$19,$15,$12,$10,$0d,$0b,$09
|
||||||
|
;.byte $07,$05,$04,$02,$01,$01,$00,$00
|
||||||
|
;.byte $00,$00,$00,$01,$01,$02,$04,$05
|
||||||
|
;.byte $07,$09,$0b,$0d,$10,$12,$15,$19
|
||||||
|
;.byte $1c,$20,$24,$28 ;,$2c,$31,$35,$3a
|
||||||
|
;;.byte $40,$45,$4b,$51,$57,$5d,$64,$6a
|
|
@ -8,10 +8,11 @@ B2D = ../bmp2dhr/b2d
|
||||||
|
|
||||||
all: seasons.dsk
|
all: seasons.dsk
|
||||||
|
|
||||||
seasons.dsk: HELLO SEASONS
|
seasons.dsk: HELLO SEASONS AUTUMN
|
||||||
cp empty.dsk seasons.dsk
|
cp empty.dsk seasons.dsk
|
||||||
$(DOS33) -y seasons.dsk SAVE A HELLO
|
$(DOS33) -y seasons.dsk SAVE A HELLO
|
||||||
$(DOS33) -y seasons.dsk BSAVE -a 0x50 SEASONS
|
$(DOS33) -y seasons.dsk BSAVE -a 0x50 SEASONS
|
||||||
|
$(DOS33) -y seasons.dsk BSAVE -a 0x300 AUTUMN
|
||||||
|
|
||||||
|
|
||||||
SEASONS: seasons.o
|
SEASONS: seasons.o
|
||||||
|
@ -21,6 +22,14 @@ SEASONS: seasons.o
|
||||||
seasons.o: seasons.s
|
seasons.o: seasons.s
|
||||||
ca65 -o seasons.o seasons.s -l seasons.lst
|
ca65 -o seasons.o seasons.s -l seasons.lst
|
||||||
|
|
||||||
|
|
||||||
|
AUTUMN: autumn.o
|
||||||
|
ld65 -o AUTUMN autumn.o -C ../linker_scripts/apple2_300.inc
|
||||||
|
|
||||||
|
autumn.o: autumn.s
|
||||||
|
ca65 -o autumn.o autumn.s -l autumn.lst
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,6 +39,6 @@ HELLO: hello.bas
|
||||||
####
|
####
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *~ *.o *.lst HELLO SEASONS
|
rm -f *~ *.o *.lst HELLO SEASONS AUTUMN
|
||||||
|
|
||||||
|
|
||||||
|
|
157
seasons/autumn.s
Normal file
157
seasons/autumn.s
Normal file
|
@ -0,0 +1,157 @@
|
||||||
|
; Autumn, based on the code in Hellmood's Autumn
|
||||||
|
; by deater (Vince Weaver) <vince@deater.net>
|
||||||
|
|
||||||
|
; Zero Page Addresses
|
||||||
|
|
||||||
|
XCOORDL = $F0
|
||||||
|
XCOORDH = $F1
|
||||||
|
YCOORDL = $F2
|
||||||
|
YCOORDH = $F3
|
||||||
|
EBP1 = $F4
|
||||||
|
EBP2 = $F5
|
||||||
|
EBP3 = $F6
|
||||||
|
EBP4 = $F7
|
||||||
|
COLORL = $F8
|
||||||
|
COLORH = $F9
|
||||||
|
|
||||||
|
; Soft Switches
|
||||||
|
KEYPRESS= $C000
|
||||||
|
KEYRESET= $C010
|
||||||
|
|
||||||
|
; ROM routines
|
||||||
|
; Some of these are in the Applesoft ROMs so need at least an Apple II+
|
||||||
|
; or later to run
|
||||||
|
|
||||||
|
TEXT = $FB36 ; Set text mode
|
||||||
|
HGR2 = $F3D8 ; Set full-screen hi-res mode using page 2 ($4000)
|
||||||
|
; 280x192 6-colors
|
||||||
|
HPLOT0 = $F457 ; Plot point, (Y,X) = Horizontal, (A=Vertical)
|
||||||
|
HCOLOR = $F6EC ; Set color in X, must be 0..7
|
||||||
|
|
||||||
|
|
||||||
|
autumn:
|
||||||
|
|
||||||
|
;===================
|
||||||
|
; init screen ; Instruction Length
|
||||||
|
jsr HGR2 ; 3
|
||||||
|
|
||||||
|
autumn_forever:
|
||||||
|
|
||||||
|
; save old Xcoord value to X/Y for later
|
||||||
|
; push/pop is 1 byte each but have to get
|
||||||
|
; value into accumulator first
|
||||||
|
ldx XCOORDL ; 2
|
||||||
|
ldy XCOORDH ; 2
|
||||||
|
|
||||||
|
; 16-bit subtraction x=x-y
|
||||||
|
; need to set carry before subtraction on 6502
|
||||||
|
txa ; 1
|
||||||
|
sec ; 1
|
||||||
|
sbc YCOORDL ; 2
|
||||||
|
sta XCOORDL ; 2
|
||||||
|
tya ; 1
|
||||||
|
sbc YCOORDH ; 2
|
||||||
|
|
||||||
|
; 16-bit arithmatic shift right of X
|
||||||
|
; 6502 has no asr instruction
|
||||||
|
; cmp #$80 sets carry if high bit set
|
||||||
|
cmp #$80 ; 2 ; XCOORDH still in A from before
|
||||||
|
ror ; 1
|
||||||
|
sta XCOORDH ; 2
|
||||||
|
ror XCOORDL ; 2
|
||||||
|
|
||||||
|
; 16-bit add, ycoord=ycoord+oldx
|
||||||
|
clc ; 1
|
||||||
|
txa ; 1
|
||||||
|
adc YCOORDL ; 2
|
||||||
|
sta YCOORDL ; 2
|
||||||
|
tya ; 1
|
||||||
|
adc YCOORDH ; 2
|
||||||
|
|
||||||
|
; 16-bit arithmatic shift right of y-coord
|
||||||
|
cmp #$80 ; 2 ; YCOORDH still in A from before
|
||||||
|
ror ; 1
|
||||||
|
sta YCOORDH ; 2
|
||||||
|
ror YCOORDL ; 2
|
||||||
|
|
||||||
|
; 32 bit rotate of low bit shifted out of Y-coordinate
|
||||||
|
ror EBP1 ; 2
|
||||||
|
ror EBP2 ; 2
|
||||||
|
ror EBP3 ; 2
|
||||||
|
ror EBP4 ; 2
|
||||||
|
|
||||||
|
; branch if carry set
|
||||||
|
bcs label_11f ; 2
|
||||||
|
|
||||||
|
; 16-bit increment of color
|
||||||
|
inc COLORL ; 2
|
||||||
|
bne no_oflo ; 2
|
||||||
|
inc COLORH ; 2
|
||||||
|
no_oflo:
|
||||||
|
|
||||||
|
; 16-bit add of X-coord by 0x80
|
||||||
|
; this keeps the drawing roughly to the 280x192 screen
|
||||||
|
; carry should still be clear (inc doesn't set it)
|
||||||
|
lda XCOORDL ; 2
|
||||||
|
adc #$80 ; 2
|
||||||
|
sta XCOORDL ; 2
|
||||||
|
bcc no_oflo2 ; 2
|
||||||
|
inc XCOORDH ; 2
|
||||||
|
no_oflo2:
|
||||||
|
|
||||||
|
; 16-bit negate of Y-coord
|
||||||
|
sec ; 1
|
||||||
|
lda #0 ; 2
|
||||||
|
sbc YCOORDL ; 2
|
||||||
|
sta YCOORDL ; 2
|
||||||
|
lda #0 ; 2
|
||||||
|
sbc YCOORDH ; 2
|
||||||
|
sta YCOORDH ; 2
|
||||||
|
|
||||||
|
label_11f:
|
||||||
|
|
||||||
|
; skipping the color manipulation done here by original
|
||||||
|
|
||||||
|
; mix colors a bit?
|
||||||
|
|
||||||
|
; 16-bit shift of color
|
||||||
|
; 2nd is a rotate as asl doesn't shift in cary
|
||||||
|
|
||||||
|
lda COLORL ; 2
|
||||||
|
asl ; 1 ; shl %ax
|
||||||
|
rol COLORH ; 2
|
||||||
|
eor COLORH ; 2
|
||||||
|
sta COLORL ; 2
|
||||||
|
|
||||||
|
; get color mapping
|
||||||
|
; using a color lookup table looks best but too many bytes
|
||||||
|
; you can approximate something close to the lookup with
|
||||||
|
; two extra instructions
|
||||||
|
|
||||||
|
and #$7 ; 2
|
||||||
|
ora #$2 ; 2
|
||||||
|
tax ; 1
|
||||||
|
|
||||||
|
; if ycoord negative, loop
|
||||||
|
lda YCOORDH ; 2
|
||||||
|
bmi autumn_forever ; 2
|
||||||
|
|
||||||
|
; if top bits of xcoord, loop
|
||||||
|
lda XCOORDH ; 2
|
||||||
|
and #$f0 ; 2
|
||||||
|
bne autumn_forever ; 2
|
||||||
|
|
||||||
|
put_pixel:
|
||||||
|
|
||||||
|
; actually set the color
|
||||||
|
jsr HCOLOR ; 3
|
||||||
|
|
||||||
|
; set up paramaters for HPLOT call
|
||||||
|
ldx XCOORDL ; 2
|
||||||
|
ldy XCOORDH ; 2
|
||||||
|
lda YCOORDL ; 2
|
||||||
|
jsr HPLOT0 ; 3
|
||||||
|
|
||||||
|
jmp autumn_forever ; 3 ; if we get under 128 bytes
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,37 @@ include ../Makefile.inc
|
||||||
DOS33 = ../dos33fs-utils/dos33
|
DOS33 = ../dos33fs-utils/dos33
|
||||||
TOKENIZE = ../asoft_basic-utils/tokenize_asoft
|
TOKENIZE = ../asoft_basic-utils/tokenize_asoft
|
||||||
|
|
||||||
all: entropy.dsk
|
all: entropy.dsk convert_to convert_back
|
||||||
|
|
||||||
entropy.dsk: ENTROPY ENTROPY.BAS
|
entropy.dsk: ENTROPY ENTROPY.BAS E2.BAS FLAME.BAS FLAME2.BAS \
|
||||||
|
CIRCLES.BAS AUTUMN.BAS LOAD
|
||||||
$(DOS33) -y entropy.dsk BSAVE -a 0x0C00 ENTROPY
|
$(DOS33) -y entropy.dsk BSAVE -a 0x0C00 ENTROPY
|
||||||
|
$(DOS33) -y entropy.dsk BSAVE -a 0x0300 LOAD
|
||||||
$(DOS33) -y entropy.dsk SAVE A ENTROPY.BAS
|
$(DOS33) -y entropy.dsk SAVE A ENTROPY.BAS
|
||||||
|
$(DOS33) -y entropy.dsk SAVE A E2.BAS
|
||||||
|
$(DOS33) -y entropy.dsk SAVE A FLAME.BAS
|
||||||
|
$(DOS33) -y entropy.dsk SAVE A FLAME2.BAS
|
||||||
|
$(DOS33) -y entropy.dsk SAVE A AUTUMN.BAS
|
||||||
|
$(DOS33) -y entropy.dsk SAVE A CIRCLES.BAS
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
convert_to: convert_to.o
|
||||||
|
$(CC) $(LFLAGS) -o convert_to convert_to.o
|
||||||
|
|
||||||
|
convert_to.o: convert_to.c
|
||||||
|
$(CC) $(CFLAGS) -c convert_to.c
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
convert_back: convert_back.o
|
||||||
|
$(CC) $(LFLAGS) -o convert_back convert_back.o
|
||||||
|
|
||||||
|
convert_back.o: convert_back.c
|
||||||
|
$(CC) $(CFLAGS) -c convert_back.c
|
||||||
|
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
ENTROPY: entropy.o
|
ENTROPY: entropy.o
|
||||||
ld65 -o ENTROPY entropy.o -C ../linker_scripts/apple2_c00.inc
|
ld65 -o ENTROPY entropy.o -C ../linker_scripts/apple2_c00.inc
|
||||||
|
@ -15,8 +41,49 @@ ENTROPY: entropy.o
|
||||||
entropy.o: entropy.s
|
entropy.o: entropy.s
|
||||||
ca65 -o entropy.o entropy.s -l entropy.lst
|
ca65 -o entropy.o entropy.s -l entropy.lst
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
LOAD: load.o
|
||||||
|
ld65 -o LOAD load.o -C ../linker_scripts/apple2_300.inc
|
||||||
|
|
||||||
|
load.o: load.s
|
||||||
|
ca65 -o load.o load.s -l load.lst
|
||||||
|
|
||||||
|
|
||||||
|
####
|
||||||
|
|
||||||
ENTROPY.BAS: entropy.bas
|
ENTROPY.BAS: entropy.bas
|
||||||
$(TOKENIZE) < entropy.bas > ENTROPY.BAS
|
$(TOKENIZE) < entropy.bas > ENTROPY.BAS
|
||||||
|
|
||||||
|
####
|
||||||
|
|
||||||
|
E2.BAS: entropy_small.bas
|
||||||
|
$(TOKENIZE) < entropy_small.bas > E2.BAS
|
||||||
|
|
||||||
|
|
||||||
|
####
|
||||||
|
|
||||||
|
FLAME2.BAS: flame2.bas
|
||||||
|
$(TOKENIZE) < flame2.bas > FLAME2.BAS
|
||||||
|
|
||||||
|
|
||||||
|
####
|
||||||
|
|
||||||
|
FLAME.BAS: flame.bas
|
||||||
|
$(TOKENIZE) < flame.bas > FLAME.BAS
|
||||||
|
|
||||||
|
####
|
||||||
|
|
||||||
|
AUTUMN.BAS: autumn.bas
|
||||||
|
$(TOKENIZE) < autumn.bas > AUTUMN.BAS
|
||||||
|
|
||||||
|
####
|
||||||
|
|
||||||
|
CIRCLES.BAS: circles.bas
|
||||||
|
$(TOKENIZE) < circles.bas > CIRCLES.BAS
|
||||||
|
|
||||||
|
|
||||||
|
####
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *~ *.o *.lst ENTROPY
|
rm -f *~ *.o *.lst ENTROPY LOAD
|
||||||
|
|
8
two-liners/autumn.bas
Normal file
8
two-liners/autumn.bas
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
2 FOR X=0TO116:A=(PEEK(2264+X/2)-32)/4:IFJTHENA=(A-INT(A))*4
|
||||||
|
3 J=NOTJ:POKE768+X,(PEEK(2147+X)-32)*4+A:NEXT:CALL768
|
||||||
|
9 REM (V\I\I\B.Y\A\FY\R@:A\9\&B9\A\F9\R@:A\9\9]9]9]9]L'Y^T Y^I\:@A\D Y\.J Y\A\J Y\A\I^")^1^A^*!" JI\,HI\*\TG([]I\I\I\(5]3 . &!) '$)& ))('$).*"&*,& *%!! *$$&&$''$*%%!-*'#%$! * %(,#,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
2
two-liners/circles.bas
Normal file
2
two-liners/circles.bas
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
2 GR:FOR X=0TO100:A=(PEEK(2245+X/2)-32)/4:IFJTHENA=(A-INT(A))*4
|
||||||
|
3 J=NOTJ:POKE768+X,(PEEK(2144+X)-32)*4+A:NEXT:CALL768:REM+4PY_H&A\RH%A\B&N3 ""?2 29_*'222A^JN8 A,I\B( ^I\( ^I^B( ^I\( ^Y\B$SY\R$P,N)('&&%%$$##""!!!! 5 ="""". ! &.)+)!.*#!'$!( ' . !, ) "."!!+&"""')#)$ $,
|
8
two-liners/convert4_4/autumn.bas
Normal file
8
two-liners/convert4_4/autumn.bas
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
1 FOR X=0TO116:POKE 768+X,(PEEK(2115+X)-64)*16+(PEEK(X+2232))-64:NEXT X:CALL768
|
||||||
|
9 "BMOJOJOHCNOHOINOLHFHOFOAHFOHOIFOLHFHOFOFOFOFOFOKANOM@NOJOFHHOI@NOCJ@NOHOJ@NOHOJO@BODOHOB@@@JJOCJJOBOMIBNOJOJOJOBEOD@@@HCF@DAJHEBE@HECI@JEAF@HJEBEBHECI@JECFBFDFEFFFG@MFH@BFIE@I@E@@BFAHI@EBEBI@ECECEHJFIEIEHIGIBJEC@CEAI@@M@LFF@DAEB@GDLCC"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
25
two-liners/convert4_4/convert_to.c
Normal file
25
two-liners/convert4_4/convert_to.c
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
|
int i,len,rv;
|
||||||
|
unsigned char string[BUFSIZ];
|
||||||
|
unsigned char out[BUFSIZ];
|
||||||
|
|
||||||
|
rv=read(0,string,BUFSIZ);
|
||||||
|
if (rv<=0) return -1;
|
||||||
|
|
||||||
|
len=rv;
|
||||||
|
printf("Len=%d\n",len);
|
||||||
|
printf("\"");
|
||||||
|
for(i=0;i<len;i++) {
|
||||||
|
out[i]='@'+(string[i]>>4);
|
||||||
|
out[i+len]='@'+(string[i]&0xf);
|
||||||
|
}
|
||||||
|
out[2*len]=0;
|
||||||
|
printf("%s",out);
|
||||||
|
printf("\"\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
2
two-liners/convert6/autumn.bas
Normal file
2
two-liners/convert6/autumn.bas
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
1 FOR X=0TO116:POKE 768+X,(PEEK(2112+X)-32)*4+PEEK(X+2229)-32:NEXT:CALL768
|
||||||
|
9 REM (V\I\I\B.Y\A\FY\R@:A\9\&B9\A\F9\R@:A\9\9]9]9]9]L'Y^T Y^I\:@A\D Y\.J Y\A\J Y\A\I^")^1^A^*!" JI\,HI\*\TG([]I\I\I\(5]3 #" !" !"! !#! "!!" "!"!" !#! "!#""" "!"""# !" ""!! ! ! ""! ! !"!"! !#!#! ""!!!! !#!""!# #!!! ! "" !!" # ##
|
25
two-liners/convert6/convert_to.c
Normal file
25
two-liners/convert6/convert_to.c
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
|
int i,len,rv;
|
||||||
|
unsigned char string[BUFSIZ];
|
||||||
|
unsigned char out[BUFSIZ];
|
||||||
|
|
||||||
|
rv=read(0,string,BUFSIZ);
|
||||||
|
if (rv<=0) return -1;
|
||||||
|
|
||||||
|
len=rv;
|
||||||
|
printf("Len=%d\n",len);
|
||||||
|
printf("\"");
|
||||||
|
for(i=0;i<len;i++) {
|
||||||
|
out[i]=' '+(string[i]>>2);
|
||||||
|
out[i+len]=' '+(string[i]&0x3);
|
||||||
|
}
|
||||||
|
out[2*len]=0;
|
||||||
|
printf("%s",out);
|
||||||
|
printf("\"\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
35
two-liners/convert6_2/convert_back.c
Normal file
35
two-liners/convert6_2/convert_back.c
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
|
int i,a,x,len;
|
||||||
|
char buf[BUFSIZ];
|
||||||
|
char out[BUFSIZ];
|
||||||
|
|
||||||
|
len=read(0,buf,BUFSIZ);
|
||||||
|
|
||||||
|
i=1;
|
||||||
|
while(buf[i]!='\"') {
|
||||||
|
if (buf[i]==' ') len=i;
|
||||||
|
buf[i]-='#';
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// for(i=1;i<len;i++) out[i-1]=buf[i];
|
||||||
|
|
||||||
|
x=0;
|
||||||
|
for(i=1;i<len;i+=3) {
|
||||||
|
a=buf[len+x+1];
|
||||||
|
out[i]=buf[i]|((a<<2)&0xc0);
|
||||||
|
out[i+1]=buf[i+1]|((a<<4)&0xc0);
|
||||||
|
out[i+2]=buf[i+2]|((a<<6)&0xc0);
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
|
||||||
|
write(1,out+1,len);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
30
two-liners/convert6_2/convert_to.c
Normal file
30
two-liners/convert6_2/convert_to.c
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
|
int i,len,rv;
|
||||||
|
char string[BUFSIZ];
|
||||||
|
unsigned char a;
|
||||||
|
|
||||||
|
rv=read(0,string,BUFSIZ);
|
||||||
|
if (rv<=0) return -1;
|
||||||
|
|
||||||
|
len=rv;
|
||||||
|
printf("\"");
|
||||||
|
for(i=0;i<len;i++) {
|
||||||
|
printf("%c",'#'+(string[i]&0x3f));
|
||||||
|
}
|
||||||
|
printf(" ");
|
||||||
|
for(i=0;i<len;i+=3) {
|
||||||
|
a=(string[i]&0xc0)>>2;
|
||||||
|
a|=(string[i+1]&0xc0)>>4;
|
||||||
|
a|=(string[i+2]&0xc0)>>6;
|
||||||
|
a+='#';
|
||||||
|
printf("%c",a);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\"\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
66
two-liners/convert6_2/load.good.s
Normal file
66
two-liners/convert6_2/load.good.s
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
LEN = $ff
|
||||||
|
|
||||||
|
load:
|
||||||
|
ldy #1
|
||||||
|
sub_loop:
|
||||||
|
lda string,Y
|
||||||
|
bmi done_sub_loop
|
||||||
|
cmp #' '
|
||||||
|
bne nolen
|
||||||
|
sty LEN
|
||||||
|
nolen:
|
||||||
|
sec
|
||||||
|
sbc #'#'
|
||||||
|
sta string,Y
|
||||||
|
iny
|
||||||
|
jmp sub_loop
|
||||||
|
|
||||||
|
done_sub_loop:
|
||||||
|
|
||||||
|
ldx LEN
|
||||||
|
inx
|
||||||
|
ldy #1
|
||||||
|
hard_loop:
|
||||||
|
cpy LEN
|
||||||
|
bcs all_done
|
||||||
|
|
||||||
|
lda string,X ; a=buf[len+x+1];
|
||||||
|
; lda #00
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
pha
|
||||||
|
and #$c0
|
||||||
|
ora string,Y
|
||||||
|
sta $2FF,Y
|
||||||
|
pla
|
||||||
|
iny
|
||||||
|
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
pha
|
||||||
|
and #$c0
|
||||||
|
ora string,Y
|
||||||
|
sta $2FF,Y
|
||||||
|
pla
|
||||||
|
iny
|
||||||
|
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
pha
|
||||||
|
and #$c0
|
||||||
|
ora string,Y
|
||||||
|
sta $2FF,Y
|
||||||
|
pla
|
||||||
|
iny
|
||||||
|
|
||||||
|
; out[i]=buf[i]|((a<<2)&0xc0);
|
||||||
|
; out[i+1]=buf[i+1]|((a<<4)&0xc0);
|
||||||
|
; out[i+2]=buf[i+2]|((a<<6)&0xc0);
|
||||||
|
inx
|
||||||
|
jmp hard_loop
|
||||||
|
|
||||||
|
all_done:
|
||||||
|
jmp $300
|
||||||
|
|
||||||
|
string:
|
||||||
|
.byte 34,"O3#O5#CS_Lb4M+3^L9(HCE_CJKS(-S'3%,@+S-TKL*M`\&4K+3I)H3@S0#^#M#<#@ ***Q+[C1*&+4%#K+FSV+E/",$80
|
56
two-liners/convert6_2/load.good2.s
Normal file
56
two-liners/convert6_2/load.good2.s
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
LEN = $ff
|
||||||
|
|
||||||
|
load:
|
||||||
|
ldx #1
|
||||||
|
sub_loop:
|
||||||
|
lda string,X
|
||||||
|
cmp #' '
|
||||||
|
beq done_sub_loop
|
||||||
|
; sty LEN
|
||||||
|
;nolen:
|
||||||
|
sec
|
||||||
|
sbc #'#'
|
||||||
|
sta string,X
|
||||||
|
inx
|
||||||
|
bne sub_loop
|
||||||
|
|
||||||
|
done_sub_loop:
|
||||||
|
|
||||||
|
; ldx LEN
|
||||||
|
inx
|
||||||
|
ldy #1 ; make Y 1
|
||||||
|
hard_loop:
|
||||||
|
; cpy LEN
|
||||||
|
; bcs all_done
|
||||||
|
|
||||||
|
lda string,X ; a=buf[len+x+1];
|
||||||
|
bmi all_done
|
||||||
|
sec
|
||||||
|
sbc #'#'
|
||||||
|
|
||||||
|
stx $FE
|
||||||
|
ldx #3
|
||||||
|
|
||||||
|
inner_loop:
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
pha
|
||||||
|
and #$c0
|
||||||
|
ora string,Y
|
||||||
|
sta $2FF,Y
|
||||||
|
pla
|
||||||
|
iny
|
||||||
|
|
||||||
|
dex
|
||||||
|
bne inner_loop
|
||||||
|
|
||||||
|
ldx $FE
|
||||||
|
|
||||||
|
inx
|
||||||
|
jmp hard_loop
|
||||||
|
|
||||||
|
all_done:
|
||||||
|
jmp $300
|
||||||
|
|
||||||
|
string:
|
||||||
|
.byte 34,"O3#O5#CS_Lb4M+3^L9(HCE_CJKS(-S'3%,@+S-TKL*M`\&4K+3I)H3@S0#^#M#<#@ ***Q+[C1*&+4%#K+FSV+E/",$80
|
51
two-liners/convert6_2/load.s
Normal file
51
two-liners/convert6_2/load.s
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
LEN = $ff
|
||||||
|
|
||||||
|
load:
|
||||||
|
ldx #1
|
||||||
|
sub_loop:
|
||||||
|
lda string,X
|
||||||
|
cmp #' '
|
||||||
|
beq done_sub_loop
|
||||||
|
sec
|
||||||
|
sbc #'#'
|
||||||
|
sta string,X
|
||||||
|
inx
|
||||||
|
bne sub_loop
|
||||||
|
|
||||||
|
done_sub_loop:
|
||||||
|
|
||||||
|
inx
|
||||||
|
ldy #1 ; make Y 1
|
||||||
|
hard_loop:
|
||||||
|
|
||||||
|
lda string,X ; a=buf[len+x+1];
|
||||||
|
bmi all_done
|
||||||
|
sec
|
||||||
|
sbc #'#'
|
||||||
|
|
||||||
|
stx $FE
|
||||||
|
ldx #3
|
||||||
|
|
||||||
|
inner_loop:
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
pha
|
||||||
|
and #$c0
|
||||||
|
ora string,Y
|
||||||
|
sta $2FF,Y
|
||||||
|
pla
|
||||||
|
iny
|
||||||
|
|
||||||
|
dex
|
||||||
|
bne inner_loop
|
||||||
|
|
||||||
|
ldx $FE
|
||||||
|
|
||||||
|
inx
|
||||||
|
jmp hard_loop
|
||||||
|
|
||||||
|
all_done:
|
||||||
|
jmp $300
|
||||||
|
|
||||||
|
string:
|
||||||
|
.byte 34,"O3#O5#CS_Lb4M+3^L9(HCE_CJKS(-S'3%,@+S-TKL*M`\&4K+3I)H3@S0#^#M#<#@ ***Q+[C1*&+4%#K+FSV+E/",$80
|
71
two-liners/convert6_2/simple.s
Normal file
71
two-liners/convert6_2/simple.s
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
; 35..96
|
||||||
|
;
|
||||||
|
; = 35<<2 + 35 = 175 235
|
||||||
|
; = 40<<2 + 35 = 195 4
|
||||||
|
; = 50<<2 + 35 = 235 39
|
||||||
|
; = 60<<2 + 35 = 19 79
|
||||||
|
; = 64<<2 + 35 = 35 95
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; 35 96
|
||||||
|
; = 35<<1 + 35 = 105 166
|
||||||
|
; = 45<<1 + 35 = 125 186
|
||||||
|
; = 55<<1 + 35 = 145 206
|
||||||
|
= 95<<1 + 35 = 225 29
|
||||||
|
|
||||||
|
|
||||||
|
; 32..96
|
||||||
|
; <<
|
||||||
|
; add
|
||||||
|
; 1
|
||||||
|
; 2631
|
||||||
|
; 8426 8421
|
||||||
|
; 4 bits 0XXX X000 so
|
||||||
|
; ..95
|
||||||
|
load:
|
||||||
|
ldx #1
|
||||||
|
sub_loop:
|
||||||
|
lda string,X
|
||||||
|
bmi done_sub_loop
|
||||||
|
sec
|
||||||
|
sbc #'#'
|
||||||
|
|
||||||
|
|
||||||
|
done_sub_loop:
|
||||||
|
|
||||||
|
inx
|
||||||
|
ldy #1 ; make Y 1
|
||||||
|
hard_loop:
|
||||||
|
|
||||||
|
lda string,X ; a=buf[len+x+1];
|
||||||
|
bmi all_done
|
||||||
|
sec
|
||||||
|
sbc #'#'
|
||||||
|
|
||||||
|
stx $FE
|
||||||
|
ldx #3
|
||||||
|
|
||||||
|
inner_loop:
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
pha
|
||||||
|
and #$c0
|
||||||
|
ora string,Y
|
||||||
|
sta $2FF,Y
|
||||||
|
pla
|
||||||
|
iny
|
||||||
|
|
||||||
|
dex
|
||||||
|
bne inner_loop
|
||||||
|
|
||||||
|
ldx $FE
|
||||||
|
|
||||||
|
inx
|
||||||
|
jmp hard_loop
|
||||||
|
|
||||||
|
all_done:
|
||||||
|
jmp $300
|
||||||
|
|
||||||
|
string:
|
||||||
|
.byte 34,"O3#O5#CS_Lb4M+3^L9(HCE_CJKS(-S'3%,@+S-TKL*M`\&4K+3I)H3@S0#^#M#<#@ ***Q+[C1*&+4%#K+FSV+E/",$80
|
26
two-liners/convert_back.c
Normal file
26
two-liners/convert_back.c
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
|
int i,a,x,len;
|
||||||
|
char buf[BUFSIZ];
|
||||||
|
char out[BUFSIZ];
|
||||||
|
|
||||||
|
len=read(0,buf,BUFSIZ)-2;
|
||||||
|
len/=2;
|
||||||
|
|
||||||
|
i=1;
|
||||||
|
while(buf[i]!='\"') {
|
||||||
|
a=buf[i]<<3;
|
||||||
|
a^=buf[i+len];
|
||||||
|
out[i-1]=a;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
write(1,out,len);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
27
two-liners/convert_to.c
Normal file
27
two-liners/convert_to.c
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
|
int i,len,rv,a;
|
||||||
|
unsigned char string[BUFSIZ];
|
||||||
|
unsigned char out[BUFSIZ];
|
||||||
|
|
||||||
|
rv=read(0,string,BUFSIZ);
|
||||||
|
if (rv<=0) return -1;
|
||||||
|
|
||||||
|
len=rv;
|
||||||
|
printf("Len=%d\n",len);
|
||||||
|
for(i=0;i<len;i++) {
|
||||||
|
out[i]=' '+(string[i]>>2);
|
||||||
|
}
|
||||||
|
for(i=0;i<len;i+=2) {
|
||||||
|
a=(string[i]&3)<<2;
|
||||||
|
a|=(string[i+1]&3);
|
||||||
|
out[len+i/2]=' '+a;
|
||||||
|
}
|
||||||
|
out[len+len/2+1]=0;
|
||||||
|
printf("%s",out);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
26
two-liners/convert_xor/convert_back.c
Normal file
26
two-liners/convert_xor/convert_back.c
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
|
int i,a,x,len;
|
||||||
|
char buf[BUFSIZ];
|
||||||
|
char out[BUFSIZ];
|
||||||
|
|
||||||
|
len=read(0,buf,BUFSIZ)-2;
|
||||||
|
len/=2;
|
||||||
|
|
||||||
|
i=1;
|
||||||
|
while(buf[i]!='\"') {
|
||||||
|
a=buf[i]<<3;
|
||||||
|
a^=buf[i+len];
|
||||||
|
out[i-1]=a;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
write(1,out,len);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
25
two-liners/convert_xor/convert_to.c
Normal file
25
two-liners/convert_xor/convert_to.c
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
|
int i,len,rv;
|
||||||
|
char string[BUFSIZ];
|
||||||
|
char out[BUFSIZ];
|
||||||
|
|
||||||
|
rv=read(0,string,BUFSIZ);
|
||||||
|
if (rv<=0) return -1;
|
||||||
|
|
||||||
|
len=rv;
|
||||||
|
printf("Len=%d\n",len);
|
||||||
|
printf("\"");
|
||||||
|
for(i=0;i<len;i++) {
|
||||||
|
out[i]='@'+(((string[i]>>3)&0x1f)^8);
|
||||||
|
out[i+len]='@'+(string[i]&0x7);
|
||||||
|
}
|
||||||
|
out[2*len]=0;
|
||||||
|
printf("%s",out);
|
||||||
|
printf("\"\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
2
two-liners/entropy_small.bas
Normal file
2
two-liners/entropy_small.bas
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
1 ROT=0:POKE 232,252:POKE 233,29:FOR I=1 TO 14:READ A:POKE 7675+I,A:NEXT:DATA 1,255,4,0,18,63,36,36,45,45,54,54,63,0
|
||||||
|
9 HGR2:FOR E=.08 TO .15 STEP .01:FOR Y=4 TO 189 STEP 6:FOR X=4 TO 278 STEP 6:SCALE=(RND(1)< E)*RND(1)*E*20+1:XDRAW 1 AT X,Y:NEXT:NEXT:NEXT:GOTO 2
|
5
two-liners/flame.bas
Normal file
5
two-liners/flame.bas
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
1 FOR X=768TO832:READ A:POKE X,A:NEXT:CALL768
|
||||||
|
9 DATA 44,80,192,44,82,192,32,112,252,169,255,145,42,136,16,251,169,22,133,37,32,34,252,160,39,104,240,5,10,240,4,144,2,73,29,72,48,10,177,40,41,7,170,189,57,3,145,40,136,16,230,198,37,16,221,48,205,0,187,0,170,0,153,0,221
|
||||||
|
|
||||||
|
|
5
two-liners/flame2.bas
Normal file
5
two-liners/flame2.bas
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
1 FOR X=768TO789:READ A:POKE X,A:NEXT:CALL768:DATA162,0,189,106,8,48,12,10,10,10,93,171,8,157,0,12,232,208,239,76,0,12
|
||||||
|
9 "MBPMBPLFW]WZMYJW]JXLLLW\LEVHIVHZHAKANI^MMH]_OIZMYJTPLJSNQH_H]H[HSD@@DB@@@DAGAB@@CAFEE@BD@G@@EB@D@BAE@@BA@AGBEADA@@@FFE@E@E@C@B@A@E"+
|
||||||
|
|
||||||
|
|
||||||
|
|
24
two-liners/load.s
Normal file
24
two-liners/load.s
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
string = $86A
|
||||||
|
;size = 65
|
||||||
|
size=117
|
||||||
|
|
||||||
|
load:
|
||||||
|
ldx #0
|
||||||
|
sub_loop:
|
||||||
|
lda string,X
|
||||||
|
bmi all_done ; goes off end, do we care?
|
||||||
|
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
eor string+size,X
|
||||||
|
sta $C00,X
|
||||||
|
inx
|
||||||
|
bne sub_loop
|
||||||
|
all_done:
|
||||||
|
jmp $c00
|
||||||
|
|
||||||
|
;string:
|
||||||
|
.byte 34,"MBPMBPLFW]WZMYJW]JXLLLW\LEVHIVHZHAKANI^MMH]_OIZMYJTPLJSNQH_H]H[HSD@@DB@@@DAGAB@@CAFEE@BD@G@@EB@D@BAE@@BA@AGBEADA@@@FFE@E@E@C@B@A@E",80
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user