0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

#概要

plunkerでassembler-simulatorやってみた。
練習問題やってみた。

#練習問題

1から98まで、印字せよ。

#写真

image.png

#サンプルコード

;1-98 print
start:
	MOV 	A, 1
loop:
	CALL	print
	INC 	A
	CMP 	A, 99
	JNZ 	loop
	HLT
print:
	PUSH	A
	MOV		B, A
	CMP		A, 10
	JNC		jmp2
lop1:	
	ADD		A, 48
	MOV		C, 49
	MOV		[254], A
	MOV		[255], C
	MOV		D, 32
	MOV		[254], D
	MOV		[255], C
	jmp		pre1
jmp2:
	DIV		10	
	MOV		D, A
	ADD		D, 48
	MOV		C, 49
	MOV		[254], D
	MOV		[255], C
	MUL		10
	MOV		C, A
	MOV		A, B
	SUB		A, C
	JMP		lop1
pre1:	
	POP		A
	RET

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?