⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 prog49a.asm

📁 主要是8051源代码
💻 ASM
字号:
;  Prog49A - Do Some Real Video Output  
;
;
;  This Program is an Attempt to get a White Bar Across the Screen.  
;  
;  To get the Correct Voltage Levels:
;   0.00 Volts (Synch/"Blacker than Black")
;   0.35 Volts (Synch)
;   0.43 Volts (Black)
;   0.87 Volts (White)
;
;  Myke Predko
;  98.07.02
;
;  Hardware Notes:
;  DS87C520 is used as the Microcontroller
;   - Oscillator Speed is 11.0592 MHz
;  P0.0 is Used for "Synch" Select
;  P0.1 is Used for "Blank" Select
;  P0.2 is Used for "Black" Select  


;  Constant Declarations
Zero  EQU 0FEh                  ;  Zero Volts Output Using P0
Synch EQU 0FBh                  ;  Synch Voltage
Black EQU 0FDh                  ;  Black Level
White EQU 0FFh                  ;  White on the Screen

;  Variable Declarations
Flags EQU 020h                  ;  Bit Flags
Odd   EQU   0                   ;   - Bit 0, When Set, the "Odd" Field


;  Macros


;  Mainline
 org 0                          ;  Execution Starts Here

 clr      C                     ;  Start the the "Even" Field
 mov      Odd,C

 mov      P0,#Zero              ;  3 - Put in the First Synch Pulse

 ajmp     FieldStart            ;  3

FieldStart:                     ;  Come Here with the Last Backporch (13 Cycles)

  mov     P0,#Synch             ;  3 - Back Up to Synch

  mov     C,Odd                 ;  2 - Get the "Odd" Bit
  mov     A,#5                  ;  2 - Get the Number of Pre Synch Half Lines Remaining
  addc    A,#0                  ;  2 - Add the Carry to the Number
  mov     R4,A                  ;  1 - R4 Contains the Leading Number of Cycles

  mov     R3,#6                 ;  2 - Get the Number of Synch Cycles

  mov     C,Odd                 ;  2 
  mov     A,#6                  ;  2 - Get the Number of Post Synch Half Lines
  subb    A,#0                  ;  2
  mov     R5,A                  ;  1 - R5 Contains the Number of Post Synch Cycles
  
  mov     C,Odd                 ;  2
  mov     A,#10                 ;  2 - Get the Number of Post Synch Full Lines
  addc    A,#0                  ;  2
  mov     R6,A                  ;  1 - R6 Contains the Number of Post Synch Cycles

  mov     R7,#243               ;  2 - Number of Lines to Display

  cpl     Odd                   ;  2 - Change Odd to Even and vica versa

  mov     R0,#16                ;  2 - Delay 52 Cycles Before Doing the Vertical Sych
V_Loop:
  djnz    R0,V_Loop             ;  3
  nop                           ;  1
  nop                           ;  1

V1_Loop:                        ;      Do Remaining Cycles

  mov     P0,#Zero              ;  3 - Synch Low for 6 Cycles
  nop                           ;  1
  nop                           ;  1
  nop                           ;  1
  mov     P0,#Synch             ;  3 - Synch High

  mov     R0,#24                ;  2 - Now Delay 74 Cycles to get 88 Cycles for H-Line 
V1_Loop1:
  djnz    R0,V1_Loop1           ;  3   
  nop                           ;  1
  nop                           ;  1

  djnz    R4,V1_Loop            ;  3 - Do Another Synch?    

V2_Loop:
 
  mov     P0,#Zero              ;  3 - Output Zero Voltage for 76 Instruction Cycles

  mov     R1,#23                ;  2 - Delay the 76 Cycles
V2_Loop1:
  djnz    R1,V2_Loop1           ;  3
  nop                           ;  1 
  nop                           ;  1

  mov     P0,#Synch             ;  3 - Now, Output the Synch Pulse

  mov     R1,#1                 ;  2 - Delay 12 Cycles
V2_Loop2:
  djnz    R1,V2_Loop2           ;  3
  nop                           ;  1

  djnz    R3,V2_Loop            ;  3 - Do the Next Vertical Synch Pulse?

V3_Loop:                        ;      Do the Post 1/2 Cycles

  mov     P0,#Zero              ;  3 - Synch Low for 6 Cycles
  nop                           ;  1
  nop                           ;  1
  nop                           ;  1
  mov     P0,#Synch             ;  3 - Synch High

  mov     R0,#24                ;  2 - Now Delay 74 Cycles to get 88 Cycles for H-Line 
V3_Loop1:
  djnz    R0,V3_Loop1           ;  3   
  nop                           ;  1
  nop                           ;  1

  djnz    R5,V3_Loop            ;  3 - Do Another Synch?    

V4_Loop:                        ;      Do the Post Full Cycles

  mov     P0,#Zero              ;  3 - Synch Low for 6 Cycles


  mov     R1,#2                 ;  2 - Delay 12 Cycles
V4_Loop1:
  djnz    R1,V4_Loop1           ;  3
  nop                           ;  1

  mov     P0,#Synch             ;  3 - Synch High

  mov     R0,#52                ;  2 - Delay 52 Cycles
V4_Loop2:
  djnz    R0,V4_Loop2           ;  3   

  djnz    R6,V4_Loop            ;  3 - Do Another Synch?


  mov     P0,#Zero              ;  3 - Start the Next Horizontal Pulse

  ajmp    DataField             ;  3 - Match Other Synchs
  

DataField:                      ;  Now, Output the Data

;  NOTE: The Backporch is at the End of each Data Line  

  mov     R0,#1                 ;  2 - Delay 13 Cycles for the Synch Pulse
DF_Loop1:
  djnz    R0,DF_Loop1           ;  3
  nop                           ;  1
  nop                           ;  1

  mov     P0,#Synch             ;  3 - Delay 13 Cycles for the Back Porch

  mov     R0,#2                 ;  2
DF_Loop2:
  djnz    R0,DF_Loop2           ;  3
  nop                           ;  1
  nop                           ;  1

  mov     P0,#Black             ;  3 - Now, Display the Data

;  #### - Display Information Below - 135 Cycles

  mov     R0,#13                ;  2 - Delay 45 Cycles with Black
DF_Black1:
  djnz    R0,DF_Black1          ;  3 -

  mov     P0,#White             ;  3 - Output the White Signal

  mov     R0,#14                ;  2  
DF_White:
  djnz    R0,DF_White           ;  3

  mov     P0,#Black             ;  3 - Finish with the Field Black

  mov     R0,#14                ;  2
DF_Black2:
  djnz    R0,DF_Black2          ;  3

;  #### - Display Information Above - 135 Cycles

  mov     P0,#Black             ;  3

  dec     R7                    ;  1 - Display another Line?  
  mov     A,R7                  ;  1 - See if Decrement == 0
  jz      DF_NewField           ;  3 - If Zero, Display a New Field

  mov     P0,#Synch             ;  3 - Else, Output the Front Porch
  nop                           ;  1 -  Front Porch is 4 Cycles Long

  mov     P0,#Zero              ;  3 - Start the Synch Pulse
  
  ajmp    DataField             ;  3 - Display the Next Loop

DF_NewField:                    ;  Have to Start a New Field

  mov     P0,#Synch             ;  3
  nop                           ;  1

  mov     P0,#Zero              ;  3 Start the Synch Pulses Again

  ajmp    FieldStart            ;  3

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -