mirror of https://github.com/digarok/Appy.git
Compare commits
14 Commits
Author | SHA1 | Date |
---|---|---|
Dagen Brock | 0c9a3d7210 | |
Dagen Brock | 5d546a6c81 | |
Dagen Brock | cb15aa2a5f | |
Dagen Brock | 9083586502 | |
Dagen Brock | 5c1390ac57 | |
Dagen Brock | 35c693212e | |
Dagen Brock | 52f839cd7d | |
Dagen Brock | 137a52f643 | |
Dagen Brock | 3f01a77fca | |
Dagen Brock | 1b2a55a6f7 | |
Dagen Brock | 4008cda19c | |
Dagen Brock | 8bf48c3deb | |
Dagen Brock | 7d5ca59b49 | |
Dagen Brock | 17dd7fbc5e |
|
@ -0,0 +1,6 @@
|
|||
# cadius disk files
|
||||
*.2mg
|
||||
*.po
|
||||
# merlin assembly listings
|
||||
*_output.txt
|
||||
*.exe
|
48
README.md
48
README.md
|
@ -27,9 +27,13 @@ Appy abstracts the tools away from a script mindset, and into a project mindset.
|
|||
|
||||
## The project file
|
||||
|
||||
Currently it uses an `appy.yaml` file in the current project directory. The format is as follows:
|
||||
Appy uses an `appy.yaml` file in the current project directory. The basic format is as follows:
|
||||
```
|
||||
assemble: [main.s, grafix.s, snd.s, a.s, b.s] # <--- list of files to assemble with Merlin
|
||||
assemble: [main.s, grafix.s, snd.s, a.s, b.s] # <--- list of files to assemble with Merlin
|
||||
assembleflags: "-V" # <--- optional flags to Merlin, including macro directory
|
||||
indent: [c.s] # <--- optional additional files to indent when running `appy fmt`
|
||||
formatflags: "mc:10 oc:14 cc:30 ms:1 bs:2" # <--- optional flags to indent
|
||||
|
||||
disks: # <--- define disks, can be more than one, handy for 140K + 800K
|
||||
- name: mydiskimage # <---- each disk has a name (ProDOS volume name)
|
||||
file: mydiskimage800.2mg # <---- each disk has a filename for the image it creates
|
||||
|
@ -45,7 +49,7 @@ disks: # <--- define disks, can be more
|
|||
```
|
||||
|
||||
## User Overrides
|
||||
What if your copy of Merlin32 (assembler) is in a different location than your teammates? You can set up local binary overrides with an `appy.user.yaml` file in the same directory. It allows the following 3 program settings:
|
||||
What if your copy of Merlin32 (assembler) is in a different location than your teammate's? You can set up local binary overrides with an `appy.user.yaml` file in the same directory. It allows the following 3 program settings:
|
||||
```
|
||||
# local system settings/overrides
|
||||
programs:
|
||||
|
@ -72,9 +76,47 @@ $ appy build # assemble files and make disk, aka 'asm'+'disk'
|
|||
|
||||
$ appy brun # assemble files, make disk, and launch emulator
|
||||
# aka 'asm'+'disk'+'run'
|
||||
|
||||
$ appy fmt # format/indent your assembly file in appy.yaml
|
||||
# you can also pass in filename(s) to format
|
||||
```
|
||||
|
||||
### About the built-in code formatter
|
||||
|
||||
Appy uses the [MerlinGo](https://github.com/digarok/merlingo) formatter to indent source code. You can override the default indentation with the various options documented here.
|
||||
|
||||
- `mc`: mnemonic column, where instructions start
|
||||
- `oc`: opcode column
|
||||
- `cc`: comment column
|
||||
- `ms`: min space, the minimum amount of space it will allow between two columns
|
||||
|
||||
You can define these in your `appy.yaml` project file like so:
|
||||
```
|
||||
formatflags: "mc:10 oc:14 cc:30 ms:1"
|
||||
```
|
||||
|
||||
You can also set it in files directly by adding it as a comment marked `ed:` on any line of the file like:
|
||||
```
|
||||
* ed: mc=40 oc=26 cc=48 ms=5 <- indentation modeline
|
||||
```
|
||||
OR
|
||||
```
|
||||
org $2000
|
||||
; ed: mc=40 oc=26 cc=48 ms=5 <- indentation modeline
|
||||
lda ...
|
||||
```
|
||||
Again either comment style works on any line of the file, but don't add more than one modeline per file.
|
||||
|
||||
Also, if you set format options at the project AND file level, then Appy will use the project defaults except when a file specifies its own settings, then it will respect the file settings instead.
|
||||
|
||||
### Version Notes
|
||||
This is an early experimental version not intended for public use.
|
||||
|
||||
Versioning/vendoring binaries from external sources not yet implemented but all core functionality exists including local binary overrides.
|
||||
|
||||
|
||||
### Dev Quickstart
|
||||
|
||||
1. Checkout
|
||||
2. Run `go mod tidy` to install dependencies
|
||||
3. Run `go build & go install` to build and install
|
|
@ -1,4 +1,7 @@
|
|||
assemble: [testsrc/sp.s, testsrc/pc.s]
|
||||
assemble: [testsrc/sp.s, testsrc/pc.s, testsrc/fmt.s]
|
||||
assembleflags: "-V"
|
||||
formatflags: "mc:10 oc:14 cc:30 ms:1 bs:2"
|
||||
indent: [testsrc/fmt2.s]
|
||||
disks:
|
||||
- name: mydiskimage
|
||||
file: mydiskimage800.2mg
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/digarok/appy/core"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// 'appy fmt' command
|
||||
var fmtCmd = &cobra.Command{
|
||||
Use: "fmt",
|
||||
Short: "Format the source files in your project",
|
||||
Long: `This will run an internal formatter over the assembly language files in the appy.yaml 'assemble:' list, OR you can pass filename arguments.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
core.Format(args)
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(fmtCmd)
|
||||
}
|
|
@ -9,14 +9,13 @@ import (
|
|||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
var filesToAssemble []string
|
||||
|
||||
func Assemble() {
|
||||
// assemble all files in list
|
||||
for _, filename := range project.AppyProj.Assemble {
|
||||
fmt.Printf("Assembling %v\n", filename)
|
||||
fmt.Printf(">> %v %v %v\n", project.LocalConf.Programs.Merlin32, project.AppyProj.AssembleFlags, filename)
|
||||
|
||||
out, err := exec.Command(project.LocalConf.Programs.Merlin32, "-V", filename).Output()
|
||||
out, err := exec.Command(project.LocalConf.Programs.Merlin32, project.AppyProj.AssembleFlags, filename).Output()
|
||||
if err != nil {
|
||||
color.Cyan(string(out))
|
||||
log.Fatal(err)
|
||||
|
|
|
@ -6,14 +6,15 @@ import (
|
|||
"os/exec"
|
||||
|
||||
"github.com/digarok/appy/core/project"
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
func CreateDisk(name string, file string, size string) {
|
||||
fmt.Printf("Creating Disk: \"%s\" -> %s \tSize: %s\n", name, file, size)
|
||||
|
||||
cmd := exec.Command(project.LocalConf.Programs.Cadius, "CREATEVOLUME", file, name, size)
|
||||
err := cmd.Run()
|
||||
out, err := exec.Command(project.LocalConf.Programs.Cadius, "CREATEVOLUME", file, name, size).Output()
|
||||
if err != nil {
|
||||
color.Cyan(string(out))
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
@ -21,12 +22,11 @@ func CreateDisk(name string, file string, size string) {
|
|||
func AddFiles(disk project.Disk) {
|
||||
fmt.Printf("Add files to: \"%s\"\n", disk.Name)
|
||||
for _, file := range disk.Files {
|
||||
// fmt.Printf("%s ADDFILE %s %s %s\n", CadiusPath, disk.File, file.Output, file.Input)
|
||||
fmt.Printf(" Adding file: -----> %s\n", file.Input)
|
||||
|
||||
cmd := exec.Command(project.LocalConf.Programs.Cadius, "ADDFILE", disk.File, file.Output, file.Input)
|
||||
err := cmd.Run()
|
||||
out, err := exec.Command(project.LocalConf.Programs.Cadius, "ADDFILE", disk.File, file.Output, file.Input).Output()
|
||||
if err != nil {
|
||||
color.Cyan(string(out))
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/digarok/appy/core/project"
|
||||
"github.com/digarok/merlingo"
|
||||
)
|
||||
|
||||
func Format(args []string) {
|
||||
// merlingo.Status()
|
||||
if project.AppyProj.FormatFlags != "" {
|
||||
merlingo.ParseModeline(project.AppyProj.FormatFlags)
|
||||
}
|
||||
if len(args) == 0 {
|
||||
// format all assembly files in appy.yaml
|
||||
for _, filename := range project.AppyProj.Assemble {
|
||||
fmt.Printf("Formatting %v\n", filename)
|
||||
merlingo.FmtFile(filename)
|
||||
}
|
||||
// format all indent files in appy.yaml
|
||||
for _, filename := range project.AppyProj.Indent {
|
||||
fmt.Printf("Formatting %v\n", filename)
|
||||
merlingo.FmtFile(filename)
|
||||
}
|
||||
} else {
|
||||
// format all assembly files in args
|
||||
for _, filename := range args {
|
||||
fmt.Printf("Formatting %v\n", filename)
|
||||
merlingo.FmtFile(filename)
|
||||
}
|
||||
}
|
||||
// merlingo.Status()
|
||||
}
|
|
@ -10,9 +10,12 @@ import (
|
|||
)
|
||||
|
||||
type Project struct {
|
||||
name string
|
||||
Disks []Disk
|
||||
Assemble []string
|
||||
name string
|
||||
Disks []Disk
|
||||
Assemble []string
|
||||
Indent []string
|
||||
AssembleFlags string
|
||||
FormatFlags string
|
||||
}
|
||||
|
||||
type Disk struct {
|
||||
|
@ -37,8 +40,8 @@ type Programs struct {
|
|||
Gsplus string
|
||||
}
|
||||
|
||||
const Merlin32Path = "/usr/local/bin/merlin32"
|
||||
const CadiusPath = "/usr/local/bin/cadius"
|
||||
const Merlin32Path = "merlin32"
|
||||
const CadiusPath = "cadius"
|
||||
const GsplusPath = "gsplus"
|
||||
|
||||
var AppyProj Project
|
||||
|
@ -46,6 +49,7 @@ var LocalConf LocalConfig
|
|||
|
||||
func SelfConfigure() {
|
||||
AppyProj.name = "Default"
|
||||
AppyProj.AssembleFlags = ""
|
||||
LocalConf.Programs.Merlin32 = Merlin32Path
|
||||
LocalConf.Programs.Cadius = CadiusPath
|
||||
LocalConf.Programs.Gsplus = GsplusPath
|
||||
|
|
27
go.mod
27
go.mod
|
@ -1,10 +1,33 @@
|
|||
module github.com/digarok/appy
|
||||
|
||||
go 1.16
|
||||
go 1.17
|
||||
|
||||
require (
|
||||
github.com/fatih/color v1.10.0
|
||||
github.com/digarok/merlingo v1.0.5
|
||||
github.com/fatih/color v1.13.0
|
||||
github.com/mitchellh/go-homedir v1.1.0
|
||||
github.com/spf13/cobra v1.1.3
|
||||
github.com/spf13/viper v1.7.1
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/fsnotify/fsnotify v1.4.7 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.0.0 // indirect
|
||||
github.com/magiconair/properties v1.8.1 // indirect
|
||||
github.com/mattn/go-colorable v0.1.9 // indirect
|
||||
github.com/mattn/go-isatty v0.0.14 // indirect
|
||||
github.com/mitchellh/mapstructure v1.1.2 // indirect
|
||||
github.com/pelletier/go-toml v1.2.0 // indirect
|
||||
github.com/spf13/afero v1.1.2 // indirect
|
||||
github.com/spf13/cast v1.3.0 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.0.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/subosito/gotenv v1.2.0 // indirect
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
|
||||
golang.org/x/text v0.3.2 // indirect
|
||||
gopkg.in/ini.v1 v1.51.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
)
|
||||
|
||||
//replace github.com/digarok/merlingo => ../merlingo
|
||||
|
|
16
go.sum
16
go.sum
|
@ -37,9 +37,11 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
|
|||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
|
||||
github.com/digarok/merlingo v1.0.5 h1:XjKLWHk3Cemh4UlgVLEojwA2WUp8ZjZcLA/BUMc1htI=
|
||||
github.com/digarok/merlingo v1.0.5/go.mod h1:rdReR6enl/63dfkssdM4xwg0gXw3j4QprK9e+e8mX9U=
|
||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg=
|
||||
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
|
||||
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
|
||||
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
|
||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
|
@ -115,11 +117,12 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
|||
github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4=
|
||||
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
|
||||
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U=
|
||||
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
|
||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
|
||||
|
@ -254,8 +257,9 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
* formatting test
|
||||
org $300 ; start
|
||||
|
||||
main nop
|
||||
* what about this
|
||||
|
||||
; and this
|
||||
|
||||
sta :jo+1
|
||||
|
||||
|
||||
:jo lda $400
|
||||
lda $400
|
||||
rts
|
||||
|
||||
** 24 (bit) hex to 8 (nibble) / 4 byte BCD
|
||||
** 24 (bit) hex to
|
||||
HEXDEC mx %11
|
||||
LDA #0 ; Ensure the result is clear
|
||||
STA DEC8+0
|
||||
STA DEC8+1
|
||||
STA DEC8+2
|
||||
STA DEC8+3
|
||||
ReallyThisisaLoooooongLabelwith stal $e12000,x ; look at this long line
|
||||
|
||||
* TABS....
|
||||
* $D5 $0008 sequence [Application Specific]
|
||||
DEC8 ds 24
|
|
@ -0,0 +1,28 @@
|
|||
* formatting test
|
||||
org $300 ; start
|
||||
|
||||
main nop
|
||||
* what about this
|
||||
|
||||
; and this
|
||||
|
||||
sta :jo+1
|
||||
|
||||
|
||||
:jo+1 lda $400
|
||||
lda $400
|
||||
rts
|
||||
|
||||
** 24 (bit) hex to 8 (nibble) / 4 byte BCD
|
||||
** 24 (bit) hex to
|
||||
HEXDEC mx %11
|
||||
LDA #0 ; Ensure the result is clear
|
||||
STA DEC8+0
|
||||
STA DEC8+1
|
||||
STA DEC8+2
|
||||
STA DEC8+3
|
||||
ReallyThisisaLoooooongLabelwith stal $e12000,y ; look at this long line
|
||||
|
||||
* TABS....
|
||||
* $D5 $0008 sequence [Application Specific]
|
||||
; ed: mc=40 oc=26 cc=48 ms=5 bs=2 <- indentation modeline
|
Loading…
Reference in New Issue