Click here to Skip to main content
15,914,217 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: CAOTD (*): JavaScript is the new Assembly Pin
KP Lee18-Nov-13 11:33
KP Lee18-Nov-13 11:33 
GeneralRe: CAOTD (*): JavaScript is the new Assembly Pin
Marc Clifton19-Nov-13 13:41
mvaMarc Clifton19-Nov-13 13:41 
GeneralRe: CAOTD (*): JavaScript is the new Assembly Pin
KP Lee19-Nov-13 15:05
KP Lee19-Nov-13 15:05 
GeneralRe: CAOTD (*): JavaScript is the new Assembly Pin
OriginalGriff15-Nov-13 22:09
mveOriginalGriff15-Nov-13 22:09 
GeneralRe: CAOTD (*): JavaScript is the new Assembly Pin
CDP180215-Nov-13 23:34
CDP180215-Nov-13 23:34 
GeneralRe: CAOTD (*): JavaScript is the new Assembly Pin
CPallini16-Nov-13 5:45
mveCPallini16-Nov-13 5:45 
GeneralRe: CAOTD (*): JavaScript is the new Assembly Pin
Roger Wright16-Nov-13 16:29
professionalRoger Wright16-Nov-13 16:29 
GeneralRe: CAOTD (*): JavaScript is the new Assembly Pin
CDP180216-Nov-13 17:46
CDP180216-Nov-13 17:46 
Does this assembly stuff look like this? Smile | :)

; =========================================================================================
; Parameters:
; RE.0		X coordinate of the sprite
; RE.1		Y coordinate of the sprite
; RF		Pointer to sprite
; RD		Size of the sprite in bytes
;
; Internal:
; RC		Pointer to video memory
; =========================================================================================

DrawSprite:		DEC  R2
			LDI  hi(DisplayBuffer)		; calculate the offset in the video buffer
			PHI  RC				; DisplayBuffer + Y * 8 + X / 8
			GHI  RE				; result goes to RC

			IF Resolution == 20H
			ANI  1FH			; between 0 - 31
			ENDIF
				
			IF Resolution == 40H
			ANI  3FH			; or 0 - 63
			ENDIF

			IF Resolution == 80H
			ANI  7FH			; or 0 - 127
			ENDIF

			SHL
			SHL
			SHL
			PLO  RC
			BNF  DSP_SkipIncrement
			GHI  RC
			ADI  01H
			PHI  RC
					
DSP_SkipIncrement:	GLO  RC
			STR  R2
			GLO  RE
			ANI  3FH
			SHR
			SHR
			SHR
			ADD
			PLO  RC
			GLO  RE				; calculate the number of required shifts 
			ANI  07H		; result to RE.1, replacing the Y coordinate
			PHI  RE				; RE.0 will be used later to count the shifts

DSP_ByteLoop:		GLO  RD				; exit if all bytes of the sprite have been drawn
			BZ   DSP_Exit
					
			IF Resolution == 20H		; or if we are about to draw outside the video buffer
			LDI  hi(DisplayBuffer)		; only one page at 64 x 32
			ENDIF

			IF Resolution == 40H
			LDI   hi(DisplayBuffer) + 1	; two pages at 64 x 64
			ENDIF

			IF Resolution == 80H
			LDI   hi(DisplayBuffer) + 3	; four pages at 64 x 128
			ENDIF

			STR  R2
			GHI  RC
			SD
			BNF  DSP_Exit
			LDN	 RF			; load the next byte of the sprite into RB.0
			PLO  RB
			LDI  00H		; set RB.1 to OOH
			PHI  RB
			DEC  RD				; decrement the sprite's byte counter
			INC  RF				; increment the pointer to the sprite's bytes
			GHI  RE				; prepare the shift counter
			PLO  RE
DSP_ShiftLoop:		GLO  RE				; exit the loop if all shifts have been performed
			BZ   DSP_ShiftExit
			DEC  RE				; decrement the shift counter
			GLO  RB				; shift the values in RB
			SHR
			PLO  RB
			GHI  RB
			RSHR
			PHI  RB
			BR   DSP_ShiftLoop
DSP_ShiftExit:		SEX  RC				; store the shifted bytes in the video buffer
			GLO  RB
			XOR
			STR  RC
			INC  RC
			GHI  RB
			XOR
			STR  RC
			SEX  R2
			GLO  RC				; advance the video buffer pointer to the next line
			ADI  07H
			PLO  RC
			GHI  RC
			ADCI 00H
			PHI  RC
			BR   DSP_ByteLoop
DSP_Exit			INC  R2
			SEP  R5

;------------------------------------------------------------------------------------------

Sent from my BatComputer via HAL 9000 and M5


modified 16-Nov-13 23:56pm.

GeneralRe: CAOTD (*): JavaScript is the new Assembly Pin
Roger Wright16-Nov-13 17:56
professionalRoger Wright16-Nov-13 17:56 
GeneralRe: CAOTD (*): JavaScript is the new Assembly Pin
CDP180216-Nov-13 18:10
CDP180216-Nov-13 18:10 
GeneralRe: CAOTD (*): JavaScript is the new Assembly Pin
Andrei Straut18-Nov-13 1:48
Andrei Straut18-Nov-13 1:48 
GeneralRe: CAOTD (*): JavaScript is the new Assembly Pin
KP Lee18-Nov-13 10:41
KP Lee18-Nov-13 10:41 
GeneralRe: CAOTD (*): JavaScript is the new Assembly Pin
BotReject19-Nov-13 12:44
BotReject19-Nov-13 12:44 
GeneralVisual Studio Online Pin
Richard Andrew x6415-Nov-13 14:43
professionalRichard Andrew x6415-Nov-13 14:43 
GeneralRe: Visual Studio Online Pin
Ron Beyer15-Nov-13 14:52
professionalRon Beyer15-Nov-13 14:52 
GeneralRe: Visual Studio Online Pin
Richard Andrew x6415-Nov-13 14:54
professionalRichard Andrew x6415-Nov-13 14:54 
GeneralRe: Visual Studio Online Pin
Ron Beyer15-Nov-13 14:59
professionalRon Beyer15-Nov-13 14:59 
GeneralRe: Visual Studio Online Pin
Richard Andrew x6415-Nov-13 15:01
professionalRichard Andrew x6415-Nov-13 15:01 
GeneralRe: Visual Studio Online Pin
Ranjan.D15-Nov-13 15:15
professionalRanjan.D15-Nov-13 15:15 
GeneralRe: Visual Studio Online Pin
Mycroft Holmes15-Nov-13 15:01
professionalMycroft Holmes15-Nov-13 15:01 
GeneralRe: Visual Studio Online Pin
Richard Andrew x6415-Nov-13 15:03
professionalRichard Andrew x6415-Nov-13 15:03 
GeneralRe: Visual Studio Online Pin
Mike Hankey15-Nov-13 17:47
mveMike Hankey15-Nov-13 17:47 
GeneralRe: Visual Studio Online Pin
Richard Andrew x6415-Nov-13 17:51
professionalRichard Andrew x6415-Nov-13 17:51 
GeneralRe: Visual Studio Online Pin
Mike Hankey16-Nov-13 2:11
mveMike Hankey16-Nov-13 2:11 
GeneralRe: Visual Studio Online Pin
Rutvik Dave15-Nov-13 18:59
professionalRutvik Dave15-Nov-13 18:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.