Jump to content
View in the app

A better way to browse. Learn more.

300ZX Owners Club

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Hey guys, I need to write a program based on the one below but I have no idea what it is doing or means, only 3 lectures into the course. Can someone who understands it make some notes next to each line for me explaining what's going on?

 

I don't know exactly what language it is but it's the one you write in DOS and then assemble and link, IBM PC i think its called? the module im studying is microprocessor programming.

 

Cheers

Yas

 

[Edit: for some reason the tabbed lines stay to the left so i'v replaced the tabs with a dash]

 

 

 

.186

 

code SEGMENT para 'CODE'

ASSUME CS:code,DS:code,ES:nothing,SS:nothing

 

putdec:

-MOV AX,5

-CALL PUTIT

-MOV AX,4C00H

-INT 21H

;

 

PUTIT:

-PUSH AX

-PUSH BX

-PUSH CX

-PUSH DX

-PUSH BP

-PUSH DS

-PUSHF

-MOV DX,CS

-MOV DS,DX

-MOV BYTE PTR sign,00

-TEST AX,08000

-JZ POS

-MOV BYTE PTR sign,01

 

POS:

-NEG AX

-MOV CX,0000

-MOV BX,000Ah ;........................................ 10

 

again1:

-MOV DX,0000

-DIV BX ; .................................................divide by ten

-ADD DL,30h

-PUSH DX

-INC CX

-CMP AX,+00

-JNZ again1

-CMP byte ptr sign,00

-JZ plonk

-MOV AL,2Dh

-PUSH AX

-INC CX

 

plonk:

-MOV DX,6

-SUB DX,CX

 

newch:

-POP dx ; .................................................pop character

-MOV AH,2

-INT 21h

-LOOP newch

-POPF

-POP DS

-POP BP

-POP DX

-POP CX

-POP BX

-POP AX

-RET

 

sign db 0

allign db 0

 

CODE ENDS

 

End

Featured Replies

those push, pop and move sound like stack operations to me, sorry I couldn't be more help- its been 4 years since i was at uni and I didn't even pay any attention when I was there

OK, I'm rusty as hell but I think it's x86 assembly language. Loads of info here including a decent tutorial http://grail.cba.csuohio.edu/~somos/asmx86.html. Thing about assembly is it looks horrible but each operation is actually really simple so you shouldn't have too much trouble figuring it out. In short

 

PUSH - pushes an item onto the stack and moves the stack pointer accordingly (depends on size of item: 32-bits, 64-bits etc).

 

POP - does the reverse of push: pulls an item from the stack and moves the stack pointer back.

 

MOV - moves an value into/out of a register

 

SUB/ADD/DIV - (integer) arithmetic operations

 

INC - increment

 

Like I say, once you've got a basic understanding it should be fairly easy to figure it out.

  • Author

thanks guys, will be having a good look at it today. anyone else done assembly language before?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Recently Browsing 0

  • No registered users viewing this page.

Important Information

Terms of Use

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.