More instructions for awkasm

This commit is contained in:
Nero 2023-11-15 18:50:21 +00:00
parent cb59338554
commit 2c13f25c30

View File

@ -103,10 +103,14 @@ BEGIN {
ops_sb["nop"]=128+16 ops_sb["nop"]=128+16
ops_sb["movsb"]=164 ops_sb["movsb"]=164
ops_sb["movsw"]=165 ops_sb["movsw"]=165
ops_sb["cmpsb"]=166
ops_sb["cmpsw"]=166
ops_sb["stosb"]=170 ops_sb["stosb"]=170
ops_sb["stosw"]=171 ops_sb["stosw"]=171
ops_sb["lodsb"]=172 ops_sb["lodsb"]=172
ops_sb["lodsw"]=173 ops_sb["lodsw"]=173
ops_sb["scasb"]=174
ops_sb["scasw"]=175
ops_sb["ret"]=195 ops_sb["ret"]=195
ops_sb["retf"]=203 ops_sb["retf"]=203
ops_sb["hlt"]=244 ops_sb["hlt"]=244
@ -116,11 +120,11 @@ BEGIN {
prefix["ss"]=54 prefix["ss"]=54
prefix["ds"]=64 prefix["ds"]=64
prefix["lock"]=240 prefix["lock"]=240
prefix["repne"]=242
prefix["repnz"]=242
prefix["rep"]=243 prefix["rep"]=243
prefix["repe"]=242 prefix["repe"]=243
prefix["repz"]=242 prefix["repz"]=243
prefix["repne"]=243
prefix["repnz"]=243
} }
# error string to insert into listing # error string to insert into listing
function err(str) { function err(str) {
@ -477,12 +481,24 @@ op=="mov" {
# modrm <- imm # modrm <- imm
} else if (byteop && rm1) { } else if (byteop && rm1) {
push_byte(198) push_byte(198)
push_modrm(rm1, 0, r16) push_modrm(op1, 0, r16)
push_byte(imm(op2))
} else if (wordop && rm1) { } else if (wordop && rm1) {
push_byte(199) 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 { op=="push" && op1 in r16 {
push_byte(80+r16[op1]) push_byte(80+r16[op1])
} }
@ -498,14 +514,15 @@ op=="int" { # CD
} }
op=="jmp" { op=="jmp" {
val=imm(op1)-(pos+2) val=imm(op1)-(pos+2)
if (!wordop || (val>-127 && val<128 && ecrit)) { if (byteop && (!wordop || (val>-127 && val<128 && ecrit))) {
push_byte(235) push_byte(235)
push_signed_byte(val) push_signed_byte(val)
submit(pos);next
} else if(wordop) { } else if(wordop) {
push_byte(233) push_byte(233)
push_word(val-1) push_word(val-1)
}
submit(pos);next submit(pos);next
}
} }
op=="call" && wordop { op=="call" && wordop {
push_byte(232) push_byte(232)