it got no erros but when we run it .. its only a black screen :P

.model small
.stack 100h
.286 ;for port/string insturctions

MaxStar Equ 600d
RomSeg Equ 0f000h ;needed for Random numbers
VgaSeg Equ 0a000h ;vga screen segament
LineWidth Equ 320d
LineHeight Equ 200d

.data
attrib DB ?
row DB ?
col DB ?
create DB ' ### ### #### #### #### # # '
DB ' # # # # # # # ## # '
DB ' ### # #### ### ### # # # '
DB ' # # # # # # # # ## '
DB ' ### ### # # #### #### # # '
DB ' SAVER '
DB ' '
DB ' by '
DB ' PAUL ANTHONY BIRUNG '
DB ' LEA SANTURTIO '
DB ' LARY BALOFINOS '
DB ' '
DB 41 DUP(0dbh)
DB 0dbh,' ',0dbh
DB 0dbh,' * SCREEN SAVER * ',0dbh
DB 0dbh,' ',0dbh
DB 0dbh,' 1) PAUL BIRUNG ',0dbh
DB 0dbh,' 2) STARS ',0dbh
DB 0dbh,' ',0dbh
DB 0dbh,' <ESC> to exit ',0dbh
DB 0dbh,' ',0dbh
DB 41 DUP(0dbh)
choice DB ' Enter your choice ==> $'

Stars DD MaxStar dup(?) ;Star buffer:X(word)+Y(byte)+
; Color(b)=Double Word(4 bytes)

Palette DB 15,15,15,25,25,25,40,40,40,60,60,60

name1 DB ' ###### ##### # # # ###### ### ###### # # ## # #### ',13,10
DB ' # # # # # # # # # # # # # # ## # # # ',13,10
DB ' # # # # # # # # # # # # # # # # # # ',13,10
DB ' ###### ####### # # # ###### # ###### # # # # # # #### ',13,10
DB ' # # # # # # # # # # # # # # # # # # ',13,10
DB ' # # # # # # # # # # # # # # ## # # ',13,10
DB ' # # # ##### ####### ###### ### # # ##### # ## #### ',13,10,'$'
.386
.code
Smain proc near
mov ax, @data
mov ds, ax
MOV ES,AX
lp1:
MOV attrib, 02h
CALL clear
CALL output
CALL inpt
CMP al, 31h
JE s1
CMP al, 32h
JE s2
CMP al, 1bh
JE EXT
JNE lp1
s1:
CALL ssaver1
JMP EXT
s2: CALL ssaver2
EXT:
call clear
mov ah, 4ch
int 21h
Smain endp
ssaver1 PROC NEAR
PUSHA
mov attrib, 12h
call clear
mov row, 00
mov col, 00
call set
call disply
mov cx, 100
again:
inc attrib
call delay
call clear
inc row
cmp row,17
JNE ss1
mov row,00
ss1: call set
call disply
call delay
dec cx
cmp cx, 0
jne again
POPA
RET
ssaver1 ENDP
ssaver2 PROC NEAR
PUSHA
jmp entry

StarBuffer Proc ;Initialize Star Data(X,Y,Color)

mov cx,MaxStar ;initialize counter(CX)
mov ax,RomSeg
mov ds,ax
xor si,si ;DS:SI points to ROM
mov di,offset Stars ;ES:DI points to Star buffer

Fill:lodsw ;Load word from ROM(DS:SI)
mov bx,LineWidth
xor dx,dx
div bx
mov ax,dx ;ax=ax mod 320(X coordinate)
stosw ;store ax to star buffer(ES:DI)
lodsw ;load another word from ROM
mov bx,LineHeight
xor dx,dx
div bx
mov ax,dx ;ax=ax mod 200(Y coordinate)
stosb ;store byte(ES:DI)

lodsb ;load byte from ROM
and al,3
inc al ;al=al mod 4+1
stosb ;store byte(ES:DI)
Loop Fill ;decrease CX(Counter)
Ret ;Return
StarBuffer EndP

PlotStar Proc ;Plot pixel(dx=X,al=Y,ah=Color)

push ax ;save AX
push dx ;save DX
xor ah,ah
mov bx,LineWidth
mul bx
pop dx ;restore DX
add ax,dx ;ax=X+Y*320
mov bx,ax

mov ax,VgaSeg
mov es,ax ;ES points to vga screen
pop ax ;restore AX
mov es:,ah ;Plot pixel
Ret
PlotStar EndP

DrawStars Proc ;Move all stars

mov cx,MaxStar ;our Counter(CX)
mov si,offset Stars ;SI points at "Stars"

StarLoop:lodsw ;Load word from "Stars"
mov dx,ax
lodsw
xor ah,ah ;Set AH(color) to zero
call PlotStar ;do Plot Pixel

sub si,4 ;2*lodsw=adds to si 4(2 words)
lodsw
mov dx,ax
lodsw

mov bx,ax
shr ax,8 ;shift right 8 ax times(al=ah)
add dx,ax ;add dx(X),color
cmp dx,LineWidth ;range checking
jnae Continue ;jump NOT above or equel
xor dx,dx ;DX(X)=0
Continue:sub si,4
mov ,dx ;store new values
mov ,bx
mov ax,bx
call PlotStar ;do Plot Pixel
add si,4 ;next star data
loop StarLoop ;decrease counter(CX)
Ret
DrawStars EndP

Sync Proc ;Vertical screen Sync

mov dx,3dah ;vga input data port
@v:in al,dx
test al,00001000b ;like logical AND
jz @v ;repeat until the 3rd bit is
mov dx,3dah ;on.
@z:in al,dx
test al,00001000b
jnz @z ;repeat until the 3rd bit is
Ret ;off.
Sync EndP

Entry: ;Main prog start's here

call StarBuffer ;Initialize stars
mov ax,@data
mov ds,ax ;DS points at Data segament

mov ax,13h
int 10h ;mode 320x200x256

mov dx,03c8h ;palette sequencer port(03c8h)
mov al,1
out dx,al ;assign value to port
inc dx ;palette data port(03c9h)
mov si,offset Palette
mov cx,4*3 ;assign palette to port 03c9h
rep outsb

Main:call DrawStars ;main loop:
call Sync
mov ah,1
int 16h ;check if keypressed
jz Main ;if not repeat loop

mov ah,0ch ;flush keyboard buffer
int 21h
mov ax,3
int 10h ;mode 80x25x16
POPA
RET
ssaver2 ENDP
output PROC NEAR
PUSHA

MOV ax, 1300h
LEA bp, create
MOVZX bx, attrib
MOV cx, 41
MOV dh, 0
MOV dl, 19
A10:
INT 10h
ADD bp, 41
INC dh
CMP dh, 22
JNE A10

MOV row, 24
CALL set
LEA dx, choice
MOV ah, 9
INT 21h

POPA
RET
output ENDP
disply PROC NEAR
pusha
mov ah,9
lea dx, name1
int 21h
popa
RET
disply ENDP
delay PROC NEAR
PUSHA
MOV dx, 80h
T1: MOV cx, 0ffffh
T2: dec cx
JNZ T2
DEC dx
JNZ T1
POPA
RET
delay ENDP
inpt PROC NEAR
MOV ah, 1
INT 21h
RET
inpt ENDP
set PROC NEAR
PUSHA
mov ah, 02
mov bh, 00
mov dh, row
mov dl, col
INT 10h
POPA
RET
set ENDP
clear proc near
pusha
mov ax, 0600h
mov bh,attrib
mov cx,0000h
mov dx,184fh
int 10h
popa
ret
clear endp
end
Posted on 2004-09-22 06:52:20 by kraven
1. don't expect that anyone is going to read such a huge block of code
2. this isn't win32asm at all
3. you appear to have no clue what you are doing
Posted on 2004-09-22 10:50:28 by lifewire
At least put some text formatting, it's painful to read as it is. Use the "Code" button to preserve the formatting when editing your post. :)
Posted on 2004-09-22 14:56:27 by QvasiModo
The problem is in your output function. When the BIOS returns, the registers won't have the same value. You have to set them again. My BIOS changes AX, CX and DX. I don't know if other BIOSes change other registers.
Posted on 2004-09-22 16:02:31 by Sephiroth3
Here's more info on interrupts:
http://www.ctyme.com/rbrown.htm
Posted on 2004-09-22 16:42:23 by QvasiModo
1. don't expect that anyone is going to read such a huge block of code
2. this isn't win32asm at all
3. you appear to have no clue what you are doing


One of the reasons that people post on these boards is so that they can learn more about assembler. Everyone starts assembler without knowing very much. Insulting them when they are just beginning doesn't help.
Posted on 2004-09-22 17:59:14 by mark_larson
people on these boards aren't here to do other's homeworks. that code looks like code that he either 1.) stole from somewhere entirely, ot 2.) product of patchwork - and thus lacking any understanding for it.
Posted on 2004-09-22 22:44:44 by Drocon
people on these boards aren't here to do other's homeworks. that code looks like code that he either 1.) stole from somewhere entirely, ot 2.) product of patchwork - and thus lacking any understanding for it.


If people on the boards aren't here to do other people's homework then why did people reply with help? The truth is *YOU* aren't here to do someone elses homework, don't speak for other people. So instead of popping in here and mouthing off, let people who want to help help. We can't help promote the assembler community if people keep getting their hands chopped off when they ask for help. If you don't want to help the guy, then simply don't respond.


1) Stolen? Hardly. Did you even try and read the code line for line? or did you just skim it? It's quite obviously not stolen. It looks like someone who does not know much about assembler trying to write code. Which if he's taking a class in assembler makes sense.

2) patchwork? The professor probably provided bits and pieces or at least a starting point to do the assignment. That's pretty common as well in assignments from school.
Posted on 2004-09-23 10:39:31 by mark_larson
the major problem i had with this thread is that it is something like: here is my code, i have no clue where the bug is, please find it.

imho a ridiculus question, because of several reasons:

1. usually you don't write a total program, run and discover that it doesn't work at all. normally one writes such stuff bit by bit. especially when (like you suggest) you are learning something new. so first switch to a graphic mode, draw some pixels, make the pixels move, make stars.

2. like i stated before: it is not very likely is going to read such a huge block of code and will then say: the bug is there and there. unless you are some machine or other non-human being.

i felt that this code was stolen indeed, to quickly gather some creditpoints without doing much work. also, on my school and university the teachers / proffesors who were leading projects were always very helpful when you had a good question.
Posted on 2004-09-23 12:20:44 by lifewire
Guys don't let this become a silly flame, mark espically come on, its a bit hypocritical to tell someone to simply not post if they don't want help when your own posts offer no help. I'm not saying that the circumstances or motivations are the same but your only dragging things further off topic.

The fact is in most cases when someone posts like this and no one responds then they repost bits like "So no one knows?" or "Why won't anyone answer?" eventually they leave probably to never come back. Sometimes they get abusive even.

So I see it as no real porblem that lifewire or Drocon said what they did, in fact its a good thing because at least now kraven as some idea why he/shes not getting help.

Anyway, while this is perhaps being a bit moderatorish of me I want noone to post anymore on this debate, I want only posts which address the origional question, if they don't come then kraven sorry, but the reasons why have been made pretty clear.

Anyone who can't let the issue go then fight it out in The Crusades or away from the board :)
Posted on 2004-09-23 18:03:21 by Eóin
i just need someone who can figure out what the error is.. pls help
heres the execution file and .asm file
http://www.geocities.com/luap10ph/PAUL.zip
http://www.geocities.com/luap10ph/paul.asm
Posted on 2004-09-24 10:33:09 by kraven
There are several errors here. As I said, the registers will have changed after you call BIOS in your Output function. And you have to put "end Smain" at the end, and not just "end", to indicate where the program starts. And then you're referring to some data in the code segment through DS, which points to your data segment. You have to move the data into the data segment.
Posted on 2004-09-24 11:37:53 by Sephiroth3