commit c1664150da046789cdd178c422f49d9cb7eb8e24 Author: Zellyn Hunter Date: Mon Sep 12 21:52:46 2016 -0400 Initial commit: floating bus test - Translated "Have an Apple Split" routine to assembly. - Created build script to build autorunning floatbus.dsk disk image. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1a0f801 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.o +floatbus/floatbus.dsk diff --git a/dsk/blank.dsk b/dsk/blank.dsk new file mode 100644 index 0000000..db11d35 Binary files /dev/null and b/dsk/blank.dsk differ diff --git a/dsk/dos33mst.dsk b/dsk/dos33mst.dsk new file mode 100644 index 0000000..ef257aa Binary files /dev/null and b/dsk/dos33mst.dsk differ diff --git a/floatbus/apple_split_1.asm b/floatbus/apple_split_1.asm new file mode 100644 index 0000000..630f620 --- /dev/null +++ b/floatbus/apple_split_1.asm @@ -0,0 +1,83 @@ +;;; Assembly conversion of listings 1 and 2 from +;;; http://rich12345.tripod.com/aiivideo/softalk.html#list2 + + !convtab + !to "apple_split_1.o", plain + * = $6000 + + V2 = $2D ; bottom point for vertical line drawing + HOME = $FC58 + SETCOL = $F864 + VLINE = $F828 + MSGPOS = $690 +main: + +;;; 100 HOME + JSR HOME + +;;; 200 FOR K = 0 TO 39 + LDX #39 +loop: +;;; 210 POKE 1448 + K, 14 * 16 + LDA #$E0 + STA 0x5a8,X +;;; 220 POKE 2000 + K, 10 * 16 + LDA #$A0 + STA 0x7D0,X + + TXA + TAY + +;;; 230 COLOR= K + 4 + ADC #4 + JSR SETCOL + +;;; 240 VLIN 25,45 AT K + LDA #45 + STA V2 + LDA #25 + JSR VLINE + +;;; 250 NEXT K + DEX + BPL loop + +;;; 300 VTAB 6: HTAB 17 +;;; 310 PRINT "APPLE II" + + LDX #7 +msgloop: + LDA message,X + STA MSGPOS,X + DEX + BPL msgloop + +;;; 400 CALL 768 +;;; 500 GOTO 400 + + +forever: + jsr sync + jmp forever + +message: !text "APPLE II" +sync: + STA $C052 + LDA #$E0 +loop1: + LDX #$04 +loop2: + CMP $C051 + BNE loop1 + DEX + BNE loop2 + LDA #$A0 +loop3: + LDX #$04 +loop4: + CMP $C050 + BNE loop3 + DEX + BNE loop4 + STA $C051 + RTS diff --git a/floatbus/apple_split_1.bas b/floatbus/apple_split_1.bas new file mode 100644 index 0000000..1bbe9c7 --- /dev/null +++ b/floatbus/apple_split_1.bas @@ -0,0 +1,14 @@ +10 H$ = "300:8D 52 C0 A9 E0 A2 04 CD 51 C0 D0 F9 CA D0 F8 A9 A0 A2 04 CD 50 C0 D0 F9 CA D0 F8 8D 51 C0 60 N D9C6G" +20 FOR X = 1 TO LEN(H$): POKE 511 + X, ASC ( MID$ (H$,X,1)) + 128: NEXT +30 POKE 72,0: CALL -144 +100 HOME +200 FOR K = 0 TO 39 +210 POKE 1448 + K, 14 * 16 +220 POKE 2000 + K, 10 * 16 +230 COLOR= K + 4 +240 VLIN 25,45 AT K +250 NEXT K +300 VTAB 6: HTAB 17 +310 PRINT "APPLE II" +400 CALL 768 +500 GOTO 400 diff --git a/floatbus/build b/floatbus/build new file mode 100755 index 0000000..e6e326d --- /dev/null +++ b/floatbus/build @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +set -euo pipefail +set -x +export ACME="$HOME/gh/acme/ACME_Lib" +cp ../dsk/blank.dsk floatbus.dsk +acme apple_split_1.asm +applecommander -d floatbus.dsk HELLO || echo '(No HELLO to delete)' +applecommander -d floatbus.dsk BHELLO || echo '(No HELLO to delete)' +applecommander -p floatbus.dsk HELLO A < hello.bas.bin +applecommander -p floatbus.dsk BHELLO B 0x6000 < apple_split_1.o diff --git a/floatbus/hello.bas.bin b/floatbus/hello.bas.bin new file mode 100644 index 0000000..af84588 Binary files /dev/null and b/floatbus/hello.bas.bin differ diff --git a/shasum/shasum.a b/shasum/shasum.a new file mode 100644 index 0000000..2804e3f --- /dev/null +++ b/shasum/shasum.a @@ -0,0 +1,58 @@ + !to "shasum.o", plain + * = $6000 + jmp test + + ;; clear addresses: + ;; (http://apple2.org.za/gswv/a2zine/faqs/csa2pfaq.html#017) + ;; 06-09 + ;; EB-EF + ;; FA-FD + + !addr src = $06 + !addr dest = $08 + !addr input = $eb + +h0: !32 0 ; return value (hash) +h1: !32 0 +h2: !32 0 +h3: !32 0 +h4: !32 0 +ml: !32 0 ; message length +w: !fill 64, 0 +w_next: !fill 64, 0 +kh0: !be32 $67452301 ; initial values for h0..h4 +kh1: !be32 $EFCDAB89 +kh2: !be32 $98BADCFE +kh3: !be32 $10325476 +kh4: !be32 $C3D2E1F0 +k1: !be32 $5A827999 ; k = constants +k2: !be32 $6ED9EBA1 +k3: !be32 $8F1BBCDC +k4: !be32 $CA62C1D6 +test: jsr $ff2d + rts + + !eof + +TODOs +[ ] Routine to print n hex bytes (address, length (byte)) +[ ] Routine to get the next 16 values (64 bytes) +[ ] Routine to get w[i] one i at a time, and rebuild next 16 values +[ ] Routine to get the next 16 values (64 bytes) of input + +Chacha20 code isn't so useful, because it's little-endian. + +611B ADD32 +612B XOR32 +613A ROL16 +6152 RORX +6165 ROL12 +616E ROL8 +6180 ROL7 +6189 PR32 + +Needed sha1sum: +- leftrotate 1 --> ? +- leftrotate 5 --> ROL8, RORX 3 +- leftrotate 30 --> RORX 2 +