======================================= ULM Assembler (Part 2: Code Generation) [TOC] ======================================= ---- VIDEO ------------------------------ https://www.youtube.com/embed/bi05Z9UvC0E ----------------------------------------- Directives for Generating Data ============================== ---- SHELL (path=session11/io/, hide) ------------------------------------------ make -------------------------------------------------------------------------------- ---- CODE (file=session11/io/1_ulm_build/io/data.s) ---------------------------- .space 8 .string "foo" .byte 0x11 .word 0x2211 .long 0x44332211 .quad 0x8877665544332211 -------------------------------------------------------------------------------- ---- SHELL (path=session11/io/1_ulm_build/io) ---------------------------------- ulmas data.s -------------------------------------------------------------------------------- :import: session11/io/1_ulm_build/io/a.out Redefinition of Symbols with `.equ` =================================== Some assemblers take the meaning of `.equ` as _equivalent_ very serious. Once a symbol was defined to be equivalent to some expression you can not chnage that. The GNU assembler is more relaxed and so is the ULM assembler. It certainly would be better to treat `.equ` strictly as an equivalence, and provide a `.sym` directive that allows redefinition of symbols. Well, we live in a world were lots of things could be better. ---- CODE (file=session11/io/1_ulm_build/io/equ.s) ----------------------------- .data .byte foo .equ foo, 1 .byte foo .equ foo, 2 -------------------------------------------------------------------------------- ---- SHELL (path=session11/io/1_ulm_build/io) ---------------------------------- ulmas equ.s -------------------------------------------------------------------------------- What would you expect is the value of the byte used in the first `.byte` directive (Line 2)? :import: session11/io/1_ulm_build/io/a.out