I'm wondering if there's any way to reserve more bytes for code segment (specifically 256), because I need to have all segments at least 256 bytes long and I need to store data in all of them. I tried resb that works for all other segments but that doesn't seem to work for cs.
CodePudding user response:
In the BSS section you can use RESB
, RESW
, ...
In the DATA section you can use DB
, DW
, ...
In the CODE section you normally just write instructions, but you can also use DB
, DW
, ...
Accessing this data would require using a segment override prefix like in mov ax, [cs:bx]
.
Additionally you can use the ALIGN
macro both in CODE and DATA sections.
Say your CODE section only contains the one instruction RET
and you let it follow by ALIGN 256
, then the new CODE section will have 256 bytes: 1 time RET
and 255 times NOP
.