projekt pk_os_go
This commit is contained in:
parent
5577560640
commit
decc8f3324
16 changed files with 70 additions and 126 deletions
|
|
@ -1,7 +0,0 @@
|
|||
package code
|
||||
|
||||
type program struct {
|
||||
name string
|
||||
instruction_list
|
||||
lc uint32
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
package comment
|
||||
|
||||
type Comment struct {
|
||||
value string
|
||||
}
|
||||
|
||||
func newComment(val string) Comment {
|
||||
return Comment {
|
||||
value: val
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
package instruction
|
||||
|
||||
type Instruction interface {
|
||||
newInstruction() Instruction
|
||||
}
|
||||
|
||||
|
||||
func newInstruction() {}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
package instructionF1
|
||||
|
||||
type InstructionF1 struct {
|
||||
opcode uint8
|
||||
}
|
||||
|
||||
func newInstructionF1(opcode uint8) InstructionF1 {
|
||||
return InstructionF1 {
|
||||
opcode: opcode
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
package instructionF2
|
||||
|
||||
type InstructionF2 struct {
|
||||
opcode uint8
|
||||
r1 uint8
|
||||
r2 uint8
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
package instructionF3
|
||||
|
||||
type InstructionF3 struct {
|
||||
opcode uint8
|
||||
n bool
|
||||
i bool
|
||||
x bool
|
||||
b bool
|
||||
p bool
|
||||
e bool
|
||||
offset uint16
|
||||
}
|
||||
|
||||
func newInstructionF3(opcode uint8, n bool, i bool, x bool, b bool, p bool, e bool, offset uint16) InstructionF3 {
|
||||
return InstructionF3{
|
||||
opcode: opcode,
|
||||
n: n,
|
||||
i: i,
|
||||
x: x,
|
||||
b: b,
|
||||
p: p,
|
||||
e: e,
|
||||
offset: offset
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
package instructionF4
|
||||
|
||||
type InstructionF4 struct {
|
||||
opcode uint8,
|
||||
n bool,
|
||||
i bool,
|
||||
x bool,
|
||||
b bool,
|
||||
p bool,
|
||||
e bool,
|
||||
offset uint32
|
||||
}
|
||||
|
||||
func newInstructionF4(opcode uint8, n bool, i bool, x bool, b bool, p bool, e bool, offset uint32) InstructionF4 {
|
||||
return InstructionF4{
|
||||
opcode: opcode,
|
||||
n: n,
|
||||
i: i,
|
||||
x: x,
|
||||
b: b,
|
||||
p: p,
|
||||
e: e,
|
||||
offset: offset
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
package instructionSIC
|
||||
|
||||
type InstructionSIC struct {
|
||||
opcode uint8
|
||||
n bool
|
||||
i bool
|
||||
x bool
|
||||
b bool
|
||||
p bool
|
||||
e bool
|
||||
offset uint16
|
||||
}
|
||||
|
||||
func newInstructionSIC(opcode uint8, n bool, i bool, x bool, b bool, p bool, e bool, offset uint16) InstructionSIC {
|
||||
return InstructionSIC{
|
||||
opcode: opcode,
|
||||
n: n,
|
||||
i: i,
|
||||
x: x,
|
||||
b: b,
|
||||
p: p,
|
||||
e: e,
|
||||
offset: offset
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
arithr START 0 .komentar1
|
||||
LDX #10
|
||||
SHIFTR A, 10, X
|
||||
LDS #11 .komentar2
|
||||
LDT #5
|
||||
|
|
|
|||
|
|
@ -125,6 +125,22 @@ type format_F2_rr struct {
|
|||
r2 string
|
||||
}
|
||||
|
||||
type format_F3 struct {
|
||||
oznaka string
|
||||
opcode int
|
||||
format int
|
||||
velikost int
|
||||
}
|
||||
|
||||
type format_F3_m struct {
|
||||
oznaka string
|
||||
opcode int
|
||||
format int
|
||||
velikost int
|
||||
naslov string
|
||||
x bool
|
||||
}
|
||||
|
||||
func remove_comments_and_empty_lines(el string) bool {
|
||||
match_pure_comment, err := regexp.MatchString(`(?m)^[\t ]*\..*$\n`, el)
|
||||
if err != nil {
|
||||
|
|
@ -187,7 +203,7 @@ func check_F2_n(el string, AST *[]ukaz) bool {
|
|||
nov_ukaz.x = false
|
||||
nov_ukaz.n = temp
|
||||
}
|
||||
fmt.Println("F2_n ", el[:len(el) - 1], nov_ukaz)
|
||||
//fmt.Println("F2_n ", el[:len(el) - 1], nov_ukaz)
|
||||
*AST = append(*AST, nov_ukaz)
|
||||
return true
|
||||
}
|
||||
|
|
@ -248,7 +264,7 @@ func check_F2_rn(el string, AST *[]ukaz) bool {
|
|||
nov_ukaz.x = false
|
||||
nov_ukaz.n = temp
|
||||
}
|
||||
fmt.Println("F2_rn: ", el[:len(el) - 1], nov_ukaz)
|
||||
//fmt.Println("F2_rn: ", el[:len(el) - 1], nov_ukaz)
|
||||
*AST = append(*AST, nov_ukaz)
|
||||
return true
|
||||
}
|
||||
|
|
@ -305,6 +321,7 @@ func main() {
|
|||
if check_F1(el, &AST) {
|
||||
continue
|
||||
}
|
||||
// TODO !!! odstrani # in @ in x naslalvljaje od F2 formata, saj nima bitov, da to podpre
|
||||
if check_F2_n(el, &AST) {
|
||||
continue
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue