More instructions for awkasm
This commit is contained in:
parent
cb59338554
commit
2c13f25c30
33
host/asm.awk
33
host/asm.awk
@ -103,10 +103,14 @@ BEGIN {
|
||||
ops_sb["nop"]=128+16
|
||||
ops_sb["movsb"]=164
|
||||
ops_sb["movsw"]=165
|
||||
ops_sb["cmpsb"]=166
|
||||
ops_sb["cmpsw"]=166
|
||||
ops_sb["stosb"]=170
|
||||
ops_sb["stosw"]=171
|
||||
ops_sb["lodsb"]=172
|
||||
ops_sb["lodsw"]=173
|
||||
ops_sb["scasb"]=174
|
||||
ops_sb["scasw"]=175
|
||||
ops_sb["ret"]=195
|
||||
ops_sb["retf"]=203
|
||||
ops_sb["hlt"]=244
|
||||
@ -116,11 +120,11 @@ BEGIN {
|
||||
prefix["ss"]=54
|
||||
prefix["ds"]=64
|
||||
prefix["lock"]=240
|
||||
prefix["repne"]=242
|
||||
prefix["repnz"]=242
|
||||
prefix["rep"]=243
|
||||
prefix["repe"]=242
|
||||
prefix["repz"]=242
|
||||
prefix["repne"]=243
|
||||
prefix["repnz"]=243
|
||||
prefix["repe"]=243
|
||||
prefix["repz"]=243
|
||||
}
|
||||
# error string to insert into listing
|
||||
function err(str) {
|
||||
@ -477,12 +481,24 @@ op=="mov" {
|
||||
# modrm <- imm
|
||||
} else if (byteop && rm1) {
|
||||
push_byte(198)
|
||||
push_modrm(rm1, 0, r16)
|
||||
push_modrm(op1, 0, r16)
|
||||
push_byte(imm(op2))
|
||||
} else if (wordop && rm1) {
|
||||
push_byte(199)
|
||||
push_modrm(rm1, 0, r16)
|
||||
push_modrm(op1, 0, r16)
|
||||
push_word(imm(op2))
|
||||
}
|
||||
}
|
||||
op=="lea" && op1 in r16 {
|
||||
push_byte(141)
|
||||
push_modrm(op2, r16[op1], r16)
|
||||
}
|
||||
op=="div" {
|
||||
push_op_fixed_spare(246, 6)
|
||||
}
|
||||
op=="mul" {
|
||||
push_op_fixed_spare(246, 4)
|
||||
}
|
||||
op=="push" && op1 in r16 {
|
||||
push_byte(80+r16[op1])
|
||||
}
|
||||
@ -498,15 +514,16 @@ op=="int" { # CD
|
||||
}
|
||||
op=="jmp" {
|
||||
val=imm(op1)-(pos+2)
|
||||
if (!wordop || (val>-127 && val<128 && ecrit)) {
|
||||
if (byteop && (!wordop || (val>-127 && val<128 && ecrit))) {
|
||||
push_byte(235)
|
||||
push_signed_byte(val)
|
||||
submit(pos);next
|
||||
} else if(wordop) {
|
||||
push_byte(233)
|
||||
push_word(val-1)
|
||||
}
|
||||
submit(pos);next
|
||||
}
|
||||
}
|
||||
op=="call" && wordop {
|
||||
push_byte(232)
|
||||
push_word(imm(op1)-(pos+3))
|
||||
|
Loading…
Reference in New Issue
Block a user