Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualCuajin

Posted 11 July 2012 - 11:49 PM

So I am trying to create a game in assembly just for fun.

EDIT: Please read my second post, it simplifies my question a lot.

In the game you have an inventory and some items. Must the game is actually finished already, and each subroutine works. However, I am having problems printing to the screen.

I have printed to the screen before but it was a pain.

I’m trying to create a function (subroutine) to display the binary content of R0 to the console. So I want it to print 1 or 0 for each bit; which will mean something in the game. I start in R0[15]…R0[0] end there.

PRINT
	  ST R7, PRS7
	  ST R3, PRS3
;AND  R3, R3, #0
LD R3, MASK

LOOP
AND  R0, R0, R3
BRp CHECK  
CHECK ADD  R0, R0, #1
TRAP  x21
BRnzp DOWN
ELSE AND  R0, R0, #0
TRAP  x21
DOWN
	 LD R3, PRS3
	 LD R7, PRS7
PRS7 .BLKW 1
PRS3 .BLKW 1
MASK .FILL x8000  ; Mask x8000

There has to be an easy way to do this. Please help.

#2Cuajin

Posted 11 July 2012 - 09:44 PM

So I am trying to create a game in assembly just for fun.

In the game you have an inventory and some items. Must the game is actually finished already, and each subroutine works. However, I am having problems printing to the screen.

I have printed to the screen before but it was a pain.

I’m trying to create a function (subroutine) to display the binary content of R0 to the console. So I want it to print 1 or 0 for each bit; which will mean something in the game. I start in R0[15]…R0[0] end there.

PRINT
	  ST R7, PRS7
	  ST R3, PRS3
;AND  R3, R3, #0
LD R3, MASK

LOOP
AND  R0, R0, R3
BRp CHECK  
CHECK ADD  R0, R0, #1
TRAP  x21
BRnzp DOWN
ELSE AND  R0, R0, #0
TRAP  x21
DOWN
	 LD R3, PRS3
	 LD R7, PRS7
PRS7 .BLKW 1
PRS3 .BLKW 1
MASK .FILL x8000  ; Mask x8000

There has to be an easy way to do this. Please help.

#1Cuajin

Posted 11 July 2012 - 09:42 PM

So I am trying to create a game in assembly just for fun.

In the game you have an inventory and some items. Must the game is actually finished already, and each subroutine works. However, I am having problems printing to the screen.

I have printed to the screen before but it was a pain.

I’m trying to create a function (subroutine) to display the binary content of R0 to the console. So I want it to print 1 or 0 for each bit; which will mean something in the game. I start in R0[15]…R0[0] end there.

PRINT
	  ST R7, PRS7
	  ST R3, PRS3
;AND  R3, R3, #0 
LD R3, MASK

LOOP
AND  R0, R0, R3 
BRp CHECK  
CHECK ADD  R0, R0, #1
TRAP  x21
BRnzp DOWN
ELSE AND  R0, R0, #0
TRAP  x21
DOWN
	 LD R3, PRS3
	 LD R7, PRS7
PRS7 .BLKW 1
PRS3 .BLKW 1
MASK .FILL x8000  ; Mask x8000

PARTNERS