mirror of
https://github.com/brain-hackers/lab
synced 2025-07-13 06:54:16 +09:00
Compare commits
No commits in common. "27fb64ac7bbc6764657896ea23599eb8b5a4cbe3" and "c9c5e95777d1c932cb67602f7b5ada23057bdf63" have entirely different histories.
27fb64ac7b
...
c9c5e95777
@ -7,7 +7,6 @@
|
|||||||
- [read_keys_SH3.c](read_keys_SH3.c) Scan key matrix and return key name rewritten with C. nice performance
|
- [read_keys_SH3.c](read_keys_SH3.c) Scan key matrix and return key name rewritten with C. nice performance
|
||||||
- [x1](x1) Executable to analyze `[JHSBA]1` gen
|
- [x1](x1) Executable to analyze `[JHSBA]1` gen
|
||||||
- [lcdbench](lcdbench) Benchmark fb0 fill and show results
|
- [lcdbench](lcdbench) Benchmark fb0 fill and show results
|
||||||
- [tmemo_converter](tmemo_converter) Converts 手書き暗記メモ into PNGs (2G or older)
|
|
||||||
|
|
||||||
|
|
||||||
### License
|
### License
|
||||||
|
1
tmemo_converter/.gitignore
vendored
1
tmemo_converter/.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
!*.exe
|
|
@ -1,16 +0,0 @@
|
|||||||
### Prerequisites
|
|
||||||
- Go 1.1x
|
|
||||||
|
|
||||||
|
|
||||||
### Run
|
|
||||||
|
|
||||||
```shell-session
|
|
||||||
$ # Example 1
|
|
||||||
$ go run main.go tmemo000.tmd
|
|
||||||
|
|
||||||
$ # Example 2
|
|
||||||
$ go run main.go tmemo000.tmd tmemo001.tmd
|
|
||||||
|
|
||||||
$ # Example 3
|
|
||||||
$ go run main.go *.tmd
|
|
||||||
```
|
|
@ -1,71 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"image"
|
|
||||||
"image/color"
|
|
||||||
"image/png"
|
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
bytesPerPixel = 2
|
|
||||||
width = 480
|
|
||||||
height = 320
|
|
||||||
toolbarHeight = 16
|
|
||||||
actualHeight = height - toolbarHeight
|
|
||||||
|
|
||||||
total = width * actualHeight * bytesPerPixel
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
if len(os.Args) == 1 {
|
|
||||||
fmt.Printf("Usage: %s INPUT ...\n", os.Args[0])
|
|
||||||
fmt.Printf("Example: %s tmemo000.tmd tmemo001.tmd\n", os.Args[0])
|
|
||||||
os.Exit(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, a := range os.Args[1:] {
|
|
||||||
err := convert(a)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Fprintf(os.Stderr, "failed to convert %s: %s\n", a, err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func convert(fn string) error {
|
|
||||||
raw, err := ioutil.ReadFile(fn)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to read %s: %s", fn, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(raw) != total {
|
|
||||||
return fmt.Errorf("unexpected binary length: expect=%d, actual=%d", total, len(raw))
|
|
||||||
}
|
|
||||||
|
|
||||||
rgba := image.NewRGBA(image.Rect(0, 0, width, actualHeight))
|
|
||||||
|
|
||||||
for i := 0; i < width*actualHeight; i++ {
|
|
||||||
pixel := uint16(raw[i*2+1])<<8 + uint16(raw[i*2])
|
|
||||||
r := float64(pixel&0xf800>>11) * 255 / 31
|
|
||||||
g := float64(pixel&0x07e0>>5) * 255 / 63
|
|
||||||
b := float64(pixel&0x001f) * 255 / 31
|
|
||||||
rgba.SetRGBA(i%width, actualHeight-i/width, color.RGBA{R: uint8(r), G: uint8(g), B: uint8(b), A: 255})
|
|
||||||
}
|
|
||||||
|
|
||||||
newFn := fn + ".png"
|
|
||||||
out, err := os.Create(newFn)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to create a file %s: %s", newFn, err)
|
|
||||||
}
|
|
||||||
defer out.Close()
|
|
||||||
|
|
||||||
err = png.Encode(out, rgba)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to compress the image into PNG: %s", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,33 +0,0 @@
|
|||||||
CROSS_COMPILE := arm-linux-gnueabihf-
|
|
||||||
AS := $(CROSS_COMPILE)as
|
|
||||||
CC := $(CROSS_COMPILE)gcc
|
|
||||||
LD := $(CROSS_COMPILE)ld
|
|
||||||
OBJCOPY := $(CROSS_COMPILE)objcopy
|
|
||||||
|
|
||||||
TARGET := AppMain
|
|
||||||
OBJS := ../linkerscript/crt0.o selftester.o
|
|
||||||
|
|
||||||
LIBS := ../linkerscript/libbrain/libbrain.a
|
|
||||||
|
|
||||||
ASFLAGS := -W
|
|
||||||
CFLAGS := -Wall -ffreestanding -fomit-frame-pointer -Os -I../linkerscript/libbrain
|
|
||||||
LDFLAGS := -T ../linkerscript/x1.ld
|
|
||||||
|
|
||||||
.PHONY:
|
|
||||||
all: $(TARGET).bin
|
|
||||||
|
|
||||||
.PHONY:
|
|
||||||
clean:
|
|
||||||
-rm -f $(TARGET).bin $(TARGET).elf $(OBJS)
|
|
||||||
|
|
||||||
%.o: %.s
|
|
||||||
$(AS) $(ASFLAGS) $< -o $@
|
|
||||||
|
|
||||||
%.o: %.c
|
|
||||||
$(CC) -c $(CFLAGS) $<
|
|
||||||
|
|
||||||
$(TARGET).elf: $(OBJS)
|
|
||||||
$(LD) $(LDFLAGS) $^ $(LIBS) -o $@
|
|
||||||
|
|
||||||
$(TARGET).bin: $(TARGET).elf
|
|
||||||
$(OBJCOPY) -O binary $< $@
|
|
@ -1,9 +0,0 @@
|
|||||||
#include <libbrain.h>
|
|
||||||
|
|
||||||
int main(void *arg)
|
|
||||||
{
|
|
||||||
typedef void (*FUNC_POINTER)();
|
|
||||||
FUNC_POINTER func = (FUNC_POINTER)0x60198000;
|
|
||||||
func();
|
|
||||||
return 0;
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user