home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Oakland CPM Archive
/
oakcpm.iso
/
cpmug
/
cpmug035.ark
/
SHOWSWAP.ASM
< prev
next >
Wrap
Assembly Source File
|
1984-04-29
|
4KB
|
152 lines
; 19 JUNE: FIXED SHOW'S DOUBLE ZERO PROBLEM
;
; SHOW -- --
;
; WITTENBERG & MOSHELL.
;
ORG 2BD0H
FILL2K EQU 503CH
ONBUF EQU 5090H
CODE EQU 0FFH
FINISH EQU 080H
INPAR EQU 5030H
BACKGRND EQU 5092H ;AT LEAST AT THE MOMENT.
COLOR EQU 0FH
PUT EQU 5000H
OBJR EQU 5006H
OBJW EQU 5009H
ROTATE EQU 2CD0H
ONLIST EQU 130H
* NEW VERSION OF SHOW (JUNE 19, 1979)
* IN THIS VERSION, THE FIRST BYTE IN THE LIST TELLS US THE NUMBER OF
* OBJECTS IN THE LIST (I.E., HOW MANY OBJECTS TO SHOW)
SHOW: LXI H,ONLIST
MOV A,M ;GET # OF OBJECTS TO A
ORA A
JZ SWAP ;SHOW NO OBJECTS IF NONE TO SHOW
SHLOOP: INX H ;LOOK AT ONLIST ELEMENT
MOV D,M ;OBJECT # INTO D
PUSH PSW ;SAVE COUNT AND POINTER INTO ONLIST
PUSH H
CALL SHOWONE
POP H
POP PSW ;RETRIEVE COUNT AND POINTER
DCR A ;ONE LESS OBJECT TO WORRY ABOUT
JNZ SHLOOP ;CONTINUE IF MORE OBJECTS TO SHOW
JMP SWAP ;DISPLAY OBJECTS SHOWN
;
* OLD SHOW ALGORITHM
SHOWONE:MVI E,0 ;START W/ THE 1ST OBJECT BYTE (COLOR)
MOV L,D ;SAVE THE OBJECT # FOR FURTHER REFERENCE
CALL OBJR ;GET THE FIRST BYTE OF THE OBJECT INTO A
ANI COLOR ;LEAVE JUST THE COLOR IN A
MOV H,A ;STORE THE COLOR IN H FOR FURTHER REF.
* IF THE OBJECT HAS AN ORIENTATION OTHER THAN ZERO, WE MUST CALL
* "ROTATE" TO DO THE JOB
INR E ;LOOK AT THE 2ND OBJECT BYTE (ORIENTATION)
CALL OBJR ;
CPI 0 ;IS ITS ORIENTATION NON-ZERO?
JNZ ROTATE ;YES--LET 'ROTATE' TURN&SHOW IT.
;
* DISPLAY THE OBJECT
INR E ! INR E ;SKIP OVER CENTRE OF GRAVITY
SHWLP: INR E ;LOOK AT NEXT OBJECT BYTE
CALL OBJR
CPI CODE ;IS IT A SPECIAL CODE?
JZ SPEC ;YES--TAKE CARE OF IT
MOV B,A ;NO--IT'S AN X CO-ORDINATE
INR E ;GET THE Y CO-ORDINATE
CALL OBJR
MOV C,A
MOV D,H ;GET THE COLOR INTO D FOR A CALL TO "PUT"
CALL PUT
MOV D,L ;GET OBJECT # BACK INTO D
JMP SHWLP ;NEXT.
* TAKE CARE OF SPECIAL CODES
SPEC: INR E ;LOOK AT THE BYTE WITH THE CODE
CALL OBJR
CPI FINISH ;IS IT THE END-OF-OBJECT CODE?
RZ ;YES--WE'RE FINISHED.
CPI COLOR ;IS IT A CHANGE OF COLOR?
JNC SHWLP ;NO--IGNORE IT
MOV H,A ;ELSE STORE THE NEW COLOR FOR POSTERITY
JMP SHWLP ;AND GET NEXT BYTE.
;
; SWAP -- THIS MOVES DAZZLER'S ATTENTION TO 'ONBUF',THE BUFFER WHICH
; HAS BEEN THE TARGET OF AL THE 'PUTS' AND 'GETS' LATELLY. IT ALSO
; CHANGES THE 'ONBUF'POINTER TO POINT TO THE BUFFER THAT WAS BEING
; SHOWN BEFORE, AND FILLS THAT ONE WITH THE BACKGROUND SCENE.
SWAP: LDA ONBUF+1 ;'ONBUF' POINTS TO BUFFER CURRENTLY RECEIVING
MOV E,A ;'PUT'-RESULTS...ACTUALLY THE OTHER BUFFER IS
XRI 08H ;BEING SHOWN BY DAZZLER.WE SWITCH HERE.
MOV D,A ;'E' HAS (HI-PART OF)NEXT SHOW-BUFF.
STA ONBUF+1 ;'D' HAS (HI-PART OF)NEXT ON-BUFF..
MOV A,E
STC
RAR ;THIS PREPARES DAZZLER CONTROL WORD FOR DMA
OUT 0EH ;CONTROL: BIT 7 SET, BITS 6-0 ARE HIGH-ADDR.
LHLD BACKGRND
XCHG ;NOW DE POINTS TO BACKGRND,H HAS 'ONBUF'-HI.
MVI L,0 ;HL IS READY TO POINT TO THE FILLABLE BUFFEER.
;
CALL FILL2K
;
RET
;
; ONLIST: JMM 3/79
; REVISED TO GO WITH NEW SHOW BY LEE WITTENBERG (JUNE 19, 1979)
; PREPARES A LIST AT 130 OF OBJECTS TO BE 'ON' AT
; THIS TIME. FIRST PARM IS ASSUMED TO BE THE NUMBER
; OF OBJECTS IN THE LIST AND IS SAVED AS SUCH
; (THE FIRST ITEM IN THE LIST IS THE NUMBER OF OBJECTS FOLLOWING)
;
; CALLS:INPAR
;
ONLIST EQU 130H
ORG 2C50H
LISTOP: LXI H,ONLIST
CALL INPAR ;GET # OF OBJECTS IN LIST
MOV M,E ;SAVE THAT #
MOV A,E ;USE IT AS A COUNTER
ORA A
RZ ;RETURN IF EMPTY ONLIST WANTED
LSTLP: CALL INPAR ;GET OBJECT #
INX H ;AND STORE IT AT NEXT
MOV M,E ;POSITION IN ONLIST
DCR A ;ARE WE FINISHED?
JNZ LSTLP ;NO--GET NEXT OBJECT # FOR ONLIST
RET ;YES--RETURN
;
;
; BACKGRND OP - PLACE AN OBJECT IN BACK-BUFFER.
; CALLS: SHOWONE (THIS SOURCEFILE), INPAR
;
ORG 2C80H
LHLD ONBUF
PUSH H ;SAVE CURRENT 'ONBUF'
LHLD BACKGRND
SHLD ONBUF
CALL INPAR ;'E' NOW NAMES THE OBJECT
MOV D,E
CALL SHOWONE
POP H
SHLD ONBUF ;UNDO OUR 'FIX'.
RET
;
; RECOLOR OP - SETS OBJECT (FIRST ELEMENT) TO NEW COLOR.
; USELESS UNLESS OBJECT IS A SINGLE COLOR....
;
ORG 2CA0H
CALL INPAR ;GET OBJECT NR
MOV B,E ;AND STASH IT.
CALL INPAR ;GET NEW COLOR
MOV A,E
MOV D,B ;OBJ NR. IN D.
MVI E,0 ;SPECIFY FIRST ELEMENT.
CALL OBJW
RET
;
;THAT'S ALL,FOLKS...
;
END