Compare commits
No commits in common. "b032b50b6aaaab423164cedb6d07c6e45cfc2550" and "63de05e9dd48689dc0e2559c2e1ee7eaa750710a" have entirely different histories.
b032b50b6a
...
63de05e9dd
|
|
@ -180,7 +180,7 @@ func (p *packetMarkDataStart) dataType() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *packetMarkDataStart) Asm() string {
|
func (p *packetMarkDataStart) Asm() string {
|
||||||
return fmt.Sprintf("mark_datatype_start Type:%s Bank:$%02X Addr:$%02X00 ; Checksum:%02X",
|
return fmt.Sprintf("mark_datatype_start Type:%s ArgA:$%02X ArgB:$%02X ; Checksum:%02X",
|
||||||
p.dataType(), p.ArgA, p.ArgB, p.checksum)
|
p.dataType(), p.ArgA, p.ArgB, p.checksum)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"fmt"
|
"fmt"
|
||||||
"slices"
|
"slices"
|
||||||
"bytes"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type CodeDataLog struct {
|
type CodeDataLog struct {
|
||||||
|
|
@ -167,11 +166,8 @@ func (cdl *CodeDataLog) setCode(addr int) {
|
||||||
cdl.cache[addr] |= cdlCode
|
cdl.cache[addr] |= cdlCode
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cdl *CodeDataLog) doCache(size int) error {
|
func (cdl *CodeDataLog) doCache() error {
|
||||||
cdl.cache = make(map[int]cdlBit)
|
cdl.cache = make(map[int]cdlBit)
|
||||||
for i := 0x6000; i < size+0x6000; i++ {
|
|
||||||
cdl.cache[i] = cdlUnknown
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, rng := range cdl.Code {
|
for _, rng := range cdl.Code {
|
||||||
start, err := strconv.ParseInt(rng.Start, 0, 32)
|
start, err := strconv.ParseInt(rng.Start, 0, 32)
|
||||||
|
|
@ -219,18 +215,15 @@ func (cdl *CodeDataLog) doCache(size int) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func CdlFromJson(r io.Reader) (*CodeDataLog, error) {
|
func CdlFromJson(r io.Reader) (*CodeDataLog, error) {
|
||||||
raw, err := io.ReadAll(r)
|
|
||||||
buf := bytes.NewReader(raw)
|
|
||||||
|
|
||||||
cdl := NewCDL()
|
cdl := NewCDL()
|
||||||
dec := json.NewDecoder(buf)
|
dec := json.NewDecoder(r)
|
||||||
err = dec.Decode(cdl)
|
err := dec.Decode(cdl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
//cdl.Data = []CdlRange{}
|
//cdl.Data = []CdlRange{}
|
||||||
cdl.doCache(len(raw))
|
cdl.doCache()
|
||||||
|
|
||||||
return cdl, nil
|
return cdl, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,25 +69,7 @@ var Instructions []*Instruction = []*Instruction{
|
||||||
&Instruction{ 0x9F, 6, 0, 0, false, ""},
|
&Instruction{ 0x9F, 6, 0, 0, false, ""},
|
||||||
|
|
||||||
&Instruction{ 0xA0, 2, 0, 1, false, ""},
|
&Instruction{ 0xA0, 2, 0, 1, false, ""},
|
||||||
|
&Instruction{ 0xA1, 1, 0, 0, false, ""},
|
||||||
// Draw a screen from ROM.
|
|
||||||
// ArgA is screen index (ArgA <= 14)
|
|
||||||
// 00 - Window (used as the unit screens in the english tapes)
|
|
||||||
// 01 - bricks??
|
|
||||||
// 02 - Notebook (used for the mid-lesson quizes in the english tapes)
|
|
||||||
// 03 - Blimp (used after english lessons, before Gold Tomahawk)
|
|
||||||
// 04 - Map of USA (used in english tapes before final quiz)
|
|
||||||
// 05 - Green rounded title card (used in math/science)
|
|
||||||
// 06 - Orange rounded title card (used in math/science)
|
|
||||||
// 07 - Blue Triangle title card (used in a math tape)
|
|
||||||
// 08 - Blue Sci-fi title card (used in science tapes)
|
|
||||||
// 09 - Green block border (from here on don't seem to be used)
|
|
||||||
// 0A - Generic brick border
|
|
||||||
// 0B - Generic twist border
|
|
||||||
// 0C - Generic yellow embossed border
|
|
||||||
// 0D - Generic blue diamond border
|
|
||||||
// 0E - Generic brownish border
|
|
||||||
&Instruction{ 0xA1, 1, 0, 0, false, "load_rom_screen"},
|
|
||||||
&Instruction{ 0xA2, 1, 0, 0, false, "buffer_palette"},
|
&Instruction{ 0xA2, 1, 0, 0, false, "buffer_palette"},
|
||||||
|
|
||||||
// Possibly a sprite setup routine. loads up some CHR data and some palette
|
// Possibly a sprite setup routine. loads up some CHR data and some palette
|
||||||
|
|
@ -212,14 +194,6 @@ var Instructions []*Instruction = []*Instruction{
|
||||||
&Instruction{ 0xE0, 2, 0, 1, false, "modulo"},
|
&Instruction{ 0xE0, 2, 0, 1, false, "modulo"},
|
||||||
|
|
||||||
&Instruction{ 0xE1, 4, 0, 0, false, ""},
|
&Instruction{ 0xE1, 4, 0, 0, false, ""},
|
||||||
|
|
||||||
// ArgA: Palette ID
|
|
||||||
// ArgB: FG palette index
|
|
||||||
// ArgC: BG palette index
|
|
||||||
// ArgD: Priority (something else too?)
|
|
||||||
// ArgE: X coord
|
|
||||||
// ArgF: Y coord
|
|
||||||
// ArgG: ??
|
|
||||||
&Instruction{ 0xE2, 7, 0, 0, false, "setup_sprite"},
|
&Instruction{ 0xE2, 7, 0, 0, false, "setup_sprite"},
|
||||||
|
|
||||||
// Pops a word off the stack, uses it as a pointer, and pushes the byte
|
// Pops a word off the stack, uses it as a pointer, and pushes the byte
|
||||||
|
|
@ -255,10 +229,7 @@ var Instructions []*Instruction = []*Instruction{
|
||||||
// ArgD: Priority (something else too?)
|
// ArgD: Priority (something else too?)
|
||||||
// ArgE: X coord
|
// ArgE: X coord
|
||||||
// ArgF: Y coord
|
// ArgF: Y coord
|
||||||
// THIS WORD WRAPS APPARENTLY?????
|
&Instruction{ 0xEF, 6, 0, 0, false, "draw_string_sprites"},
|
||||||
// Duplicate tiles are ignored and not displayed. However, space is left
|
|
||||||
// for them as if they were. Word wrapping adds 17 to the Y offset.
|
|
||||||
&Instruction{ 0xEF, 6, 0, 0, false, "draw_debug_sprites"},
|
|
||||||
|
|
||||||
&Instruction{ 0xF0, 0, 0, 0, false, "disable_sprites"},
|
&Instruction{ 0xF0, 0, 0, 0, false, "disable_sprites"},
|
||||||
&Instruction{ 0xF1, 4, 0, 0, false, ""},
|
&Instruction{ 0xF1, 4, 0, 0, false, ""},
|
||||||
|
|
|
||||||
|
|
@ -191,19 +191,26 @@ INNER:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add data tokens
|
// Add data tokens
|
||||||
for addr := 0x6002; addr < len(rawinput)+0x6000; addr++ {
|
for addr, bit := range p.script.CDL.cache {
|
||||||
bit := p.script.CDL.cache[addr]
|
if addr < 0x6002 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// ignore code bytes
|
// ignore code bytes
|
||||||
if bit & cdlCode == cdlCode {
|
if bit & cdlCode == cdlCode {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ignore labels outside the script's address range
|
||||||
|
if addr > len(rawinput)+0x6000 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if _, ok := p.script.Labels[addr]; ok {
|
if _, ok := p.script.Labels[addr]; ok {
|
||||||
p.script.Tokens = append(p.script.Tokens, &Token{
|
p.script.Tokens = append(p.script.Tokens, &Token{
|
||||||
Offset: addr,
|
Offset: addr,
|
||||||
//Inline: []InlineVal{NewWordVal([]byte{rawinput[addr-0x6000], rawinput[addr+1-0x6000]})},
|
Inline: []InlineVal{NewWordVal([]byte{rawinput[addr-0x6000], rawinput[addr+1-0x6000]})},
|
||||||
//IsVariable: true,
|
IsVariable: true,
|
||||||
IsData: true,
|
IsData: true,
|
||||||
cdl: bit.String(),
|
cdl: bit.String(),
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -44,12 +44,12 @@ func (s *Script) DebugCDL(filename string) error {
|
||||||
return fmt.Errorf("origSize == 0")
|
return fmt.Errorf("origSize == 0")
|
||||||
}
|
}
|
||||||
|
|
||||||
//if s.CDL.cache == nil {
|
if s.CDL.cache == nil {
|
||||||
// err := s.CDL.doCache()
|
err := s.CDL.doCache()
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// return fmt.Errorf("doCache() error: %w", err)
|
return fmt.Errorf("doCache() error: %w", err)
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
|
|
||||||
dat := make([]byte, s.origSize)
|
dat := make([]byte, s.origSize)
|
||||||
for i := 2; i < len(dat); i++ {
|
for i := 2; i < len(dat); i++ {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue