Compare commits
3 Commits
63de05e9dd
...
b032b50b6a
| Author | SHA1 | Date |
|---|---|---|
|
|
b032b50b6a | |
|
|
31b297b2e0 | |
|
|
37711fa4bb |
|
|
@ -180,7 +180,7 @@ func (p *packetMarkDataStart) dataType() string {
|
|||
}
|
||||
|
||||
func (p *packetMarkDataStart) Asm() string {
|
||||
return fmt.Sprintf("mark_datatype_start Type:%s ArgA:$%02X ArgB:$%02X ; Checksum:%02X",
|
||||
return fmt.Sprintf("mark_datatype_start Type:%s Bank:$%02X Addr:$%02X00 ; Checksum:%02X",
|
||||
p.dataType(), p.ArgA, p.ArgB, p.checksum)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import (
|
|||
"strconv"
|
||||
"fmt"
|
||||
"slices"
|
||||
"bytes"
|
||||
)
|
||||
|
||||
type CodeDataLog struct {
|
||||
|
|
@ -166,8 +167,11 @@ func (cdl *CodeDataLog) setCode(addr int) {
|
|||
cdl.cache[addr] |= cdlCode
|
||||
}
|
||||
|
||||
func (cdl *CodeDataLog) doCache() error {
|
||||
func (cdl *CodeDataLog) doCache(size int) error {
|
||||
cdl.cache = make(map[int]cdlBit)
|
||||
for i := 0x6000; i < size+0x6000; i++ {
|
||||
cdl.cache[i] = cdlUnknown
|
||||
}
|
||||
|
||||
for _, rng := range cdl.Code {
|
||||
start, err := strconv.ParseInt(rng.Start, 0, 32)
|
||||
|
|
@ -215,15 +219,18 @@ func (cdl *CodeDataLog) doCache() error {
|
|||
}
|
||||
|
||||
func CdlFromJson(r io.Reader) (*CodeDataLog, error) {
|
||||
raw, err := io.ReadAll(r)
|
||||
buf := bytes.NewReader(raw)
|
||||
|
||||
cdl := NewCDL()
|
||||
dec := json.NewDecoder(r)
|
||||
err := dec.Decode(cdl)
|
||||
dec := json.NewDecoder(buf)
|
||||
err = dec.Decode(cdl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
//cdl.Data = []CdlRange{}
|
||||
cdl.doCache()
|
||||
cdl.doCache(len(raw))
|
||||
|
||||
return cdl, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,25 @@ var Instructions []*Instruction = []*Instruction{
|
|||
&Instruction{ 0x9F, 6, 0, 0, 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"},
|
||||
|
||||
// Possibly a sprite setup routine. loads up some CHR data and some palette
|
||||
|
|
@ -194,6 +212,14 @@ var Instructions []*Instruction = []*Instruction{
|
|||
&Instruction{ 0xE0, 2, 0, 1, false, "modulo"},
|
||||
|
||||
&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"},
|
||||
|
||||
// Pops a word off the stack, uses it as a pointer, and pushes the byte
|
||||
|
|
@ -229,7 +255,10 @@ var Instructions []*Instruction = []*Instruction{
|
|||
// ArgD: Priority (something else too?)
|
||||
// ArgE: X coord
|
||||
// ArgF: Y coord
|
||||
&Instruction{ 0xEF, 6, 0, 0, false, "draw_string_sprites"},
|
||||
// THIS WORD WRAPS APPARENTLY?????
|
||||
// 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{ 0xF1, 4, 0, 0, false, ""},
|
||||
|
|
|
|||
|
|
@ -191,26 +191,19 @@ INNER:
|
|||
}
|
||||
|
||||
// Add data tokens
|
||||
for addr, bit := range p.script.CDL.cache {
|
||||
if addr < 0x6002 {
|
||||
continue
|
||||
}
|
||||
for addr := 0x6002; addr < len(rawinput)+0x6000; addr++ {
|
||||
bit := p.script.CDL.cache[addr]
|
||||
|
||||
// ignore code bytes
|
||||
if bit & cdlCode == cdlCode {
|
||||
continue
|
||||
}
|
||||
|
||||
// ignore labels outside the script's address range
|
||||
if addr > len(rawinput)+0x6000 {
|
||||
continue
|
||||
}
|
||||
|
||||
if _, ok := p.script.Labels[addr]; ok {
|
||||
p.script.Tokens = append(p.script.Tokens, &Token{
|
||||
Offset: addr,
|
||||
Inline: []InlineVal{NewWordVal([]byte{rawinput[addr-0x6000], rawinput[addr+1-0x6000]})},
|
||||
IsVariable: true,
|
||||
//Inline: []InlineVal{NewWordVal([]byte{rawinput[addr-0x6000], rawinput[addr+1-0x6000]})},
|
||||
//IsVariable: true,
|
||||
IsData: true,
|
||||
cdl: bit.String(),
|
||||
})
|
||||
|
|
|
|||
|
|
@ -44,12 +44,12 @@ func (s *Script) DebugCDL(filename string) error {
|
|||
return fmt.Errorf("origSize == 0")
|
||||
}
|
||||
|
||||
if s.CDL.cache == nil {
|
||||
err := s.CDL.doCache()
|
||||
if err != nil {
|
||||
return fmt.Errorf("doCache() error: %w", err)
|
||||
}
|
||||
}
|
||||
//if s.CDL.cache == nil {
|
||||
// err := s.CDL.doCache()
|
||||
// if err != nil {
|
||||
// return fmt.Errorf("doCache() error: %w", err)
|
||||
// }
|
||||
//}
|
||||
|
||||
dat := make([]byte, s.origSize)
|
||||
for i := 2; i < len(dat); i++ {
|
||||
|
|
|
|||
Loading…
Reference in New Issue