You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1215 lines
12 KiB

2 years ago
# in: R2=str
.set PrintStr, 0x0008
# in: R2=one R3=two
# re: R0=res
.set StrCmp, 0x0010
# in: R2=table R3=value
# re: R0=index (err=-1)
.set FindIndex, 0x0018
# in: R2=mem
# re: R0=res (err=-1)
.set ConvertHex, 0x0020
# in: R1=size R2=dst R3=src
.set MemCpy, 0x0028
# in: R2=mem R3=size
.set ReadStr, 0x0030
# in: R2=mem
.set StrTrim, 0x0038
# in: R0=val R1=size R2=mem
.set MemSet, 0x0040
# in: R0=char
.macro copr_putc
copr 0x01
.endm
# re: R0=char
.macro copr_getc
copr 0x02
.endm
.macro copr_halt
copr 0x03
.endm
# in: R0=blk R1=out
.macro copr_readblk
copr 0x04
.endm
# re: R0=val
.macro copr_random
copr 0x05
.endm
.macro brk
.byte 0x00
.endm
.macro mul_r0 n16
.byte 0x01
.2byte \n16
.endm
.macro mul_r0_r1
.byte 0x02
.endm
.macro div_r0 n16
.byte 0x03
.2byte \n16
.endm
.macro div_r0_r1
.byte 0x04
.endm
.macro ret
.byte 0x05
.endm
.macro copr func
.byte 0x06
.byte \func
.endm
.macro mix
.byte 0x07
.endm
.macro nop
.byte 0x08
.endm
.macro ld_sp n16
.byte 0x09
.2byte \n16
.endm
.macro ld_r0_sp
.byte 0x0a
.endm
.macro ld_sp_r0
.byte 0x0b
.endm
.macro nop_0c
.byte 0x0c
.endm
.macro illegal_0d
.byte 0x0d
.endm
.macro shl_r0
.byte 0x0e
.endm
.macro shr_r0
.byte 0x0f
.endm
.macro ld_r0 n16
.byte 0x10
.2byte \n16
.endm
.macro ld_r1 n16
.byte 0x11
.2byte \n16
.endm
.macro ld_r2 n16
.byte 0x12
.2byte \n16
.endm
.macro ld_r3 n16
.byte 0x13
.2byte \n16
.endm
.macro illegal_14
.byte 0x14
.endm
.macro illegal_15
.byte 0x15
.endm
.macro illegal_16
.byte 0x16
.endm
.macro illegal_17
.byte 0x17
.endm
.macro illegal_18
.byte 0x18
.endm
.macro illegal_19
.byte 0x19
.endm
.macro illegal_1a
.byte 0x1a
.endm
.macro illegal_1b
.byte 0x1b
.endm
.macro illegal_1c
.byte 0x1c
.endm
.macro illegal_1d
.byte 0x1d
.endm
.macro illegal_1e
.byte 0x1e
.endm
.macro illegal_1f
.byte 0x1f
.endm
.macro ld_r0_r0
.byte 0x20
.endm
.macro ld_r0_r1
.byte 0x21
.endm
.macro ld_r0_r2
.byte 0x22
.endm
.macro ld_r0_r3
.byte 0x23
.endm
.macro ld_r1_r0
.byte 0x24
.endm
.macro ld_r1_r1
.byte 0x25
.endm
.macro ld_r1_r2
.byte 0x26
.endm
.macro ld_r1_r3
.byte 0x27
.endm
.macro ld_r2_r0
.byte 0x28
.endm
.macro ld_r2_r1
.byte 0x29
.endm
.macro ld_r2_r2
.byte 0x2a
.endm
.macro ld_r2_r3
.byte 0x2b
.endm
.macro ld_r3_r0
.byte 0x2c
.endm
.macro ld_r3_r1
.byte 0x2d
.endm
.macro ld_r3_r2
.byte 0x2e
.endm
.macro ld_r3_r3
.byte 0x2f
.endm
.macro add_r0_r0
.byte 0x30
.endm
.macro add_r0_r1
.byte 0x31
.endm
.macro add_r0_r2
.byte 0x32
.endm
.macro add_r0_r3
.byte 0x33
.endm
.macro add_r1_r0
.byte 0x34
.endm
.macro add_r1_r1
.byte 0x35
.endm
.macro add_r1_r2
.byte 0x36
.endm
.macro add_r1_r3
.byte 0x37
.endm
.macro add_r2_r0
.byte 0x38
.endm
.macro add_r2_r1
.byte 0x39
.endm
.macro add_r2_r2
.byte 0x3a
.endm
.macro add_r2_r3
.byte 0x3b
.endm
.macro add_r3_r0
.byte 0x3c
.endm
.macro add_r3_r1
.byte 0x3d
.endm
.macro add_r3_r2
.byte 0x3e
.endm
.macro add_r3_r3
.byte 0x3f
.endm
.macro ldrb_r0_r0
.byte 0x40
.endm
.macro ldrb_r0_r1
.byte 0x41
.endm
.macro ldrb_r0_r2
.byte 0x42
.endm
.macro ldrb_r0_r3
.byte 0x43
.endm
.macro ldrb_r1_r0
.byte 0x44
.endm
.macro ldrb_r1_r1
.byte 0x45
.endm
.macro ldrb_r1_r2
.byte 0x46
.endm
.macro ldrb_r1_r3
.byte 0x47
.endm
.macro ldrb_r2_r0
.byte 0x48
.endm
.macro ldrb_r2_r1
.byte 0x49
.endm
.macro ldrb_r2_r2
.byte 0x4a
.endm
.macro ldrb_r2_r3
.byte 0x4b
.endm
.macro ldrb_r3_r0
.byte 0x4c
.endm
.macro ldrb_r3_r1
.byte 0x4d
.endm
.macro ldrb_r3_r2
.byte 0x4e
.endm
.macro ldrb_r3_r3
.byte 0x4f
.endm
.macro ldr_r0_r0
.byte 0x50
.endm
.macro ldr_r0_r1
.byte 0x51
.endm
.macro ldr_r0_r2
.byte 0x52
.endm
.macro ldr_r0_r3
.byte 0x53
.endm
.macro ldr_r1_r0
.byte 0x54
.endm
.macro ldr_r1_r1
.byte 0x55
.endm
.macro ldr_r1_r2
.byte 0x56
.endm
.macro ldr_r1_r3
.byte 0x57
.endm
.macro ldr_r2_r0
.byte 0x58
.endm
.macro ldr_r2_r1
.byte 0x59
.endm
.macro ldr_r2_r2
.byte 0x5a
.endm
.macro ldr_r2_r3
.byte 0x5b
.endm
.macro ldr_r3_r0
.byte 0x5c
.endm
.macro ldr_r3_r1
.byte 0x5d
.endm
.macro ldr_r3_r2
.byte 0x5e
.endm
.macro ldr_r3_r3
.byte 0x5f
.endm
.macro strb_r0_r0
.byte 0x60
.endm
.macro strb_r1_r0
.byte 0x61
.endm
.macro strb_r2_r0
.byte 0x62
.endm
.macro strb_r3_r0
.byte 0x63
.endm
.macro strb_r0_r1
.byte 0x64
.endm
.macro strb_r1_r1
.byte 0x65
.endm
.macro strb_r2_r1
.byte 0x66
.endm
.macro strb_r3_r1
.byte 0x67
.endm
.macro strb_r0_r2
.byte 0x68
.endm
.macro strb_r1_r2
.byte 0x69
.endm
.macro strb_r2_r2
.byte 0x6a
.endm
.macro strb_r3_r2
.byte 0x6b
.endm
.macro strb_r0_r3
.byte 0x6c
.endm
.macro strb_r1_r3
.byte 0x6d
.endm
.macro strb_r2_r3
.byte 0x6e
.endm
.macro strb_r3_r3
.byte 0x6f
.endm
.macro str_r0_r0
.byte 0x70
.endm
.macro str_r1_r0
.byte 0x71
.endm
.macro str_r2_r0
.byte 0x72
.endm
.macro str_r3_r0
.byte 0x73
.endm
.macro str_r0_r1
.byte 0x74
.endm
.macro str_r1_r1
.byte 0x75
.endm
.macro str_r2_r1
.byte 0x76
.endm
.macro str_r3_r1
.byte 0x77
.endm
.macro str_r0_r2
.byte 0x78
.endm
.macro str_r1_r2
.byte 0x79
.endm
.macro str_r2_r2
.byte 0x7a
.endm
.macro str_r3_r2
.byte 0x7b
.endm
.macro str_r0_r3
.byte 0x7c
.endm
.macro str_r1_r3
.byte 0x7d
.endm
.macro str_r2_r3
.byte 0x7e
.endm
.macro str_r3_r3
.byte 0x7f
.endm
.macro cp_r0_r0
.byte 0x80
.endm
.macro cp_r0_r1
.byte 0x81
.endm
.macro cp_r0_r2
.byte 0x82
.endm
.macro cp_r0_r3
.byte 0x83
.endm
.macro cp_r1_r0
.byte 0x84
.endm
.macro cp_r1_r1
.byte 0x85
.endm
.macro cp_r1_r2
.byte 0x86
.endm
.macro cp_r1_r3
.byte 0x87
.endm
.macro cp_r2_r0
.byte 0x88
.endm
.macro cp_r2_r1
.byte 0x89
.endm
.macro cp_r2_r2
.byte 0x8a
.endm
.macro cp_r2_r3
.byte 0x8b
.endm
.macro cp_r3_r0
.byte 0x8c
.endm
.macro cp_r3_r1
.byte 0x8d
.endm
.macro cp_r3_r2
.byte 0x8e
.endm
.macro cp_r3_r3
.byte 0x8f
.endm
.macro push_r0
.byte 0x90
.endm
.macro push_r1
.byte 0x91
.endm
.macro push_r2
.byte 0x92
.endm
.macro push_r3
.byte 0x93
.endm
.macro pop_r0
.byte 0x94
.endm
.macro pop_r1
.byte 0x95
.endm
.macro pop_r2
.byte 0x96
.endm
.macro pop_r3
.byte 0x97
.endm
.macro jp addr
.byte 0x98
.2byte \addr
.endm
.macro call addr
.byte 0x99
.2byte \addr
.endm
.macro jp_hi addr
.byte 0x9a
.2byte \addr
.endm
.macro jp_lo addr
.byte 0x9b
.2byte \addr
.endm
.macro jp_eq addr
.byte 0x9c
.2byte \addr
.endm
.macro jp_ne addr
.byte 0x9d
.2byte \addr
.endm
.macro call_hi addr
.byte 0x9e
.2byte \addr
.endm
.macro call_lo addr
.byte 0x9f
.2byte \addr
.endm
.macro call_eq addr
.byte 0xa0
.2byte \addr
.endm
.macro call_ne addr
.byte 0xa1
.2byte \addr
.endm
.macro cp_r0 n16
.byte 0xa2
.2byte \n16
.endm
.macro cp_r1 n16
.byte 0xa3
.2byte \n16
.endm
.macro cp_r2 n16
.byte 0xa4
.2byte \n16
.endm
.macro cp_r3 n16
.byte 0xa5
.2byte \n16
.endm
.macro push_sp
.byte 0xa6
.endm
.macro push_pc
.byte 0xa7
.endm
.macro inc_r0
.byte 0xa8
.endm
.macro inc_r1
.byte 0xa9
.endm
.macro inc_r2
.byte 0xaa
.endm
.macro inc_r3
.byte 0xab
.endm
.macro dec_r0
.byte 0xac
.endm
.macro dec_r1
.byte 0xad
.endm
.macro dec_r2
.byte 0xae
.endm
.macro dec_r3
.byte 0xaf
.endm
.macro ldrb_r0 n16
.byte 0xb0
.2byte \n16
.endm
.macro ldrb_r1 n16
.byte 0xb1
.2byte \n16
.endm
.macro ldrb_r2 n16
.byte 0xb2
.2byte \n16
.endm
.macro ldrb_r3 n16
.byte 0xb3
.2byte \n16
.endm
.macro ldr_r0 n16
.byte 0xb4
.2byte \n16
.endm
.macro ldr_r1 n16
.byte 0xb5
.2byte \n16
.endm
.macro ldr_r2 n16
.byte 0xb6
.2byte \n16
.endm
.macro ldr_r3 n16
.byte 0xb7
.2byte \n16
.endm
.macro strb_r0 n16
.byte 0xb8
.2byte \n16
.endm
.macro strb_r1 n16
.byte 0xb9
.2byte \n16
.endm
.macro strb_r2 n16
.byte 0xba
.2byte \n16
.endm
.macro strb_r3 n16
.byte 0xbb
.2byte \n16
.endm
.macro str_r0 n16
.byte 0xbc
.2byte \n16
.endm
.macro str_r1 n16
.byte 0xbd
.2byte \n16
.endm
.macro str_r2 n16
.byte 0xbe
.2byte \n16
.endm
.macro str_r3 n16
.byte 0xbf
.2byte \n16
.endm
.macro illegal_c0
.byte 0xc0
.endm
.macro illegal_c1
.byte 0xc1
.endm
.macro illegal_c2
.byte 0xc2
.endm
.macro illegal_c3
.byte 0xc3
.endm
.macro illegal_c4
.byte 0xc4
.endm
.macro jp_r0
.byte 0xc5
.endm
.macro jp_r1
.byte 0xc6
.endm
.macro jp_r2
.byte 0xc7
.endm
.macro jp_r3
.byte 0xc8
.endm
.macro call_r0
.byte 0xc9
.endm
.macro call_r1
.byte 0xca
.endm
.macro call_r2
.byte 0xcb
.endm
.macro call_r3
.byte 0xcc
.endm
.macro and_r0 n16
.byte 0xcd
.2byte \n16
.endm
.macro or_r0 n16
.byte 0xce
.2byte \n16
.endm
.macro xor_r0 n16
.byte 0xcf
.2byte \n16
.endm
.macro and_r0_r0
.byte 0xd0
.endm
.macro and_r0_r1
.byte 0xd1
.endm
.macro and_r0_r2
.byte 0xd2
.endm
.macro and_r0_r3
.byte 0xd3
.endm
.macro or_r0_r0
.byte 0xd4
.endm
.macro or_r0_r1
.byte 0xd5
.endm
.macro or_r0_r2
.byte 0xd6
.endm
.macro or_r0_r3
.byte 0xd7
.endm
.macro xor_r0_r0
.byte 0xd8
.endm
.macro xor_r0_r1
.byte 0xd9
.endm
.macro xor_r0_r2
.byte 0xda
.endm
.macro xor_r0_r3
.byte 0xdb
.endm
.macro swap_r0
.byte 0xdc
.endm
.macro swap_r1
.byte 0xdd
.endm
.macro swap_r2
.byte 0xde
.endm
.macro swap_r3
.byte 0xdf
.endm
.macro add_r0 n16
.byte 0xe0
.2byte \n16
.endm
.macro add_r1 n16
.byte 0xe1
.2byte \n16
.endm
.macro add_r2 n16
.byte 0xe2
.2byte \n16
.endm
.macro add_r3 n16
.byte 0xe3
.2byte \n16
.endm
.macro illegal_e4
.byte 0xe4
.endm
.macro illegal_e5
.byte 0xe5
.endm
.macro illegal_e6
.byte 0xe6
.endm
.macro illegal_e7
.byte 0xe7
.endm
.macro illegal_e8
.byte 0xe8
.endm
.macro illegal_e9
.byte 0xe9
.endm
.macro illegal_ea
.byte 0xea
.endm
.macro illegal_eb
.byte 0xeb
.endm
.macro illegal_ec
.byte 0xec
.endm
.macro illegal_ed
.byte 0xed
.endm
.macro illegal_ee
.byte 0xee
.endm
.macro illegal_ef
.byte 0xef
.endm
.macro illegal_f0
.byte 0xf0
.endm
.macro illegal_f1
.byte 0xf1
.endm
.macro illegal_f2
.byte 0xf2
.endm
.macro illegal_f3
.byte 0xf3
.endm
.macro illegal_f4
.byte 0xf4
.endm
.macro illegal_f5
.byte 0xf5
.endm
.macro illegal_f6
.byte 0xf6
.endm
.macro illegal_f7
.byte 0xf7
.endm
.macro illegal_f8
.byte 0xf8
.endm
.macro illegal_f9
.byte 0xf9
.endm
.macro illegal_fa
.byte 0xfa
.endm
.macro illegal_fb
.byte 0xfb
.endm
.macro illegal_fc
.byte 0xfc
.endm
.macro illegal_fd
.byte 0xfd
.endm
.macro illegal_fe
.byte 0xfe
.endm
.macro illegal_ff
.byte 0xff
.endm
.macro text_ram_word n16
.byte 0xf0
.2byte \n16
.endm
.macro text_ram_byte n16
.byte 0xf1
.2byte \n16
.endm
.macro mix1_cp_r0_r1
.byte 0x1a
.endm
.macro mix1_jp_ne n16
.byte 0x65
.2byte \n16
.endm
.macro mix1_switch2 n8
.byte 0x78
.endm
.macro mix1_ld_r1 n16
.byte 0xa7
.2byte \n16
.endm
.macro mix1_inc_r3
.byte 0xdf
.endm
.macro mix1_ldr_r0_r1
.byte 0xf0
.endm
.macro mix1_inc_r1
.byte 0xfc
.endm
.macro mix2_end
.byte 0x00
.endm
.macro mix2_ldr_r0 n16
.byte 0x37
.2byte \n16
.endm
.macro mix2_inc_r3
.byte 0x49
.endm
.macro mix2_cp_r0 n16
.byte 0x5f
.2byte \n16
.endm
.macro mix2_switch3
.byte 0x95
.endm
.macro mix2_jp_ne n16
.byte 0xdd
.2byte \n16
.endm
.macro mix2_xor_r0 n16
.byte 0xfc
.2byte \n16
.endm
.macro mix3_ldrb_r0_r1
.byte 0x2a
.endm
.macro mix3_jp_ne n16
.byte 0x3b
.2byte \n16
.endm
.macro mix3_ld_r0 n16
.byte 0x4d
.2byte \n16
.endm
.macro mix3_cp_r0 n16
.byte 0x5b
.2byte \n16
.endm
.macro mix3_end
.byte 0x5c
.endm
.macro mix3_dec_r0
.byte 0x64
.endm
.macro mix3_dec_r1
.byte 0x67
.endm
.macro mix3_inc_r3
.byte 0x8a
.endm
.macro mix3_ld_r1 n16
.byte 0x8b
.2byte \n16
.endm
.macro mix3_add_r0_r0
.byte 0xf2
.endm