0

I'm working through a set of problems related to the YASMIN CPU/OS simulator with a RISC-like instruction set. (Editor's note, possibly this one or another version of it). I just cant seem to find the answer to the following:

  1. Add the following code and run:
STB #h41, 16
LDB 16, R03
ADD #1, R03
STB R03, 17

What is the significance of h in h41 above?

There seems to be no information anywhere to reference. I have tried pairing different numbers with h to distinguish a pattern but to no avail. See my attempt below.

CPU simulator attempt

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Aurora
  • 1
  • You can verify with an instruction manual: I think it means hex. – Erik Eidt Aug 04 '22 at 20:26
  • You can check if `h` means hex by using it with an add-immediate or mov-immediate to put a value into a register, then look in the debugger window to see the register value. Also, googling on "YASMIN cpu simulator" found some links, including one I added to the question. https://teach-sim.com/cpu-2/ has links to an instruction-set PDF for the ISA the simulator uses, which hopefully explains the asm syntax as well as the machine-code format. – Peter Cordes Aug 05 '22 at 00:19

2 Answers2

1

#h41 means literal value hex 41. h prefix simply means the following number is a hex number. As simple as that.

youngturk
  • 11
  • 1
1

refer to their tutorial (Investigating Programming Model 2) , where they gave an example on page 5 where they said :

MSF

PSH #h60 -> puts the number hex 60 on top of the stack

CAL $Label2

HLT

that means that h is indication that this number in HEX format and # means that it's a immediate value, so in the example you provided :

STB #h41, 16

#h41 is a HEX number which is equivalent to 65 in decimal number systems.

abdo Salm
  • 1,678
  • 4
  • 12
  • 22